Skip to main content

Resolving validation errors - "Global value set <xxx> in record type <yyy> on the entity <zzz> cannot be resolved" on Record Type metadata type

Cause and solution to this Salesforce validation error surfaced on Record Type metadata

Written by Mateusz Kochanowicz

Error overview

You may run into this Salesforce validation error when deploying a RecordType (Record type) metadata type.

In Gearset the error message would be reported as below:

"Global value set '<xxx>' in record type '<yyy>' on the entity '<zzz>' cannot be resolved (line:<nnn>)" - where:

  • <xxx> refers to the API name of a picklist field that the record type references (for example Gearset_Tracking_Sub_Status_del__c),

  • <yyy> refers to the label of the record type (for example Business Interruption),

  • <zzz> refers to the API name of the object the record type belongs to (for example Package_pm__Matter__c)

  • <nnn> refers to a line number in the deployment package at which Salesforce detected the problem.

In the cases we've seen, this error has only been reported on the RecordType metadata type. It's common to see it on several Record Types of the same object in a single validation, all are pointing to the same picklist field.

Explanation of the error

Based on our understanding, despite its wording, the error usually isn't about a Global Value Set component. The name in quotes is the API name of a picklist field that Salesforce can't find on the object in the target org.

A Record Type stores information on which values of each picklist field on the object are available for that Record Type.

In the Record Type's XML file, each picklist field has its own <picklistValues> block, and the field's API name is stored in the <picklist> element.

<picklistValues>
<picklist>Gearset_Tracking_Sub_Status_del__c</picklist>
<values>
<fullName>Pending</fullName>
<default>false</default>
</values>
</picklistValues>

When validation runs, Salesforce tries to match every <picklist> element to a picklist field on the object in the target org. If the field can't be found, Salesforce fails the Record Type with this error.

In the cases we've seen, this happened when:

  • The referenced picklist field doesn't exist in the target org, and it isn't included in the deployment package.

  • The referenced picklist field is included in the deployment package, but it failed to validate itself.

  • The referenced picklist field belongs to a managed package (its API name starts with a namespace prefix, for example FinServ__), and that package isn't installed in the target org, or it was uninstalled from one of the environments.

  • The referenced picklist field was deleted in the source org. Its API name then ends with _del__c (see below).

When the field name ends with "_del__c"

When a custom field is deleted in Salesforce, it isn't erased straight away. It moves to the object's Deleted Fields list for 15 days, and its API name gets a _del suffix. For example Gearset_Tracking_Sub_Status__c becomes Gearset_Tracking_Sub_Status_del__c.

Deleted fields aren't retrieved as CustomField components, so they won't show up in your comparison. However, Record Types retrieved from that org can still contain a <picklistValues> block referencing the deleted field. Once that block is committed to your Git branch or included in the deployment package, every validation against an org without that deleted field will fail with this error.

This is why the error can be confusing: comparing your orgs shows no Global Value Set and no field with that name, and yet the Record Types still reference it.

Note: It is our understanding that the line number in the error message Gearset returns refers to the file as it was packaged for the validation. Therefore, it may not match the line numbers you see in your Gearset comparison. Use it as a rough pointer, rather than an exact location.

Resolution

How to find the picklist field that the Record Type depends on, and how to resolve the error depends on how you're making your deployment in Gearset.

However, before we move to the resolution itself, it's worth going through the steps below ensure you have all the required information that will help you resolve the error.

Troubleshooting: Find what the Record Type references

  • Open the comparison for your failed validation and select the Record Type component named in the error.

  • Switch to the XML view of the component and find the <picklistValues> block whose <picklist> element matches the name in the error message.

  • Check the field's API name:

  • If it ends with _del__c, the Record Type references a deleted field. The reference needs to be removed.

  • If it starts with a namespace prefix (for example FinServ__), the field belongs to a managed package. Check whether that package is installed in the target org.

  • Once you've verified that the package is installed, check if the field exists in the target org in Setup > Object Manager > [Object_Name] > Fields & Relationships.

  • If the field exists in the target org, check if the field itself is included in your deployment package. If the field is not in the deployment package, verify if managed packages are retrieved in your comparison.

  • If you're deploying via a CI job, or if this is a PR validation in your Gearset Pipeline, check if the CI job's metadata filter is configured to retrieve the managed package the field belongs to.

