Issue with a Checkbox Variable and an 'If' conditional script in a workflow

chris_smith
Kilo Expert

Hi there,

I'm having some trouble with a checkbox variable in an 'if' conditional workflow activity.

This seems like a silly scripting issue, but I might need an extra set of eyes on this one, now that I'm pulling at straws. 🙂

Heres' the issue.

I have a variable 'app_sam' and its a checkbox on an application catalog item. If the user would select this item then an addition approval is needed.

I reviewed this article [ Checkbox variables not evaluating - they are true/false correct? ] and was still having some trouble getting it to follow the 'yes' path on the condition.

I've tried several versions of the same line of code:

function ifScript() {

if (current.variable_pool.app_sam==true) {
return 'yes';
}
return 'no';
}

I've also tried these

current.variable_pool.app_sam=='true'
current.variables.app_sam==true
current.variables.app_sam=='true'

I also tried 'True' with a capital T but that didn't look right either.

I still seem to have it take no by default when its selected.

Any thoughts on this one?


Thanks in advance,

2 REPLIES 2

Jay_Ford
Kilo Guru

Try this



answer = ifScript();

function ifScript() {
if (current.variable_pool.app_sam == 'true') {
return 'yes';
}
else{
return 'no';
}
}


chris_smith
Kilo Expert

Many Thanks, Jay.

Note to self:

answer = ifScript();

Make a call to the function 🙂

I knew I needed an extra set of eyes.

Thanks again!