Hello all,
I've been searching for a way to accomplish this and have not found a good solution. It seems that someone out there might have tried to do something similar in the past...
Situation:
- I have a model-driven view (grid) that contains the Primary Contact's Email.
- I have a custom page that has a field to hold all of the emails of the records selected in the grid.
- I am successfully loading the grid to a panel on the right and passing the selected items from the grid to page, but the only item passed is the recordId of the account.
- Microsoft documentation states that if we are trying to get the GridContext of the model-driven app to be available to the custom page we are to add the parameter "SelectedControl" to the Command button that displays the custom page.
- I'm also passing the parameter "SelectedControlsSelectedItemReferences", which returns the Id, Name, TypeName, and TypeCode for each selected row in the grid.
Issue:
I cannot figure out how to access the grid column that contains the Primary Contact's email address for the selected rows.
It seems as though I should be able to do something like this:
function OpenSendEmail(selectedControl,selectedItems,selectedItemCount) {
var gridContext = selectedControl;
var selectedEmail = gridContext.getAttribute('emailaddress1');
// display side pane
if (selectedItems) {
var paneInput = {
title: "Send Email",
paneId: "SendEmail",
canClose: false,
width: 600
};
var navigationOptions = {
pageType: "custom",
name: "vc_sendemail_aed9d",
entityName: selectedControl._entityName
};
};
Xrm.App.sidePanes.createPane(paneInput).then((pane) => {
pane.navigate(navigationOptions)
});
console.log(selectedControl);
console.log(selectedItems);
console.log(selectedEmail);
console.log(selectedItemCount);
console.log(navigationOptions);
}
But the third line, throws an error stating that gridContext.getAttribute is not a function. With that, how do I grab the value contained in the 'emailaddress1' column of each selected row?