EDIT:
I have search online and could not find any resource that talks about how to get metadata for Approval Process
I know that the approval process stores in the ProcessDefinition object but what I'm trying to find is the Entry Criteria
that user have selected for the Approval Process how do I get this information in metadata api (workbench)
Here is the screen shot for ref:
I'm trying to execute the following rest explorer in Workbench and getting this error, what I'm doing wrong here?
/services/data/v40.0/tooling/query?q=SELECT+Id+FROM+ProcessDefinition
INVALID_TYPE message: sObject type 'ProcessDefinition'
is not
supported. errorCode: INVALID_TYPE
Best Answer
I suspect you just want a normal SOQL query rather than a Tooling API query.
The following ran against the SOAP Partner API no problem.
It also worked in the Developer Console, which means it was executed against the REST API.
See also:
Update for subsequent question
To get the Entry Criteria for the approval process you will need to go to the Metadata API. See
ApprovalProcess
and the associatedentryCriteria
of type ApprovalEntryCriteria.Getting to that in Apex will require a bit of work. You could try the Apex Wrapper Salesforce Metadata API. There is also the official Apex Metadata API, but that doesn't have access to the approval processes yet (as at Summer '17). Try raising the use case in the success community or as an idea.