JOB NAME THAT RUN TO IMPORT MS CHAT INTO sn_tcm_collab_hook_ms_teams_chat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 08:19 AM
Hello. I have been searching for the job name that updates the sn_tcm_collab_hook_ms_teams_chat for chat history. I only have the default chat configuration currently in place and the documentation said it will update the sn_tcm_collab_hook_ms_teams_chat table every 30 minutes when a new chat comes in via MS team. However, I don't see my sn_tcm_collab_hook_ms_teams_chat table getting updated by the chat message that occurred in the MS Team side. Is there a job that runs to import chat message from MS Team to sn_tcm_collab_hook_ms_teams_chat?
- Labels:
-
Architect

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 10:41 AM
Hi @rick5050 . Thank you for the response. We are in Utah Patch 3 and MS Team Version is shown in the second screenshot. The first screenshot did not show the "MS Teams Chat Import" job. Am I going to find this in another place?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 08:48 AM - edited 03-20-2024 08:49 AM
This is how it works:
1. Every 30 mins ServiceNow checks for new updates in Teams and any new chat entries will be saved in the 'sn_tcm_collab_hook_ms_teams_chat' table if 'Auto Import' is set to 'true' for that Document ID (record)
2. Whenever a new chat is created, Business Rule 'Auto Import Chat SubFlow' which is of type Async will kick off and the chat will be imported by this Subflow 'Auto Import Messages Subflow' (make sure this is Active and Published)
Link to view the 'Auto Import Messages Subflow' that are in 'waiting' state:
https://<instance-name>.service-now.com/sys_flow_context_list.do?sysparm_query=sys_created_onONToday%40javascript%3Ags.beginningOfToday()%40javascript%3Ags.endOfToday()%5Ename%3DAuto%20Import%20Messag
3. Auto-import functionality is applicable by default for the following tables:
- HR Core task (sn_hr_core_task)
- HR Life events Case (sn_hr_le_case)
- HR Core case (sn_hr_core_case)
- Request Item (sc_req_item)
- Task (sc_task)
- Incident (incident)
- Request (sc_request)
- Change request (change_request)
you can add any other table by creating a new chat config record.
4. For this to work you will also need an entry under Chat Administration > Chat Configuration. this needs to be active and Auto Import set to true:
Note:
The system imports a maximum of 500 active chats in a 30-minute interval.
If there are more than active 500 chats the system will not auto-import the new chat records for the 30-minute interval.
The system executes a maximum of 10,000 sub-flows to import the chats for an interval of 30 minutes, 1 hour, 2 hour, 4-hour, 8-hour intervals. This is a count of all the active subflows that auto-import the messages into ServiceNow.
If the system reaches the limit, a message is displayed to the agent that the system level is reached and the chat can’t be auto imported on the Start Microsoft Teams Chat modal.
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 06:43 AM
If the system reaches the limit, does it retry importing chats it could not import when the next job instance is executed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 12:42 PM
As previous poster mentioned. The import is every 30 minutes OR when the associated task record is active=false.
Alternatively you can force it by triggering the Auto Import Messages Subflow with you chat record sys_id. Sample trigger script taken from the "create snippet" feature of Flow Designer.
(function() {
var chatrec = new GlideRecord('sn_tcm_collab_hook_ms_teams_chat');
if (chatrec.get('fb157df5474f2a5086b00faa216d438e')) { // sys_id of chat record
try {
// Look up the full sys_user GlideRecord
var userGR = new GlideRecord('sys_user');
if (!userGR.get(chatrec.getValue('initiated_by'))) {
gs.error('Could not find user with sys_id: ' + chatrec.getValue('initiated_by'));
return;
}
var inputs = {
chat_id: chatrec.getValue('chat_id'), // String
initiated_by: userGR, // Full GlideRecord from sys_user
latest_message_id: chatrec.getValue('latest_message_id'), // String
wait_duration: '', // Duration
execution_count: '' // Integer
};
// Execute Synchronously
var result = sn_fd.FlowAPI.getRunner()
.action('sn_tcm_collab_hook.auto_import_messages')
.inForeground()
.withInputs(inputs)
.run();
var outputs = result.getOutputs();
var status = outputs['status'];
gs.info('Flow completed with status: ' + status);
} catch (ex) {
gs.error('Exception: ' + ex.getMessage());
}
} else {
gs.warn('Chat record not found.');
}
})();