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">



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

  1. You're specifying --checkonly in your command. This means it's just validating and it won't deploy(screenshot from your documentation link). You may want to keep this if you're testing the validation portion.

enter image description here

  1. testLevel is an optional field and you can just ignore it if you want the default behavior in production to take affect enter image description here

You should be able to do the following to validate

sfdx force:source:deploy --checkonly -x ./manifest/package.xml -u myProdUserName

And then the following to deploy

sfdx force:source:deploy -x ./manifest/package.xml -u myProdUserName

Also, you can always do the following to get help in the CLI

sfdx force:source:deploy --help
| improve this answer | |

Thanks for the reply Kris!

I have removed the testevel and run this command. But it doesn't work in that case. See the screenshot. Error of production deployment using SFDX

I found one way to deploy the custom labels by using the following command. (Removed --checkonly)

sfdx force:source:deploy -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests

It has only one problem that it directly deploys the components (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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.