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
Debendra Ray 8Debendra Ray 8 

System.DmlException: Update failed. First exception on row 0 with id 0066F00000jPi87QAC; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, bad value for restricted picklist field:

Dear All,
Please could someone provide help on the below issue :

I'm facing this issue despite the fact that , I have uncheck the option "Strictly enforce picklist values" on the dependent field. Following is the  code which throws this error in PRODUCTION Org , however the passes the testing in SANDBOX :
@istest(SeeAllData=true)  private class TestEmailAlertsForQoute {             static testmethod void test() {                            Test.startTest();             Account acc = new Account(name='acc1');           insert acc;                   Opportunity oppr = new Opportunity();           oppr.AccountId = acc.ID;           oppr.Annual_Contract_Value_ACV__c = 111;           oppr.BU__c = 'MJ';           oppr.CloseDate = Date.today();           oppr.Contract_Opportunity_Estimate_CoE__c = 111;           oppr.Total_Contract_Value_TCV__c = 111;            oppr.Name = 'SubmitforQuoteApproval';            oppr.StageName = 'Prospecting';             oppr.Date_on_Opportunity_Prospecting_Stage__c = Date.today();           insert oppr;                      oppr.Region__c ='North';           oppr.Responsible_Sales_Rep__c ='Siddharth Bhatia';           update oppr;                                         Quote quot1 = new Quote ();           quot1.Name = 'TestPropForSandbox2016-10';            quot1.Status ='Draft';           quot1.OpportunityId = oppr.id ;           insert quot1;                                  quot1.Status = 'Acceptance by Client';            update quot1 ;                       Test.stopTest();          }           }

Any help resolving the error : System.DmlException: Update failed. First exception on row 0 with id 0066F00000jPi87QAC; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, bad value for restricted picklist field: Siddharth Bhatia: [Responsible_Sales_Rep__c]
Stack Trace: Class.TestEmailAlertsForQoute.test: line 24, column 1

Regards,

Debendra
September 27, 2016
 
Dilip_VDilip_V
Hi ray,

That is because you are passing picklist value that is not exist or defined.
Make sure that spelling of 'Siddharth Bhatia'.

Let me know if it helps.

If it helps make it as best answer.

Thanks.
Debendra Ray 8Debendra Ray 8
Hi,

I've validated the value in the picklist and this is defined & Correct in spelling as well - Please advise further.


Thanks.

Regards,

Debendra
 
Dilip_VDilip_V
Ray,

Please share the snapshot of Responsible_Sales_Rep__c  picklist values.

Thanks.
Debendra Ray 8Debendra Ray 8
User-added image
Debendra Ray 8Debendra Ray 8
User-added image
Debendra Ray 8Debendra Ray 8
Hi Dilip, Please find the Controlling and the dependent Picklist snapshots attached herewith. Thanks & Regards, Debendra Ray Head Enterprise IT projects [cid:_2_0C3AAB780C3AA938001D1E6B65257C7F] Read the Inspiring Story of Entrepreneurial Growth of mjunction : http://www.mjunction.in/mjunctionstory …………………………………………………………… mjunction services limited Godrej Waterside, 3rd Floor, Tower 1, Plot V Block DP, Sector V, Salt Lake, Kolkata - 700091. …………………………………………………………… Landphone: +91 33 66106100 (Board) Landphone: +91 33 66106307 (Direct) Handphone: +91 85840 08270 Fax: +91 33 44091808 …………………………………………………………… Corporate Website: www.mjunction.in ……………………………………………………………
Debendra Ray 8Debendra Ray 8
Hi Dilip, Please find the test class below : @istest(SeeAllData=true) private class TestEmailAlertsForQoute { static testmethod void test() { Test.startTest(); Account acc = new Account(name='acc1'); insert acc; Opportunity oppr = new Opportunity(); oppr.AccountId = acc.ID; oppr.Annual_Contract_Value_ACV__c = 111; oppr.BU__c = 'MJ'; oppr.CloseDate = Date.today(); oppr.Contract_Opportunity_Estimate_CoE__c = 111; oppr.Total_Contract_Value_TCV__c = 111; oppr.Name = 'SubmitforQuoteApproval'; oppr.StageName = 'Prospecting'; oppr.Date_on_Opportunity_Prospecting_Stage__c = Date.today(); insert oppr; oppr.Region__c ='North'; oppr.Responsible_Sales_Rep__c ='Siddharth Bhatia'; update oppr; Quote quot1 = new Quote (); quot1.Name = 'TestPropForSandbox2016-10'; quot1.Status ='Draft'; quot1.OpportunityId = oppr.id ; insert quot1; quot1.Status = 'Acceptance by Client'; update quot1 ; Test.stopTest(); } } Thanks & Regards, Debendra Ray Head Enterprise IT projects [cid:_2_0C3AAB780C3AA938001D1E6B65257C7F] Read the Inspiring Story of Entrepreneurial Growth of mjunction : http://www.mjunction.in/mjunctionstory …………………………………………………………… mjunction services limited Godrej Waterside, 3rd Floor, Tower 1, Plot V Block DP, Sector V, Salt Lake, Kolkata - 700091. …………………………………………………………… Landphone: +91 33 66106100 (Board) Landphone: +91 33 66106307 (Direct) Handphone: +91 85840 08270 Fax: +91 33 44091808 …………………………………………………………… Corporate Website: www.mjunction.in ……………………………………………………………
Dilip_VDilip_V
HI ray,

Do you have any record types?

Make sure that assighned record type for Oppr in test class has access to picklist value 'Siddharth Bhatia'.

Let me know if it helps.

Thanks.
 
Dilip_VDilip_V
Ray,

I can't find attachement related to dependent picklist values.

That may be the cause to.
Please attach it one more time 

THanks.
Debendra Ray 8Debendra Ray 8
Hi, Yes the record type has access to these Picklists : [cid:image001.png@01D218D0.784D9420] Thanks & Regards, Debendra Ray Head Enterprise IT projects [cid:_2_0C3AAB780C3AA938001D1E6B65257C7F] Read the Inspiring Story of Entrepreneurial Growth of mjunction : http://www.mjunction.in/mjunctionstory …………………………………………………………… mjunction services limited Godrej Waterside, 3rd Floor, Tower 1, Plot V Block DP, Sector V, Salt Lake, Kolkata - 700091. …………………………………………………………… Landphone: +91 33 66106100 (Board) Landphone: +91 33 66106307 (Direct) Handphone: +91 85840 08270 Fax: +91 33 44091808 …………………………………………………………… Corporate Website: www.mjunction.in ……………………………………………………………
Debendra Ray 8Debendra Ray 8
Hi, Please find below the controlling and the dependent picklists : [cid:image001.png@01D218D0.B9B7A450] [cid:image002.png@01D218D0.B9B7A450] Thanks & Regards, Debendra Ray Head Enterprise IT projects [cid:_2_0C3AAB780C3AA938001D1E6B65257C7F] Read the Inspiring Story of Entrepreneurial Growth of mjunction : http://www.mjunction.in/mjunctionstory …………………………………………………………… mjunction services limited Godrej Waterside, 3rd Floor, Tower 1, Plot V Block DP, Sector V, Salt Lake, Kolkata - 700091. …………………………………………………………… Landphone: +91 33 66106100 (Board) Landphone: +91 33 66106307 (Direct) Handphone: +91 85840 08270 Fax: +91 33 44091808 …………………………………………………………… Corporate Website: www.mjunction.in ……………………………………………………………