Configure automatic messaging in workspace chat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 06:50 AM
I need to configure sending the interaction number in the chat, as soon as it is created.
Below is a print of how it is today, the interaction number is being sent manually copy and paste.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 05:40 AM
To automatically send the interaction number in a chat as soon as it is created, you will need to modify the chat queue's script include that handles incoming chats. Here are the steps:
In the ServiceNow navigation menu, go to "System Definition" > "Script Includes."
Search for the "Chat Queue" script include and open it.
In the script include, locate the "handleNewChat" function.
Within the "handleNewChat" function, you can use the "g_chat_queue.getNextChat()" method to retrieve the interaction record for the new chat.
From the interaction record, you can retrieve the interaction number using the "getDisplayValue('number')" method.
Once you have the interaction number, you can use the "g_chat_queue.sendSystemMessage()" method to send it to the chat user.
handleNewChat: function(chat) {
var interaction = g_chat_queue.getNextChat();
var interactionNumber = interaction.getDisplayValue('number');
g_chat_queue.sendSystemMessage(chat, 'Your interaction number is: ' + interactionNumber);
// handle the rest of the chat handling logic here
}
This code retrieves the interaction record for the new chat, gets the interaction number, and sends a system message to the chat user with the interaction number.
Note that this is just an example and you will need to modify the code to fit your specific use case and any additional logic you have in your chat queue handling script. Also, make sure to test this code thoroughly in a non-production environment before deploying it to your live instance.