- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 10:55 PM
Hi,
I want to get the UI Action name from the business rules when the users click on any UI Action on the table form like g_form.getActionName() at client scripts. How can I do that ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 03:40 AM
I will mark this answer as an "Accept as solution" because I have found an way to resolve this. For keyboard shortcuts saving the record I just create an business rules to detect the changes and for the UI Action, it needs clicking to process the script so I've put an constraint check if the fields which are inputted by users are not correct it will not run current.update() at the UI Action. With that I won't have to check if the button "Save" is clicked or not at business rules because solving this as an client script is easier than at business script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 10:56 PM
why the requirement to get UI action name in business rule script?
Why not update the BR script in UI action script itself?
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-12-2023 11:02 PM - edited 06-12-2023 11:04 PM
Hi @Ankur Bawiskar, the UI Action I'm checking is "Save" button, I need to know what events users trigger. Currently, I have found that if users use keyboard shortcuts to save the record the events in my UI Action can't run which is causing a lot bugs so that I need to create an BR script runs on update event but only runs when "state" field of that record changes but I don't want it to run at the same time when users click on "Save" button. That is my case, do you have any suggestion or better approach to check this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 11:14 PM
@sieusaopolo15 I think you need to create a save button on your table and with same action name as that of OOTB save button. Then add your logic to newly created save ui action.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 11:30 PM
I did create an new UI Action for this and it's just the same. The UI Action only runs the script when we clicked on it, but in my case users use the keyboard shortcuts to save the record which bypass all the events in the "Save" UI Action