Workaround for failed PR validation in Gearset Pipeline

To resolve the error when a PR in your Gearset Pipeline fails the validation, follow these steps depending on the scenario that applies to your use case.

If the field is missing from the target org

  • Check the metadata filter of the CI job for the target environment. Make sure it includes the Custom object metadata type (Custom field is a sub-component of a Custom object), otherwise the field can't be part of the validation even if it's committed to the feature branch.

  • Commit the referenced picklist field to the feature branch from which your PR was created. In your Gearset Pipeline, you can do it by selecting the Dev Sandbox from which the feature was created, and then selecting the Commit more changes... option.
    ​Note: Make sure to commit changes to the correct feature branch.

  • Alternatively, deploy the referenced field to the target environment first as part of a separate PR.

  • Once the PR with the referenced field is deployed to the target org, re-validate the existing PR in your pipeline.

If the field name ends with "_del__c"

  • In the feature branch from which your PR was created, remove the <picklistValues> block that references the _del__c field from every affected Record Type. You can do this by editing the Record Type's XML file(s) directly in your Version Control System (e.g. GitHub). Keep any blocks that reference the current version of the field (without the _del suffix).

  • If the error is reported on a Dev Sandbox Update, the reference has already been promoted to a branch further along your pipeline. Remove it from there too, via a new feature branch and PR, so that future updates don't bring it back.

  • Once the fix is committed, re-validate the PR, or re-run the Dev Sandbox Update.

Guidelines on how to add more changes to an existing feature branch can be found in this article: Promoting your first features.

Workaround for deployments made via Compare and deploy

These troubleshooting steps are mainly for scenarios where you're not working with Gearset Pipelines.

Does the error happen when running a validation via Compare and deploy (e.g. Git to org, or org-to-org)?

For Git to org deployments

  • If the field is missing from the target org, use Compare and deploy to commit the referenced picklist field from your source org into the branch you're deploying from. Make sure your comparison's metadata filter includes the Custom object metadata with Custom field as its sub-component.

  • If the field name ends with _del__c, remove the <picklistValues> block that references it. Make sure to remov it from every affected Record Type's XML file in the branch you're deploying from.

  • Refresh the comparison, then validate the package against the target org again.

For org to org deployments

  • Make sure your comparison's metadata filter includes the Custom object with Custom field as its sub-component.

  • Add the referenced picklist field to the deployment package alongside the Record Type. Gearset's missing dependencies Problem Analyzer can suggest it for you once the field has been retrieved.

  • If the Record Type references a field that isn't on the object (for example a _del__c field), Gearset's problem analysis can suggest removing that picklist definition from the Record Type. More information is in our article on how to deploy Record types.

  • If the validation still fails, download the deployment package using the Download package option on the pre-deployment summary page (see our guidance on how to change the deployment package before deploying). Remove the <picklistValues> block from the object file in the objects folder, re-zip the package keeping the original folder structure, and use the same .zip package as the source of your deployment in Compare and deploy by selecting Local files as the source, then Zip and Upload zip.

  • Validate the deployment again.

If the field belongs to a managed package

In the cases we've seen, the managed package was either not installed in the target org, or it was uninstalled from one of the environments after the Record Type was committed.

  • If the package should be present, install it in the target org. Ideally, install the same package version as in the source org. Then validate again in Gearset.

  • If the package was removed on purpose, remove the references to its fields from the Record Types in your source (org or branch). Any feature branches created while the package was still installed may still contain these references. Consider re-creating a feature branch once the references are removed from the Main branch.

Clean up the deleted field in the source org

To stop the _del__c reference from being picked up again the next time Record Types are retrieved from your source org:

  • In the org where the field was deleted, go to Setup > Object Manager > [Object_Name] > Fields & Relationships > Deleted Fields.

  • If the _del__c field is listed there, Erase it, provided the deletion was intended. Note: Erase is permanent and removes any data held in that field.

  • We'd recommend avoiding Undelete in this case. The restored field keeps the _del suffix in its API name, and it would conflict with a new field that uses the original name.

  • If the field isn't listed there, it has already been permanently removed, as Salesforce erases deleted fields automatically after 15 days.

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.

Did this answer your question?