CRM Crate

Understanding the getEntityMainFormDescriptor API in Dynamics 365

We will learn and understand the getEntityMainFormDescriptor client API in Dynamics 365 CRM. Before we start, make sure to subscribe to CRM Crate.

Xrm.Utility.getEntityMainFormDescriptor API in Dynamics 365

What is client API reference for model-driven apps?

A. The Client API object model also contains the Xrm.Internal namespace, and use of the objects/methods in this namespace isn’t supported. These objects, and any parts of the HTML Document Object Model (DOM), are subject to change without notice. We recommend that you don’t use these functions or any script that depends on the DOM.
B. Also, while debugging, you may find methods and objects in the Client API object model that aren’t documented. Only documented objects and methods are supported.
C. Most of the client scripting APIs available in this documentation also apply to Dynamics 365 Customer Engagement (on-premises). For a list of client scripting APIs not available for Customer Engagement (on-premises), see Client scripting reference for Dynamics 365 Customer Engagement (on-premises).

Understanding the getEntityMainFormDescriptor client API

The Xrm.Utility.getEntityMainFormDescriptor client API is used to get the details of default main form of specified entity in the form of sections and attributes / field list.

The getEntityMainFormDescriptor returns the main form descriptor for the specified table.

Syntax for using getEntityMainFormDescriptor –

Xrm.Utility.getEntityMainFormDescriptor(entityName, formId);
entityNameStringYesThe logical name of the table.
formIdStringNoThe form ID of the table.

The above promise returns the below given parameters –

Parameter NameTypeDescription
AttributesArray of stringsList of all the columns on the main form.
EntityLogicalNameStringThe logical name of the specified table.
IdstringThe form ID of the specified table.
LabelStringThe label of the specified table.
NameStringThe display name of the specified table.
SectionsStringThe sections name of the specified table.
ShowLabelBooleanIndicates whether to show the label of the specified table or not.
VisibleBooleanIndicates whether the form is visible or not.

JavaScript Code Snippet for getEntityMainFormDescriptor in Dynamics 365 CRM

We have developed a JavaScript code for retrieving the list of forms sections using getEntityMainFormDescriptor .

A. Below is the code snippet which calls the getEntityMainFormDescriptor client API to retrieve the list of sections in the form.

function CallMethod (executionContext) {

//CRM Crate JavaScript Snippet -

//Declare Form ID and Entity Schema Name.
var formId = "3d77A72F99-B266-4771-B89A-453E0CEDDD3C"; //Pass the Form ID.
var entityName = "cc_researchdevelopment"; //Pass the Entity Schema Name.

// Utilize the getEntityMainFormDescriptor client API.
Xrm.Utility.getEntityMainFormDescriptor(entityName, formId).then(function
(response) {
var entityFormSections = response.Sections;
}, function(error) {

B. The output returned from the above code snippet is observed in the debugger console as shown below.

Thus we learned to use the Xrm.Utility.getEntityMainFormDescriptor in Dynamics 365 CRM.

5 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!


Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.