How-To Series 10: How To get Selected Record Entity Name from Activities or Queue Item Entity Home Page Grid

Hi All,
           We know that we can use “SelectedEntityTypeName” to get the selected record’s “Entity Name” in a Grid. This is useful for every entity with an exception to couple of entities like “Queue Item” and “Acitivity” HomePage Grids as these will display records belongs to more than one entity. For an instance, “Activities” will display “EMail, Phonecall, Appointment etc..”. 
           So, if you want to retireve the selected record’s entity name then use the following function. The following function requires all the views in the grid to have the entity name as one of the column at the same location. It will retrieve selected record’s Id along with its entity name. Its the same way we used to do in CRM 4.0’s ISV.Config.
function ShowSelectedIdsWithEntityName()
{
var selectedrecords = document.all[‘crmGrid’].InnerGrid.SelectedRecords;
for (var i=0; i < selectedrecords.length; i++)
{
//This will return the selected record guid
alert(“Selected Record Id: “+selectedrecords [i][0]);
// This will return the 5th column data. OOB, in “Queue Item” entity “Type(Entity Name)” is the 5th column for all views.
alert(“Selected Entity Name: “+selectedrecords [i][3].cells[4].innerText);
}
}

Following is for “Queue Item” entity.
 

Hope it helps….

Cheers
Vikranth P.

Leave a Reply

Your email address will not be published.