Variable condition on catalog task

munwala
Kilo Contributor

Hi All,

I have a variable which is displayed only on the catalog task form and I want to make it mandatory only when the State of the catalog task is updated to 'Closed Complete'.

In order to accomplish this I have a UI policy created which displays it only on the catalog task form and hides it elsewhere. Now the trouble I am having is how should I set up the condition where it should be mandatory only when the catalog task State changes to 'Closed Complete'?

Can it be done in the same UI policy or will I need a client script?

Any help would be appreciated.

Thanks!

1 ACCEPTED SOLUTION

Inactive_Us1976
Giga Expert

I used a UI Policy to do this.   I set the state to Closed complete and used this script



function onCondition() {


g_form.setMandatory('variables.preorder',true);}



And then the false version of this for the "reverse if condition is false".



I also had to add something to the "Close Task" button to ensure the UI Policy was checked before closing out the task utilizing that button.   I believe I utilized this thread to accomplish that: https://community.servicenow.com/thread/183633


View solution in original post

13 REPLIES 13

Select state field


Oh I think I know what I am doing wrong. I have a created a catalog client script but instead I need to create client script on the catalog task table correct?


Inactive_Us1976
Giga Expert

I used a UI Policy to do this.   I set the state to Closed complete and used this script



function onCondition() {


g_form.setMandatory('variables.preorder',true);}



And then the false version of this for the "reverse if condition is false".



I also had to add something to the "Close Task" button to ensure the UI Policy was checked before closing out the task utilizing that button.   I believe I utilized this thread to accomplish that: https://community.servicenow.com/thread/183633


Thanks a bunch!