I have a sandbox that has some meta data such as custom objects, permission sets, profiles, classes, and remote site settings that need to be removed. The sandbox also has an unlocked package installed that has a folder that has all the meta data that I need removed from the sandbox.

I was thinking initially that I could remove the meta data by installing a new version of the package that does not have the folder in question. However in my testing I see that the meta data stays installed. Is that not possible?

Specifically help says:

Help for force:package:install Supply the ID of the package version to install. The package installs in your default target org unless you supply the username for a different target org. For package upgrades, to specify options for component deprecation or deletion of removed components, include an --upgradetype value. To delete components that can be safely deleted and deprecate the others, specify --upgradetype Mixed (the default). To deprecate all removed components, specify --upgradetype DeprecateOnly. To delete all removed components, except for custom objects and custom fields, that don't have dependencies, specify --upgradetype Delete. (Note: This option can result in the loss of data that is associated with the deleted components.) The default is Mixed.

So if that is not possible then is the only approach here to delete the meta data manually in the org? And then remove the folder from the package so that it doesn't install that meta data in future?


1 Answer 1


To remove metadata from installed org, you need to use destructive changes with Ant/Workbench(or similar tool). Also if you have any data dependency - you need to remove it from code and if require data backup needs to be taken care.

However, if you are installing the package in new org/sandbox, it won't come since it was not packaged.

I would not rely on deprecate/delete part.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .