How to Hide catalog item on service portal based on users country

Sanket Pawar
Tera Contributor

Hi All,

I have an requrement where the catalog item should be hidden on portal if the currently logged in user's country is Finland . Any guidance will be helpful.

 

Thanks!

16 REPLIES 16

Sagar Pagar
Tera Patron

Hi @Sanket Pawar,

You can use the user criteria based on country to hide the catalog items.

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Hi @Sagar Pagar ,

Tried with user criteria, still not working, is there any other alternative to hide the catalog item based on user's country.

Hi @Sanket Pawar,

Try by checking Diagnostics User criteria for that user. How user have access for catalog item.

 

Thanks,
Sagar Pagar

The world works with ServiceNow

sushantmalsure
Mega Sage
Mega Sage

Hi @Sanket Pawar 

Open related catalog item from maintain items.

Scroll down below and locate 'Not Available for' related list.

Click on create new which will open up new user criteria form.

Then in advance you can write script of your choice for evaluation and your case you want to hide it for all users from Finland then it can look like following:

var country = 'FI'; //validate this value for Finland
var usr = new GlideRecord('sys_user');
usr.get(gs.getUserID());
if (usr.country == country) {
    retVal = true;
} else {
    retVal = false;
}

 

and that will be all

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure