Getting an error on the below that says, "Unable to get property 'text' of undefined or null reference at RecordTypeOnChange function RecordTypeOnChange() { var RecordType = Xrm.Page.getAttribute("nhs_recordtype").getText(); var Startup = Xrm.Page.getAttribute("nhs_startup").getText(); if (RecordType == null || RecordType =='undefined' || RecordType =='') { Xrm.Page.getControl("nhs_callcentertype").clearOptions(); } else if (RecordType != null && RecordType != 'undefined' && RecordType !='') { var RecordTypeText = Xrm.Page.getAttribute("nhs_recordtype").getSelectedOption().text; var StartupText = Xrm.Page.getAttribute("nhs_startup").getSelectedOption().text(); if (RecordType == "Medicare" && Startup == "No") { Xrm.Page.getControl("nhs_callcentertype").removeOption(127130000); Xrm.Page.getControl("nhs_callcentertype").removeOption(127130004); Xrm.Page.getControl("nhs_callcentertype").removeOption(127130005); } else if (RecordType == "Medicare" && Startup =="Yes") { Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130000, text: 'Member'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130001, text: 'Prescriber'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130002, text: 'Pharmacies'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130003, text: 'Prescrber & Pharmacy'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130004, text: 'Member & Prescriber'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130005, text: 'Member & Pharmacy'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130006, text: 'All'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130007, text: 'TBD'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130008, text: 'Pharmacy After Hours'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130009, text: 'Prescriber After Hours'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130010, text: 'Pharmacy & Prescriber After Hours'}); Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130011, text: 'All Core Business Hours'}); } } } Any help is appreciated. Thank you.
↧