It is common practice in Microsoft Dynamics 365 to use Business Rules to show and hide fields on a form. But, with that addition of multi-select option sets, you can't do this. So the next logical step is to use JavaScript. There is just one small problem, there is no setVisible() function for multi-selection option sets. Here are the controls we do have access too, as of this post:
So, how can we dynamically show / hide multi select option sets? The easiest way is to use a section. Place a new section on you form. Then you will need to use JavaScript to get the tab and section by name. Once you have that, you can dynamically show / hide the section to make the multi-selection option set show and hide. Here is an example of the JavaScript:
So, how can we dynamically show / hide multi select option sets? The easiest way is to use a section. Place a new section on you form. Then you will need to use JavaScript to get the tab and section by name. Once you have that, you can dynamically show / hide the section to make the multi-selection option set show and hide. Here is an example of the JavaScript:
function ShowHide(executionContext)
{
//Create the form context
var formContext = executionContext.getFormContext();
var contactStatus = formContext.getAttribute("Field Name").getValue();
var tabObj = formContext.ui.tabs.get("Tab Name");
var sectionObj = tabObj.sections.get("Section Name");
if (contactStatus === 1)
{
sectionObj.setVisible(true);
formContext.getAttribute("fieldName").setRequiredLevel("required");
}
}

Nice idea,keep sharing your ideas with us.i hope this information's will be helpful for the new learners.
ReplyDeleteSoftware Testing Training in Chennai
software testing course in chennai
JAVA Training in Chennai
Python Training in Chennai
Big data training in chennai
Selenium Training in Chennai
Software Testing Training in Chennai
Software testing training in OMR
The article addresses a limitation in Microsoft Dynamics 365 when working with multi-select option sets. Unlike regular fields, these controls do not provide a setVisible() function for directly showing or hiding them through JavaScript. The suggested workaround is to place the multi-select option set inside a dedicated form section and use JavaScript to retrieve the parent tab and section by name, then control the section's visibility dynamically.
DeleteThis approach demonstrates how JavaScript can overcome limitations in standard form customization and improve the user experience in Dynamics 365. Developers can strengthen their practical understanding of these techniques through Javascript Online Training, especially when working with form controls, event handling, and dynamic interface behavior.
The workaround also highlights the importance of understanding the Dynamics 365 form object model when implementing custom functionality. Exploring these programming fundamentals through Javascript Online Course can help developers build interactive interfaces and handle similar customization requirements.
DeleteThank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me.
ReplyDeleteAWS Training in Chennai
Good blog with necessary information only..!
ReplyDeleteTesting Courses in Chennai
Software Testing Institute in Bangalore
Software Testing Course