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
Dmitry OfitserovDmitry Ofitserov 

How to query "Approval History" related list

Hello,
Is there any way to query the "Approval History" related list on custom object ?
The fields I need to query are :"Actual Approver","Overall Status" and "Date".

Thanks
Best Answer chosen by Dmitry Ofitserov
Shazib MahmoodShazib Mahmood
You will have to query processinstanceworkitem.
http://https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processinstanceworkitem.htm

See for more info: https://developer.salesforce.com/forums/?id=906F0000000A98bIAC

All Answers

Shazib MahmoodShazib Mahmood
You will have to query processinstanceworkitem.
http://https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processinstanceworkitem.htm

See for more info: https://developer.salesforce.com/forums/?id=906F0000000A98bIAC
This was selected as the best answer
Mahesh DMahesh D
Hi Dmitry,

ProcessInstaceWorkItem represents a user's pending approval request and ProcessInstanceHistory shows all steps and pending approval requests associated with an approval process

We can not directly query ProcessInstanceHistory object. We can query using parent object i.e. through processInstance.


Example:
SELECT Id, (SELECT Id, StepStatus,Actor.Name, Comments FROM StepsAndWorkitems where StepStatus = 'Pending')
FROM ProcessInstance


Please go through the below links:

https://developer.salesforce.com/forums/?id=906F0000000A98bIAC

http://appirio.com/category/tech-blog/2014/09/display-approval-history-approval-notification/

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processinstanceworkitem.htm

http://salesforce.stackexchange.com/questions/89920/how-to-query-recent-approver-name-from-approval-history

https://developer.salesforce.com/forums/?id=906F0000000956gIAA

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_processinstancehistory.htm

https://developer.salesforce.com/forums/?id=906F0000000A48KIAS


Please do let me know if it helps you.

Regards,
Mahesh
Sagar BhatiaSagar Bhatia
Hi All,

Can anyone answer my query : https://developer.salesforce.com/forums/?id=9060G0000005W54QAE
We are  trying to figure out how exactly StepsAndWorkItems relate with respect to each step in the Approval process. 
Thanks
Greg Adams 58Greg Adams 58
The Americans with Incapacities Act is a critical US social equality regulation (https://mobilunity.com/blog/ada-consulting/). Everything no doubt revolves around guaranteeing reasonableness and equivalent open doors for individuals with incapacities. From work and public spaces to transportation and innovation, ADA safeguards inclusivity in each part of life.