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
Mrityunjay Patel 18Mrityunjay Patel 18 

write the trigger on contact for update custom field

update condition
if contact email  is null then insert the some xyz@mail in email field
if contact email is not null then copy the value of contact email in custom field cemail_c on contact
 
Best Answer chosen by Mrityunjay Patel 18
Suraj Tripathi 47Suraj Tripathi 47
Hello Mrityunjay,

trigger UpdateEmail on Contact (before insert) {
if(Trigger.isInsert)
{
if(Trigger.isBefore)
{
for(contact con:Trigger.New)
{
if(con.email==null)
{
con.email='xyz@gmail.com';
}
else
{
con.cemail_c=con.email;
}
}
}
}
}


I hope you find the above solution helpful. If it does, please mark it as the Best Answer to help others too.
Thanks and Regards,
Suraj Tripathi