Skip to content

Cannot update a field to a Summary from something else

Detection

  • RegExp: Error (.*) Cannot update a field to a (.*) from something else

Examples

  • Error Account.Total__c Cannot update a field to a Summary from something else

Resolution

You probably changed the type of field {1} to {2}, and Salesforce does not allow that with deployments. You can:
- Change the type of {1} 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 type, 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 type of field {1} to {2}" --instructions "1. In Setup, open Object Manager, the object of {1}, then Fields & Relationships
2. Open {1}, click Change Field Type and select {2}, or delete the field if its data can be lost
3. If {1} is already a {2}, there is nothing to do"

Documentation: https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-manual/

Comments