I'd like to query all Active approval process, know what Object they control, and ultimately pull the type of Approver (related, user, queue etc..) is this possible? doesn't seem like it..
2 Answers
you can do it by means of Process..
sobjects:
- ProcessDefinition (Represents the definition of a single approval process.)
- ProcessInstance (Represents an instance of a single, end-to-end approval process. Use this and the node, step, and workitem process instance objects to create approval history reports.)
- ProcessInstanceHistory (This read-only object shows all steps and pending approval requests associated with an approval process (ProcessInstance).)
- ProcessInstanceStep (Represents one work item in an approval process (ProcessInstance).)
- ProcessInstanceNode (Represents a step in an instance of an approval process. Compare to ProcessNode, which describes the step in a process definition. Use this object to retrieve approval history.)
- ProcessInstanceWorkitem (Represents a user’s pending approval request.)
-
1Okay this is great -- Especially ProcessDefinition for grabbing the target object -- but how do I query for the field that grabs the Approver: Type - relatedUserField> developer.salesforce.com/docs/atlas.en-us.api_meta.meta/… I want to check if that field has a null value and throw an error if that's the case: Commented Sep 27, 2018 at 18:54
SELECT Id,Name, DeveloperName, TableEnumOrId,Description, State, Type from ProcessDefinition where TableEnumOrId = and State ='Active'
-
Welcome to Salesforce Stack Exchange (SFSE)! Thank you for your contribution. Here on SFSE the why (explanation) is often as or more important than the how (code) in an answer - especially since it can help future searchers/readers. Please edit your answer to explain - even briefly (but enough to understand) - how your query solves the original issue. Also, your query would fail as-is with
...WHERE TableEnumOrId = AND...
. Then even if that is fixed, it does not seem to me to bring in all of the info that is asked for in the original question. Another reason for your explanation.– MoonpieCommented Dec 7, 2022 at 12:28