You need to sign in to do that
Don't have an account?
Approval Process - Assigning Queue as a approver thru code
Facing a issue with Queue assignment as approver. As we can not dynamically assign queues in Approval Process we are first assigning it to a general user and reassigning it to a queue thru code. But while doing this, only if the current user is with Admin profile it is allowing to assign to a user and then reassign to a queue dynamically. but with restricted profiles(Without Modify All profile Permission) it is not happening. Finer details given below.
Approval Process is on child object(Approval__c -with Public Read/Write setting) of Opportunity(Master detail relationship )
Using Without Sharing in Controller .
Code Snippet:
--------------------------------
id QueueId;
QueueId = [Select queueid from QueueSobject q where SobjectType = 'Approval__c' and q.Queue.Name = :queuename Limit 1].queueid;
try
{
ProcessInstanceWorkItem workItemList = [Select p.ProcessInstance.Status, p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId From ProcessInstanceWorkitem p where p.ProcessInstance.TargetObjectId =:app and p.actorid=:DGSystemUserId order by createddate desc limit 1];
workItemList.ActorId = QueueId;
update workItemList;
}
Appreciate your valuable response
Facing the same issue now. does anyone resolve this?