I have a Lightning component that will send Record Id and User Id to Apex Class. In Apex class I am trying to update the existing approver with new user id that was passed by Lightning component.

My Apex class is defined with

public without sharing class className{
    public static void fun(Id recordId, Id userId)
        ProcessInstanceWorkItem PIWI = [
            SELECT p.ProcessInstance.Status,
            FROM ProcessInstanceWorkitem p 
            WHERE p.ProcessInstance.TargetObjectId =: recordId

        PIWI.ActorId = userId;

        update PIWI;

If I login as Admin and try to change the approver via lightning component works without any error.

But when i login as a user who have access to opportunity and try to change the approver via lightning component, getting this error

Update failed. First exception on row 0 with id XXXXXXXXXXXXXXXXX; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

It is throwing this error at line "update PIWI;"

Another thing i noticed was that if actual user and logged in user are same and use lightning component to change the approver, it works without any error.

Do Lightning component run in User Mode or System Mode? I appreciate any help in resolving this issue.


Approval Request reassignments are very special when it comes to who can actually perform this action, even in system mode.

These are the only users that can perform a reassignment of an approval request:

  1. The currently assigned Approver
  2. Users with the global Modify All permission (ex: System Admins)
  3. Users with the Modify All permission on that Object (ex: Approval Request on Opportunity object, Users with Modify All permission on Opportunities)

This is something that I have encountered myself and was confirmed by Salesforce support to be the expected behavior.

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.