Help with User Criteria - Not Available For - Advanced Script

jlaue
Kilo Sage

Hello - I am having trouble getting an advanced script in a User Criteria record working properly.  We have a 'Temp Accounts' User Criteria that we are using in some of our 'Not Available For' criteria for catalog items.  However, we have one specific location that we want to exclude from this.  This is what I am using:

 

checkCondition();

function checkCondition() {

 

var user = new GlideRecord('sys_user');
user.get(user_id);

 

if (user.location != '123' && user.u_ad_temp_account == 1) {

 

return true;

}

return false;
}

 

The original script was the same, except for this line:

if (user.u_ad_temp_account == 1) {

 

I have validated that my test user is a part of location 123 and is flagged as a Temp Account, however it never lets that test user view the catalog item.  It is always evaluating to 'true' in this user criteria record.  I am wondering if I am able to use the   !=  logic in a script like this, or if I am missing something. 

 

Thanks!! 

 

5 REPLIES 5

No problem at all, I should have detailed it a bit better.  I appreciate your time and assistance !!