0

I want to know who was previous approver for my record. I checked for process instance lastactor but value for this field is empty and I cant query approval history record in soql

2 Answers 2

0

So for this you have to query against ProcessInstance but it has 4 child relationships Nodes,StepsAndWorkitems,WorkItems,Steps if you query these they do have last actor Ids they might be what you are looking for. Steps are pretty good as it shows you who should of approved it and who actually approved it (delegated approvals etc). Example empty query below:

SELECT Id,
    (
        SELECT Id
        FROM StepsAndWorkitems
    ),
    (
        SELECT Id
        FROM Nodes
    ),
    (
        SELECT Id
        FROM Steps
    ),
    (
        SELECT Id
        FROM Workitems
    )
FROM ProcessInstance
0

I have resolved this using ProcessInstanceStep Please find query below:

SELECT Id,Actor.Name
FROM ProcessInstanceStep
WHERE ProcessInstance.TargetObjectId = 'record_object_id'
AND StepStatus = 'Approved',
ORDER BY CreatedDate DESC

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .