How to hide tabs based on field value

Forum Post: Change the Filter On option on Opportunity Associated View for Account form

I have this code created but want to add to it for if the same field is another value, show another tab. How do I add conditions to what I already have? 

function Industry() {
//show Construction tab if the Account Type = Construction and the Sub Type = Public
var AccountTypeValue = Xrm.Page.getAttribute(“accountypecode”).getValue();
var SubTypeValue = Xrm.Page.getAttribute(“grey_subtype”).getValue();

var industrytab = Xrm.Page.ui.tabs.get(“IndustryTab”);

if (SubTypeValue != null && SubTypeValue == 3) {

//show the section
else {
//hide the section

this code works but I need another condition where if account type = public sector show a public sector tab. I know it’s the same script but how do I include this script within the existing script. Anything I try gives me an error as it is outside the function

Source link

Leave a reply

Please enter your comment!
Please enter your name here