Can anyone help please ?
I have search other similar queries but still cannot get a working answer.
On a Form there is a field (Form Type) which has 2 choices. I want to show/hide tabs (Tab_3, Tab_4 and Tab_5) depending on the option selected - hide all three or show all three. The original script was hoping to OnLoad (of the form) hide all three tab, and then OnChange of the field show or hide depending on the option.
Whatever I have tried I get the error "Cannot read properties of undefined (reading 'getFormContext') - I have tried changing so may parts of the script - cutting it right down to just OnChange and just one Tab - still not working.
This is the code as it is now
function ToggleTab(executionContext) {
var formContext = executionContext.getFormContext();
var tabvalue = formContext.getAttribute("crm365_formtype").getValue();
formContext.ui.tabs.get("tab_5").setVisible(false);
formContext.ui.tabs.get("tab_3").setVisible(false);
formContext.ui.tabs.get("tab_4").setVisible(false);
if (tabvalue == 154220000)
formContext.ui.tabs.get("tab_5").setVisible(true);
formContext.ui.tabs.get("tab_3").setVisible(true);
formContext.ui.tabs.get("tab_4").setVisible(true);
if (tabvalue == 154220001)
formContext.ui.tabs.get("tab_5").setVisible(false);
formContext.ui.tabs.get("tab_3").setVisible(false);
formContext.ui.tabs.get("tab_4").setVisible(false);
}