Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

UI Action Visibility Issue: Hide button in CMDB WS while keeping it visible in Asset WS

MatteoMian0
Mega Contributor

I am facing an issue managing UI Action visibility when a user navigates between different Workspaces (Asset Workspace and CMDB Workspace). I need to find a way to dynamically hide the action based on the active Workspace.

  1. Environment Context
    Table: Configuration Item [cmdb_ci]
    Configuration: Client checkbox selected
    Goal: The UI Action is displayed in the Asset Workspace. Upon clicking, it should open the current record within the CMDB Workspace. Once the record is opened in the CMDB Workspace, the button must disappear to prevent the user from opening the same page repeatedly.

  2. Problem Description
    The UI Action remains visible even in the CMDB Workspace. Consequently, if the user clicks the button again from the new tab, the system opens another identical tab.

  3. Current UI Action Condition
gs.hasRole("sn_cmdb_user") && (RP.getReferringURL() != null && RP.getReferringURL().indexOf('/now/cmdb/') == -1)
  • Script Client Side
function onClick(g_form) {
 var sys_id = g_form.getUniqueValue();
 var table = g_form.getTableName();

 var url = "/now/cmdb/record/" + table + "/" + sys_id;
 top.window.open(url, "_blank");
}​

 

1 REPLY 1

Ankur Bawiskar
Tera Patron

@MatteoMian0 

did you try to use action exclusion and try to remove it from CMDB workspace?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader