Disable a Relationship Tab

I added a relationship to Part Item Type and I tried to disable the relationship tab in certain condition( the condition is not added to the code yet) . Relationship name ="a_Cost Data", label =" Cost Data", I am not sure which one I should use for GetTsbId(?) , tried both of them, neither works, the Cost Data tab is still enable.

The action of the method is added to the Part Form Event , Event = onLoad

Please advice

Thanks

if (parent.relationships.relTabbar !==null){
clearInterval(interval);
disableTab();
}


function disableTab()
{
var showTab = false;
var tabbar = parent.relationships.relTabbar;

var tabID =tabbar.GetTsbID(" a_Cost Data");
//var tabID =tabbar.GetTsbID("Cost Data");
if (!tabID){
aras.AlertError("Cannot access Tab")
}
else {
tabbar.setTabEnabled(tabid,showTab);
}
return;
}

Also I like to know if there is any documentation for all the Form related functions and use cases,  I  couldn't find at ARAS Programming Guide  or ARAS API references 

Parents
  • Hi QuietClounds

    You can use below code to hide and show tabs.

    In this code, I'm trying to hide the Goals tab in Part item type when classification = Assembly else show Goals tab.

    Input : Tab Label

    Event : Form OnPopulated in Part Form

    //debugger;
    var tabname = "Goals"; //label of the tab
    var showTab = true;
    var classification = aras.getItemProperty(parent.item, "classification"); //Property based on hide and show tab should toggle
    if(classification == "Assembly")
    {
    showTab = false;
    }

    hideTabs = function () {
    if (!isTabloaded()) {
    setTimeout(hideTabs, 200);
    return;
    }
    var tabbar = parent.relationships.relTabbar;
    var tabID = tabbar.GetTabId(tabname);
    tabbar.SetTabVisible(tabID, showTab);
    };
    var isTabloaded = function () {
    if (parent.relationships === undefined)
    return false;
    var isloaded = Boolean(!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") !== "");
    return isloaded;
    };
    setTimeout(hideTabs, 200);

Reply
  • Hi QuietClounds

    You can use below code to hide and show tabs.

    In this code, I'm trying to hide the Goals tab in Part item type when classification = Assembly else show Goals tab.

    Input : Tab Label

    Event : Form OnPopulated in Part Form

    //debugger;
    var tabname = "Goals"; //label of the tab
    var showTab = true;
    var classification = aras.getItemProperty(parent.item, "classification"); //Property based on hide and show tab should toggle
    if(classification == "Assembly")
    {
    showTab = false;
    }

    hideTabs = function () {
    if (!isTabloaded()) {
    setTimeout(hideTabs, 200);
    return;
    }
    var tabbar = parent.relationships.relTabbar;
    var tabID = tabbar.GetTabId(tabname);
    tabbar.SetTabVisible(tabID, showTab);
    };
    var isTabloaded = function () {
    if (parent.relationships === undefined)
    return false;
    var isloaded = Boolean(!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") !== "");
    return isloaded;
    };
    setTimeout(hideTabs, 200);

Children