You need to sign in to do that
Don't have an account?
Yaroslav Pro
System.DmlException: Update failed
Hello
I cant solve this, maybe someone can help me
System.DmlException: Update failed. First exception on row 0 with id 0066E000004pfWbQAI; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, In the stage Demo, you need to fill in the fields "Scope Test Determined", Testperiod In Salesforce" and Order Task Sent to Salesforce".: []
static testMethod void testClosedWonUpdate_positive_03(){
List<Opportunity> oppList = [SELECT Id, StageName,End_Date_Test_Phase__c FROM Opportunity WHERE Name LIKE 'Test%' LIMIT 1];
Opportunity opp = oppList.get(0);
opp.StageName = 'Test';
Date d = date.today();
opp.End_Date_Test_Phase__c = d.addDays(40);
update opp;
System.debug(' 632 ====> ' + opp);
List<Account> aList = [SELECT Id, Name FROM Account WHERE Name LIKE 'Test%' LIMIT 1];
Account a = aList.get(0);
System.debug(' 636 ====> ' + a);
List<Asset> assets = [SELECT Id, Price_Agreements__c, Price, Status, Product2Id, Test_Asset__c, IsCompetitorProduct
FROM Asset WHERE AccountId = :a.Id];
System.debug(' 640 ====> ' + assets);
System.assertEquals('In test', assets[0].Status);
Test.startTest();
opp.StageName = 'Closed Won';
update opp;
Test.stopTest();
OpportunityLineItem ol = [SELECT OpportunityId FROM OpportunityLineItem WHERE Name LIKE 'Test%'];
List<Asset> assets1 = [SELECT Id, Price_Agreements__c, Price, Product2Id, Test_Asset__c, IsCompetitorProduct
FROM Asset WHERE AccountId = :a.Id];
List<OpportunityLineItem> oliList = [select Id, Asset__c from OpportunityLineItem where Id =: ol.Id LIMIT 1];
System.assertEquals(1, assets1.size());
System.debug(' 657 ====> ' + assets1);
System.assertEquals(false, assets1[0].Test_Asset__c);
System.assertEquals(false, assets1[0].IsCompetitorProduct);
System.assertEquals(oliList[0].Asset__c, assets1[0].Id);
}
Let me know
I cant solve this, maybe someone can help me
System.DmlException: Update failed. First exception on row 0 with id 0066E000004pfWbQAI; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, In the stage Demo, you need to fill in the fields "Scope Test Determined", Testperiod In Salesforce" and Order Task Sent to Salesforce".: []
static testMethod void testClosedWonUpdate_positive_03(){
List<Opportunity> oppList = [SELECT Id, StageName,End_Date_Test_Phase__c FROM Opportunity WHERE Name LIKE 'Test%' LIMIT 1];
Opportunity opp = oppList.get(0);
opp.StageName = 'Test';
Date d = date.today();
opp.End_Date_Test_Phase__c = d.addDays(40);
update opp;
System.debug(' 632 ====> ' + opp);
List<Account> aList = [SELECT Id, Name FROM Account WHERE Name LIKE 'Test%' LIMIT 1];
Account a = aList.get(0);
System.debug(' 636 ====> ' + a);
List<Asset> assets = [SELECT Id, Price_Agreements__c, Price, Status, Product2Id, Test_Asset__c, IsCompetitorProduct
FROM Asset WHERE AccountId = :a.Id];
System.debug(' 640 ====> ' + assets);
System.assertEquals('In test', assets[0].Status);
Test.startTest();
opp.StageName = 'Closed Won';
update opp;
Test.stopTest();
OpportunityLineItem ol = [SELECT OpportunityId FROM OpportunityLineItem WHERE Name LIKE 'Test%'];
List<Asset> assets1 = [SELECT Id, Price_Agreements__c, Price, Product2Id, Test_Asset__c, IsCompetitorProduct
FROM Asset WHERE AccountId = :a.Id];
List<OpportunityLineItem> oliList = [select Id, Asset__c from OpportunityLineItem where Id =: ol.Id LIMIT 1];
System.assertEquals(1, assets1.size());
System.debug(' 657 ====> ' + assets1);
System.assertEquals(false, assets1[0].Test_Asset__c);
System.assertEquals(false, assets1[0].IsCompetitorProduct);
System.assertEquals(oliList[0].Asset__c, assets1[0].Id);
}
Let me know
As your error shows, There is a custom validation rule (FIELD_CUSTOM_VALIDATION_EXCEPTION) written on Opportunity object. you are trying to insert new opportunity stage. Please insert stage name like Closed/Won etc. which are predefined.
I hope it will help you.
All Answers
As your error shows, There is a custom validation rule (FIELD_CUSTOM_VALIDATION_EXCEPTION) written on Opportunity object. you are trying to insert new opportunity stage. Please insert stage name like Closed/Won etc. which are predefined.
I hope it will help you.
Can you plz check with validation rule written on Opportunity, due to that you are getting Field Custom Validation Exception.
And Update your this line of code:
opp.StageName = 'Test'; // Give here actual "StageName" picklist value like: Prospecting / Qualification ... etc.
Hope it will help you.