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

Community Alums
Not applicable


And also check these two Sys properties 

- glide.sc.use_user_criteria property is set to true

- glide.sc.entitlement.override has the role only admin

 

 

sushantmalsure
Mega Sage

@Sanket Pawar  mind sharing the user criteria you have defined which is not working.

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

Hi @sushantmalsure ,

Updated the user criteria as mentioned but still the caralog item is visible for finland user,please refer the below screenshot.

I think you havent copied correctly:

Copy this complete.

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;
}

 

Now also it depends on where you have added this.

is it added in 'Available for' or 'NoT available for' related list under the catalog item.

Above code is for 'Not Available for'

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

I have updated under "Not availble for" also updated the script ,still user is able to see the catalog item.