Perform a Dynamics 365 action (action) instance through the Web API in the browser without using a tool

Source: Internet
Author: User
Tags microsoft dynamics

Abstract: I and the public number: Microsoft Dynamics CRM experts in Rayong, reply 262 or 20170727 can be easily accessible this article, but also in the first to get my latest post information, follow me! My website is www.luoyong.me.

My previous article using the Fiddler Modify request information to perform a Dynamics 365 action (action) instance through the Web API with the help of the Fiddler tool, you might ask, can I only have a browser if I don't have a tool? This is what this article is going to tell you.

We know that the General browser press F12 will come out developer tools, we use chrome as an example to explain, or the same as the previous blog, do the same thing.

Please select the Developer tool Console this tab, in order to facilitate the input code, please clear this tab of the things, then I enter the following JavaScript code:

varClienturl =Xrm.Page.context.getClientUrl ();varreq =NewXMLHttpRequest () Req.open ("POST", encodeURI (Clienturl + "/api/data/v8.2/workflows (6BEBC426-F722-4B64-AE5D-0DA379F8A8C4)/ Microsoft.Dynamics.CRM.ExecuteWorkflow "),true); Req.setrequestheader ("Accept", "Application/json"); Req.setrequestheader ("Content-type", "Application/json; Charset=utf-8 "); Req.setrequestheader ("Odata-maxversion", "4.0"); Req.setrequestheader ("Odata-version", "4.0"); Req.onreadystatechange=function () {  if( This. readyState = = 4/* Complete*/) {Req.onreadystatechange=NULL; if( This. Status = = 200) {Xrm.Utility.alertDialog ("Successful Execution!"); Console.log ( This. responsetext); }        Else{Xrm.Utility.alertDialog ("Execution error. "); Console.log ( This. responsetext); }     }  };varRequestmsg ={};requestmsg.entityid= "B907de1b-cf99-e611-8161-000d3a80c8b8"; Req.send (Json.stringify (requestmsg));

Press ENTER after the loss, and soon the code execution is complete prompt me to succeed:

After I click OK, the code will get the returned content written to the console (console) as follows:

This is not a bit more technical work, need you will write JavaScript code, which brings the benefits I will not say, believe that smart friends can guess.

Perform a Dynamics 365 action (action) instance through the Web API in the browser without using a tool

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.