I'm getting the above error when trying to bring a few Apex classes over to Prod. I recently changed some values in our custom object Status picklist field. The one erroring here was Completed and I changed it to Training Complete. It seems not to recognize it. I've read that creating a controlling picklist can fix this error, but we don't want there to be a controlling picklist on this object. Any other ideas?

Full Error

System.DmlException: Update failed. First exception on row 0 with id a0V4000000VkpypEAB; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Status: bad value for restricted picklist field: Training Complete: [Status__c] Stack Trace: Class.ImplementationTriggerHandlerTest.test_method_one: line 19, column 1

private class ImplementationTriggerHandlerTest {

    @isTest static void test_method_one() {
        Account acc = TestDataGenerator.getAccount();
        Insert acc;

        Implementation__c imp = TestDataGenerator.getImplementationAndInsert(acc);

        imp.Implementation_Status__c = 'Implementation Complete';
        Update imp;

        List<Training__c> trainingList = new List<Training__c>();
        for(Training__c t : [SELECT Id FROM Training__c]){
            t.Status__c = 'Training Complete';

        Update trainingList;

        delete imp;
  • Can you confirm if 'Training Complete' is actually a configured value for the Status__c field? – Adrian Larson Aug 22 '17 at 15:58
  • Yep it's a value. – Heather Aug 22 '17 at 16:27
  • Check if there are extra spaces in your Training Complete value in the picklist field (in the middle or at the end). Also if you have record types on the custom object, make sure the value is available for the record type you're using in the test. – David Cheng Aug 22 '17 at 20:15

please include the picklist values in the record type and deploy the field with record type as well. Also check if that picklist value is there in that field.

If not you can remove the restrict picklist values checkbox on that field -> deploy it, then manually check it

  • But then the code won't read the value once it's in Prod because it doesn't read it now. Right? – Heather Aug 22 '17 at 16:45
  • Yes, Heather in case if it is restricted picklist then this error is possible only on two scenarios: 1) when the value itself is not included in the picklist or 2) when that picklist is not included in the record type. If you take care of these two, we will never get this error – Abhishek AVK Aug 23 '17 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.