I have two picklist : Lead source and dependent picklist is Lead Source Details I am trying to write a trigger on the same. I want if Lead source value is chosen as 'List Import' then Lead Source Details 'ZoomInfo' . The current problem is Lead Source field is a required field and when I choose 'List Import' and try to save the same Trigger is not getting fired . Below is my trigger
trigger LeadSourceDetailUpdate on Lead (before insert) {
for(Lead l : Trigger.new){
if(l.LeadSource=='List Import'){
l.Lead_Source_Detail__c='Zoominfo';
System.debug('This is the correct' +l.Lead_Source_Detail__c);
Update l;
}
}
}
1 respuesta
Hi Abhishek,
I can only spot one problem with the trigger: you can't update your record in a before context - and you don't need to. This should result in an exception being thrown - are you getting that?
Try removing the update altogether.