0

I am showing only permissionable and accessible fields of an object on the UI, then I am upserting the field permissions for the selected fields for custom permission set. It works fine for some fields but for other fields, I get the error - "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST", message: "Field Name: bad value for restricted picklist field: {fieldname}"

For example - When I tried to upsert FieldPermissions for ParentId field of Account object, the error occurred - "INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST", message: "Field Name: bad value for restricted picklist field: Account.ParentId"

Thanks in advance.

2
  • For the standard fields like Id, Name, and audit fields, you can't modify their settings. You might need to skip those fields. Also, the required fields always need to have read and edit access, so you can't edit those as well. Sep 18 '20 at 13:11
  • 1
    Those fields I have skipped by checking isPermissionable(), so after that only filtered fields are available. Also, I can edit the permissions for Account.ParentId through standard Salesforce Permission set UI but not through the apex. I am not getting the logic behind this and how to recognise these type of fields in my custom logic.
    – Avi Rai
    Sep 18 '20 at 13:20
0

It's strange for me to see that in the "Field" picklist type field of "FieldPermissions" - Account.ParentId is referred to as Account.Parent. In fact, all the standard fields that end with "Id" are referred to as same.

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.