Dynamics CRM 2015 Update 1 Series (3): Old APIs VS New APIs, dynamicsapis

Source: Internet
Author: User

Dynamics CRM 2015 Update 1 Series (3): Old APIs VS New APIs, dynamicsapis

Today, let's take a look at API changes. Some common data processing APIs are removed in the new system, such as SetStateRequest, SetBusinessUnitRequest, and SetParentBusinessUnitRequest. Now we do this type of operation without calling this type of API separately. We can directly construct the expected Entity object and push it to the server, the system will install the corresponding content for processing.
As the saying goes, a layman looks busy and provides a guard. Although only a few APIs are removed, the internal architecture of the new system should have undergone a huge reconstruction. For our developers, this adjustment is absolutely good news, because we can greatly reduce the number of interactions with the server when designing system scripts or data interfaces. That is to say, if we use this new change to refactor the previous interface program, the performance will be greatly improved.
This article will not discuss all the APIs that involve changes, but will briefly introduce several APIs that we will use in daily 80%: AssignRequest and SetStateRequest. This article briefly introduces how they should be used after adjustment, which will serve as an example for everyone.
You can refer to the following code snippet. Here we perform two operations on a customer record: assigning and setting properties. You can also find that all these operations are implemented at the Entity Level and no additional Requests is called.

            //set state            Entity testEntity = null;            Guid userId = Guid.Parse("{7651C7AF-8B18-E511-80E0-3863BB2E8C90}");            Guid userId2 = Guid.Parse("{461C2001-C724-4DFE-BA6E-ED2D274784D2}");            Guid teamId=Guid.Parse("{BC2D90A5-F221-E511-80E1-3863BB2E7CD8}");            Guid parentBUId=Guid.Parse("{4FE4929F-F221-E511-80E1-3863BB2E7CD8}");            Guid BUId=Guid.Parse("{A4448DF6-F221-E511-80E1-3863BB2E7CD8}");            QueryExpression query4Acc = new QueryExpression("account");            query4Acc.ColumnSet = new ColumnSet(true);            EntityCollection accounts = CrmSvc_Online.RetrieveMultiple(query4Acc);            if (accounts.Entities.Count > 0)            {                testEntity = accounts.Entities[0];            }            //set owner            if (testEntity != null)            {                testEntity["ownerid"] = new EntityReference("systemuser",userId);            }            //set state            if (testEntity != null)            {                testEntity["statecode"] = new OptionSetValue(1);                testEntity["statuscode"] = new OptionSetValue(2);            }            CrmSvc_Online.Update(testEntity);

Of course, the system only reconstructs a few APIs. We believe that with the subsequent updates, the system will provide a more convenient development experience to developers. The following is an API that supports calling Entity Level. Of course, the API will be discarded: D

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.