[SalesForce] How to capture duplicate rules in flows

one of the steps of my flow is to create a contact. The users enter in the interface all the details and click next, my flow then tries to save the contact; however, if salesforce detects a duplicate user via the duplicate rules, then it only throws an error message. Is there any way to detect the duplicate error and also capture the duplicate matches(records)? I would like to display all the duplicate matches and provide a nicer error message to the end-user.

I know that in apex is possible to detect the duplicate errors and also capture the duplicate matches. So I think I could create an Apex Action and detect the duplicate error and return the duplicate matches, but I am looking for an out-of-box solution for flows or an easier solution.

Best Answer

Does your duplicate rule block the creation of the contact or just warn? If it is blocking then you should be able to catch the fault/error then go to another screen to show similar contacts after getting them first. To show multiple fields in a tabular format, I would recommend that you use the the unofficial SF Datatable component. https://unofficialsf.com/datatable-lightning-web-component-for-flow-screens-2/

Related Topic