Once a managed package is released, we have to perform several manual steps such as update picklist values, add field to layout, update field level security etc. And there are around 100's of subscriber orgs to be updated. So I wanted to automate it.

I have created an Apex class which would update the metadata API of subscriber orgs. The idea was to run this script asynchronously (using either @future or batch) as post install class. However, it doesn't work as there is no session available with package install user as well as no session available in scheduled or batch job.

Getting this error:

First error: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=

The other obvious alternate is to allow admins of subscriber org to click a link or button which would fire the Apex and perform the update.

Is there any way of automating this activity after package is installed?


1 Answer 1


Andrew Fawcett's Post Install Apex Metadata API Configuration Solved! blog post discusses additional problems in doing this and describes in detail the solution of initiating the Metadata API call from the post-install page.

You must log in to answer this question.

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