I'm using the major push upgrades to install a new version of my managed package in our customer.

In this package I have a new field and it didn't exist in an older version of the package. In the postInstall script I'm trying to populate this field. Then I got the error: "Field is not writeable".

How can I solve it? I already setted a permission set for all the users giving access to the field, but the postInstall script is executed with another user.

  • 2
    Can you post some more details? Some code, and some more info on the field you are attempting to write to, would help. AFAIK there is no general issue with post-install scripts and new custom fields, I've done what you describe several times. – jkraybill Jun 17 '13 at 3:33
  • It's working now! There still was a with sharing in a class called by the PostInstall script. Thanks. – vanderlindo Jun 19 '13 at 14:29
  • 1
    Hopefully PJC's post will get undeleted, and when it does, please accept his answer instead of your own since he got it right immediately :) – jkraybill Jun 20 '13 at 2:48
  • 1
    I did an undelete. – pjcarly Jun 20 '13 at 7:12

Try adding

without sharing to your postinstall class

  • It didn't work. I got the same error. Thanks anyway. – vanderlindo Jun 14 '13 at 18:50

I was using the with sharing key in a class called by the PostInstall Script.

I have changed it for without sharing so it doesn't consider the sharing rules for the execution.

  • It looks like PJC proposed this on the 14th, is there a reason you didn't accept his answer? – ca_peterson Jun 20 '13 at 11:24

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.