function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kaustubh chandratre 2kaustubh chandratre 2 

write a trigger on lead if phonenumber starts from 111 Update email as balaji@gmail.com

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Can you try the below trigger on Lead.
 
trigger UpdateEmail on Lead (before insert,before Update) {
    
    for(Lead le:Trigger.new){
        
        if(le.phone.startswith('111')){
           le.Email='balaji@gmail.com' ;
        }
    }

}

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
ravi soniravi soni
hi kaustubh,
find your trigger on lead object.
trigger UpdateLeadEmail on Lead (before insert,before Update) {
 if(trigger.isBefore && (trigger.isInsert || trigger.isUpdate)){   
    for(Lead le:Trigger.new){
        
        if(le.phone.startswith('111')){
           le.Email='balaji@gmail.com' ;
        }
    }

}
}

don't forget to mark it as the best answer.
Thank you