UI Action to display document template in related list of Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello developers,
I need to create a UI Action button on form. When I clicked , it should display a list of records from Document Table(ds_document). I am not sure which is the best way to do this.
Can someone guide me on the recommended approach?
Thank you
Regards,
Mayur Patil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Mayur Patil2
Could you please give more info on the requirement..?
Like what should happen after diplaying the list of records? etc..
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Here's a recommended approach:
Step-by-Step Guide:
Create a UI Action:
- Navigate to the UI Actions module in ServiceNow.
- Click on New to create a new UI Action.
- Fill in the necessary fields:
- Name: Give your UI Action a meaningful name.
- Table: Select the table where you want the button to appear (e.g., incident).
- Action Name: This is a unique identifier for your action.
- Show insert: Check this if you want the button to appear on new records.
- Show update: Check this if you want the button to appear on existing records.
- Condition: Specify any conditions under which the button should appear.
- Order: Determine the order of the button relative to other UI Actions.
- Client: Check this box to make the UI Action client-callable.
Client-side Script for UI Action:
- In the Script field, write a client-side script to show or hide the related list. Below is a sample script:
function toggleRelatedList() {
var relatedListName = 'related_list_name'; // Replace with the actual related list name
var relatedList = document.getElementById(relatedListName);
if (relatedList) {
if (relatedList.style.display === 'none') {
relatedList.style.display = '';
} else {
relatedList.style.display = 'none';
}
}
}
toggleRelatedList();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
You can create a UI Action button that calls a Script Include. The Script Include will take input from the current record, query the ds_document table, and return the results. Based on your requirement, you can either use that data to populate fields on the current record or simply display it in a message. For reference, you can look at OOTB UI Actions on the Incident table (like Create Problem or Reopen) to understand how they’re structured.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.