How to fix "Record not found.." error while trying to insert new row into Dataverse entity using ADF

Mohsin Patel 0 Reputation points Microsoft Employee
2025-03-07T19:59:03.8666667+00:00

I have a data factory pipeline that contains a Copy activity with Source as a SQL Server table and Sink as Dataverse entity. The pipeline reads new or existing rows from the table and Upserts into dataverse. However for a new row that does not exists in dataverse entity, it shows an error:

"ErrorCode=DynamicsOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Dynamics operation failed with error code: -2147220891, error message: Cannot find record to be updated.,Source=Microsoft.DataTransfer.ClientLibrary.DynamicsPlugin,''Type=System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Message=The creator of this fault did not specify a Reason.,Source=Microsoft.DataTransfer.ClientLibrary.DynamicsPlugin,'"

Not sure why the Upsert is not working as expected, i.e. when a record exists it overwrites it otherwise it inserts the new row. I am making sure that all fields are mapped explicitly including the key field. I am using Dataverse (Common Data Service for Apps) type of linked service for the sink.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,323 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chandra Boorla 9,835 Reputation points Microsoft External Staff
    2025-03-07T21:28:23.8966667+00:00

    Hi @Mohsin Patel

    The error "Cannot find record to be updated" (error code -2147220891) suggests that the Upsert operation is failing because Dataverse cannot locate an existing record to update. This typically happens when the key field mapping is incorrect or Dataverse does not recognize the record as existing.

    Possible Causes & Fixes -

    Check Key Column Mapping in ADF Copy Activity - Go to Sink settings in your Copy Activity. Ensure that the correct Primary Key or Alternate Key is selected for the Upsert operation. If using an Alternate Key, make sure it is already defined in Dataverse.

    Verify Alternate Key in Dataverse - In Power Apps, navigate to Tables → Your Dataverse Entity → Keys. If an Alternate Key (e.g., unique business ID, email) is missing, define it and try again.

    Ensure Matching Data Types - The key column in SQL Server and Dataverse must have compatible data types. If SQL Server uses nvarchar but Dataverse expects a GUID, the Upsert may fail.

    Test with an Insert Operation - Temporarily change the Write Behavior in ADF from Upsert to Insert and run the pipeline. If it inserts successfully, then the issue is with the Upsert key detection.

    Consider Using OData v4 Linked Service - If the issue persists, try switching from Dataverse (Common Data Service for Apps) to OData v4 linked service, as it sometimes handles Upsert more reliably.

    For further details, please refer:

    Please refer to MS Q&A thread - https://learn.microsoft.com/en-us/answers/questions/1643446/data-factory-copy-data-activity-cant-find-record-t addressing similar issue.

    I hope this information helps. Please do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.