You need to sign in to do that
Don't have an account?
Trigger causing errors with Data Loader
I have the following trigger deployed with the reference test class:
trigger LeadConvert on Lead (after insert,after update) {
|
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
I have the following trigger deployed with the reference test class:
trigger LeadConvert on Lead (after insert,after update) {
|
try this.
Without any edits to the class it prompts a Compile Error: Variable does not exist at line 21 column 9. This is my first trigger I've deployed and I do not have a Computer sciences background - any detailed explanation/reasoning would be appreciated :)
I have updated the above post. please try it.
New compile error line 22, column 27 :Variable does not exist" setLeadId - might eventually lead to a compile error on line 23 as it works through the string?
If I understood how it was trying to work I might be able to fix without asking, but I am lost.
My original trigger works, I just cannot use for batches larger than 100
Can you try it again. i have updated the code.
this will surely work. it worked for me.
That did work - wouldn't I now need to adjust the Apex Class for testing?
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class testLeadConvert2 {
static testMethod void leadConvertTest() {
// Create test data
List<Lead> leadList = new List<Lead>();
// Insert Leads
for(integer i=0; i<10; i++){
Lead l1 = new Lead(Company = 'Test Account#' +i , LastName= 'Test Lead LastName' +i, Status ='Confirmed');
leadList.add(l1);
}
Profile p1 = [select Id from profile where name = 'Standard User'];
User u = new User( Alias = 'standasf',
Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8',
LastName='Testing',
LanguageLocaleKey='en_US',
LocaleSidKey='en_US',
ProfileId = p1.Id,
TimeZoneSidKey='America/Los_Angeles',
UserName='stadfasdfsdfndarduser@testorg.com'
);
System.runAs(u){
Test.startTest();
Database.Insert(leadList);
Test.stopTest();
}
//Assertion Testing
leadList = [select Id, IsConverted, ConvertedAccountId, ConvertedContactId from Lead where Id IN :leadList];
for(integer i=0;i<leadList.size();i++){
System.assertEquals(leadList[i].IsConverted, false , 'Values not equal');
System.assert(leadList[i].ConvertedAccountId <> null );
System.assert(leadList[i].ConvertedContactId <> null );
}
}
}
getting error at Line 36, column 1 when running test and trying to validate;
Failure Message: "System.AssertException: Assertion Failed: Values not equal: Expected: true, Actual: false", Failure Stack Trace: "Class.testLeadConvert.leadConvertTest: line 36, column 1"
Also this error when Running test:
Class.testLeadConvert2.leadConvertTest: line 37, column 1
try this.
received "expected false, received true message. Terurned to False and bow get this:
System.AssertException: Assertion FailedClass.testLeadConvert2.leadConvertTest: line 38, column 1
What System Assertion is being reference that it cannot find?
You might be using the statement
As it is expecting for false and as the lead is converted and value is true the condition is failing.
Try changing it to
typed exactly as instructed and this error:
back at false, the rror moves to next line regarding ContactId <> null
Can you check the debug log and the values? For some reason, it worked perectly for me..
added the debug lines and still this error:
I downloaded debug log - but have no clue what to look for
Look for the values in the three statements.
if possible can you post me the debug log. you can send the log in a private message.
can you try the code i have sent you in the Private message.