How to get only one return in workflow if activity ?

ads
Tera Expert

Hi All,

The below ifScript is not working, can anyone please help me on this ?


var usrDivision = current.variables.requested_for.company.sys_id;
var div = gs.getProperty('all.divisions');
var isUsrCI = div.includes(usrDivision);

var ans;
answer = ifScript();

function ifScript() {
var ans = 'yes';
if (isUsrCI == true) {
ans = 'yes';
}
return ans;
}

 

Can anyone please help me on the above.

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

I would recommend putting the entire code in the function, following the standard/suggested format for the function and return, and adding a temporary logging line like this to confirm the variable values:

answer = ifScript();

function ifScript() {
    var usrDivision = current.variables.requested_for.company;
    var div = gs.getProperty('all.divisions');
    var isUsrCI = div.includes(usrDivision);
    workflow.info('usrDivision= ' + usrDivision + ' div= ' + div + ' isUsrCI= ' + isUsrCI);
    if (isUsrCI == true) {
        return 'yes';
    }
    return 'no';
}