Hi, I am trying to get the contact id from a selected row, like the below, how can I get that?
Hi, I am trying to get the contact id from a selected row, like the below, how can I get that?
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:
Hi, it is working fine with subgrid, what if it is the default system view in contact page?
You can refer this as well: msdn.microsoft.com/.../dn932126.aspx
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
Andre Arnaud de Cal... 283,375 Super User
Martin Dráb 223,308 Super User
nmaenpaa 101,140