function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Deborah PerrottDeborah Perrott 

Conga query for approval history where there are multiple approvers for each step

Im trying to create a Conga / SOQL query to bring back ALL approvers for all steps on an opportunity - we use approval routes with a lot of steps and multiple approvers.
  • I can create a query to bring back step status, actor name BUT no date of approval:
SELECT Id,TargetObjectid, Status,(select id,actor.name from Workitems),(SELECT Id, StepStatus, Actor.Name FROM Steps) FROM ProcessInstance where TargetObjectId = '{pv0}'
  • I can create a query to bring back last modified approver, stage name, completed date - but this misses off previous approvers in same steps as it only retrieves last modified
SELECT CompletedDate, ProcessNodeName, LastModifiedBy.Name, ProcessInstance.Status FROM ProcessInstanceNode WHERE ProcessInstanceId IN (SELECT Id FROM ProcessInstance WHERE TargetObjectId = '{pv0}' and Status = 'Approved' ) ORDER BY CompletedDate ASC LIMIT 100

What i need is the approval history of ALL steps, for ALL approvers to include - approver name, step name and date is was marked approved.

Any out there who can help me please  - Im sure its a simple request and any support much appriciated