Skip to content

Cannot modify managed object

Detection

  • RegExp: Error (.*) Cannot modify managed object: entity=(\w+), component=(\w+)

Examples

  • Error acme__Admin Cannot modify managed object: entity=CustomPermissionSet, component=0PSAa000000AbCd, field=Description, state=installed

Resolution

{1} belongs to a managed package installed in the target org: only the vendor of the package can change it.
- Remove the items of the package from your sources: sf hardis:project:clean:manageditems --namespace <namespace>
- Or let the deployment action below remove {1} from package.xml before each deployment
- Install the same package version in every org, from the Installed Packages panel of VS Code (https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-install-packages/)

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 remove-packagexml-items --label "Remove managed item {1} from package.xml" --packagexml-items "METADATA_TYPE:{1}"

Before running it, replace METADATA_TYPE in the command with the real value.

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

Comments