web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to get Entity Name or ID from Entity View in MS Dynamics CRM ?

(0) ShareShare
ReportReport
Posted on by

Hi,

I want to get Entity Name from View of Entity in MS Dynamics CRM.

Here I am getting entity name by Xrm.Page.data.entity.getEntityName(); But it gives an error.

64285.Untitled.png

Can anyone suggest how to get Entity Name or Entity ID?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    u seem to be non responsive after u get the answers.

    1)When ur questions are answered and if it solves ur issue make sure to verify the answer...if the answers provided doesn’t work atleast say so..

    2) before posting questions do check whether there are similar questions in forum.

  • Suggested answer
    VermaNitin Profile Picture
    455 on at

    Hi

    You won't get Xrm.Page here as it is available on form.

    If you have registered your script on ribbon button then you may pass the primary entity name as a crm parameter to your function using Ribbon Workbench.

    Hope it helps!

    Many thanks,

    Nitin Verma

  • Community Member Profile Picture
    on at

    Thanks Nitin!

    I want to get CRM Entity name on onLoad of view page of CRM.  Please look at give screenshot.

    Suppose I clicked on Sales -> Account

    It shows default view of Account and I want to get Entity Name here.

    Can you please suggest me?

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Chhaya,

    As Nitin suggestion, this can be implemented by using JavaScript, but you will need to do this by adding a script library to your home page. In order to do this, you would need Ribbon Workbench to either create your own button, or customize an existing button and provide your JavaScript library as a reference, so that it is loaded when the home page view is loaded.

    You should be able to customize your script library to get an onload event there.

  • Nithya Gopinath Profile Picture
    17,078 on at

    Hi Chhaya,

    Why do you need to get the entity name of the view? Please explain the scenario.

  • Jharana Baliyar Singh Profile Picture
    2,667 on at

    Hi All,

    Even i want to know how we can get entity name from view areas ?

    But here Xrm.Page will not work.Is there any way so we can get atleast attribute name from view name using javascript ?

    Thanks,

    Jharana

  • Suggested answer
    Oleksandr Domin Profile Picture
    16 on at

    Hi Chhaya,

    I'll slightly extend Nitin Verma's reply.

    You can either have a Home Page context or a Form context.

    Depends on the invocation location you can pass SelectedControl (would work on Home Page) and PrimaryControl (would work on the Form) into JS and in the script there should be two arguments in the function like OnLoad(formContext, homePageContext).

    When the function will be called out, one of two arguments would not be null so you would need to validate it and use not null one further.

    Some useful details are there in ms docs.

    Regards,

    Oleksandr

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans