Execute the Global Action Using Web API in Dynamics CRM

By | October 10, 2016


We have already discussed how to perform entity specific custom action using Web API in one of our earlier blog. But when we want an action to be performed on multiple entities, we need to create a global action.

Create global action:-

  1. Go to Settings → Processes → Click New then select category as “Action” and entity as “None(global)” as shown in below screenshot.Create global action
  2. Create the input argument (i.e InputParameter) and output argument (i.e. OutputParameter) as per below screenshot. Save and Activate the action. Create the input argument

Execute Global Action using Web API:-

Execute the created global action using Web API.
//get the current organization name
var serverURL = Xrm.Page.context.getClientUrl();
//query to send the request to the global Action 
var query=”new_GlobalAction”;
//set the current loggedin userid in to _inputParameter of the 
//Pass the input parameters of action
var data = {
"InputParameter": _ InputParameter
//Create the HttpRequestObject to send WEB API Request 
var req = new XMLHttpRequest(); 
//Post the WEB API Request 
req.open("POST", serverURL + "/api/data/v8.0/”+query+", 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) { 
//You can get the output parameter of the action with name as given below
result = JSON.parse(this.response);
} else { 
var error = JSON.parse(this.response).error; 
//Execute request passing the input parameter of the action 


To execute the global action you only need to pass Action Name “new_GlobalAction” shown in the above code

req.open(“POST”, serverURL + “/api/data/v8.0/”+query+”, true);

But to perform entity specific custom action you need to pass the EntityName and Primary id of record as

“account(” + Xrm.Page.data.entity.getId() + “)/Microsoft.Dynamics.CRM.new_EntityAction ”.


Using the above code, global action can be performed. You can perform this action on multiple entities using Web API.

Free 70% of storage space in CRM with Attachment Management Apps!

Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.