Dynamics 365 v9.0: Xrm.WebApi – CRUD Operations

Introduction

V9.0 has loads of new and exciting features. One of the most exciting improvement, at least for developers, is Xrm.WebApi. Prior to v9.0, to perform CRUD operations in Dynamics CRM, either we had to make our own library, utilize external libraries or create custom request using XmlHttpRequest and ajax. Xrm.WebApi is a cool improvement included in Dynamics 365 v9.0 which will make it easier for developers to perform CRUD operations.

Learn more about Dynamics 365 Services

Create Entity Record

To create an entity record, we can simply call Xrm.WebApi create Record using the following parameters.

  • Entity logical name
  • Entity object
This image shows Xrm.WebApi create Record

Associate Existing Entity Record

To associate new entity records to existing entity records, set the value of single-valued navigation properties using the @odata.bind annotation. The following example creates a contact record and associates it to an existing account record.

Read more: Using Microsoft Power Automate to set the Contact record Image in D365 from Twitter

Elevate your CRM Experience with Dynamics 365!

Elevate your CRM strategies and achieve better customer engagement with AlphaBOLD. Start transforming your customer interactions today.

Request a Demo
this image shows associate new entity records to existing entity records

Create Related Entity Records

In Dynamics CRM, we also need to relate records with each other. For example, any opportunity is related to any account record. When creating an account record, we need to relate another record with it. Flowing is the code to relate opportunity with account entity.

this image shows Dynamics CRM Related Entity Records

Update Entity Record

To update the record, we will create object of the entity and then set the fields and its value, that we need to update and then call Xrm.WebApi.updateRecord function to create the record in CRM. The parameters of this function are as shown below:

  1. Entity logical name
  2. Entity GUID
  3. Entity object
this image shows Xrm.WebApi.updateRecord function

Delete Entity Record

To delete record from CRM, use Xrm.WebApi.delete Record.

The parameters of this function are shown below:

  1. Entity logical name
  2. Entity GUID
this image shows delete record from CRM

Retrieve Single Entity Record

Use following syntax to retrieve single entity record:
this image shows syntax to retrieve single entity record

Retrieve Multiple Records

Use following syntax to retrieve multiple records:
this image shows syntax to retrieve multiple records

Retrieve Related Entity Record

Use following syntax to retrieve related entity record:
this image shows syntax to retrieve related entity record

Optimize your Operations with Dynamics 365 Integration!

Ready to integrate advanced CRM functionalities using Dynamics 365 v9.0? Let AlphaBOLD help you optimize your operations and enhance customer relationships through powerful integration solutions.

Request a Demo

Conclusion

Above described is the method to customize and to perform create, insert, update, delete as well as to associate operations in Dynamics CRM using V9.0 web API. Web API provides us much simpler way to perform crud apportions as compare to old OData methods.

Explore Recent Blog Posts

Infographics show the 2021 MSUS Partner Award winner

Related Posts

Receive Updates on Youtube