Filtering Incident based on roles

Ethan4
Tera Contributor

I have a requirement where I have 2 departments(HR and Others) and HR can't see Others Tickets and Others can't see HR tickets. I have written a Before Query BR for that use case. It is working fine but there is a slight problem here, its making the end users unable to see their request in employee centre. How do I rectify this?

 

(function executeRule(current, previous /*null when async*/ ) {
// Check if the current user has the 'hr_itil' role
if (!gs.getUser().hasRole('hr_itil')) {
var cat = current.addNullQuery('category').addOrCondition('category', '!=', 'inquiry');
} else if (gs.getUser().hasRole('hr_itil')) {
var cate = current.addNullQuery('category').addOrCondition('category', '=', 'inquiry');
}
})(current, previous);

0 REPLIES 0