Hi Guys,
Is there such a business rule where I could hide Section(s) or Tab(s) depending on fields value.
Thanks
*This post is locked for comments
Hi Guys,
Is there such a business rule where I could hide Section(s) or Tab(s) depending on fields value.
Thanks
*This post is locked for comments
I have created some Generic Method to Hide and Show Tab and Section
Please refer here : https://vjcity.blogspot.com/2021/07/generic-method-to-hide-and-show-tab-and.html
you need to add this code on form load and field option set change.
Create JavaScript function with parameter as option set value, and add logic to show / hide based on option set.
call this function on form load and pass option set value.
also call this function on option set value change so that tab/ section will be shown / hidden.
Thanks for you reply, Where would I put the field Value? I have many sections/tabs but I only want to display if field option set = required option.
Rasi, no there is not a business rule for this in CRM that i am aware of.
You could apply JS logic to hide a particular section in CRM easily depending on your fields value on the CRM form. Here is essentially a function that you can use in CRM. You can pass the sectionname, and then the visibility choice in order to show or hide your desired section.
function ViewFormSection(sectionname, visibility) {
var tabs = Xrm.Page.ui.tabs.get();
for (var i in tabs) {
var tab = tabs[i];
tab.sections.forEach(function (section, index) {
if (section.getName() == sectionname) {
section.setVisible(visibility);
}
});
}
}
Unfortunately you can not hide section tab using business rules. You need to write JavaScript for that as suggested above.
Hi Rasi,
You cannot create business rule to show or hide sections / tabs.. but you can write JavaScript to show / hide sections and tab from form.
TO show /hide tabs
formContext.ui.tabs.get("tabname").setVisible(true); //to show
formContext.ui.tabs.get("tabname").setVisible(false); //to hide
more details
docs.microsoft.com/.../formcontext-ui-tabs
and for sections
var tabObj = formContext.ui.tabs.get("tabname");
var sectionObj = tabObj.sections.get("sectionname");
sectionObj.setVisible(true); //to show
sectionObj.setVisible(false); //to hide
more details
docs.microsoft.com/.../formcontext-ui-sections
Hope this will help..
André Arnaud de Cal...
293,001
Super User 2025 Season 1
Martin Dráb
231,833
Most Valuable Professional
nmaenpaa
101,156
Moderator