+ Start a Discussion

apex trigger on account

when account creating it should check for duplicate
if same name must update new values in old record 

help bros
Hi Pradeep,

This is not possible in a trigger, because when you addError to the record in trigger.new to mark it as duplicate, it rolls back any DML statements after that.

You probably have to either use a VF page to do that or override the Save button in your page layout with a custom button.

This button has to look for the matching record, if found populate the id field of the new Account object and do an update.

Hope this helps.