0

enter image description here

I use a '/services/data/v41.0/tooling/sobjects/RecordType/'. But picklistValues is always empty, I need it to edit from code

3
  • What is your picklist field name? @Denis Titarenko Mar 22, 2021 at 15:02
  • @RuklaniAttanyake 'Job Title' Mar 22, 2021 at 15:02
  • Did you make any picklist values for the field within that record type? Mar 22, 2021 at 18:23

1 Answer 1

0

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:

enter image description here

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:

enter image description here

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.

2
  • 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
  • @DenisTitarenko I updated the answer above, hope that helps you out
    – Z33dawg
    Mar 22, 2021 at 18:17

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