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

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. 

Community Alums
Not applicable

This is what I came up with based on your example and it's working now (if I take the isLoading out from line 2). 

find_real_file.png