How to dynamically hide a Tab in an IM task
search cancel

How to dynamically hide a Tab in an IM task

book

Article ID: 257598

calendar_today

Updated On:

Products

CA Identity Manager CA Identity Suite

Issue/Introduction

How to dynamically hide a Tab in an IM task

Environment

All Identity Manager

Resolution

Please review the "Sample Javascript for Tab Controllers" section of the following doc page which:

https://techdocs.broadcom.com/us/en/symantec-security-software/identity-security/identity-manager/14-4/configuring/user-console-design/task-navigation/task-flow/configure-a-tab-sequence.html

If you review the \IAM Suite\Identity Manager\tools\samples\WizardSequencerScripts\readme.txt and look at the WizrdSample.js it is a simple sample of script that can be used in Tab Display JavaScript for Wizard Tab Controller or Standard Tab controller. It hides the second tab.

This JavaScript must contain a function with the signature "function displayTab(TabControllerContext, tabIndex)" and return true if the tab with the specified index should be displayed, false if the tab should be hidden. TabControllerContext provides access to an array of tabs for the task and tabIndex is an int index for a particular tab.

//This is a simple sample of Tab Display JavaScript.
//It hides the second tab.
function displayTab(ctx, tab) {
  // hide the second tab, display the others
  if (tab == 1) {
     return false;
  }
  return true;
}

This is the same sample provided but it now showing getting the current value of a user's attribute and uses that value in the conditional on whether to execute the hiding of a tab.= since the TabControllerContext ctx inherits methods from the BLTHContext such as getUser per the java doc. 

//This is a simple sample of Tab Display JavaScript.
//It hides the second tab.
function displayTab(ctx, tab) {

var userAttr = ctx.getUser().getAttribute("imAttributeFoo");

    if (userAttr == "my_value") {
        // hide the second tab, display the others
        if (tab == 1) {
            return false;
        }
    }
    return true;
}

In the example the TabControllerContext ctx inherits methods from the BLTHContext as seen with the usage of the getUser method.

You can download the im_javadoc.zip from the following link and review what methods are available with the TabControllerContext and BLTHContext to see what you further you can do.

https://techdocs.broadcom.com/us/en/symantec-security-software/identity-security/identity-manager/14-4/programming/ca-identity-manager-programming-reference.html