Dynamics CRM 2015/2016 Web api:unbound Custom action and Bound custom action

Source: Internet
Author: User

Today, let's look at Bound/unbound custom action, what is custom action? The unknown partners are out, and Dynamics CRM 2013 has this feature. Like WhoAmI, we can call them through code, but today I'm going to tell you how to invoke them using the Web API.

Custom action is also divided into bound and unbound two types, their specific meaning and function and action before the difference, the only difference is that the custom action here is our own configuration, here in popular science, We can create an action in the setting-process, which creates the following interface:

Bound Custom Action


Unbound Custom Action


They are called in the same way as the OOB action, without distinction, as the following code snippet can be consulted:

Bound Custom Action

 Httprequestmessage custboundactionreq = new Httprequestmessage (httpmethod.post, Webapiurl + "/accounts (            723EF58A-75BB-E511-80D9-C4346BC43F3C)/microsoft.dynamics.crm.new_createprimarycontactforaccount "); CustBoundActionReq.Headers.Authorization = new Authenticationheadervalue ("Bearer", auth. Acquiretoken ().            Accesstoken);            Jobject custboundactioncontent = new Jobject ();            Custboundactioncontent.add ("FirstName", "Jeff");            Custboundactioncontent.add ("LastName", "Xiong");            Custboundactioncontent.add ("Telephone", "15000303158");            Custboundactioncontent.add ("Email", "[email protected]"); Custboundactionreq.content = new Stringcontent (Jsonconvert.serializeobject (custboundactioncontent), Encoding.UTF8,            "Application/json"); Httpresponsemessage Custboundactionresp = await client.            SendAsync (Custboundactionreq); if (custboundactionresp.issuccessstatuscode) {jobject result =Jsonconvert.deserializeobject<jobject> (await CustBoundActionResp.Content.ReadAsStringAsync ());            Console.WriteLine (result); }

Unbound Custom Action

Httprequestmessage custactionreq = new Httprequestmessage (httpmethod.post, Webapiurl + "/new_createdemoaccount_ua"); "Accounts (723ef58a-75bb-e511-80d9-c4346bc43f3c)/microsoft.dynamics.crm.new_createdemoaccount" CustActionReq.H Eaders. Authorization = new Authenticationheadervalue ("Bearer", auth. Acquiretoken ().            Accesstoken);            Jobject custactioncontent = new Jobject ();            Custactioncontent.add ("AccountName", "Jeff ' s Demo account"); Custactionreq.content = new Stringcontent (Jsonconvert.serializeobject (custactioncontent), Encoding.UTF8, "            Application/json "); Httpresponsemessage Custactionresp = await client.            SendAsync (Custactionreq); if (custactionresp.issuccessstatuscode) {jobject result = Jsonconvert.deserializeobject<jobj                Ect> (await CustActionResp.Content.ReadAsStringAsync ());            Console.WriteLine (result); }

isn't it easy? The small partners need to know that before we define such a custom action we have to spend Dickens, Daoteng Web service or something. Now we just need to through the UI interface can easily configure a good action, is not very happy!



Dynamics CRM 2015/2016 Web api:unbound Custom action and Bound custom action

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.