You need to sign in to do that
Don't have an account?
Kiran Kumar Gottula
Trigger error meaasage
I am getting this error while writing test class for a trigger on opportunity for trigger events like after insert , befre insert , after update.before update
Please help me.......
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OpportunityOneTrigger: execution of AfterInsert.
Class.TestAutoLaunchApprovalTrg.myUnitTest: line 80, column 1
@isTest
private class TestAutoLaunchApprovalTrg {
static testMethod void myUnitTest() {
list<RecordType> rectype = [select Id,name from RecordType where SobjectType='Opportunity'];
map<string,Id> mprecname = new map<string,Id>();
for(RecordType rec:rectype){
mprecname.put(rec.Name,rec.Id);
}
decimal MgmtQuarterlyFees = 20000;
decimal Expected = 1000;
Account acc = [select Id,name from Account limit 1];
User uUnderwriter = [select Id from User where UserRole.Name = 'Global Coverage Underwriter' and IsActive = true limit 1];
//Inserting Opportunity
Opportunity opp = new Opportunity();
opp.RecordTypeId = mprecname.get('META Documentation');
opp.MEA_vs_Global__c = 'Global';
opp.MGEC_Anticipated_Funding_Date__c = system.today();
opp.Customer_Reply_Deadline__c = system.today();
opp.Country__c = 'Algeria';
opp.Name = 'Test Auto Launch Approval Trg';
opp.AccountId = acc.Id;
opp.MGEC_Confidence__c = '10%';
opp.StageName = 'Prospecting';
opp.MGEC_Vs_Customer__c = 'Both';
opp.Comments_Next_Steps__c = 'cmts';
opp.Opportunity_Source__c = 'EFS';
opp.Risk_Closing_Memo_Attached__c = true;
opp.Legal_Checklist_attached__c = true;
opp.Final_Pricing__c = true;
opp.KYC_Docs_Attached__c = true;
opp.Tax_Checklist_Attached__c = true;
opp.IC_Minutes_Attached__c = true;
opp.Commitment_Fee_closing__c = 30;
opp.Adjusted_ROE_closing__c = 23;
opp.Adjusted_ROI_Closing__c = 18;
opp.EBITDA_Closing__c = 13;
opp.Spread_bps_closing__c = 12;
opp.Anchor_Fee_closing__c = 11;
opp.Loss_Provision_closing__c = 10;
opp.MGEC_Asset_Class__c = 'Equity';
opp.Deal_Pole__c = 'MEA';
opp.MGEC_Deal_Category__c = 'Retro';
opp.MGEC_Vertical__c = 'SME';
opp.Fixed_Floating__c = 'Fixed';
opp.Lease_Loan__c = 'Loan';
opp.CurrencyIsoCode = 'USD';
opp.MGEC_Commitment_Amount__c = MgmtQuarterlyFees;
opp.Expected_O_S__c = Expected;
opp.MGEC_MNPI__c = 'Yes';
opp.MGEC_Confidential__c = 'No';
opp.CloseDate = system.today();
opp.ERM__c = true;
opp.Program_New_Exist__c = 'New';
opp.Compliance_Approvers__c = 'Pierre Abinakle';
opp.MDC_Representative_META__c = 'MDC Rep';
opp.GE_Representative_META__c = 'GE Rep';
opp.Underwriter__c = uUnderwriter.Id;
insert opp;
Opportunity opp1 = opp.clone(false,true);
opp1.RecordTypeId = mprecname.get('META Term Sheet');
insert opp;
opp1.RecordTypeId = mprecname.get('META underwriting');
update opp1;
}
}
You'll need to look at the code in this trigger:
OpportunityOneTrigger
and find the where in that trigger it's failing... just the test class isn't really enough for anyone to help you.
Please post the trigger code, it will help us in debugging the issue.