Picklist value not found
Detection
- RegExp:
Picklist value: (.*) in picklist: (.*) not found
Examples
Error Account.Partner Picklist value: Hot in picklist: Rating__c not found
Resolution
Sources refer to value {1} of picklist {2}, which the target org does not have.
- If picklist {2} is standard, retrieve its StandardValueSet {2} with the Metadata Retriever of VS Code, commit it and save your User Story
- With delta deployments, an item that did not change in the Pull Request is not deployed: change it in the Pull Request, or turn on useDeltaDeploymentWithDependencies (https://sfdx-hardis.cloudity.com/salesforce-devops-config-delta-deployment/)
- If value {1} was removed on purpose, remove the XML tags that still refer to it (record types...)
- If value {1} exists but is inactive in the target org, the deployment action below can activate it: replace OBJECT_NAME by the object of picklist {2} (or, for a standard value set, use "metadataType":"StandardValueSet" and "metadataFullName":"{2}")
- If value {1} was renamed in the sources, rename it in the target org instead: the same picklists setting does it with "newApiName" (https://amtrack.github.io/sfdx-browserforce-plugin/settings/picklists/)
Deployment action
A deployment action can solve this error. Create it on the Pull Request of the current branch:
sf hardis:project:action:create --agent --scope pr --pr-id current --when pre-deploy --type browser --label "Activate value {1} of picklist {2}" --browser-setting picklists --browser-config '{"picklistValues":[{"metadataType":"CustomField","metadataFullName":"OBJECT_NAME.{2}","value":"{1}","active":true}]}'
Before running it, replace OBJECT_NAME in the command with the real value.
A deployment check only simulates a browser action. If this check still fails on this error once the action is created, apply the setting once in the target org with the Run in another org button of the VS Code Deployment Actions tab, or with sf hardis:project:action:run --select-org, then run the check again.
Documentation: https://amtrack.github.io/sfdx-browserforce-plugin/settings/picklists/