Search code examples
dynamics-crmdynamics-crm-365dynamics-crm-webapidynamics-crm-365-v9

Dynamics WebAPI: Update only changed fields?


I am writing an application that accesses Dynamics 365 CE via the webapi (v9.0 / 9.1). My application retrieves a record and displays that to the user, the user can make changes and save the record again.

In that case, my application will attempt to save the changes using a Patch call against the Dynamics WebAPI.

Is there a built in way of updating only the fields that the user had changes? This is in a web application where I can't be sure to be able to have a proper client side change tracking, meaning I either have to do another call against the CRM, compare both records and send only the updated values to the CRM or send the entire record to the CRM. The second case is obviously much more performant and easier but I can't seem to find a way to tell the WebAPI to only update the changed fields..


Solution

  • Retrieval of record attributes using web API & binding the values to UI controls, identifying the dirty attributes & update back the source system with only those dirty fields - this is what usual cycle will be.

    What you have is issue in identifying the dirty fields - it is not actual change tracking. Try to identify them in client side using an efficient way before submitting a update server request (PATCH).

    Sending whole record field values irrespective of its dirtiness is not recommended for various reasons like losing Audit track, pipeline business logic in CRM Plugin/Workflow, etc.