user criteria evaluates correctly in background script but not using user criteria diagnostic tool

levino
Giga Guru

Hi there

user criteria evaluates correctly in background script but not using user criteria diagnostic tool

 

function checkCondition(user_id) {
    var user = new GlideRecord('sys_user');
    user.get(user_id);
    
    if (user.title.indexOf('DCL') !== -1 || user.title.indexOf('CHAPTER LEAD') !== -1) {
        return true;
    }
    return false;
}
1 ACCEPTED SOLUTION
8 REPLIES 8

Try this

 

function checkCondition(user_id) {
 var user = GlideUser.getUserByID(user_id);
    if (user.title.toString().indexOf('DCL') > -1 && user.title.toString().indexOf('CHAPTER LEAD') > -1) {
        answer = true;
    }else
     {
    answer = false;
     }
}

Hi Anurag

should it be  || or  &&

 

Thanks

Levino

Actually it should be || i think.

Was this solved @levino