Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.



411 University St, Seattle, USA


+1 -800-456-478-23

Dynamics 365
Retrieving View Name in Dynamics 365

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.id, viewEntity.columnSet) 

    .then(function (result) { 

        var viewName = result.name; 

        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. 

Anas Arshad
Anas Arshad
Software Engineer II at Imperium Dynamics | + posts


Abdul Wasay

Leave a comment

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