Contact duplicate detection in Dynamics 365
When generating a contact in Dynamics 365, verify if a contact with the same email address already exists. If a duplicate is found, prompt an error message indicating the presence of a duplicate email address.
Establish Connection and Setup
Generate a Blank Canvas App, then establish a connection with a Dynamics 365 Data Source. Utilize the Contact Entity as your primary dataset. Optionally, you can connect additional entities based on your specific needs.
Design the duplicate detection dialog screen
Add a fresh Blank Screen to display the Duplicate Detection Dialog.
Include several Text Input and Button Controls, or design them according to your requirements.
Formulas for duplicate record identification
Implement the following formula on the Button Control (within the onSelect property) to identify Duplicate Records
If(
IsBlank(
LookUp(Contacts, emailaddress1 = Emailaddress_Text.Text)
),
UpdateContext({result: "Duplicates Record not found"}),
Navigate(DuplicateDetectionDailogbox, ScreenTransition.CoverRight)
);
You may also apply the following formula on the Button Control within the onSelect property to detect Duplicate Records
UpdateContext({recordCount: CountIf(Contacts, emailaddress1 = Emailaddress_Text.Text)});
If(recordCount > 0, Navigate(DuplicateDetectionDailogbox, ScreenTransition.Fade))
Test the application
Now, proceed to test the application.
Before executing the application, I retrieved the email address from an already existing contact.
After entering the details into the application, clicking 'Submit' will prompt the Duplicate Detection Screen to appear.
If you input a new email address that is not present in the contact records, the outcome will be displayed as "Duplicate Record not found". You can retrieve the result from variables.
Thanks.!!