0

I'm creating a post install script for our managed package, and wanted to test it out in a beta release before going live. I only see an option to set it on the main package page, and from the Specify a Post Install Script doc, it's unclear exact what happens once it's set:

Once you have created and tested the post install script, you can specify it in the Post Install Script lookup field on the Package Detail page. In subsequent patch releases, you can change the contents of the script but not the Apex class.

Questions:

  1. Does the post install script automatically apply to previous released versions of your package? Or only on the upcoming beta/full package releases?
  2. After it's set, can you unset/deactivate it in the future? Looks like from the quote above that you might have to just gut the code within the class itself if you wanted to disable it
2

I'll answer in reverse order:

Regarding #2, You can certainly change and/or remove your PostInstallScript from release to release. However, as you know, PostInstallScript classes must be declared global so you won't be able to completely remove them from the package as easily as a non-global class. Of course, you can always comment code inside.

Patch releases are not the same as regular versions and come with several caveats (see here).

Regarding your question #1, they run only on versions of the package that specify that class. If you leave the class in your package but clear the "PostInstallScript" field on your build, then the class will not run (though it'll get deployed)

| improve this answer | |
  • Re #1 - if the PostInstallScript class is already part of the package (and now can't be removed in future releases), will those package versions run the post install script based on whether the lookup field is populated right now? Or that only gets set at the time of the new version creation? Meaning, if v1.01 was created with the post install lookup field populated, and now we're on v1.05 and have removed the post install lookup field - does v1.01 still always run the post install script? – Brian Miller Feb 5 at 22:09
  • 1
    No, the lookup field population is for that specific build. So if you populated it for v1.01 then it will always run in v1.01, regardless of what v1.05 has – Sebastian Kessel Feb 5 at 22:10
  • 1
    Thank you, this makes a lot of sense and wish it was more explicit in the SF official docs! – Brian Miller Feb 5 at 22:13
  • Welcome to packaging.... this world is full of new and exciting "features". And 2GP is a whole 'nother ballgame. :) – Sebastian Kessel Feb 5 at 22:13
  • 1
    I know, I'm getting a taste of it! I wish I could start using 2GP but am already too far invested with the managed package right now. I really hope they push the feature to allow converting/usage of 2GP on 1GP packages :fingers-crossed: – Brian Miller Feb 5 at 22:16

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.