function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Active Picklist value is not working-Erroring with Bad value

Hi Friends, 
I have a strange problem in our org that one of the active picklist value is not working. 
There is a  field called Nationality__c in contact, and updates are being receved from integration api. 
for example : If I get contact updates in which Nationality is "Turkey", contact gets updated correctly without any error. 
But with the same contact update api, whenever I get updates for "Libya", I get "bad value for Restricted picklist field" with status code=INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST. 

When I check the picklist values of this field, both of these values are Active, not getting any idea why its failing for Libya but not for Turkey. 
FYI, this picklist values are created from Global value set. 
Vikash GoyalVikash Goyal
Hi Navinku,

Do you have record types on the object?

If yes, please check if 'Libya' picklist value is available for the record type for which you are updating records.

You can check available picklist values for record type as follow: Go to Object ---> Record Types ---> Select record type ---> There will be related list 'Picklists Available for Editing' on record type detail page ---> Click on 'Edit' for 'Nationality__c' ---> Check 'Selected Values' if 'Libya' is there
---> if not then move 'Libya' from available values to selected values and save.

Hope this will help you

Hi Vikash, Thanks for the quick reply. I see that there are 2 record types and both of them have “Libya” in selected values. Is there anything else i can check. Thanks Navinku
Vikash GoyalVikash Goyal
Yes, Is this a dependent picklist field? If yes, then please check for controlling field value and dependent picklist value is a valid combination or not.
No Vikash, its not a dependent piclist field. 
Alternative I updated the API name of this value in Global value set  to same as value which is being used in this field and it worked. 
Any thoughts how updating the api name to same as value fixed it ? 
Vikash GoyalVikash Goyal
Hi Navinku, Picklist date works similar to the name-value pair data representation. In Salesforce, each picklist value is represented with a label and an API name.
Picklist label is displayed on UI while Picklist API name is used internally to save data or on metadata level. So when you try to save or update a picklist value it is matched to API name instead of the label.
But there are many other picklist values in the same field which has Label and API name different and are working perfectly fine. Only for this value if I have Label and API different its failiing.