Notifications
Announcements
No record found.
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 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
docs.microsoft.com/.../formcontext-ui-sections
Hope this will help..
Unfortunately you can not hide section tab using business rules. You need to write JavaScript for that as suggested above.
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);
}
});
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.
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.
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
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2