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
fredkafredka 

Restricted Picklists while testing

Just last week I started getting issues with picklists that have restricted values.  I am creating records in a test and I have copied the value right from the picklist when I recreate it in my test.. however, the test is failing due to, "System.DmlException: Insert failed. First exception on row 1; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, bad value for restricted picklist field: Inter-Plan Preparing: [Cede_Status__c]"

I'm hoping there is just something I'm missing here?  

thanks!!

Fred
kirubakaran viswanathankirubakaran viswanathan
Hi Fred,

Please check whether you have any space in the picklist value. Or Better delete the value you have which causing the problem and recreate. 
Else uncheck the restricted picklist value option in the picklist definition.
Margaret FleischakerMargaret Fleischaker
Hey Fred - I've run into this issue before when the picklist values haven't been added to the record type for that object yet.