You need to sign in to do that
Don't have an account?
Post Install Script doesn't work with With Sharing classes
We ran into issues in testing our post install script class that I wanted to share.
My class kicks off a couple batch jobs to do some data migration. These classes have the "with sharing" bit in the class signature, as is the default. It seems that the special "package install user" that runs the install script doesn't have access to packaged fields or objects, as we got errors like this:
caused by: System.QueryException: sObject type 'cx__Relationship_Type__c' is not supported
This problem seemed to be resolved by removing "with sharing" from the install class, as well as any classes called by the install script, but it's not documented anywhere that you need to do that.
Cheers,
Chuck
Turns out this isn't actually resolved. Removing with sharing from the install script class fixed errors in that class, but any batch jobs that you start as part of the script fail with a "Field is not writeable" error. These batch classes don't have with sharing on them, so I don't know what else to do at this point.