Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 03:26 AM
Hi @rmaroti ,
Add toString()
updated code. its working for me well.
checkCondition();
function checkCondition() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
// Define the allowed countries
var allowedCountries = ["Argentina", "Brazil", "Colombia", "Mexico"];
// Check if the user's country is in the allowed list
if (user.isValidRecord() && allowedCountries.includes(user.location.country.toString())) {
// User's country is allowed, so return true to grant access
return true;
} else {
// User's country is not allowed, so return false to deny access
return false;
}
}
🙂
Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)