2

I have 2 dev orgs. In org1 I have created one class, aura components and its controller class & custom meatadata. Then created an unlocked package and version it. Post that I have installed the package (first version) in org 2. Then I have removed the class, aura components and custom metadata from package and done the new versioning. When I installed the new version in 2nd org then I have noticed that class and aura components got deleted but controller class and metadata got deprecated.

Could you please let me know that why some components got deprecated and some are got deleted?

2

The behavior is described in the document here

When you install the unlocked packages you have three specific options,

  • Mixed Mode(This is what is selected by default)

Mixed (the default) specifies that listed components here if removed in your new package they are deleted, and any other components are marked deprecated.

One exception to above - If a component in the prior version is referenced by subscriber org then the component is marked deprecated.

Example of metadata thats deprecated is

An object such as an Apex class is deprecated and not deleted if it is referenced in a Lightning component that is in the subscriber org.

  • DeprecateOnly

DeprecateOnly specifies that all removed components must be marked deprecated. The removed metadata exists in the target org after package upgrade, but is shown in the UI as deprecated from the package. This option is useful when migrating metadata from one package to another.

  • Delete

Delete specifies to delete all removed components, except for custom objects and custom fields, that don’t have dependencies.

If you want the class to be deleted select the delete option when you install the package.

| improve this answer | |
  • Thanks Mohit. Got it now. – Ananga Apr 13 at 15:20
  • @Ananga Note documentation still looks incomplete a little to me and does not cover what gets deprecated and when. I have posted this internally at Salesforce to see if someone has better insights ! – Mohith Shrivastava Apr 13 at 15:23
  • @Ananga Please find updated answer. I have fixed it – Mohith Shrivastava Apr 14 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.