Retrieving View Name in Dynamics 365 with Xrm.RetrieveRecord

| Editorial Team

In Microsoft Dynamics 365, views are crucial in organizing and presenting data to users. Sometimes, while working with client-side code, you may need to retrieve the name of a specific view for further processing. This blog post will explore how to obtain the view name using the Xrm.RetrieveRecord method in JavaScript.


To follow along, you should have a basic understanding of JavaScript and be familiar with Microsoft Dynamics 365 development concepts.

Step 1: Identify the View GUID and Entity Logical Name

Before retrieving the view name, you must determine the unique identifier (GUID) of the view you want to work with. Additionally, note down the logical name of the entity associated with the view.

Step 2: Accessing the View Name with Xrm.RetrieveRecord

The Xrm.RetrieveRecord method allows us to retrieve data related to a specific record or entity. In our case, we will use this method to fetch the view name.

var viewId = “{View GUID}”; // Replace {View GUID} with the actual GUID of the view

var entityName = “{Entity Logical Name}”; // Replace {Entity Logical Name} with the logical name of the entity

var viewEntity = {

entityType: “savedquery”,

id: viewId,

columnSet: [“name”]


Xrm.WebApi.retrieveRecord(viewEntity.entityType,, viewEntity.columnSet)

.then(function (result) {

var viewName =;

console.log(“View Name: ” + viewName);


.fail(function (error) {

console.log(“Error retrieving view: ” + error.message);


In the code snippet above, replace {View GUID} with the actual GUID of the view and {Entity Logical Name} with the entity’s logical name.

We create a viewEntity object that defines the entity type (savedquery for system views, userquery for personal/shared views), the view ID, and the columnSet array specifying the columns we want to retrieve. In this case, we only need the view name to include “name” in the columnSet.

Using the Xrm.WebApi.retrieveRecord method, we pass the entity type, view ID, and columnSet as parameters to retrieve the view record. The method returns a promise, and we handle the response in the success callback function.

In the success callback, we extract the view name from the result object and log it to the console.


Retrieving the view name using Xrm.RetrieveRecord in Dynamics 365 can be accomplished with just a few lines of JavaScript code by leveraging the Xrm.WebApi.retrieveRecord method and specifying the necessary entity type, view ID, and desired columns, you can quickly obtain the view name for further processing or display purposes in your Dynamics 365 customizations.

Remember to replace the placeholders with the actual view GUID and entity logical name to retrieve the view name in your specific scenario successfully.

Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.

More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting