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.

Chuck Tomasi
Tera Patron

The new knowledge came in fast this week. As a writer, it's always nice to have a queue of topics.

This week's topic is overriding a global UI Action. Here's the scenario I got from the client… "I want to change the behavior of the Update button on the change form without impacting everyone else who uses that (since Update is a global UI Action.)" More specifically, he wanted to hide it from the button bar without impacting the other applications. They wanted to use a client script, but started noticing performance issues from using too many client scripts. (They use other UI action form buttons to drive the process.)

The solution… make your own UI Action with the same Action Name and it will override the global one.

Normally, the Update button has attributes similar to the following:



Name: Update
Table: global
Order: 100
Action name: sysverb_update
Active: true
Form button: true

To accomplish the goal of "hiding it" (without using a client script), we created a new UI Action with the following:



Name: Update
Table: change_request
Order: 100
Action name: sysverb_update
Active: true
Form button: true
Condition: current.number.nil()

Having the same action_name for the specific change_request table means it will override the default Update button. Since the condition "current.number.nil()" says "display this button if you have nothing in the number field" which will evaluate to false. Exception: if you assign numbers after the record is created, in which case, change the condition to !current.number.nil()

Now the condition will always be false, the button won't be displayed, and no client scripts. Nice and fast. Feel free to change the name, condition, etc. to suit your needs. This also works with the other action names, sysverb_insert, sysverb_delete, sysverb_update_and_stay, sysverb_new, etc.

find_real_file.png

10 Comments