Best practice - remove UI action from extended table

Daniel A-C
Tera Expert

Looking for advice on best practice regarding UI actions

Requirement: Remove 'Add to visual task board' UI action from context menu in a change request.

This UI action is defined against the 'task' table. We don't want to remove it from anywhere else. I know of a number of ways to achieve this but have been unsure whether there's a 'best practice' way or at least a ServiceNow recommended way.

Options (that I know of):

1. Add extra condition to existing task-based UI action - current.sys_class_name != 'change_request'

2. Duplicate the UI action, set the new record to active= false and use the 'overrides' field to specify the original action to override

3. Duplicate the UI action, set the new record to active = false and give it a lower order value whilst maintaining the same action name (and adding a unique one to both records if empty)

4. Duplicate the UI action, set the new record to active = false and set the table to change_request whilst maintaining the same action name (and adding a unique one to both records if empty)

5. Duplicate the UI action, set the new record to   condition = false and use the 'overrides' field to specify the original action to override

6. Duplicate the UI action, set the new record to condition = false and give it a lower order value whilst maintaining the same action name (and adding a unique one to both records if empty)

7. Duplicate the UI action, set the new record to condition = false and set the table to change_request whilst maintaining the same action name (and adding a unique one to both records if empty)

Notes/Observations:

- Option 1 seems simplest but amending an OOTB ui action ultimately causes more work during system upgrades. It can also have a horrible impact in a qualified and validated environment as you're potentially amending something which is used by multiple applications (incident, problem, change etc).

- Leaving a UI action active means the condition will get evaluated, but leaving it inactive may leave it vulnerable to being removed by a future developer

- I like the idea that defining a UI action with the same 'action name' in an extended table will override a UI action defined against a parent table as it feels closer to an object-oriented approach - but then what's the point of the 'overrides' field? and are there any downsides?

It's a nice problem to have though. I'd hate to be sitting here saying "why can't I achieve this!"

Thanks guys

Dan

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi Daniel,



As you rightly said that there are multiple ways to do this and all of them will provide the 'RIGHT' result.



Burt generally speaking in such scenarios i go with the override the ui action option. Its neat, limited to a table or scope and you will save yourself from touching a global object that might have cross stream impact.


i got confused with so many options so ill just write it down:



So create a UI Action on change_request with same name, same action name and same order and condition = false.


-Anurag

View solution in original post

6 REPLIES 6

So there is no other way to override OOTB UI actions which doesn't have action name without touching OOTB UI action?


nikita33
Kilo Explorer

None of the above method helped me to hide the ui action.Its only overiding but noe hiding.If I make active = false,the overided action starts working.