+ 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.