I've added a few process builders in my managed package. Now when a subscriber uninstalls our package, they've to first deactivate all the process builders.

So is there any way we can deactivate our process builders through the apex? So we can write it in the postinstall script & deactivate our process builders before uninstalling the package, so our subscribers don't need to deactivate those manually.

I searched but couldn't find the proper solution for this issue. Though somehow I got to know that this can be achieved through tooling API.

So is there any documentation available for the API?

Thanks in advance.

1 Answer 1


There is no way to do this via Apex easily since you need to change metadata.

It's probably easier to provide a simple script than to do this via apex directly.

If you really want to automate this via Apex, you would need to open an Endpoint and do metadata operation against it.

For Apex, here's a link to give you the general ideas which libraries could be used: Tooling API calls from Apex requires user to set up Remote Site Settings?

  • Hi Christian, Thanks for the reply. It is really helpful. For remote site settings, I'm planning to mention in the user guide from where a subscriber will add their environment endpoint in the remote site settings. Can you please suggest which API metadata are available to disable the process builder?
    – Vijay N
    Commented Jan 14, 2019 at 13:44
  • check this: salesforce.stackexchange.com/questions/214216/… Also be aware that version numbers and the behaviour around them have recently changed (u can now deploy a process as active) - so setting the version to 0 might not work anymore. You'll need to experiment a bit. Commented Jan 14, 2019 at 16:45

You must log in to answer this question.

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