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

Source: Internet
Author: User

Today we look at the changes in the API, the new system, the removal of some common data processing API, such as: Setstaterequest, Setbusinessunitrequest, Setparentbusinessunitrequest and so on. Now we do this type of operation does not need to call this kind of API alone, we can directly construct our desired entity object and push it to the server, the system will install its content to do the corresponding processing.
As the saying goes, laymen look at the lively, professional look at doorways. Although a few APIs are simply removed, the internal architecture of the new system should have undergone massive refactoring. For our developers, such an adjustment is absolutely good news, because we can design the system script or the data interface, greatly reduce the number of interactions with the server, that is, if we use this new change to reconstruct the previous interface program, performance will be greatly improved.
This article will not discuss all the changes involved in the API, but rather a few of our daily 80% will use the Api:assignrequest and setstaterequest. Briefly describe how they should be used after adjustment, for everyone to play a starting effect.
You can refer to the code snippet below, where we have 2 operations on a customer record: assigning and setting properties. As you can see, all of these operations are implemented at the entity level, and no additional requests are invoked.

            //set StateEntity 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 =NewQueryExpression ("Account"); Query4acc.columnset =NewColumnSet (true); Entitycollection accounts = crmsvc_online.retrievemultiple (QUERY4ACC);if(Accounts. Entities.count >0) {testentity = accounts. entities[0]; }//set owner            if(Testentity! =NULL) {testentity["ownerID"] =NewEntityReference ("SystemUser", userId); }//set State            if(Testentity! =NULL) {testentity["Statecode"] =NewOptionsetvalue (1); testentity["StatusCode"] =NewOptionsetvalue (2); } crmsvc_online.update (testentity);

Of course, now the system only reconstructs a few APIs, I believe that with the follow-up with the new, the system will be more convenient development experience for the vast number of developers. The following is an API that already supports an entity level call and, of course, its API will be discarded: D

    1. Assignrequest–> Entity.owerid
    2. Setstaterequest–>entity.statecode
    3. Setparentsystemuserrequest–>systemuser.parentsystemuserid
    4. Setparentteamrequest–>team.businessunitid
    5. Setparentbusinessunitrequest–>businessunit
    6. Setbusinessequipmentrequest–>equipment.businessunitid
    7. Setbusinesssystemuserrequest–>systemuser.businessunitid

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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

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.