In a test class, I’m passing a value of a restricted picklist. Below is the value, and the screenshot of the restricted picklist LOVs:-
SVMXC__Quote_Line__c testQuoteLine = new SVMXC__Quote_Line__c(); testQuoteLine.ESMX_Maintenance_Window__c='SWE Reg – Regular Labour, Semi-Weekend (e.g. Saturday)';
Even though, as it can be seen, we are passing the correct value, we are getting the below error while running the test class:-
System.DmlException: Update failed. First exception on row 0 with id a34g0000000v3ceAAA; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Maintenance Window: bad value for restricted picklist field: SWE Reg – Regular Labour, Semi-Weekend (e.g. Saturday): [ESMX_Maintenance_Window__c]
N.B.: No record type or Field dependency issue faced here.
probably the value you want to enter isnt exposed to the record type.
- go to the object`s record type
- select the relevant one
- select the relevant “picklists Available for Editing” for edit
- add the values