You need to sign in to do that
Don't have an account?
RAMANJINEYULU GOGULA
Unable map lead standard fields to opportunity custom fields
Initially I copied lead fields into lead custom fields after that I'm trying map Name and Email fields to Opportunity custom fields..
trigger mapping on Lead (after update)
{
Opportunity opp=new Opportunity();
for(Lead ll:Trigger.New)
{
if(ll.isconverted==true)
{
opp.Client_Name__c=ll.Name;
opp.Client_Email__c=ll.Email;
}
insert opp;
}
}
This is working but opportunity fields not getting added.
trigger mapping on Lead (after update)
{
Opportunity opp=new Opportunity();
for(Lead ll:Trigger.New)
{
if(ll.isconverted==true)
{
opp.Client_Name__c=ll.Name;
opp.Client_Email__c=ll.Email;
}
insert opp;
}
}
This is working but opportunity fields not getting added.
Do you have "validation and triggers for lead convert" enabled for lead conversion? You will need this function enabled by SFDC for triggers to work on lead conversion. Once complete, the trigger should be like:
trigger mapping on Lead (after update) {
List<Opportunity> oppList = new List<Opportunity>();
for(Lead ll:Trigger.New) {
if(ll.isConverted==true && ll.ConvertedOpportunityId != null) {
Opportunity opp = new Opportunity(Id = ll.ConvertedOpportunityId, Client_Name__c=ll.Name, Client_Email__c=ll.Email);
oppList.add(opp);
}
}
update oppList;
}
All Answers
Do you have "validation and triggers for lead convert" enabled for lead conversion? You will need this function enabled by SFDC for triggers to work on lead conversion. Once complete, the trigger should be like:
trigger mapping on Lead (after update) {
List<Opportunity> oppList = new List<Opportunity>();
for(Lead ll:Trigger.New) {
if(ll.isConverted==true && ll.ConvertedOpportunityId != null) {
Opportunity opp = new Opportunity(Id = ll.ConvertedOpportunityId, Client_Name__c=ll.Name, Client_Email__c=ll.Email);
oppList.add(opp);
}
}
update oppList;
}