Below are the steps that I completed so far - Created 2GP managed package, created package version, Promoted package, Connected App. Yet to submit package for security review.

Below is my query - There is a change in metadata now. How to incorporate new metadata to the package? Is it through upgrade? If yes, then what is the command that we need to use? How to remove the existing metadata?

If we remove/add metadata in VCS, will that reflect or do we need to create version and Promote package again on top of existing one?

  • Why are you asking about removing the existing metadata? What are you trying to do, exactly?
    – sfdcfox
    Sep 14, 2023 at 12:07
  • sorry with wrong choice of words. There is only 1VF page and Apex class as of now. Not removing exactly, don't want to show existing VF page and Apex class of the package. Using LWC to achieve same with some more functionality as an approach. Is there a way to degrade it existing one? Or how to upgrade with new metadata
    – SF Dev
    Sep 14, 2023 at 12:12

1 Answer 1


If you want to actually delete the page and class, you can request the ability to do so, but it comes with implications. You can read all about that functionality in Remove Metadata Components from Second-Generation Managed Packages. Generally speaking, if you feel you might need the component later, or can repurpose it, consider not deleting the page and/or class. You can simply add your new LWC to the package, and use the "package version create" and "package version promote" commands to make a new production-ready version.

  • Thank you @sfdcfox. Keeping existing page makes sense to me as well. My query now is - when I add LWC and then create version and promote it. Will it override existing package and it wont reflect old page and class in package ? Because what I understood is VCS is source of truth in 2GP and VCS has VF page and Apex class.
    – SF Dev
    Sep 14, 2023 at 12:30
  • @SFDev Whatever is in your VCS is what constitutes the package. If the page, class, and LWC are all present, they will all be reflected in that version. If you delete files from the VCS and then create a new version, that will count as a deletion in the package, which is governed by the link in my answer. In other words, your VCS should contain all the files that represent that version of the package.
    – sfdcfox
    Sep 14, 2023 at 12:47
  • Understood, Thank you.
    – SF Dev
    Sep 14, 2023 at 13:33

You must log in to answer this question.

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