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

Was this solved @levino 

-Anurag

View solution in original post

8 REPLIES 8

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try to use answer instead of return and change as below

 

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) {
        answer = true;
    }
else
{
    answer = false;
}
}

 

-Anurag

Thanks Anurag

tried that no luck

Can you define what condition you want to check and a sample user record along with expected behavior?

-Anurag

user has title     'DCL - Digital Workplace'

 

 

but evaluates to false in user criteria diagnostic tool. but  in background script it evaluates to true