The CreatorCon Call for Content is officially open! Get started here.

I need this UI Action button

TanujB
Tera Contributor

Create a UI Action for the child_incident related list. When clicked, this UI Action should filter the related list to display only child incidents where the category is hardware.

2 REPLIES 2

M Iftikhar
Giga Sage

Hi @TanujB


We can create this kind of UI action like:

  1. Navigate to System Definition > UI Actions and click New.

  2. Configure the UI Action form with the following values:

    • Table: Incident (incident)

    • Active: Checked

    • Show insert / Show update: Unchecked

    • Client: Unchecked (this will be a server-side script)

    • List banner button: Checked

    • Condition: current.getTableName() == 'incident'

    • Script:

// Get the sys_id of the parent incident
var parentId = current.getUniqueValue();

// Build the encoded query for the child incidents
var query = 'parent_incident=' + parentId + '^category=hardware';

// Construct the URL for the incident list with the new query
var url = 'incident_list.do?sysparm_query=' + query;

// Redirect the user to the filtered list
action.setRedirectURL(url);

 

Now, when you view an incident record and look at the "Child Incidents" related list, you will see a button (e.g., "Show Hardware Children") that, when clicked, will refresh the list to show only the child incidents with the "Hardware" category.

Hope this helps!

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

Ankur Bawiskar
Tera Patron
Tera Patron

@TanujB 

you cannot apply filter to related list on click of UI action.

You can use client side UI action and use GlideDialogWindow to show UI page and that will show child incidents where category is hardware

GlideDialogWindow: Advanced Popups Using UI Pages 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader