we have logic, that reassigns approval request in the code. This logic is executed in the batch and base on some conditions on the record reassigns Approval Request to different Approver.

public static void reassignPromotions(List<Promotion__c> promotions) {
    Map<Id, Id> promotionsToApprover = new Map<id, Id>();
    List<String> developerNames = new List<String>{
    for(Promotion__c promo: promotions) {
        if(promo.ApprovalStatus__c == 'Pending') {
            promotionsToApprover.put(promo.Id, promo.Approver__c);
        else if(promo.Payment_Approval_Status__c == 'Pending') {
            promotionsToApprover.put(promo.Id, promo.Payment_DOA_Approver__c);
        promo.ReassignmentRequired__c = false;

    List<ProcessInstanceWorkitem> approvalRequests = [SELECT Id, ProcessInstance.TargetObjectId 
                                                    FROM ProcessInstanceWorkitem
                                                    WHERE ProcessInstance.TargetObjectId IN: promotionsToApprover.keySet()
                                                    AND ProcessInstance.ProcessDefinition.DeveloperName IN: developerNames
                                                    AND ProcessInstance.Status = 'Pending'];

    for(ProcessInstanceWorkitem approvalRequest : approvalRequests) {
        Id promotionId = approvalRequest.ProcessInstance.TargetObjectId;
        approvalRequest.ActorId = promotionsToApprover.get(promotionId);

    update approvalRequests;
    update promotions;

Approval request is reassigned properly. The new approver is able to see record in 'Items to Approve' and even he's able to approve record, but the problem is he's not able to edit record once it's approval status is 'Pending'. Additionally once he approves the further logic in trigger fails, because he receives error 'Entity is locked'.

When we're trying to reassign approval request with standard Salesforce solution (by clicking button 'Reassign') the new approver is able to edit record and no error occurs. Approval process has editability enabled for Current Approver and System admin:

enter image description here

Does anyone had similar issue in the past?


You must log in to answer this question.

Browse other questions tagged .