2

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:

enter image description here EDIT END

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

1

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.

Select Id, Name From ProcessDefinition

It also worked in the Developer Console, which means it was executed against the REST API. enter image description here

Request URL:https://foo-dev-ed.my.salesforce.com/services/data/v40.0/query/?q=Select%20Id%2C%20Name%20From%20ProcessDefinition&columns=true&_=111111111111

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 associated entryCriteria 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.

  • I'm trying to get Entry Criteria for the approval process, how would you get that? and I'm aware of the ProcessDefinition object and other Process objects – Nick Kahn Sep 20 '17 at 23:17
  • @NickKahn Can you refine your question with your requirements. I read it as just needing to run the SOQL query. – Daniel Ballinger Sep 20 '17 at 23:19
  • go to the Metadata API? can you show me how would you do that in workbench rest explorer? I tried /services/data/v40.0/process/approvals but did not find any information – Nick Kahn Sep 21 '17 at 14:12
  • @NickKahn The Metadata API isn't available via REST. It is SOAP based. You want the migration>retrieve tab in Workbench. You will need to create a package.xml to retrieve the ApprovalProcess – Daniel Ballinger Sep 22 '17 at 0:46
  • can that be possible via REST API ? – Nick Kahn Sep 22 '17 at 0:48
1

because ProcessDefinition is not the supported object in tooling API.

you can check for supported object list here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.