1

I am trying to avoid using any SOAP service for such simple operations as below:

  • The picklist of all Lead Statuses (including inactive)
  • The picklist of Stages/Statuses attached to a Record Type
  • The picklist of all Task types

Taking the last requirement, this should be possible with the Tooling API with a soql query

I am told there are 3 fields:

  1. Fullname
  2. Sorted
  3. StandardValue (the picklist array)

How am I supposed to query this? I have tried SELECT StandardValue FROM StandardValueSet Where Fullname = 'Task.Type' and this returns an error:

SELECT StandardValue FROM StandardValueSet ^ ERROR at Row:1:Column:8 No such column 'StandardValue' on entity 'StandardValueSet'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

How does anyone manage to work with Salesforce with such poor documentation?

1

You can run this query SELECT id,durableid,metadata,fullname,masterlabel FROM StandardValueSet where masterlabel='TaskType' where MetaData object will be having the picklist values in an array variable standardvalue

You can check in workbench to understand more about the underlying architecture. I've attached a snapshot below. And follow is the rest query to check in workbench:
/services/data/v39.0/tooling/query?q=SELECT+id,durableid,metadata,fullname,masterlabel+FROM+StandardValueSet+where+masterlabel='TaskType'

Note: masterLabel/DurableId filter is mandatory for the qyery.

Workbench Picklist TaskType Query Response

For any other standard picklist to query you can use following link to get associated masterLabel/DurableId Labels for Standard Picklist Values

  • Thanks so much. I managed to solve my second requirement with a simple query SELECT Metadata FROM BusinessProcess Where Id = '019xxx' The first requirement is impossible, there seems to be no way to find out inactive lead statuses. – James Graham Aug 13 '17 at 17:25

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.