Get the list of UI Actions for a record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 06:16 AM
Is there an API call to get the list of UI Actions for a record.
I'd like to be able to get the list of actions with all of the conditions applied through a rest call from within an angular provider.
In the ServiceNow Server Script for a Widget, there is a $sp.getForm.
- $sp.getForm([table],[sys_id],[query],[view])
- returns f._ui_actions
Can this be used in a Script Include?
If not, is there an api call to just get the list of UI Actions in a server script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 07:25 AM
you can get list of UI actions associated to a table but not a record directly.
I assume you are saying based on 1 record you want to know which UI actions are satisfying that record's condition.
For this there is nothing OOB.
You need to create custom scripted rest api and handle this logic
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:12 AM
Thank you, @Ankur Bawiskar .
I found that $sp.getForm works in a script include.
- This function is used in the OOTB Form Widget and returns all of the information about a form
- fields, UI Actions, ...
- This function returns the list of UI Actions available for a Table and Sys_id.
- It will also further refine based on view (if provided)
- So, it will even filter based on global vs specific view
- It also applies all of the conditions before providing the list of actions
This method gives me exactly what I need and b/c it works in a script include, it can be called through rest.
The method is really heavy as it returns a lot of things I do not need.
So, I was hoping to be able to get to the underlying method used by this call to get just the UI Actions.
I guess ServiceNow is not exposing that underlying method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:29 AM
that's correct. you can leverage same capability in scripted rest api.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader