Hi experts,
I'm using below function on onload to set view of subgrid
But I'm getting this error : cannot read property 'getViewSelector' of null .
In view selector I already select all view.
Dynamics Version 9.1 online
function SetSubGridBasedOnCountry(executionContext) {
var ContactsIFollow = {
entityType: 1039, // SavedQuery
id: "*******************",
name: "uk form"
}
// Get the gridContext
var formContext = executionContext.getFormContext();
var gridContext = formContext.getControl("orderlineIteam");
// Set the view using ContactsIFollow
if (gridContext == null) {
setTimeout(function() {
SetSubGridBasedOnCountry(executionContext);
}, 2000);
return;
} else {
debugger;
gridContext.getViewSelector().setCurrentView(ContactsIFollow);
}
}
Kindly help to fix this or with some other workaround to set subgrid dynamically.