1

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..

buddybubble
  • 1,269
  • 14
  • 33
  • If you've retrieved the original values from CRM, can't you compare against that and prepare your PATCH accordingly? – jasonscript Jul 02 '19 at 03:42
  • yes that's what I resorted to doing in the end. I was hoping that there was a way to have this handled automatically by the api – buddybubble Jul 18 '19 at 14:52

1 Answers1

1

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.

  • Right, I'm aware of the issue with plugins, audit track, etc. Thats why I was hoping there would be a way of automatically identifying the dirty fields on an API level. Doing that manually is a lot of work since I can't rely on the UI giving me an accurate representation of what has really been changed by the user – buddybubble Jun 28 '19 at 18:42
  • @buddybubble unfortunately there is no option to do that with web api payload – Arun Vinoth-Precog Tech - MVP Jun 28 '19 at 18:44