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
niven sfniven sf 

Trigger to update checkbox in contact if contact email and user email are equal

Om PrakashOm Prakash
Hi,
Try bellow trigger after using your contact's checkbox field api name
 
trigger ContactTrigger on Contact (before insert) {
   String userEmail = USerInfo.getUserEmail();
   for(Contact objContact : Trigger.New){
	   if(objContact.email != null && objContact.email == userEmail){
		   objContact.EmailSameAsContact__C = true;
	   }
   }
}

Trailhead for Trigger
https://trailhead.salesforce.com/en/modules/apex_triggers/units/apex_triggers_intro