How can I give access to a Record producer to the manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hello Everyone,
Help me with this!
Scenario: Employees of a particular country have access to a record producer, but there are employees whose managers are not from that country but they need access to this country. I can give access via static conditions but I want this to be dynamic. Can someone body let me know how to achieve this.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago - last edited 8 hours ago
Hi @jkhanddh
- Navigate to User Criteria: Go to Service Catalog > Catalog Definitions > User Criteria ->lick New.
- Name the Criteria: Give a proper name
- Enable Advanced: Check the Advanced check box.
- Add the Script: In the Script field, use the following code to check if the user OR their manager belongs to the specified country //modify it as per your requirement
answer = checkAccess();
function checkAccess() {
var countryCode = 'IN'; // Change this to your target country as per your requirement
var userId = gs.getUserID();
var userGr = new GlideRecord('sys_user');
if (userGr.get(userId)) {
if (userGr.location.country == countryCode) {
return true;
}
if (userGr.manager) {
var managerGr = new GlideRecord('sys_user');
if (managerGr.get(userGr.manager)) {
if (managerGr.location.country == countryCode) {
return true;
}
}
}
}
return false;
}
Add this user criteria in Available for of your Record producer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
What not provide access through group instead of direct access
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
