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

4 thoughts on “Dynamics 365 v9.0: Xrm.WebApi – Operations Part – 2

  1. vissu.ndd@gmail.com'Vissu

    Not working through Unified Interface. getting error : Web Api failure in Dynamics CRM.
    but working fine in normal interface.
    Please suggest.


    1. Inogic Post author

      Please check If you get the Xrm object in UCI or not. If not then try with the parent.Xrm in UCI.


  2. viswamithra.m@gmail.com'Viswa

    Hi Inogic,

    I’m a good follower of your blogs. Thanks for your help for MS Buddies!!!

    Problem Statement:
    Recently I faced issue like, as part of Migration of Java Script. I have used the code which u have mentioned in the blog for “retrieveMultipleAccounts” in which u have mentioned “.fail(function (error) ” when Microsoft team has seen “.fail” method they have blasted us for using that syntax.

    As the syntax which u have given in this blog is working fine so we have used that syntax.
    Can u please tell us why we should not go with the “.fail” which you have mentioned? and this “.fail” is not using in the Microsoft blogs.

    will be waiting for your reply..!!!

    Thanks & Regards

    1. Inogic Post author


      As we have used promise so we used .fail but it should not be there, we have changed the blog.



Leave a Reply

Your email address will not be published. Required fields are marked *