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
sales@myvarmasales@myvarma 

apex trigger on account

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


help bros
LBKLBK
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.