The CreatorCon Call for Content is officially open! Get started here.

How to show the Requests, RITM and SCTASKs associated of a particular catalog item to a particular group only?

AKASH BANERJEE
Mega Guru

Can someone please let me know how can we show Requests, RITM and SCTASKs associated to a particular cataalog item to a particular group.

We have written the below code in Business rule(run before query) but it is only hiding the list of RITM numbers and Requets(REQ) and SCTASKS are still visible.

(function executeRule(current, previous /*null when async*/) {

    if (!gs.hasRole("u_Security_catalog_items") && gs.isInteractive()) {

current.addQuery("cat_item","!=","cba2e4d21b9c419445bd42e2cd4bcb31");

})(current, previous);

 

'cba2e4d21b9c419445bd42e2cd4bcb31' is sys id of the catalog item

Please let me know if anyone is having the solution for it

1 ACCEPTED SOLUTION

Hope you have included the addEncoded query as well in your code?

current.addEncodedQuery("request_item.cat_item!=cba2e4d21b9c419445bd42e2cd4bcb31");

View solution in original post

9 REPLIES 9

Nikita30
Mega Sage

Hi @AKASH BANERJEE, 

For SCTASK you need a query business rule on the sc_task table and write the below code.

(function executeRule(current, previous /*null when async*/) {

    if (!gs.hasRole("u_Security_catalog_items") && gs.isInteractive()) {

current.addEncodedQuery("request_item.cat_item!=cba2e4d21b9c419445bd42e2cd4bcb31");

})(current, previous);

Please mark the response as Helpful/Correct, if applicable. Thanks!

Hi @Nikita,

The above query you have given is not working for sctask, but the query which I wrote it it working fine but only for RITM's

Hope you have included the addEncoded query as well in your code?

current.addEncodedQuery("request_item.cat_item!=cba2e4d21b9c419445bd42e2cd4bcb31");

Please let me know what we have to put in the query to hide the REQ tickets, now RITM and sctask are hiding and working fine but REQ tickets are still visible