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

2 Answers 2

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.

6
  • 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
    Commented Sep 20, 2017 at 23:17
  • @NickKahn Can you refine your question with your requirements. I read it as just needing to run the SOQL query. Commented Sep 20, 2017 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
    Commented Sep 21, 2017 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 Commented Sep 22, 2017 at 0:46
  • can that be possible via REST API ?
    – Nick
    Commented Sep 22, 2017 at 0:48
1

because ProcessDefinition is not the supported object in tooling API.

you can check for supported object list here.

6
  • So what will be the alternate, I need to find the Entry Criteria that user have selected for the Approval Process
    – Nick
    Commented Sep 20, 2017 at 17:13
  • @NickKahn as per some old post[developer.salesforce.com/forums/?id=906F00000008yNYIAY] thats not possible. Let see what other community members say. Commented Sep 20, 2017 at 17:28
  • 1
    remove the last bracket, it will work
    – glls
    Commented Sep 20, 2017 at 17:33
  • @NickKahn remove bracket from end. developer.salesforce.com/forums/?id=906F00000008yNYIAY Commented Sep 20, 2017 at 17:35
  • I did search before I post my question here and I read that post as well so in that post it says `You could try the metadata API to query' do you know how?
    – Nick
    Commented Sep 20, 2017 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .