When creating a new contact, I'd like to have a duplicate rule to detect contact duplicates under the very same associated Account (i.e. only check records with the same contact.AccountId value).

But It seems I have to create a new text field in Contact, copy the AccountId from the associated Account in the before-trigger,and use this field in the matching rule in the duplicate rule as the matching rule field doesn't support formula field nor fields in associated object.

This is a big hassle for a small requirement. Any better way? Thanks!

1 Answer 1


Currently at this moment, Matching Rule can only support Account Name Field only in Contact object from Account. So if you want to prevent the duplicates based on field Contact.AccountId then (as you're said) you need to create the Text field and populate the accountId into that field in before logic and use that field in Matching rule to capture the duplicates.

Otherwise, You can use the Before save action in Flow and use the Custom Error component to show the existing record which makes the current record as possible duplicate. It's prevent additional field creation in Contact object.

To do that,

  • Create the flow in before action (By Selecting the FAST Field Updates) in Contact object
  • Use the Get Records Element to find the existing contact under same account.
  • Use the Custom Error component to show the error message as the current record is possible duplicate of existing record.

Hope it's helps.

  • Thanks for the help and confirmation!
    – Xi Xiao
    Commented Jan 5 at 16:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .