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
alex jainalex jain 

Hello all! How to write trigger on Lead object to compare email with contact email which is stored in Protivity or Activenet?

Raj VakatiRaj Vakati
try this code
 
trigger trigger_LeadConverted on Lead (before insert) {
	Map<String,Lead> newMpaToCon = new 	Map<String,Lead>();
	
	for(Lead l : Trigger.new){
		newMpaToCon.put(l.ContactId , l) ;
		
	}
    
	Map<Id,Contact> con =new Map<Id,Contact>([Select id ,email from contact where id in :newMpaToCon.keySet()]);
	
	for(Lead l : Trigger.new){
Contact c =con.get(l.contactId) ; 
if(l.email ! = c.email){
	l.Protivity__c = c.email ; 
}else{
	l.Activenet__c = c.email ; 
}
	
	}
    
	
	
}

 
alex jainalex jain
Hello Raj,
    
     Thanks for your reply. but this is not my requirement. Activenet or Protivity are not fields in Lead. Those are Sources for saving contacts data before getting into salesforce contact object. From that source we getting data into Salesforce through packages.