Query Business Rules on task using NQ (OR statement on top level).

SN-Murph
Kilo Contributor

Issue on Fuji: Query Business Rules on task using NQ (OR statement on top level).

Scenario

User with a role (not an ITIL role) needs to see own incidents/requests and all records of e.g. HSEQ or HR (extended from task).

The form list view does not work as before, e.g. the "Show Matching" functionality is broken. This happens only if the OR condition has been used in the query Business Rule.

I managed to get it working using a "addOrCondition" but for more complex Query Business Rules it would be very nice to use the "NQ stuff" .

Any comments/solutions are really appreciated.

2015-04-29 10.37.46 am.png

Script see below and uploaded:

if (gs.isInteractive() && gs.hasRole('itil')) {

var action = gs.action;

var url = String(action.getGlideURI());

var query = current.getEncodedQuery();

if (url.match(/sys_id/)) {

gs.addInfoMessage('SYS_ID');

} else {

gs.addInfoMessage('NO SYS_ID');

var u = gs.getUserID();

var qc = current.addQuery("caller_id", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u);

//var qc = current.addQuery("sys_class_name", '!=', 'vvv').addOrCondition("sys_class_name",'!=', 'change_request');

current.addEncodedQuery("^NQsys_class_name!=change_request");

}

gs.addInfoMessage('End Query: ' + current.getEncodedQuery());

}

4 REPLIES 4

BenPhillipsSNC
Kilo Guru

Hi Torsten,



I have not used the NQ operator. It seems to   give me trouble on my Fuji instance also. Have you tried just a ^OR? Seems to work for me. What is it that NQ does that OR does not do?



Thanks


oacp
Kilo Contributor

Hi Torsten,



I am having the same issue with the '^NQ' operator where it breaks the 'Show Matching' and 'Filter Out' functionality - did you ever find a solution to this?



Regards,



Liv


Saurabh Kumar2
Mega Guru