2

I'm trying to write an after insert trigger on DuplicateRecordSet and DuplicateRecordItem but the triggers never fire. Does anyone know if it is supported and how it can be done?

  • As i understand you want write a trigger which will prevent creating duplicate records ? – MIX DML Aug 31 '15 at 2:07
  • @Prabhat Managing Duplicate Records in Salesforce – martin Aug 31 '15 at 6:17
  • @Prabhat not really, I want to perform some action when a DuplicateRecordSet and DuplicateRecordItem are being created or updated – Dedo Aug 31 '15 at 6:34
  • @Dedo I realize you may have already worked around this issue, but it doesn't seem like the triggers appear in the debug log at all. However, try doing a DML operation or something - like create a test account in the trigger. That seems to be working for me! (But this is indeed very strange.) – Robert Watson Jul 12 '16 at 16:23
  • Were you able to sort this out? I stumbled upon the same issue – Boris Bachovski Jun 9 '17 at 6:04
1

@Dedo The triggers are supported! They are run by the Automated Process user and not your current running user, so you need to take a few extra steps when debugging this process to see that it is running.

  1. Navigate to Setup -> Debug Logs
  2. Click "New"
  3. For "Traced Entity Type", choose "Automated Process"
  • Have you tried this? – Boris Bachovski Jun 9 '17 at 6:04
  • @BorisBachovski Me? Yes. Otherwise I wouldn't have put it as the answer. I have to debug these triggers fairly often. – Robert Watson Jun 9 '17 at 6:10
  • I just stuck a debug log statement in the trigger, created a bunch of duplicate records which match the rule (Duplicate Record Items created), even updated, yet I can't see anything in the logs. The trigger is not even firing at all... – Boris Bachovski Jun 9 '17 at 6:12
  • And you have debug logging enabled on the Automated Process user? Can you try inserting a fake test record or updating a record in the trigger? The record should be inserted/updated and show the Automated Process user as the Last Modified By. It's late here, but if you're still having issues I can try to make my answer more detailed with screenshots tomorrow. – Robert Watson Jun 9 '17 at 6:19
  • It's interesting, I wrote some invalid code and I can see the error logs for duplicate items are showing the error in my handler class. Though, I can't see the actual debug log for the Automated Process (yes I'm monitoring logs for that entity).... – Boris Bachovski Jun 9 '17 at 6:20

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.