This Salesforce validation error that Gearset is surfacing is likely to occur on the Profile
or Permission Set
metadata types.
Note: This error may also occur on other metadata types in scenarios when Custom field
referenced in the error message is a new component in the source environment.
However, so far we've seen it mostly on the two metadata types referenced in this article.
The error message returned by Salesforce is:
"In field: field - no CustomField named <xxx> found
" - where <xxx>
is a reference to a specific Custom field
name.
Example of this validation error shown in Gearset in relation to TTL Standard
Profile.
Explanation of the error
On the above screenshot we're seeing that Profile TTL Standard
failed to deploy because Custom field named Next_of_Kin
(it's a field on Opportunity object) wasn't found in the target environment.
This means that Profile TTL Standard
is likely to reference that Custom field within its XML code. We can verify it by checking this Profile's XML code in Gearset's comparison:
Salesforce is throwing a validation error because we're trying to deploy a Profile that references a new Custom field, which means the field doesn't yet exist in the target org.
But the Profile we want to deploy depends on that Custom field - this means that Salesforce requires the field to be present in the target org before the Profile can be deployed.
Resolution
Since both the Profile TTL Standard
and Custom field Next_of_Kin
are new items (which means they exist only in the source, and not in the target environment), you need to:
1. First, deploy the Custom field
referenced in the Profile's XML. Make sure you deploy it as part of a separate deployment - ideally, only deploy the Custom field without including any other components in your deployment package.
Note: This is usually the Custom field referenced in the error message returned by Salesforce.
2. After the Custom field is deployed, you can follow up with deploying the Profile, or all the Profiles that reference this Custom field in the error message(s).
Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.