The CreatorCon Call for Content is officially open! Get started here.

Hide a Catalog from Users in Employee Center

Pam Walker1
Tera Contributor

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 

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

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 Manders
Mega Patron

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

Its_Azar
Tera Guru
Tera Guru

Hi there @Pam Walker1 

 

I think you can use Catalog Client Scripts and Catalog UI Policies

 

  1. 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.

 
 
 
 
 
 
 
 
 
 
☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

Pam Walker1
Tera Contributor

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