- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 06:32 AM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 08:08 AM
Hope you have included the addEncoded query as well in your code?
current.addEncodedQuery("request_item.cat_item!=cba2e4d21b9c419445bd42e2cd4bcb31");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 07:52 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 08:03 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 08:08 AM
Hope you have included the addEncoded query as well in your code?
current.addEncodedQuery("request_item.cat_item!=cba2e4d21b9c419445bd42e2cd4bcb31");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2022 08:28 AM
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