How to Hide catalog item on service portal based on users country
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:24 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:27 AM
Hi @Sanket Pawar,
You can use the user criteria based on country to hide the catalog items.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:40 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:47 AM
Hi @Sanket Pawar,
Try by checking Diagnostics User criteria for that user. How user have access for catalog item.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 12:40 AM
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
Regards,Sushant Malsure