0

I have a new custom object that I want to prevent duplicate records from being saved in. It is a junction object with two master/detail lookup relationship fields. A "duplicate" in my case will be any time these two fields are the same for any two records. I tried to use the duplicate matching rules to address this, but you apparently can only use one lookup field when defining a rule. Since that is not an option would the next best route be to create a new formula field that concatenates the two lookup fields and then use that field in my duplicate matching rule? In other words, what is best practice lately to check for duplicates before saving a new record?

enter image description here

I found this great post on how to do exactly what I want to do from Gorav here. I followed all the steps, but where I am struggling is that when I choose the before save option (optimize for fast field updates) on my Flow I get an error when I try to save the Flow. The error says:

Set_Compound_Key (Assignment) - When the TriggerType field is set to "RecordBeforeSave", the $Record.Compound_Key__c field isn't supported.

Is there something I am missing?

4
  • How is Compound_Key__c defined? Is it a text field or a formula field?
    – cropredy
    May 27, 2022 at 17:44
  • It is a formula field. May 27, 2022 at 18:12
  • @DavidCheng - It is insightful, but I think more than I need as everything I want to do should be within the Junction Object I believe. Thank you for sharing. May 27, 2022 at 18:19
  • 1
    @CraigRowland the article that you have referred , as per that compound key should be text field not formula field. please go through the article agin , correct your approach and try again May 28, 2022 at 6:25

0