User Case: When setting up a contact in Dynamics 365, verify if a contact with the same email address already exists. If it does, prompt an error message indicating a duplicate email address.
Step 1: Navigate to make.powerapps.com, screen 1 àCreate a Blank Canvas App à Connect with Dynamics 365 Data Source à Connect Contact Entity as Dataset (You can connect other entity also as per your requirement)
Step 2: Screen 2 - Insert a new Blank Screen to show Duplicate Detection Dialog
Step 3: Add few Text Input and Button Controls in Screen 1 or design as per your need.
Step 4: Add below formula on Button Control (onSelect property) to find Duplicate Record.
If(IsBlank(
LookUp(Contacts,emailaddress1 =Emailaddress_Text.Text)),
UpdateContext({result: "Duplicates Record not found"}),
Navigate(DuplicateDetectionDailogbox,ScreenTransition.CoverRight)
);
You can use following formula also on Button Control (onSelect property) to find Duplicate Record
UpdateContext({recordCount: CountIf(Contacts,emailaddress1 = Emailaddress_Text.Text)});
If(recordCount > 0, Navigate(DuplicateDetectionDailogbox,ScreenTransition.Fade))
Step 5: Test the App
Before running the App, I’ve taken the existing email address from an existing contact.
And I’ve entered details into the App. Upon clicking 'Submit,' the Duplicate Detection Screen will appear.
If you provide a new email address that does not exist in the contact records, the result will be display as “Duplicates Record not found”. You can find result from variables.
Thank you..!