I have the following JavaScript to show/hide sections in a tab based on the option set selection and I'm getting three errors when loading the form and when trying to change the option set selection. Can anyone please help me determine where I'm going wrong? I have applied the event as an On Change to the option set field.
Thank you very much
function HideOrShowSectionBasedOnoptionSetValue(){
var value = Xrm.Page.getAttribute("new_testrequesttype").getValue();
if(value!=null){
if(value == 100000000){
Xrm.Page.ui.tabs.get("Test Request").sections.get("Lab Test Request").setVisible(true); //Shows section 1
Xrm.Page.ui.tabs.get("Test Request").sections.get("Application Test Request").setVisible(false); //Hides section 2
}
else if(value == 100000001){
Xrm.Page.ui.tabs.get("Test Request").sections.get("Lab Test Request").setVisible(false); //Hides section 1
Xrm.Page.ui.tabs.get("Test Request").sections.get("Application Test Request").setVisible(true); //Shows section 2
}
On form load:
Error 1:
One of the scripts for this record has caused an error. For more details, download the log file.
ReferenceError: 'ShowHideTestTabs' is not defined at eval code (eval code:1:1)
Error 2:
One of the scripts for this record has caused an error. For more details, download the log file.
TypeError: Unable to get property 'Initialize' of undefined or null reference at eval code (eval code:1:1)
When the option set selection is changed:
Error 3:
One of the scripts for this record has caused an error. For more details, download the log file.
SyntaxError: Expected ';' at RunHandlerInternal
*This post is locked for comments