Posts

Showing posts from April, 2020

Dynamics 365: Call global action with input and output parameters through JavaScript using XMLHttpRequest

Image
1. I have created below action in dynamics 365. 2. new_CreatePerson action will create a new record for custom entity. 3. 4. Below is the JavaScript code to call the action. var   firstName ; var   lastName ; function   CreatePerson () {      debugger ;      firstName  =  document . getElementById ( "firstName" ). value ;      lastName  =  document . getElementById ( "lasttName" ). value ;      var   data  =     {          "new_name" :   firstName  +  " "  +  lastName ,          "new_firstname" :   document . getElementById ( "firstName" ). value ,          "new_lastname" :   document . getElementById ( "lasttName" ). value     }      debugger ;      var   req  =  new   XMLHttpRequest ();      req . open ( "POST" ,  Xrm . Page . context . getClientUrl () +  "/api/data/v9.1/new_CreatePerson" ,  true );      req . setRequestHeader ( "O