You need to sign in to do that
Don't have an account?
rvg170550
Referring input values in Apex Trigger
trigger After_Insert_On_Lead on Lead (after insert) {
Opportunity a = new Opportunity(name='Automatically created from Lead',
StageName = 'Pending',
CloseDate = date.newInstance(2008, 10, 28),
Nextstep = 'Visit');
Insert a;
}
How can I refer to the values of the inserted Lead ? For instance, I want to copy the value of the newly created Lead in an Opportunity field.
Opportunity a = new Opportunity(name='Automatically created from Lead',
StageName = 'Pending',
CloseDate = date.newInstance(2008, 10, 28),
Nextstep = 'Visit');
Insert a;
}
How can I refer to the values of the inserted Lead ? For instance, I want to copy the value of the newly created Lead in an Opportunity field.
for (Lead l_o : Trigger.New)
{
Opportunity a = new Opportunity(name='Automatically created from Lead',
StageName = 'Pending',
CloseDate = date.newInstance(2008, 10, 29),
Location__c = 'MyPlace',
Nextstep = l_o.Company);
Insert a;
}
}
Use an "after insert" instead, then the lead id will exist.