removeOption in UI policy doesn't reverse if false

Andrew Bettcher
Kilo Sage

Hi,

I've added a simple UI policy to remove the "3" option from "Urgency" and "Impact" if a certain tick box = true (i.e. it's for security breach incidents - we want to make sure they're never logged at a low priority).

It works fine as expected but, if the tick box is then unticked, the values do not return.

"Reverse if false" is ticked as is "On Load" (Apply the UI policy actions when the form is loaded and when the user changes values on the form). So, in my mind, if the reverse of the condition is true then the action should be reversed.

I tried adding "addOption" to the "Execute if False" field with predictable results (i.e. it added new "extra" options on load).

Are my expectations incorrect or have I done something wrong?

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

"Reverse if false" only works with UI Actions, not scripts. 

It sounds like you perhaps need to break this down into two UI Policies, one that executes onload and looks for a value of true and removes the options, and one that is onchange only (remove the onload checkbox), with a script to remove options if true and to add them if false. Make the onchange a higher order than the one on load (onload 100, onchange 200). 

If this was helpful or correct, please be kind and remember to click appropriately! Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

2 REPLIES 2

Andrew Bettcher
Kilo Sage

Solved it by clearing all options in both cases and then building separate lists . E.G.:

function onCondition() {

		g_form.clearOptions('impact');
		g_form.clearOptions('urgency');
		g_form.addOption('impact', '1', '1 - High', 1);
		g_form.addOption('urgency', '1', '1 - High', 1);
		g_form.addOption('impact', '2', '2 - Medium', 2);
		g_form.addOption('urgency', '2', '2 - Medium', 2);
	
}

Michael Jones -
Giga Sage

"Reverse if false" only works with UI Actions, not scripts. 

It sounds like you perhaps need to break this down into two UI Policies, one that executes onload and looks for a value of true and removes the options, and one that is onchange only (remove the onload checkbox), with a script to remove options if true and to add them if false. Make the onchange a higher order than the one on load (onload 100, onchange 200). 

If this was helpful or correct, please be kind and remember to click appropriately! Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!