Issue with Query business rule restricting catalog task that does not meet the condition

Rhonda9
Tera Expert

Hello,

I am having an issue with a query business rule that is incorrectly restricting a Catalog Task record that does not meet the rule's condition. Instead of restricting only Catalog Tasks related to the Vulnerability Remediation Request to users with the Vulnerability Remediation role, the rule is restricting all ITIL users from accessing this Catalog Task  on a record that is not a vulnerability task.  This issue occurred after upgrading to Xanadu.

 

here is the before business rule

 

condition: !gs.getUser().hasRole("vulnerability remediation")&& gs.getSession().isInteractive()

 

(function executeRule(current, previous /*null when async*/) {
    var u = gs.getUserID(); //Get the sys_id value of the current user
    if(!gs.getUser().hasRole("vulnerability remediation")); { //if  user does not have the vulnerability remediation role
        current.addQuery("cat_item", "!=", "47d7fb3a1b8a1e50d058c992604bcb0e").addOrCondition("opened_by", gs.getUserID());
   
    }
}
)(current, previous);
2 REPLIES 2

Community Alums
Not applicable

Hi @Rhonda9 ,

What is the actual requirement here?

Looking at your code, what i assume is that, you need to use a condition something like below:

 

if (gs.hasRole('admin') || gs.getUser().isMemberOf('SYS ID OF GROUP'))

 

 

Rhonda9
Tera Expert

Thanks for your reply, the conditions should allow users with the Vulnerability Remediation role to access the Vulnerability catalog request.   When i added your logic, the query business rule is no longer restricting access. This problem occurred after our recent upgrade to Xanadu.