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
mukesh guptamukesh gupta 

Trigger_issue

Hi Expert,

I am stuck in a logic.

i have contact with email fields. like
Contact1(lastname='test', email="aa@gmail.com"). if a new contact insert with same email id then new contact all fields value merge in old contact and this new contact will be delete.  

Please suggest a way.

Thanks
Mukesh  
Lokesh KumarLokesh Kumar
Hi Mukesh,

Do you want all the existing values of old contact will get replaced with new one or merge means Old Contact name='ABC' New Contact Name = 'LKO'. Result Name = 'LKO' or 'ABCLKO. Plese confirm.

Thanks,
Lokesh
Vivian Charlie 1208Vivian Charlie 1208

Hi Mukesh,

 

You can find example for merging record in the apex developer guide itself

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_merge.htm

 

You can also check the help page for database methods which list all available methods for merge

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm

 

Thanks

Vivian

mukesh guptamukesh gupta
Hi  If a contact is exist with email,  now i am enter new contact with same email id then existing contact will be update with new contact and new contact will be delete Sent from Yahoo Mail on Android