How to restrict record producer for user specific country

rmaroti
Tera Contributor

Hi All,

 

Requirement: I have one record producer which I want give the access for only those user which country should be Argentina ,Brazil, Colombia, Mexico in their profile i.e location.country so how we can add in available for to restrict the access for other country except above four country.

1 ACCEPTED SOLUTION

Hi @rmaroti I have updated the code as below

var answer;
var userSysId = gs.getUserID(); // get current user sys_id
var userGr = new GlideRecord('sys_user');
if (userGr.get(userSysId)) {
var userCountry = userGr.location.country.toString(); // get user's country
if (userCountry == 'Argentina' || userCountry == 'Brazil' || userCountry == 'Colombia' || userCountry == 'Mexico') {
answer = true;
else {
answer = false;
}
}

Let me know if this works

Regards
Harish

View solution in original post

13 REPLIES 13

Hi @rmaroti I have updated the code as below

var answer;
var userSysId = gs.getUserID(); // get current user sys_id
var userGr = new GlideRecord('sys_user');
if (userGr.get(userSysId)) {
var userCountry = userGr.location.country.toString(); // get user's country
if (userCountry == 'Argentina' || userCountry == 'Brazil' || userCountry == 'Colombia' || userCountry == 'Mexico') {
answer = true;
else {
answer = false;
}
}

Let me know if this works

Regards
Harish

Hi @Harish KM I have created report called report outage who are business owner or service owner I have to provide access for that

rmaroti
Tera Contributor

Hi @Harish KM  thanks, this will be working