Is it possible to specify a PostInstallScript, or UninstallScript, using the second generation packaging API?

I haven't yet found any reference to it in the DX documentation, the SFDX project file documentation or the cli reference, but it would seem to be a rather big omission if it's not there, which makes me think it's something I've missed.

  • 2
    I don't think you're missing anything; 2GP is meant to organize code into units, not necessarily replace the managed package concept. But I'd love to be wrong about this.
    – sfdcfox
    Commented Feb 16, 2018 at 19:17
  • @sfdxfox Ah, I thought I read that you could just package using 2GP and do away with the packaging org entirely, which would be great - but I've probably got the wrong end of the stick!
    – berry120
    Commented Feb 16, 2018 at 22:26
  • 1
    This is a very valid question for Managed 2GP. Since that's still in Beta, it might very well be a feature gap. Commented May 13, 2019 at 11:27
  • 1
    3 years on and this question is still relevant. I have created an idea, perhaps you can upvote if you find it interesting? success.salesforce.com/ideaView?id=0873A000000lPKTQA2
    – mkorman
    Commented Jun 24, 2019 at 14:57

1 Answer 1


You can define the postInstallScript and UninstallScript within the file sfdx-project.json or when you use sfdx force:package:version:create

Source: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_customize_installs.htm


You must log in to answer this question.

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