Pro User
Timespan
explore our new search
Upsert Records in Dataverse using Power Automate - Not Insert/Update
Image Source: Shutterstock.com
Microsoft Dataverse
Sep 15, 2022 6:00 AM

Upsert Records in Dataverse using Power Automate - Not Insert/Update

by HubSite 365 about Pieter Veenstra [MVP] (SharePains)

Microsoft MVP and Microsoft Productivity Principal Architect at HybrIT Services

Citizen DeveloperMicrosoft DataverseLearning Selection

Optimize your Power Automate data import with Upsert! Eliminate errors and run processes more reliably with Update or Insert in one operation.

Refining the Utilization of Microsoft Dataverse in Data Import Using Upsert Operation

The blog post by Pieter Veenstra [MVP] (SharePains) explores the use of the Upsert (Update or Insert) approach rather than merely updating or inserting records when using Microsoft Dataversewith Power Automate.

An Upsert action, according to Veenstra, optimizes data import processes by checking if an existing record matches the data item. If a match exists, the action initiates an update; if not, it inserts the item as a fresh record.

This systemic functionality offers more reliable performance in comparison to inserting or updating an item after independently checking for its existence as it mitigates the lag time in data processes. Notably, high-volume flows could produce errors or even failures during concurrent data import exercises if the standard Insert or Update approach is applied.

Veenstra acknowledges that errors, such as the recurring "A record with matching key values already exists" error, can occur amidst simultaneous attempts to add identical records. Despite the slim likelihood of this happening, implementing error remediation via retries after failure is a recommended practice.

Veenstra further explains, "Upsert a row" action isn't an explicit feature in Power Automatic. Instead, it embeds this functionality under a unique name. Using this action, the application reads call records via Microsoft Graph, leveraging these data to pursue an update.

The crucial element in this process is the Row ID, a unique identifier with a standard GUID (Globally Unique Identifier) format. The external system is responsible for providing unique GUIDs while the database inherits.

He analyses why dataflows are not always the ideal solution, particularly for complex data requiring movement across several lists and potential adjustments. Instead, Power Automate could offer more flexibility.

To conclude, Veenstra's Upsert approach isn't fail-safe, yet it proves significantly more efficient than prior practices. However, if accompanied by effective error handling, the system's performance can be further optimized.

Depth View: The Value of Upsert in Microsoft Dataverse and Power Automate

In a broader context, Veenstra's method presents a practical solution to streamlining data import procedures in data management platforms like Microsoft Dataverse. Upsert, as a combination of Update and Insert actions, is pivotal for maintaining data consistency and minimizing processing time within a high-volume data flow.

The Upsert approach ensures the data import process is uninterrupted even during simultaneous data updates. By incorporating effective error handling methods such as scheduling retries, data management systems can attain remarkable efficiency and reliability.

Therefore, integrating Upsert actions into data import processes in Power Automate and similar platforms can greatly enhance data management's overall efficiency and reliability. Providing a comprehensive solution to vexing data import issues, the Upsert operation epitomizes efficient and reliable data management.

Read the full article Don’t Update or Insert records in Dataverse but Upsert when using Power Automate

Microsoft Dataverse - Upsert Records in Dataverse using Power Automate - Not Insert/Update

Learn about Don’t Update or Insert records in Dataverse but Upsert when using Power Automate

Microsoft Power Automate is an incredibly versatile tool that significantly streamlines data management in business applications. Updating or inserting records to a storage like Dataverse is a common operation, but often you may come to a challenge of which operation to choose. The method known as Upsert, which is a combination of Update or Insert, is an optimal method in many scenarios.

When importing data, there is a regular pattern to first check whether the data item you want to upload already exists. If it doesn't, the data item is inserted, if it does, it is updated. However, there could be a time lapse between the checking and inserting steps and within this window, the data might have changed. This could result in workflows failing, especially high-volume ones or those including concurrent flows trying to insert or update the same Dataverse table.

Unfortunately, data flows can bring up errors indicating that a record with matching key values already exists. This is one of the common issues you might encounter. Attempting to add a manual waiting or retry sections in the flows quite often doesn't resolve the problem. The Upsert action, which allows either updating or inserting the data item in one single operation, is one way to make these flows run more reliably.

However, there's a caveat: There's no 'upsert a row' action in Power Automate. It really does exist but it's present with a different name. To perform this action, external data is pulled using Microsoft Graph in an HTTP request, which is then updated to the row using the 'id' received in the call. It is significant to note that the 'id' is unique and in standard GUID format. Also, the external system (Call Records) is responsible for rendering these unique GUIDs.

The Upsert process works equally well for both new and existing records. For new records, a new row with that GUID is created; and for existing records, the existing record with the same id gets updated. Wondering why not use Dataflows instead? Dataflows could be used for simple data imports, but when the data structure gets complex and involves passing data between multiple lists while also requiring data adjustments, Power Automate turns out to be more flexible.

This Upsert method isn't 100% foolproof though, errors may still occur if attempts are made to add the same record simultaneously, something that rarely happens thanks to the microsecond precision in computer operations. In a worst-case scenario, adding a bit of error handling to your flow could provide a solution, where any failure to upsert results in a retry scheduled shortly after the failure.

Overall, Upsert is a robust method for managing record insertion or updates in Power Automate for Dataverse. It not only aids in decreasing errors but also in streamlining high-volume flows, making it a powerful tool for efficient data management in business operations.

More links on about Don’t Update or Insert records in Dataverse but Upsert when using Power Automate

Don't Update or Insert records in Dataverse but Upsert ...
May 19, 2023 — Using the data returned I'm now doing an update a row using the id that I've been given by my Graph API call. Upsert and item in Dataverse using ...
Don't Update or Insert records in Dataverse but Upsert ...
May 27, 2023 — This article discusses the process of updating or inserting records in Microsoft's Dataverse using Power Automate and suggests using the "upsert ...
Use Upsert to Create or Update a record - Dataverse
May 31, 2023 — When loading data into Dataverse from an external system, you may not know if a record already exists in Dataverse or not.

Keywords

Dataverse Upsert, Power Automate use, Update records Dataverse, Insert records Power Automate, Power Automate techniques, Upsert records Dataverse, Power Automate records management, Dataverse manipulation, Power Automate Dataverse strategy, Upsert instead update insert.