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.

3
  • 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, 2020 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, 2020 at 13:20
  • @AviRai did you resolve this? I'm encountering the same issue, and added the isPermissionable check.
    – hgolov
    Jun 16, 2022 at 6:40

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .