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?
Thanks