Dynamics 365 July 2017 Update New Web Api – Online and Offline

Dynamics 365 July 2017 Update New Web Api – Online and Offline

With the release of Dynamics 365 July 2017 Update, Web Api functionality can be performed by calling the functions and properties of the Xrm.WebApi class. The WebApi methods are available for both online and offline access (with offline access being available to mobile clients working offline). The base methods that are available for using the Xrm.WebApi include the following: createRecord, deleteRecord, retrieveRecords, retrieveMultipleRecords, updateRecord, execute and executeMultiple.

This blog post will explain the differences between the Online and Offline WebApi properties, and how each property affects the functions that can be called.

The Xrm.WebApi.online property provides the WebApi methods that can be executed when the client is connected to the Dynamics 365 Online server. To establish an online connection object we call the following function:

var onlineWebApi = Xrm.WebApi.online;

The online WebApi object provides access to the following methods:

Xrm.WebApi.createRecord

Xrm.WebApi.deleteRecord

Xrm.WebApi.retrieveRecord

Xrm.WebApi.retrieveMultipleRecords

Xrm.WebApi.updateRecord

Xrm.WebApi.execute

Xrm.WebApi.executeMultiple

The Xrm.WebApi.offline property provides the WebApi methods that can be executed when the client is not connected to the Dynamics 365 Online server. To establish an offline connection object we call the following function:

var offlineWebApi = Xrm.WebApi.offline;

The offline WebApi object provides access to the following methods:

Xrm.WebApi.createRecord

Xrm.WebApi.deleteRecord

Xrm.WebApi.retrieveRecord

Xrm.WebApi.retrieveMultipleRecords

Xrm.WebApi.updateRecord

Xrm.WebApi.isAvailableOffline

* Note that when records are created in offline mode, only basic validation is performed on the data that is being input.