I have been trying to do this for a while and used a lot of templates of codes that supposedly would hide tabs and sections on my form.
My form has two fields (aag_dateinternallyapproved and aag_datejobsopenforrecruitment) that need to be filled and after these fields are filled, CRM needs to show a tab/section. This is my code:
function hideShow() {
var DateApproved = Xrm.Page.getAttribute("aag_dateinternallyapproved").getValue();
var DateJob = Xrm.Page.getAttribute("aag_datejobsopenforrecruitment").getValue();
if (DateApproved == null) && (DateJob == null) {
Xrm.Page.ui.tabs.get("Tab_Reservation").sections.get("Section_Reservation").setVisible(false);
Xrm.Page.ui.tabs.get("Tab_Reservation").setVisible(false);
}
else {
Xrm.Page.ui.tabs.get("Tab_Reservation").sections.get("Section_Reservation").setVisible(true);
Xrm.Page.ui.tabs.get("Tab_Reservation").setVisible(true);
}
Below I have the form setting and I have also setup the script to run OnChange on the fields I have on the form.
Is there something I am doing wrong?