I use a '/services/data/v41.0/tooling/sobjects/RecordType/'. But picklistValues is always empty, I need it to edit from code
1 Answer
This worked fine for me:
I opened up the Rest Explorer in workbench (logged in to dev org as admin) and executed a GET request using the following URI
/services/data/v41.0/tooling/sobjects/RecordType/0125Y000000BhfpQAC
This returned picklist values:
Perhaps you cannot see the fields because of field level security for the fields? Ensure the user you are logged into Workbench with has Read Access to the field(s) in question.
If they dont, then grant them read access to object and field (permission set / profile level) and then retry your request.
UPDATE: I tried by creating a custom object and custom picklist field like yourself, and got the same results (no info on picklist field/values)
You can access picklist values by using a describe call:
/services/data/v23.0/sobjects/<sObjectName>/describe
maybe you can use that instead?
I did find this question: Retriving all Active picklist values of all recordtypes
the answer says:
Unfortunately, picklist + record type information has very uneven coverage across Salesforce APIs
That answer also says you can use the UI API to retrieve the picklist field values. I tried this and it works with the custom object. Try the following:
/services/data/v42.0/ui-api/object-info/<ObjectApiName>/picklist-values/<your record type id>
this returned the following:
As for using the Tooling API call, Sorry I could not answer further, but same call works for Account and fails for custom object. Seems like this is an inconsistency on Salesforces side. Maybe open up a ticket with them to get a more fruitful explanation?
If anyone else can identify the reason I would also love to know why this is happening.
-
Thanks for answear! I have permissions to read this fields. I also see picklistValues on objects like Task, Account etc. Mar 22, 2021 at 15:25
-