- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2021 04:05 PM
I have a UI Policy on the Incident table with the condition of Major Incident State is not Accepted and the desired behavior is to hide this related list if that condition is true. The scripts are:
Execute if true:
function onCondition() {
g_form.hideRelatedList('u_m2m_group_incident');
}
Execute if false:
function onCondition() {
g_form.showRelatedList('u_m2m_group_incident');
}
It works perfectly in the platform but not in Agent Workspace. In AW, when I view an incident whose MI state is not accepted, I should not see this related list, but I do. Other notes:
- I have the Global box checked.
- I have 'All' as the option for 'Run scripts in UI type'.
- I've tried checking the 'Isolate script' and not checking it. Either way doesn't matter.
I've tried setting this UI Policy to Workspace instead of global. Still doesn't work. What am I missing?
Solved! Go to Solution.
- Labels:
-
Agent Workspace

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 09:23 AM
Can you try with onChange client script?
Client script UI Type Should be ALL
script example:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue ==2)
g_form.showRelatedList('task_ci.task');
else
g_form.hideRelatedList('task_ci.task');
}
Note: Make the changes in condition based on your need.
Quick Demo:
My Testing scenario , when state value is "In progress" then show the "Affected CI" related list , else hide it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2021 05:42 PM
Why do you need script ? this can be done without writing script , you can hide it using UI Policy.
Steps:
Open your UI Policy, you will see Related List "UI Policy Related List Action", You can select the related list and set visible true/false based on your need. Tested on workspace and its working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 08:04 AM
I didn't even know that was a related list on the UI Policy form; I had to add it so that it's visible now. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 08:06 AM
Still can't get it to work in Agent Workspace, unfortunately. It only works on the platform.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 08:49 AM
I have tested it and i can see it is working for me on agent workspace as well.