function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ghanshyam Kumar 9Ghanshyam Kumar 9 

Production Deployment of CustomLabel using VS Code (INVALID_ID_FIELD: Source validate did not run tests in the org)

I am trying to deploy customLabels to the production org. But, I am not able to deploy it as it asks to run the test classes. As we know the custom label is just the configurations, not the codes. So, we don't need to run the test classes. My production org is a very new org and it doesn't have any class or test class till now.
Please help me to fix this problem. Thanks in Advance!!!

My package.xml contains the following value only.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>
        <members>*</members>
        <name>CustomLabel</name>
    </types>

    <version>47.0</version>
</Package>


I am using the following command to deploy it.
sfdx force:source:deploy --checkonly -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests


When I run this command, it successfully validates the deployment and generates the JobId. When I run the next command to deploy it gives an error - "INVALID_ID_FIELD: Source validate did not run tests in the org".


sfdx force:source:deploy --targetusername myProdUserName --validateddeployrequestid JobId


For all these operations, I am referring to this link of the salesforce. https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_build_mdapi_production.htm
I took some help from this link as well. https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm

Best Answer chosen by Ghanshyam Kumar 9
Ghanshyam Kumar 9Ghanshyam Kumar 9

Thanks for the reply!
I have removed the testevel and run this command. But it doesn't work in that case. See the screenshot.

Custom Lablel Production Deployment Error using SFDX

I found one way to deploy the custom labels by using the following command.
sfdx force:source:deploy -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests

It has only one problem that it directly deploys the component (Custom labels). It means, we didn't get the option to keep this deployment as a future-ready(Quick deploy) which we do in the changeset. 

I will update here for the knowledge if I find something or Please tell me if you get it.

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Ghanshyam,

Greetings!

Seems like the issue might be with the test runs.So,can you please try by removing the testlevel from the command while validating as we do not need to run any test classes when we deploy the custom labels.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
 
Ghanshyam Kumar 9Ghanshyam Kumar 9

Thanks for the reply!
I have removed the testevel and run this command. But it doesn't work in that case. See the screenshot.

Custom Lablel Production Deployment Error using SFDX

I found one way to deploy the custom labels by using the following command.
sfdx force:source:deploy -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests

It has only one problem that it directly deploys the component (Custom labels). It means, we didn't get the option to keep this deployment as a future-ready(Quick deploy) which we do in the changeset. 

I will update here for the knowledge if I find something or Please tell me if you get it.

This was selected as the best answer