trying to configure same UI action for three different views of the same table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago - last edited 3 hours ago
Hi experts,
i am trying to configure same UI action for three different views of the same table, below is the script that i am trying with but its not working
Business Requirement
I have three different list views (View A, View B, and View C) for the same table sn_grc_profile.
Each view shows different fields (X, Y, Z). The process is:
A user fills out the fields in a view (for example, field X in View A).
The user selects records in the list view and clicks Send for Approval.
A reviewer (checker) goes to the same view, reviews the records, and clicks Approve (or Reject) from the list view.
Currently, I created three separate buttons for each action: Send for Approval, Approve, Reject.
My challenge is that I want to reuse the same UI Action button across all three views.
Example: one Approve button should work for all three views (instead of having 3 separate Approve buttons).
Same goes for Reject and Send for Approval.
Also, the requirement is that users should be able to update multiple records directly from the list view using these buttons.
requesting for support on the issue, thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
in the List Choice UI action you possibly won't know from which view the button is getting clicked.
try to see and use this in server side code of that UI action and see if you can get to know the view name from URL
var isViewA = gs.action.getGlideURI().toString().indexOf('View A Name') > -1;
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
2 hours ago - last edited 2 hours ago
HI @Ankur Bawiskar ,
I don't need to get the view that I am currently in, I need to use a script to validate the state of the record that I have selected if its in draft it should be moved to pending for approval, as this same is UI action for the other views as well so just validation in the script is enough if it's of X field and state is draft , il send it for approval by clicking on the request for approval. button should be able update the record state.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
when you use list choice UI action you can get the sysIds selected using this
g_list.getChecked()
Then use GlideAjax and send the sysIds and then check state of each record by querying and then update the state.
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
2 hours ago
Hi @Prasad49 ,
I think you can control the visibility of the UI action using the related list shown below. You need to specify the view and whether the button should be included or excluded. There won't be a need to make changes in the script or create multiple buttons.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Dhana,
Thanks for your kind response am trying to use Ui action button to update record which checks the current state of the record in the list view and update it when Ui action button is clicked.