休息 API 被选中 layout/view

Rest API to get selected layout/view

在具有视图(如案例、客户自助服务等)的 CSM 联系人中。如何通过 Rest API 识别用户当前在联系人中选择的视图(例如,如果用户当前使用 "Customer Self Service"。我需要知道客户确切选择的视图)。

请提供详细信息。否则请为此建议替代方法。这将有助于 us.Thanks!

找参考SS,

您要查询的table是sys_user_preference.

您要查询的首选项是:<table_name>_list.view - 我不确定联系人 table 的内部名称是什么(尝试 "contact"),但对于事件table 是 "incident",所以我会告诉你。

休息 API 到:

https://your-instance.service-now.com/api/now/table/sys_user_preference?sysparm_query=name=incident_list.view

您应该会收到带有 JSON 正文的回复。如果您使用 result[0].value 键,您应该找到视图的显示名称。请注意,这仅在 API 由想要了解自己偏好的用户执行时才有效。

或者,您可以创建一个脚本化的 REST API,它使用以下 JS 来查找他们的偏好:

var user = gs.getUser(); // get our user object
user = gs.getUserById('<their sys id>'); // get the user object we want the preference of
var pref = user.getPreference('incident_list.view');

return pref;

然而,这必须由具有读取所请求用户权限的权限的用户执行。