Can not change field type with picklist
Detection
- RegExp:
Error (.*) Cannot change which global value set this picklist uses
Examples
Error Account.Region__c Cannot change which global value set this picklist uses
Resolution
You probably updated the global value set of picklist {1}, and Salesforce does not allow that with deployments. You can:
- Change it manually in the target org before the deployment, if Setup allows it
- Or delete field {1} in the target org (its data is lost: be careful in production), so the deployment creates it again
- Or create another field with the new value set, and move the data with a data deployment action (https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-data/)
- The manual deployment action below reminds to do it in each org of the pipeline, with a checkbox in the Pull Request comments
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 manual --label "Change the value set of picklist {1}" --instructions "1. In Setup, open Object Manager, the object of {1}, then Fields & Relationships
2. Open {1} and set the value set it has in the sources, or delete the field if its data can be lost
3. If {1} already uses this value set, there is nothing to do"
Documentation: https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-manual/