• Robert Torres 6
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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

  • April 22, 2013
  • Like
  • 0