Home » Resources » How-to Guides » Dataverse & Dynamics 365 Installation Guide » Duplicare Hub » Duplicare Installation Guide » Duplicare Power Automate
Duplicare: Power Automate
Data8 duplicare at it’s core uses custom actions to perform a lot it’s action which means it’s functionality can be used outside of the core model driven app scenario and be extended to solve all sorts of business needs.
We will go through the key steps people use and provide an example set up of each one. The thing that stays the same throughout all these examples is which action is being called within your Flow – everything here is using the “Perform an Unbound Action” from the “Dataverse” connector.
Finding Matching Records
Probably the most common request for use in Power Automate is the ability to take some data and go and find a record, or records, that match that data. The benefit of using it within Power Automate is the data you want to search with does not need to be in Dataverse already – so you could use it in all sorts of ways.
Request Parameters
Action Name
This value must be “data8_PerformGlobalSearch”.
Logical Name
This value should be the logical name of the records you are hoping to find.
Dirty Fields
This is the values you want to search for. The JSON structure of this directly related to the data in the Field Mappings parameter. The “Name” part of each object is used to map the data to Dataverse tables.
Field Mappings
This defines how the values provided in dirty fields map to Dataverse tables. In this simple example, the data would be mapped as follows:
- “firstname” field in Dirty Fields map to the “firstname” column on the “lead” table.
- “lastname” field in Dirty Fields map to the “lastname” column on the “lead” table.
- “email” field in Dirty Fields map to “emailaddress1”, “emailaddress2” and “emailaddress3” columns on the “lead” table.
Combining these two parameters lets you take flat data from any source, make look like a row from Dataverse then go and search for it.
Ruleset ID
This is the GUID of the dedupe+ rule you wish to run for this search. By combining the ruleset specified here with the “pretend” row we’ve now made we have enough to search.
Response Fields
The main response of the custom action comes back under a single property named “JsonResponse”. This means to use it properly, an extra step to parse that response to something usable is required like so:
The “Content” part of this action should be the “JsonResponse” field from the previous stage.
The “Schema” section the schema is as follows and you can paste this straight in.
{
"type": "object",
"properties": {
"Results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"LogicalName": {
"type": "string"
},
"DisplayName": {
"type": "string"
},
"IconSmallName": {},
"ObjectTypeCode": {
"type": "integer"
},
"Duplicates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"RecordId": {
"type": "string"
},
"DisplayName": {
"type": "string"
},
"OlmMasterId": {},
"Attributes": {}
},
"required": [
"RecordId",
"DisplayName",
"OlmMasterId",
"Attributes"
]
}
}
},
"required": [
"LogicalName",
"DisplayName",
"IconSmallName",
"ObjectTypeCode",
"Duplicates"
]
}
},
"DuplicateCount": {
"type": "integer"
}
}
}
Now you’ve got your data properly parsed, we can go through it and you can pick what is useful for you.
DuplicateCount
The total count of duplicates returned to you.
Results
Each different possible entity type is returned. When used in this way this should always only contain one result.
Within results, you have the following useful fields – note not all fields are described here as some are in the response for the main duplicare UI within the Dataverse model driven apps.
Logical Name
The logical name of all the duplicates in this group. This should match the logical name you entered in the request earlier
Duplicates
A list of RecordIds and DisplayNames of all possible matching records which should be enough information to perform any further required steps.
Multi Record Merge
Another option we often see asked for and this can work very well alongside the previous action which is merging multi records today at a time. Similar to how the “QuickMerge” functionality works in the main Dataverse UI, this will take any number of records and apply the Merge+ rules before merging all the records down to a single record.
Please note – this action must complete under 2 minutes and if it doesn’t, it will cause your flow run to fail. Larger records with many related activities can often cause this so you may need to put this consideration into your Flow.
Request Parameters
Action Name
This value must be “data8_MultiRecordMerge”.
JsonString
This value should an object with two parameters inside it which are:
LogicalName
The logical name of the rows you wish to merge
QuickMergeCandidateIds
This should be a string of all the ids you wish to merge, comma separated.
IgnoreExclusions
The Duplicare UI allows you to make duplicate exclusions that prevent merges occurring – this setting gives you the option to override and force the merge.
Response Fields
There are no response fields to this action – a successful response indicates the rows were merged.