I have been working on the following javascript for awhile now and keep getting error that function is undefined. I can not see where my code is incorrect. Any assistance would be greatly appreciated. I am trying to show/hide a field and set the requirement leve based on the value in an option set.
function onClientReportingReportTypeChange() { var reportType = Xrm.Page.getAttribute("new_reporttype").getText(); if (reportType == "Standard") { Xrm.Page.getAttribute("nhs_reportname").setRequiredLevel("none") Xrm.Page.getAttribute("nhs_reportname").setVisible(false) } else if (reportType == "Custom") { Xrm.Page.getAttribute("nhs_reportname").setRequiredLevel("required") Xrm.Page.getAttribute("nhs_reportname").setVisible(true) } }