7

Ok, so I have some code that will segment the duplicate record sets generated by the system. To give an example, in case all contacts of a duplicate record set are of a certain type, it goes to team X to de-dupe these contacts.

I was writing my test coverage for this and noticed that even though when querying for the active duplicate rules - which it finds - the rules don't seem to be generating the actual duplicate record sets and items... Anyone else noticed this issue? Any way to have those rules generate the sets and items?

To be clear, the rules are there and are working cause if I don't use this dml option: DuplicateRuleHeader.AllowSave = true, at first, it wouldn't let me insert my second (duplicate) contact...

  • so, in the testmethod, querying for DuplicateRecordSet brings back no rows? If so, then to test this you'll need to restructure your code so that the Prod code calls an interface implementation that does the SOQL and returns sobjects whereas the testmethod has its own implementation of the interface that it injects into the prod code before starting the test. The testmethod's implementation returns constructed (not queried) sobjects. – cropredy Mar 6 '16 at 7:30
  • Hey Koen. Did you find a solution to this? Struggling with the exact same problem now – Novarg Jan 18 '17 at 12:55

Your Answer

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

Browse other questions tagged or ask your own question.