Announcements
No record found.
Hi, I am trying to get the contact id from a selected row, like the below, how can I get that?
*This post is locked for comments
Hi sdnd,
Please refer this below snippet:
var selectedRows = Xrm.Page.getControl("States").getGrid().getSelectedRows();
selectedRows.forEach(function (selectedRow, i) {
var s = selectedRow.getData().getEntity().getEntityReference();
var selectedRowGuid=s.id;
var selectedRowName=s.name;
var selectedRowEntityName=s.entityType;
});
The above code snippets returns collection of selected rows and by iterating the collection we can retrieve the properties like
· id - Here id is nothing but Guid of record
· name - Here name will return the value in name fields
· entityType - This will return the logical name entity which is displaying as SubGrid
Thank you.
You can refer this as well: msdn.microsoft.com/.../dn932126.aspx
Hi, it is working fine with subgrid, what if it is the default system view in contact page?
Assuming you are referring Home page then it will be a different way, you can have a ribbon button, which can read record from the selected record, you need to use CrmParameter (msdn.microsoft.com/.../gg309332.aspx), and if you want sample code check this one step by step:
crmhub.blogspot.com/.../how-to-get-selected-records-guid-from-home-page-entity-view-using-Java-Script-MS-Dynamic-CRM.html
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.