Managers to see their direct reports and other manager direct reportes under specific conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2022 07:34 PM
We have requirement on a specific HR Service
where if a field 'request type' is 'employee spot award' --> managers must be able to see his direct reports and other manager direct reports in the field 'employee name'
whereas if field 'request type' is anything other than 'employee spot award' ---> Managers should only be able to see their direct reports only in the field 'employee name'
Kindly help me how to configure these in our instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2022 09:07 PM
Reference qualifier should be advanced and a script include will be required: reference qualifier should be like this
javascript: 'sys_idIN' + new scriptInclude().methodName(current.variables.request_type);
In the script include you can write the below script
var users = [];
var emp = new GlideRecord('sys_user');
emp.addActiveQuery();
emp.addQuery('manager', gs.getUserID());
emp.query();
while (emp.next()){
users.push(emp.getUniqueValue());
if (requestType != 'Employee spot award'){
return users;
}
var empM = new GlideRecord('sys_user');
empM.addActiveQuery();
empM.addQuery('manager', emp.getUniqueValue());
empM.query();
while (empM.next()){
users.push(empM.getUniqueValue());
}
}
return users;