Dynamics CRM Update 1 Series (2): Upsert API

Source: Internet
Author: User

Dynamics CRM Update1 introduced a heavyweight change to "Upsert Request", believing that friends who have done interfaces have encountered such scenarios when writing data to the CRM because it is not possible to determine whether the data is already present in the CRM system, You need to do a query first and then make subsequent creation or update operations. This kind of data writing process will undoubtedly greatly reduce the performance of data synchronization, because when synchronizing a piece of data, we need to interact with the server two times.

With the launch of the Upsert request, we can say goodbye to the situation, we put the detection logic of the data to the system for processing, the only thing we have to do is to assign the API to the record we want to synchronize, and call the Upsert API. The system will be processed for the records we have passed in: if it is present, it is created, otherwise it is updated. The use of this API is also very simple, you can refer to the following example:


            Entity account = new Entity (the "account");            Account. Attributes.Add ("name", String. Format ("{0}-{1}", "Sparta", DateTime.Now.ToLongTimeString ()));            Upsertrequest upsertrequest = new Upsertrequest () {Target = account};            Upsertresponse upsertresponse = Crmsvc_online.execute (upsertrequest) as Upsertresponse;            if (upsertresponse.recordcreated)            {account                . Id = upsertResponse.Target.Id;                account["name"] = string. Format ("{0}-{1}", "Sparta", DateTime.Now.ToLongTimeString ());                Upsertrequest upsertRequest2 = new Upsertrequest () {Target = account};                Upsertresponse UpsertResponse2 = Crmsvc_online.execute (upsertRequest2) as Upsertresponse;            }


Dynamics CRM Update 1 Series (2): Upsert API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.