Catalog Item variable mandatory on only one task

Jason Stephens
Kilo Guru

I need to make a catalog item variable mandatory on only one task. I do not need it to be mandatory when submitted, I just need it to be mandatory on one of the tasks that get generated by the workflow.

Thanks for the help.

Jason

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

have you tried

!g_form.getValue("variables.myvar").isNul()


View solution in original post

24 REPLIES 24

Really and truly the only time it needs to be mandatory is on close. I don't think it matters if they do updates or whatever, but if they close that field needs to be populated....


sreed
Kilo Explorer

You can grab a catalog variable from the catalog task. Just add variables in front of the variable name like so:

var test= g_form.getValue('variables.u_test');


OK got that part. Now how do I check for a close task action? As of now I get the pop up on close or update, and I just want it on a close.


make your client script onChange of status

if the newValue of status is Closed then check the variable field for contents. If its blank put the status back to open and pop the message. If its not blank skip the popup.


This is what I have and I can't get it to work. I don't see what I'm doing wrong. I want it to check the field when the state goes to closed complete (3)....

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}

//If New Machine field is empty, alert user
var task_state = g_form.getValue('state');
if ((task_state == '3')) {
var lease_new_comp=g_form.getValue('variables.lease_new_computer');
if (lease_new_comp == '') {
alert('New Machine Name Is Mandatory');
return false;

}
}
}