- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 05:32 AM
Hi All,
I have a requirement where i have to show an ui action on incident , only if
- That incident is in open state (New, in progress)
- That incident has at least one open child incident in related list (Child Incidents)
I was not sure how to add condition in ui action for related list, please let me know how to do this.
Thanks!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 09:48 AM
Hi @akshay parekar1,
You can add in that UI Action's condition as below:
(current.state == IncidentState.NEW || current.state == IncidentState.IN_PROGRESS) && new check_ui_action().checkButtonVisibility(current)
And in your Script include 'check_ui_action':
checkButtonVisibility: function(record) {
var gr = new GlideRecord('incident');
gr.addQuery('parent_incident', record.getUniqueValue());
gr.query();
if (gr.next()) {
return true;
}
return false;
},

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 05:47 AM
Hello @akshay parekar1
You need to write one script include to check if the current incident has any active child incident and return true or false based on that. Then call that script include in condition field of the UI action.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 05:55 AM
Hi,
You can use script include in condition if it returns true then UI Action is visible. In the script include check multiple condition and return the statement with all condition in AND or OR condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 09:48 AM
Hi @akshay parekar1,
You can add in that UI Action's condition as below:
(current.state == IncidentState.NEW || current.state == IncidentState.IN_PROGRESS) && new check_ui_action().checkButtonVisibility(current)
And in your Script include 'check_ui_action':
checkButtonVisibility: function(record) {
var gr = new GlideRecord('incident');
gr.addQuery('parent_incident', record.getUniqueValue());
gr.query();
if (gr.next()) {
return true;
}
return false;
},