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

Ayaka KAZAMA
Giga Guru

(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.

  1. The user is not a system user.
  2. The user is an interactive user.
  3. The user is not a member of a specific group.
  4. The user is not the Caller.
  5. 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?

19件の返信19

@Ayaka KAZAMA 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Do you know any other ideas to solve this issue?

@Ayaka KAZAMA 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

No. I've edited my business rule to your second script but it does not work.

@Ayaka KAZAMA 

can you share your update business rule script?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader