function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhishek KedariAbhishek Kedari 

​Error in updating the record from future method

Hi,
    When I used executive account, I dont get this message but if I use account with limited privilges I see below error message and my object is not getting updated.
 
​1 Update failed. First exception on row 0 with id a0ZR00000049iquMAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, This record has been locked, and changes cannot be made.: []

My flow :
    1. Call apex method and insert a record 
    2. Call future method
    3. Future method will call some external webservice and will return some id
    4. Update the record in future method by assigning this value to one of field in object
    5. Call  update on the object
    6. Future method ends here

Changes I made :
   1. Changed edit permission in workflow from 'admin' to 'admin and current approver'
   2. Provided edit pormission on that object field for every user

Please let me know if there is any issue in understanding this issue.


Thanks,
Abhishek
BalajiRanganathanBalajiRanganathan
Edit permission will not allow to edit a locked record. need modify all permission for that.
but verify, if all of your classes uses without sharing keyword so that the Apex code will run in system mode instead of running in user mode.