- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2023 02:59 AM
Hi,
Configured Start MS Teams Chat UI action with necessary setups (Requester Mapping, Close condition and Business Rules) for demands on Tokyo instance.
Recommended User list appears (in chat initiation pop-up) filled with all members of Assignment Group (from all historically assigned groups), not only the assigned to.
Could you please assist how/where to set such restriction to recommended user to:
- show (next to Submitter=requester) Assigned to only, if given
- NOT show previously assigned to users and groups
Thank you and regards,
Arpad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 02:18 AM
Custom solution followed (app.scope: Collaboration Services)
Step 1)
Extend the TABLES object (for restricted user fields of given table, in my case: dmn_demand) in MSTeamsChatRestrictedTaskParticipants Script Include:
TABLES: {
HR_CASE: {
name: 'sn_hr_core_case',
property: 'sn_now_teams_hr.chat_sn_hr_core_case_fields',
defaultValue: 'opened_for,subject_person,collaborators'
},
HR_TASK: {
name: 'sn_hr_core_task',
property: 'sn_now_teams_hr.chat_sn_hr_core_task_fields',
defaultValue: 'assigned_to'
},
DMN_DEMAND: {
name: 'dmn_demand',
property: 'sn_now_teams_dmn.chat_dmn_demand_fields',
defaultValue: 'assigned_to,u_demand_owner,submitter'
}
},
The property set above is a dummy, as defaultValue is applied in its absence.
Step 2)
As above data is also used for restriction logic in case of the global (Add) User lookup/search in the pop-up (when starting an MS Teams chat), an exemption logic was built into msteams_communication_swarm UI Page as well (beneath line 22).
if (isRestrictedTable) {
if (!(gs.getProperty('sn_tcm_collab_hook.aldi.MSTeams_unrestricted_tables_for_user_lookup').includes(table))) {
queryStr = chatUtil.getRestrictedTableContactsCondition(table, sysId);
}
}
Certainly, a sys_prop has been put in place for validating the current table (whether it is exempt from expressing such restriction logic in the queryStr).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2023 05:26 AM
Hi @Arpad Lonstak ,
You can use a GlideRecord query to retrieve the assigned to user(s) for the record and then use the sys_id(s) of the assigned to user(s) to construct a query for the user table to retrieve only those users.
Here is an example of what the modified query might look like:
var assignedTo = current.getValue('assigned_to');
var userGr = new GlideRecord('sys_user');
userGr.addQuery('sys_id', 'IN', assignedTo);
userGr.addQuery('active', true);
userGr.query();
var userList = [];
while (userGr.next()) {
userList.push(userGr.getValue('sys_id'));
}
// Excluding previously assigned users and groups
var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
gr.addQuery('sys_id', 'NOT IN', userList);
gr.addQuery('user_name', '!=', current.getValue('caller_id.user_name'));
gr.addQuery('u_teams_enabled', true);
gr.addJoinQuery('sys_user_grmember', 'user', 'sys_id', 'grmember.user');
gr.addJoinQuery('sys_user_group', 'grmember.group', 'sys_id', 'sys_user_grmember.group');
gr.addQuery('sys_user_group.name', current.assignment_group.name);
gr.setLimit(10);
gr.query();
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2023 06:33 AM - edited ‎05-10-2023 11:29 PM
Hi Ratnakar,
Thank you. However, I am not looking for a specific query, but rather the configuration item/element, where the "Recommended" user could be configured when initiating the MS Teams chat via the pre-set UI action.
I do not aim to clone or interfere with the OOTB Script Include (MSTeamsChatUtil) and related functions and methods, that handle the population of the Recommended pane (see below just an extract of the main method called):
updateSourceJounralField: function(sourceGr, chatInfo, userFieldValue, journalFieldName) {
var recommendedParticipants = this.getRecommendedParticipantsByRecord(sourceGr);
journalFieldName = journalFieldName || 'work_notes';
var userGr = new GlideRecord("sys_user");
var qc = userGr.addQuery("sys_id", userFieldValue);
qc.addOrCondition('sys_id', gs.getUserID());
userGr.query();
var userNames = [];
while (userGr.next()) {
var userId = userGr.getUniqueValue();
recommendedParticipants.forEach(function(recommendedParticipant) {
if (userId == recommendedParticipant.id)
userNames[userId] = recommendedParticipant.name;
else if (recommendedParticipant.users && Array.isArray(recommendedParticipant.users)) {
var recommendedUsers = recommendedParticipant.users;
recommendedUsers.forEach(function(recommendedUser) {
if (userId == recommendedUser.id)
userNames[userId] = recommendedUser.name;
});
}
});
}
I would like to influence the "contacts" list, that is used in deeper sections of the Script Include, BUT basically without editing the Script Include:
var contacts = [];
contacts = new sn_tcm_collab_hook.MSTeamsChatTCMParticipants().getContacts(sourceGr, contacts);
As indicated in my initial question, the Requester Mapping and Close Conditions (under ServiceNow for Microsoft Teams) are set up, but the chat recommended field is pre-populated by all members of assignment group(s), not only with the assigned to(s).
I hope I was able to clarify a bit my issue.
Kind regards, Arpad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 02:18 AM
Custom solution followed (app.scope: Collaboration Services)
Step 1)
Extend the TABLES object (for restricted user fields of given table, in my case: dmn_demand) in MSTeamsChatRestrictedTaskParticipants Script Include:
TABLES: {
HR_CASE: {
name: 'sn_hr_core_case',
property: 'sn_now_teams_hr.chat_sn_hr_core_case_fields',
defaultValue: 'opened_for,subject_person,collaborators'
},
HR_TASK: {
name: 'sn_hr_core_task',
property: 'sn_now_teams_hr.chat_sn_hr_core_task_fields',
defaultValue: 'assigned_to'
},
DMN_DEMAND: {
name: 'dmn_demand',
property: 'sn_now_teams_dmn.chat_dmn_demand_fields',
defaultValue: 'assigned_to,u_demand_owner,submitter'
}
},
The property set above is a dummy, as defaultValue is applied in its absence.
Step 2)
As above data is also used for restriction logic in case of the global (Add) User lookup/search in the pop-up (when starting an MS Teams chat), an exemption logic was built into msteams_communication_swarm UI Page as well (beneath line 22).
if (isRestrictedTable) {
if (!(gs.getProperty('sn_tcm_collab_hook.aldi.MSTeams_unrestricted_tables_for_user_lookup').includes(table))) {
queryStr = chatUtil.getRestrictedTableContactsCondition(table, sysId);
}
}
Certainly, a sys_prop has been put in place for validating the current table (whether it is exempt from expressing such restriction logic in the queryStr).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2023 09:07 AM
How can i show Specific assignment group members under recommended list. I.e
I need Assigned to, Caller and Specific group named NEC and also assignment group. The Script include is not allowing to edit any suggestions on that ?