【问题标题】:Servicenow Working with ACLs and Business Rules to read Incident tableServicenow 使用 ACL 和业务规则来读取事件表
【发布时间】:2016-11-21 10:14:49
【问题描述】:

我目前正在从事一个名为“read_incident”的角色,该角色应允许 EES 用户阅读其分配组的事件。

为此我做了以下事情:

  • 创建了一个角色“read_incident”
  • 将角色分配给“服务台”组
  • 创建了一个用户“Denis”并将他添加到“Service Desk”组中
  • 使用 addorcondition 修改了查询事件业务规则,以包括我的“read_incident”角色来读取事件。 (现在您要么拥有“itil 角色”,要么拥有“read_incident”角色来读取事件。
  • 如果分配组是我的组之一,则使用动态过滤器创建 ACL 以读取事件。

现在我使用分配给“服务台”组的事件列表报告的计量器创建了一个主页。

作为管理员,我当然可以查看所有事件。但是当我冒充“丹尼斯”时,事件列表会报告以下“No records to display

所以没有什么能阻止我阅读事件,但不知何故没有数据匹配。 我尝试创建一个新事件并将其分配给“服务台”,但用户“Denis”仍然看不到此事件。

到目前为止我所知道的: - 业务规则 100% 有效,因为没有“数据被阻塞” - 我可以查询事件表

商业规则:

if (!gs.hasRole("itil").addOrCondition(!gs.hasRole("read_incident") && gs.isInteractive()) {
  var u = gs.getUserID();
  var qc = current.addQuery("caller_id", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u);
  gs.print("query restricted to user: " + u);
}

【问题讨论】:

  • 能否提供业务规则的脚本?
  • 你好乔伊,当然,我添加了我的规则。

标签: acl business-rules servicenow


【解决方案1】:

您的业务规则不正确:gs.hasRole() 方法返回 true 或 false,您不能在此处使用方法 addOrCondition()。你的if句中也有错误,需要在条件末尾加一个“)”。

尝试以下方法:

业务规则条件

(!gs.hasRole("itil") || !gs.hasRole("read_incident")) && gs.isInteractive()

脚本

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

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

})(current, previous);

如果可能,最好使用 Condition 字段,它可以提高性能。我不确定业务规则脚本是否满足您的需求,我认为您应该检查用户是否是当前 assignment_group 的成员,对吧?

【讨论】:

    猜你喜欢
    • 2014-12-26
    • 2018-01-17
    • 1970-01-01
    • 2016-09-17
    • 2018-12-26
    • 2012-01-03
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多