I have written apex code block to fetch picklist values for dependent picklist fields for a custom object using Picklist UI API for Community Portal users.

The request URL looks like this: https:///services/data/v46.0/ui-api/object-info/Custom_Object__c/picklist-values/

Though it is working fine for Community Profile A, it is not working for Community Profile B.

For user with profile A I get the response body with the picklist field vales as expected, but for the same user with Profile B I get the following response body:

[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]

I have tried doing the following to eliminate some possible reasons:

  • Used same user: once with Profile A and once with Profile B to ensure the root cause is not something related to User differences
  • There is no difference in Object level permissions between Profile A & B
  • There is no difference in record type access between both profiles
  • Ensured same request URL for the same object and for the same record type for which both profiles have access
  • Ensured that the field level access for all picklist fields on this custom object is same for both profiles A & B

API related settings:

Enable Record Visibility API - Disabled for both profiles

API Enabled - Enabled for both profiles

API Only User - Disabled for both profiles

Please let me know if there are any other profile level settings/permissions that might cause this difference in response for Picklist UI API callout?

  • 1
    Have you checked in the debug logs the URL is being built the same way with both users? Likewise, shouldn't the url have /picklist-values/{recordtypeId}/{fieldApiName}? Nov 13 '19 at 19:00
  • Thanks for your reply @KrisGoncalves, I have now updated my question (URL). Yes, I am getting the same URL in debug log for both the profiles (used same user), and I am not using the fieldAPIname in the end as I am trying to get the picklist values for all fields for the object Nov 14 '19 at 19:14
  • To my knowledge the UI API Request Url needs to use specific recordTypeId or Master Recordtypeid if no real Recordtypes are present. So for no RecordTypes, I use /services/data/v47.0/ui-api/object-info/MyCstomObject__c/picklist-values/012000000000000AAA as request url. cf. developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/… Not sure if this mitigates User A vs User B Nov 14 '19 at 19:29
  • I have used the master record type id and tried using another record type that both profiles have access to, but it still doesn't work. Dec 2 '19 at 13:57

Your Answer

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

Browse other questions tagged or ask your own question.