Dynamics Xrm Web API upsert operation

327 Views Asked by At

I have created a PCF application and using the Xrm WebAPI library to perform CRUD operations and associations as shown here https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/xrm-webapi/online/execute

In one of the operations, I am checking if a record exists. If not, it is created, else updated. I am using two calls for this, and was wondering if there is an easier way to perform a single upsert.

1

There are 1 best solutions below

0
Guido Preite On

You need to define an alternate key and use the Web API directly (by fetch or jQuery) because Xrm.WebApi doesn't support this kind of operations.

You can find more information here: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-upsert-insert-update-record?tabs=webapi