function ChangeSubgridView(executionContext) {
var gridViews = [
{
entityType: 1039,
id: /B0B152E7-3154-4BEE-AC20-DB526501E1B4/,
name: /Active Assessed Standards/
},
{
entityType: 1039,
name: /Active Assessed Standards (For Formulation Line)/
}
]
var formContext = executionContext.getFormContext();// get the form Context
var gridContext = formContext.getControl('AssessedStandards'); //Get the Grid
var viewSelector = gridContext.getViewSelector();
console.log(viewSelector.getCurrentView());
if(formContext.getAttribute('bg_productasingredient') != null){
var isProduct = formContext.getAttribute('bg_productasingredient').getValue();// get the value of productasIngredient
console.log(isProduct)
if (isProduct) {
console.log('equates to true, should change view')
viewSelector.setCurrentView(gridViews[0]); //Set View to show assessed ingredients column
console.log(viewSelector.getCurrentView())
} else {
console.log('equates to false, should not change view')
viewSelector.setCurrentView(gridViews[1]);//Show default view
console.log(viewSelector.getCurrentView())
}
}else{
viewSelector.setCurrentView(gridViews[1]);//if null value show default view.
}
}