how to display a ui action button when clicking on other ui action button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:16 PM
hi can anyone help me with the scenario for
there are two ui action buttons in purcgase order form
one is cancel and other is comform,
i want to display comform button only when cancel is clicked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:37 PM - edited 06-27-2023 11:39 PM
Hi Raj,
The low-code way to achieve it, that came to my mind is to add a new True/False field on the table and keep it hidden.
Then add to the Cancel UI action a line of code to set the value of the new field to True. That would be something like this:
g_form.setValue('u_new_field', true);
current.update();
Then add this to the condition of the second UI action, Conform:
current.u_new_field == 'true'
Some notes: Make sure your company is ok with adding a new field to the table and then choose a meaningful name for the field.
I hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:49 PM
UI actions are shown/hidden based on UI action condition and condition is evaluated only once when form loads.
Why not have proper UI action condition in both the UI actions to show them only when you want it to be visible?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:06 AM
You really do not want to mess around with the way UI actions are displayed.
As already suggested, please use the normal conditions of the UI Action to display it.
Therefore you might use a 'helper' field that can be set by the confirm UI Action, and then leveraged by the cancel UI Action, if you do not already have some other field on which you can base your logic.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.