The Zurich release has arrived! Interested in new features and functionalities? Click here for more

UI Action - condition not working as expected

rebecca75
Tera Contributor

I thought the condition would determine when the UI Action was visible, but 'Transfer to Incident' still shows when the Assignment Group changes and the state changes to 'Assigned.' Based on the criteria below only 'Work in Progress' and 'Planning' states should show the 'Transfer to Incident.' It works when I first bring up the ticket (so if Planning state it shows), but if the state changes to 'Assigned' and the ticket is not saved, then the Context Menu still appears and it should not. I would assume current is the new value and not previous.

I need to prevent users from having this option to 'Transfer to Incident' if the state is not 'Work in Progress' or 'Planning' and right now I have users that will change the Assignment Group/state and then click the 'Transfer to Incident', but the Assigned To is not populated and leaving the RITM workflow hung.

I'm thinking there is a couple ways to fix this - but I don't want to over engineer it either...

              1. Add in a validation to the UI Action 'Transfer to Incident' to confirm the Assigned to is populated, if not pop a message and return false.

              2. Update the client script that when an Assignment Group changes, that the state changes to Assigned (this is already there), but add in the removal of the 'Transfer to Incident' from the Context menu - can this even be done?

Ideas would be helpful...

find_real_file.png

find_real_file.png

1 REPLY 1

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Rebecaa,



You are right that UI action condition will not be validated until the changes are saved. In this case you will have to write a client script to show/hide the button based on conditions. More info here.


https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/



The first point you mentioned makes sense i.e add validation at the client side. You can refer below blog on how to adjust UI action client and server side.


https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/