Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Banner call button icon

harry24
Tera Contributor

where is the configuration of call button which is present on banner of servicenow ? Can we hide it depending on the workspace ? 

3 REPLIES 3

Yashsvi
Kilo Sage

Hi @harry24,

please check below link:

https://www.servicenow.com/community/grc-forum/creating-a-list-banner-button-ui-action-that-calls-sc...

Thank you, please make helpful if you accept the solution. 

harry24
Tera Contributor

this is not what i need 

If you have different workspaces and you want to hide the button based on the workspace, you can use a script like this:

(function() {
    var workspace = g_scratchpad.workspace || ''; // Assume g_scratchpad.workspace holds the current workspace value
    return workspace !== 'desired_workspace'; // Replace 'desired_workspace' with the workspace where you want to show the button
})();

If the condition cannot be managed directly in the UI Action, you might need to use a Client Script.

function onLoad() {
    var workspace = g_scratchpad.workspace || ''; // Assume g_scratchpad.workspace holds the current workspace value
    if (workspace !== 'desired_workspace') { // Replace 'desired_workspace' with the workspace where you want to show the button
        var callButton = g_form.getControl('call_button_name'); // Replace 'call_button_name' with the actual button name or ID
        if (callButton) {
            callButton.style.display = 'none';
        }
    }
}

Thank you, please make helpful if you accept the solution.