0

I have 3 (A,B,C) objects they are A-master B-Junction object and C master of B object, B object has the Master detail relationship with A and B objects. When the records created for B due to some reason duplicate records inserted into B object the duplicate records contains the reference of both A, B same combination repeated twice.

My Question is how to identify the records in B which are duplicates for the Master records A,B. Require a SOQL query to identify them. Any help is Appreciated.

  • whats the criteria to find duplicate? – Santanu Boral Feb 1 '18 at 5:29
0

Although you can do this using SOQL, But for that you need to make your query on previous records. As the number of records increase you might face many challenge on them.

We have a easy workaround here: Create a unique field and on before insert trigger populate this field with both parentid. So when ever you try to create a duplicate record the Unique field will get same data and will throw error of record already exist.

Using this approach you don't need any SOQL.

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.