You need to sign in to do that
Don't have an account?
jonathanbernddf20131.387825590468351E12
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY - Test class
Hi
Having some trouble. Wrote a trigger/class to post info from a new case to the lead object. I cannot get a test class to insert a case.
The above is the error message with 'radioCaseToLead: execution of AfterInsert'
The line of code to referred to as a problem is 'insert newleads;'
Any insight would be great.
Having some trouble. Wrote a trigger/class to post info from a new case to the lead object. I cannot get a test class to insert a case.
The above is the error message with 'radioCaseToLead: execution of AfterInsert'
The line of code to referred to as a problem is 'insert newleads;'
Any insight would be great.
All Answers
Class then triggers.
Apex Test Result Detail
Time Started 9/5/2014 6:30 PM
Class TestRadioCaseToLead
Method Name makeCaseForLead
Pass/Fail Fail
Error Message System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, radioCaseToLead: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, radioLeadToCampaign: execution of AfterInsert
caused by: System.ListException: List index out of bounds: 0
Class.RadioCaseToLeadToCampaign.radioLeadToCampaign: line 58, column 1
Trigger.radioLeadToCampaign: line 3, column 1: []
Class.RadioCaseToLeadToCampaign.radioCaseToLead: line 31, column 1
Trigger.radioCaseToLead: line 5, column 1: []
Stack Trace Class.TestRadioCaseToLead.makeCaseForLead: line 7, column 1
The error happens on Line 58
this could be occuring because you do not have the correct test data setup inside your TestRadioCaseToLead class (would need to include that code for further analysis). Regardless of that, I would modify your code to either do an addError ir radioCamp.isEmpty or just retrun if it is empty to avoid this error
OR
If this code works doing manual testing then it may be how your test data is setup. Please include that class as well for further analysis.
Thanks again
[1] http://pcon.github.io/presentations/testing/
[2] http://blog.deadlypenguin.com/blog/2014/07/23/intro-to-apex-auto-converting-leads-in-a-trigger/