User Criteria not working!

Sri56
Tera Contributor

Hi Team,

I have build a user criteria to restrict my catalog items for germany users.

So, below is the screenshot of my user criteria

]

When i check for logs, sometimes working and sometimes not and all users are able to view the catalog item.

even though i mapped this user criteria in not availability column.

There is nothing in available column.

Can someone please help me how to fix this?

 

Thanks,

Sri

12 REPLIES 12

try this

It is recommended to use user_id to get logged in user sysId in user criteria script

are you comparing the correct country value?

are you having that logged in user with location populated?

answer = checkCondition();

function checkCondition() {
    var user = new GlideRecord('sys_user');
    user.get(user_id);
    if (user.location.country == "DE") {
        return true;
    }
    return false;
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Still no luck!

Please help!

Thanks,

Sri

Did you try adding gs.info() in the user criteria script for debugging?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader