UpsertResponse response updated or not? RRS feed

  • Question

  • Good afternoon,

    I´ve been testing the UpsertRequest for few weeks with good results, building a tiny framework around it.

    One thing which bothers me is when I get a response from "UpsertResponse" I can only see if the record was created or not.
    What about if it was updated or not?

    Let´s say if I want to log every record via UpsertRequest and only log out each create/update, response.RecordCreated gives me true when a record has been created (great!) but how can I check whether is has been updated?

    I´d like to avoid, querying CRM for all the data which I tried Upserting and check the datestamp afterwards if something has been modified.

    Any clues?

    Tuesday, July 12, 2016 9:45 PM

All replies

  • Wow I just noticed that Upsert always updates the record although there weren´t any changes on the entity. I was taken a look at 'modifiedon' field which was always updated with every run with Upsert.

    I just enabled audit and checked that Upsert is overwriting all the fields although there hasn´t been a change. Is that normal?

    So let´s say I have 100.000 customers in my CRM org and I´ll run an integration job every night, which will take another 100.000 customers DB, that means that I´ll have 100.000 audit entries and 100.000 updates on the customers although that there hasn´t been a change on the data.

    I thought that Upsert did have some kind of compare mechanism but it only has a basic 'DoesEntityExist' that is
    IF entity does not exist = CREATE
    IF entity exists = UPDATE

    Please if anybody has an experience with this and how you tackle it?

    Friday, July 15, 2016 11:22 AM
  • Up up up
    Wednesday, July 20, 2016 12:54 PM
  • CRM does not do any field level checks on the server side when an update (whether via upsert or not) is submitted. It is the responsibility of the calling code to do any field level checks to determine if the data has changed)

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Thursday, July 21, 2016 5:55 AM
  • Hi David,

    That I was afraid of :-(

    Best regards, Ragnar

    Thursday, July 21, 2016 9:53 PM