Loading

Error 'bad value for restricted picklist field' appears when a record is created

Udgivelsesdato: Aug 21, 2024
Beskrivelse

Users may receive the following error when they attempt to create a new record in Salesforce:

Error message text:

Error: Invalid Data. 
Review all error messages below to correct your data.
'bad value for restricted picklist field: PicklistValue'


Notes: 
 

  • In Salesforce Classic, this error displays the affected Field (Related field: FieldName).
  • In Lightning Experience, this error displays 'bad value for restricted picklist field: PicklistValue'
 

Cause of the 'Bad Value' error

This error occurs when the picklist field referenced in the error message meets each of the following conditions:
 

  1. The referenced picklist field has 'Restrict picklist to the values defined in the value set' set to Enabled.
  2. The referenced picklist field is a dependent picklist.
  3. The page layout does not include both the controlling and dependent picklist fields.
  4. A default value is set for the referenced picklist field:
    • If the object includes Record Types - This error occurs if the record type sets the default value.
    • If the object does not include Record Types - This error occurs if the picklist field sets the value.
    • All record types should have the newly create picklist selected in the Selected items section and not under available items.
  5. Initiate a Mass Quick Action with Predefined Value Set
  6. Any active trigger on the object where the field is used can give the same error.

When you attempt to save a record in the Object that contains this picklist field, Salesforce attempts to populate the default value. Since the controlling value is not set and the picklist is restricted to only allow the dependent values, you will receive this error when you attempt to save the record.


Additional Causes:
  • This error can occur when you deploy a picklist field from sandbox and the values are not selected on the record types.
  • This error can occur when the value 'Label' and 'API Name' are different in the values, and you use the 'Label' name in the update.
Løsning


Resolve the 'Bad Value' error

To resolve this issue, remove the default value from the Record Type or picklist field (depending on where it is set).

 

Remove the default value: Record Type


In Lightning Experience 

  1. Select the gear icon | Setup.
  2. Click Object Manager.
  3. Select the object for the record type that contains the picklist.
  4. Select Record Types.
  5. Select the record type that contains the picklist.
  6. Click Edit for the picklist you wish to change.
  7. In the 'Default' field, select --None--.
  8. Click Save.


In Salesforce Classic 

  1. Select SetupCustomize.
  2. Select the object containing the picklist, then select Record Types.
  3. Click the name of the record type that contains the picklist.
  4. On the picklist of your choice, click Edit.
  5. In the 'Default' field, select --None--.
  6. Click Save.

 

Remove the default value: Picklist


In Lightning Experience 

  1. Select the gear icon | Setup
  2. Click Object Manager.
  3. Select the object that contains the picklist.
  4. Select Fields and Relationships.
  5. Select the picklist field you wish to change.
  6. Click Edit for the picklist value that is set as the Default.
  7. Deselect the 'Default' checkbox. Note: Make this value the default for the master picklist.
  8. Click Save.


In Salesforce Classic 

  1. Select SetupCustomize
  2. Select the object containing the picklist, then select Fields.
  3. Select the picklist field you wish to change.
  4. Click Edit for the picklist value that is set as the Default. 
  5. Deselect the 'Default' checkbox. Note: Make this value the default for the master picklist.
  6. Click Save.

See also:
Vidensartikelnummer

000384095

 
Indlæser
Salesforce Help | Article