1

I have set up a duplicate rule with Report as active. What I need is when a duplicate occurred in the system for any sObject (in my case it is Account), it needs to send a email to a email address ( present in any custom field or a hard code value will also work).

For this I have tried to use the workflow Email Alert but I cann't access the Record Name field (like if it is account then I need to send the newly created Account name) since it is not available in merge fields.

Later on I have found another possible way to develop a trigger on Duplicate Record Item but I'm not able to send email from the duplicate record item trigger. I'm preety sure that the trigger code executed completely without any error (since It completes with some DML operations on other sObject) but it is not sending email to intended email address. For testing purpose I have also tried to do a sample test and write another code that works perfectly in developer console. Here is the sample code:

List<string> emailList = new List<string>(); 
Messaging.SingleEmailMessage mail= new Messaging.SingleEmailMessage(); 
mail.setsubject('Duplicate Account'); 
mail.setplaintextBody('Test the Duplicate'); 
emailList.add('xyz@abc.com'); 
mail.setToAddresses(emailList); 
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});

Can anyone have any idea or suggestions that what it the problem in writing triggers for Duplicate Record Item. Thanks for any help!!!

0

You can create a process builder that looks either on the SET or ITEM created. and autolaunch a flow, providing the SET/Item ID to it.

Send the email from within the flow tom complete your requirements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.