Restricted picklist issue even providing correct value

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)';

enter image description here

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.

  1. go to the object`s record type
  2. select the relevant one
  3. select the relevant “picklists Available for Editing” for edit
  4. add the values

Source : Link , Question Author : Abhijeet Mitra , Answer Author : Roy

Leave a Comment