特定の条件に当てはまる場合のIncidentテーブルの閲覧を制御したい

- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 03:35 AM
(English follows Japanese)
Incidentテーブルの閲覧を制限するBusiness Ruleを作っています。
① systemユーザーではない
② インタラクティブユーザーである
③ 特定のグループのメンバーではない
④ Callerではない
⑤ Watch listに入っていない
このすべての条件が満たされる場合に、「Short descriptionが「特定の名称」ではない、あるいは、空白である」Incidentが見れるようにしたいです。
①~③の条件はConditionで記載できたのですが、④~⑤がうまくいきません。
Condition:
gs.getUserName() != 'system' && gs.isInteractive() == true && gs.getUser().getMyGroups().indexOf('<特定のグループのsys_id>')==-1
Script:
(function executeRule(current, previous /*null when async*/ ) {
var QueryString1 = 'short_descriptionNOT LIKE特定の名称^ORshort_descriptionISEMPTY';
current.addQuery(QueryString1);
})(current, previous);
Condition を以下に書き換えてもうまくいきません。
gs.getUserName() != 'system' && gs.isInteractive() == true && gs.getUser().getMyGroups().indexOf('<特定のグループのsys_id>')==-1 && current.caller_id != gs.getUserID() && current.watch_list.indexOf(gs.getUserID()) == -1
どうしたら実現できるか、ご存知の方はいらっしゃいますか?
---
I am creating a Business Rule to restrict access to the Incident table.
- The user is not a system user.
- The user is an interactive user.
- The user is not a member of a specific group.
- The user is not the Caller.
- The user is not on the Watch list.
If all these conditions are met, I want users to be able to view Incidents where the “Short description” is not a “specific name” or is empty.
I was able to specify conditions for 1 to 3, but I’m having trouble with 4 and 5.
Condition:
gs.getUserName() != 'system' && gs.isInteractive() == true && gs.getUser().getMyGroups().indexOf('<specific group sys_id>') == -1
Script:
(function executeRule(current, previous /*null when async*/) {
var QueryString1 = 'short_descriptionNOT LIKE <specific name>^ORshort_descriptionISEMPTY';
current.addQuery(QueryString1);
})(current, previous);
Even when I rewrite the condition as follows, it doesn’t work:
gs.getUserName() != 'system' && gs.isInteractive() == true && gs.getUser().getMyGroups().indexOf('<specific group sys_id>') == -1 && current.caller_id != gs.getUserID() && current.watch_list.indexOf(gs.getUserID()) == -1
Does anyone know how I can achieve this?
- ラベル:
-
business rule
-
Incident
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 09:57 PM
It's not related to that business rule.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 10:04 PM
Do you know any other ideas to solve this issue?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 10:24 PM
Did the business rule logic shared by me worked fine?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 10:52 PM
No. I've edited my business rule to your second script but it does not work.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-26-2025 11:45 PM
can you share your update business rule script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader