Dynamics 365 v9.0: Xrm.WebApi – Operations Part – 2

By | February 5, 2018


In our previous blog, we have discussed about performing CURD operations Create, Update, Delete and Retrieve using Xrm.WebApi. In this blog, we will discuss Retrieve Multiple and Execute Actions.

Let’s explore about these operations one by one.

1. Retrieve Multiple: 

Retrieve multiple is used to retrieve more than one record from MS CRM. Suppose we want to retrieve all active contact from CRM then we will use the Retrieve multiple.

If we want to retrieve multiple records then use Xrm.WebApi.retrieveMultipleRecords

The parameters of this function are shown below.

  1. Entity logical name
  2. Odata Query (i.e. select and filter)
In retrieveContactSucess function loop through the records and get the values as shown below.
If you have more than 5000 records than used data.nextLink. And if the response has value data.nextLink then used it to retrieve next set of records.

2. Execute Action: 

There are predefined Actions defined in Dynamics CRM 2016 that can be executed using Web API. On the following link will find the list of Web API actions. https://msdn.microsoft.com/en-in/library/mt607829.aspx

There are three types of Action as listed below.

Unbound actions: It is not bound to any specific entity. i.e the first parameter to such actions does not include the entity. E.g. WinOpportunity, CancelContract etc

Bound actions: It is bound to a specific entity. i.e the first parameter to such actions does not include the entity. e.g. – AddToQueue Action

Custom action: It is custom actions developed by developers using Processes.

Now we will discuss about Qualify request. Suppose you want to qualify request programmatically then we will use Qualify request. Web API provides QualifyLead Action.

In our blog, we have explained QualifyLead using WebApi. Now we will see how we can do the same using inbuilt Xrm.WebApi.

To execute action use Xrm.WebApi.execute.


Using Xrm.WebApi in Dynamics 365 v9.0, it is easy to perform CURD operation without performing AJAX request or creating own library or using third party libraries.

Easily Export and Email Dynamics 365 Reports in PDF, Word, or Excel

Leave a Reply