logo

NJP

Hide UI Action in Header and Show Only at the Bottom

New article articles in ServiceNow Community · Jan 02, 2026 · article

I had a requirement where we needed to hide a UI Action from the top form header and display it only at the bottom of the form.

UI Action:

When a UI Action is enabled as a Form button, ServiceNow automatically renders it in both the header and the bottom sections of the form.

SKChandBasha_0-1767335127850.png

Client Script:

function onLoad() { //Type appropriate comment here, and begin script below g_form.addInfoMessage("TEST1"); /* This line selects the UI Action button with the data-action-name value test from the form’s HTML using ServiceNow’s jQuery ($j) */ var ans = $j('[data-action-name="test"]')[0].hide(); g_form.addInfoMessage("Answer: " + ans); }

Disable Isolate Script:

Turn off script isolation (set Isolate Script = false) so the client script can interact with the form’s DOM elements.

What happens when made true?

When Isolate script = true, ServiceNow:

  • Runs the script in a sandboxed scope
  • Prevents access to:
    • Global objects
    • DOM
    • window
    • $j / jQuery
  • Allows only safe APIs like:
    • g_form
    • g_user
    • GlideAjax

SKChandBasha_1-1767335635921.png

UI Action on the Target:

SKChandBasha_2-1767335670231.png

Result:

SKChandBasha_3-1767335723763.png

Happy Learning!!

View original source

https://www.servicenow.com/community/common-service-data-model/hide-ui-action-in-header-and-show-only-at-the-bottom/ta-p/3459060