- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 12:09 PM
I've been asked to hide a UI action button on a form until a user makes a selection on a particular drop-down field. In my case, I'm working in a global application called 'ticket', which is an extension of the task table. Tickets are created by end-users and fielded by the help desk, which reviews them and transfers them to the appropriate type of record (incident, RITM, problem, etc.) and assigns them to the appropriate group.
The bug right now is that the transfer button can be clicked before the help desk worker actually decides what kind of record to transfer the ticket to. I know how to restrict the button on the UI action record itself by adding a condition to the button. However, this only works 'onLoad'. So this method would require the help desk worker to take three actions:
- Select the type of record to transfer to in the drop-down
- Save the form
- Click the 'transfer' button which is now visible after re-loading the form
I'm hoping that there is a way for them to avoid clicking the save button and re-loading the form, so basically utilizing an onChange script or UI Policy. However, in searching the community, all of the solutions involve DOM manipulation, which is not considered best practice.
Additionally, I've tried the method found here:
https://community.servicenow.com/community?id=community_question&sys_id=2cf54361db1cdbc01dcaf3231f96...
But I'm running into the same error reported with the jquery method not being a function.
Does anyone know if this method stopped being supported in New York, or if there is any other way to show/hide a button based on another field value without reloading the form?
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2020 06:38 PM
Hello @Matt Grover
Can you try adding the "Isolate script" filed to the UI Policy form and set it to false or uncheck it.
go to configure---> form layout and drag it over to the form
and run it again.
It should be false to allow your DOM manipulation to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 10:16 AM
Where do I have to write script to hide and show the UI action? Above script with $$ worked for u?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 02:10 PM
Hello Hema,
I created a UI Policy, which has a tab for scripting. If you don't see the fields for execute if true & execute if false, then you might need to check the box for 'run scripts'. The other thing that made the $$ script work was adding the checkbox for 'isolate scripts' and making sure the box is unchecked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 06:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 06:51 AM
Hello Hema,
What version of ServiceNow are you using? I know several of the older answers on other posts have slightly different syntax than the one that worked for me. I'm speculating that this is because ServiceNow changed some things about their UI action naming scheme in New York.
In your $$('saveExit_bottom')[0].hide() statement, have you verified that 'save_Exit' is the value of the 'action name' field on the UI Action record?
Example from my transfer button below:
The only other thing I can think is playing around with the array index value. Maybe try using a [1] or a [2] instead of a [0]. You might also experiment with removing the _bottom at the end of the action name.
Other than that, I can't think of any troubleshooting steps to help, unfortunately. Please let me know if any of those work out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 08:42 AM
I am on NewYork version. Tried changing the index value. I followed this KB article
KB0697296. Getting error on '$' only.