UI Policies in Agent Workspace for Incident form?

Community Alums
Not applicable

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? 

1 ACCEPTED SOLUTION

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:

 

find_real_file.png

 

My Testing scenario , when state value is "In progress" then show the "Affected CI" related list , else hide it. 

View solution in original post

6 REPLIES 6

Harsh Vardhan
Giga Patron

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. 

 

Community Alums
Not applicable

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! 

Community Alums
Not applicable

Still can't get it to work in Agent Workspace, unfortunately. It only works on the platform. 

I have tested it and i can see it is working for me on agent workspace as well.