Hi Amy,
Something like this should work
if (Xrm.Page.data.entity.attributes.get("optionsetattributename").getValue() == "your option value")
{
Xrm.Page.ui.tabs.get("yourtabname").sections.get("your section name").setVisible(true);
}
Remember to wire this up in both page load and optionset on change.
The logic is correct, but for optionset the method getValue returns an int, for the text value it is necessary to use getText, also the else condition is missing.
Something like this:
var section = Xrm.Page.ui.tabs.get("yourtabname").sections.get("yoursectionname");
if (Xrm.Page.data.entity.attributes.get("optionsetattributename").getText() == "your option text")
{
section.setVisible(true);
}
else {
section.setVisible(false);
}
My blog: www.crmanswers.net -
Rockstar 365 Profile