Hide a Catalog from Users in Employee Center
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:03 AM
I would like to hide certain catalogs based on a users location. I have the items within the Catalog set as "Available for" or "Not Available for" but this just displays that the user is not authorized. How can I stop the end user seeing items that are Not available to them
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:06 AM
Hi @Pam Walker1
I am not 100% sure the not available for should not display the items. the reason can be user is able to see the item form available from and after this NOT available take precedence and stop user to open that.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:08 AM
User criteria should show/hide the items based on the conditions. Not show them and don't give access, they really should hide. If you have a user criteria for all users with location 'basement' and put that on the 'not available for' related list, the 'basement' users shouldn't see those items on the portal.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:22 AM
Hi there @Pam Walker1
I think you can use Catalog Client Scripts and Catalog UI Policies
Create a Catalog UI Policy: Create a Catalog UI Policy that will conditionally hide the catalog based on the user's location.
(function executeUIPolicy(scriptContext) {
var catalogVariableName = 'catalog_variable_name';
var userLocationField = 'user_location_field';
var locationValueToHide = 'location_value_to_hide';
var catalogVariableValue = scriptContext.current.variables[catalogVariableName].getDisplayValue();
var userLocation = scriptContext.currentUser[userLocationField].getDisplayValue();
if (userLocation === locationValueToHide) {
scriptContext.isVisible = false;
}
})(current);
Apply the created UI policy to the relevant catalog items or categories.
By using Catalog UI Policies like this, you can dynamically hide catalogs based on the user's location, providing a more personalized experience for users in ServiceNow's Employee Center.
If this helps kindly accept the response thanks much.
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 04:33 AM
Thanks both.
It was they way I had things set out on the Employee Center.
If you have a icon link to a catalog on the homepage this link shows the items however if you search they cannot see them. I have changed the layout of the portal and all is good