Dynamics 365 - Duplicate Detection with PowerApps

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.

Tree view

Screen

Design the duplicate detection dialog screen

Add a fresh Blank Screen to display the Duplicate Detection Dialog.

Email address already exist

Include several Text Input and Button Controls, or design them according to your requirements.

Check contact exist

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)
);

Submit

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.

Email address

After entering the details into the application, clicking 'Submit' will prompt the Duplicate Detection Screen to appear.

Duplicate detection

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.

Context variables

Thanks.!!


Similar Articles