Access Location based catalog item by specific role user

manish123
Giga Guru

Hi All,

 

In our system all Catalog Items are restricted to user's specific location. And if a user belong to that location then he/she can able to access those items.

 

However, we have a requirement to make these all catalog items to available for a specific role users regardless to location restriction. 

 

Could anyone of you please let me know what is the best way to achieve this with less customisation and considering the best practice of SN.

 

Quick reply will be much appreciated!!!

 

7 REPLIES 7

manish123
Giga Guru

Thanks for your responses.

 

However, Requested for variable in catalog item is also restricted for that location's user and we would like to build an exception for a specific role user to update Requested for in the checkout page at last through which they can select any Global user in Requested for and raise a request which is technically not available for that Region or Location.

This exception is quite valid for our business case.

 

I need your help & guidance to achieve the same. As per my initial analysis, I think it would need lots of customisation to UI page or macro related to checkout page.

 

Quick reply will be much appreciated!!!

manish123
Giga Guru

Thanks everyone for your response.

 

However, Requested for variable in catalog item is also restricted for that location's user and we would like to build an exception for a specific role user to update Requested for in the checkout page at last through which they can select any Global user in Requested for and raise a request which is technically not available for that Region or Location.

This exception is quite valid for our business case.

 

I need your help & guidance to achieve the same. As per my initial analysis, I think it would need lots of customisation to UI page or macro related to checkout page.

 

Quick reply will be much appreciated!!!

sumanta pal
Kilo Guru

Sure, you can achieve this by modifying the Catalog Item's 'Can View' and 'Can Order' ACLs. Here are the steps: 1. Navigate to the Catalog Item's ACLs by going to "System Security > Access Control (ACL)". 2. Search for the table 'sc_cat_item'. 3. You will find two ACLs for 'read' (Can View) and 'write' (Can Order). 4. Modify these ACLs to add your specific role. You can use the 'Advanced' condition to add a script that checks if the user has the specific role. 5. In the script, you can use the 'hasRole' function to check if the user has the specific role. If the user has the role, return true; otherwise, check the location restriction. Here is a sample script for the 'Advanced' condition: javascript if(gs.getUser().hasRole('your_specific_role')) { return true; } else { // Check the location restriction var userLocation = gs.getUser().getLocation(); return current.location == userLocation; } This script first checks if the user has the specific role. If the user has the role, it bypasses the location restriction and allows the user to view and order the Catalog Item. If the user does not have the role, it checks the location restriction. Remember to replace 'your_specific_role' with the actual role that you want to bypass the location restriction. This solution requires minimal customization and follows ServiceNow best practices. It uses the existing ACLs and just modifies the conditions to add the role check. It also uses the 'hasRole' function which is a recommended way to check a user's roles.