Hi all,
I'm looking for a better way to complete Hide/Show of sections based on a selection in a pick list. Here is the code that I am currently working with.
The logic is, if "Blues_Topic" = 552190000 then show a section, if not hide the section.
function hideOrShowDispSup() {
var AA = Xrm.Page.getAttribute("blues_topic").getValue();
if (AA == 552190000) {
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_RiskBased_Part1").setVisible(true);
} else {
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_RiskBased_Part1").setVisible(false);
}
}
I have a 6 choice options in the Blues_topic and 2 sections for each option. I looking to name the section based on the selection. Rather than a suite of If, Then, statements, I would like to perhaps use the variable in this format
function hideOrShowDispSup() {
var AA = Xrm.Page.getAttribute("blues_topic").getValue();
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_552190000_SecA").setVisible(false);
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_552190000_SecB").setVisible(false);
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_552190001_SecA").setVisible(false);
Xrm.Page.ui.tabs.get("TopicDetail").sections.get("Top_552190001_SecB").setVisible(false);
Xrm.Page.ui.tabs.get("TopicDetail").sections.get(AA+"_SecA").setVisible(true);
Xrm.Page.ui.tabs.get("TopicDetail").sections.get(AA+"_SecB").setVisible(true);
}
}
The logic is variable AA is set to the choice value.
Set all sections not visible.
then
set the sections AA_1 and AA_2 as visible
If the selection was 552190000
AA = 552190000
Section 552190000_SecA and 552190000_B would be visible.