Need to fetch records from approval History which are assigned to Queue of which currently Loogged in User is part of

1.8k Views Asked by At

I have a requirement where i need to display Order records which are assigned to Queue of which Loged in User is part of.

Basically Need to fetch the Assignto Field from Approval History and compare with Queue ID.

Please see the below Code that i am trying out:

 for(ProcessInstanceStep steps1 : [Select id,p.ActorId,p.processInstanceid,p.processInstance.id,p.processInstance.targetobject.id from 
                                                  ProcessInstanceStep  p where  p.OriginalActorId ='00Gi0000004qIOFEA2'  ]) {

                                TargetIDList.add(steps1.ProcessInstance.TargetObjectId);    



                                system.debug('CheckRecords' + TargetIDList.size()); 

But unfortunatily its not returning any records..

Is i am using correct Field "OriginalActorId" of Steps in order to compare with Queue id here.

Please suggest.

1

There are 1 best solutions below

0
On

If you want to get the Id of the currently logged in user, take a look the static UserInfo class, in particular the getUserId() method.

For context, ActorId pertains to the user who is currently assigned to the approval step, while OriginalActorId is the user who was originally assigned to the approval step when it was first created.