Hello User,
To delete duplicate rows from the Contact entity in Dynamics 365 Sales using Power Automate (Microsoft Flow), you can follow these steps:
1. Identify Duplicates:
Before setting up the flow, you need to define how you'll identify duplicates. This could be based on specific fields such as Email, Phone Number, Full Name, or a combination of fields.
You can use the "Advanced Find" feature in Dynamics 365 to search for potential duplicates based on these fields.
2. Create the Power Automate Flow:
In Power Automate, you can set up a flow that retrieves contacts, compares them for duplicates, and deletes them if duplicates are found.
Here’s an approach for setting up the flow:
2.1 Trigger: Manual or Scheduled Flow
You can either manually trigger the flow or use a scheduled trigger to run it periodically. For example, "Recurrence" can be set to run daily, weekly, etc.
2.2 List Rows: Retrieve Contacts from Dataverse
Use the List Rows action from the Dataverse connector to retrieve all contacts from the Contact table.
You can specify an OData query to filter rows based on fields likely to have duplicates (e.g., filter by email, phone number, etc.).
Example Action:
Table Name: Contact
OData Filter Query: emailaddress1 ne null
2.3 Loop Through Contacts:
Use an Apply to Each action to loop through the retrieved contact rows. Inside this loop, you can check for duplicate records based on the chosen fields.
2.4 Condition to Identify Duplicates:
Inside the loop, use a List Rows action again to search for other contacts with the same value in the fields you're comparing for duplicates (e.g., email address).
Use the returned records from the second List Rows to determine if there is more than one contact with the same key values.
2.5 Delete Duplicates:
Once a duplicate is identified, use the Delete a Row action to delete the duplicate record.
To avoid deleting all records in a duplicate set, you can keep one record (e.g., the oldest or the first retrieved) and delete the rest.
Thank you,
Amit Katariya