You need to sign in to do that
Don't have an account?
Keenan Wojnicz
FIELD_CUSTOM_VALIDATION_EXCEPTION, Duplicate name found when deploying to production
I have a class in production with 51% code coverage, so in the sandbox I rewrote the test class to improve the coverage to 96%.
When I try to deploy that updated test class to production i get the following error and I am in great need of some help.
TestZebraScoreController.testClass(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Duplicate name found: [] Class.TestZebraScoreController.testClass: line 64, column 1
Here is my test class that I am deploying.
When I try to deploy that updated test class to production i get the following error and I am in great need of some help.
TestZebraScoreController.testClass(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Duplicate name found: [] Class.TestZebraScoreController.testClass: line 64, column 1
Here is my test class that I am deploying.
public class TestZebraScoreController { @isTest private static void testClass(){ Account acc = new Account(Name='test'); insert acc; List<Zebra_Label_and_Tooltip__c > listZLT = new List<Zebra_Label_and_Tooltip__c>(); Zebra_Label_and_Tooltip__c zlat1 = new Zebra_Label_and_Tooltip__c(); zlat1.Name = 'Access to Power'; zlat1.Label_on_score_0__c = 'test'; zlat1.Label_on_score_4__c = 'test'; zlat1.Tooltip_on_score_0__c = 'test'; zlat1.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat1); Zebra_Label_and_Tooltip__c zlat2 = new Zebra_Label_and_Tooltip__c(); zlat2.Name = 'Company Profile'; zlat2.Label_on_score_0__c = 'test'; zlat2.Label_on_score_4__c = 'test'; zlat2.Tooltip_on_score_0__c = 'test'; zlat2.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat2); Zebra_Label_and_Tooltip__c zlat3 = new Zebra_Label_and_Tooltip__c(); zlat3.Name = 'Funding'; zlat3.Label_on_score_0__c = 'test'; zlat3.Label_on_score_4__c = 'test'; zlat3.Tooltip_on_score_0__c = 'test'; zlat3.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat3); Zebra_Label_and_Tooltip__c zlat4 = new Zebra_Label_and_Tooltip__c(); zlat4.Name = 'Operations'; zlat4.Label_on_score_0__c = 'test'; zlat4.Label_on_score_4__c = 'test'; zlat4.Tooltip_on_score_0__c = 'test'; zlat4.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat4); Zebra_Label_and_Tooltip__c zlat5 = new Zebra_Label_and_Tooltip__c(); zlat5.Name = 'ROI'; zlat5.Label_on_score_0__c = 'test'; zlat5.Label_on_score_4__c = 'test'; zlat5.Tooltip_on_score_0__c = 'test'; zlat5.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat5); Zebra_Label_and_Tooltip__c zlat6 = new Zebra_Label_and_Tooltip__c(); zlat6.Name = 'Service'; zlat6.Label_on_score_0__c = 'test'; zlat6.Label_on_score_4__c = 'test'; zlat6.Tooltip_on_score_0__c = 'test'; zlat6.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat6); Zebra_Label_and_Tooltip__c zlat7 = new Zebra_Label_and_Tooltip__c(); zlat7.Name = 'Technology'; zlat7.Label_on_score_0__c = 'test'; zlat7.Label_on_score_4__c = 'test'; zlat7.Tooltip_on_score_0__c = 'test'; zlat7.Tooltip_on_score_4__c = 'test'; listZLT.add(zlat7); insert listZLT; Opportunity opp = new Opportunity(Name='testopp', AccountId = acc.Id, StageName = 'IOA Completed', CloseDate = Date.today()); insert opp; ApexPages.currentPage().getParameters().put('opportunityId', opp.Id); ZebraScoreController zsc = new ZebraScoreController(); zsc.Save(); zsc.Cancel(); } }
Try with below code it will help !!
Let me know if it helps !!
Thanks
Manoj
All Answers
Try with below code it will help !!
Let me know if it helps !!
Thanks
Manoj