Notifications

8 views

Description

This article explains how to create connect support chat conversation off of an existing incident with a chat agent.

Instructions

Create a UI action called "Chat" on the Incident table with the following script

function chatRedirect() {
var queueID = 'b05cfd27d70122004f1e82285e61038d'; //sys_id of the chat queue you need to redirect to
location.href = '/$chat_support.do?queueID='+ queueID +'&fromTable=incident&fromSysID='+ g_form.getUniqueValue();
}

Create an after insert business rule on the chat_queue_entry table with When to Run condition Selected as ' From Type' is 'Incident' and following script.

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

var inc = current.from_id.getRefRecord();

var groupID = current.getValue('group');

var profileID = '';

var linkUrl = "/incident.do?sys_id="+inc.getUniqueValue();

var linkName = inc.number+': '+inc.short_description;

var msg = "@L["+linkUrl+"|"+linkName+"]";

var grProfile = new GlideRecord('live_profile');

grProfile.addQuery('name', 'Cloud Support');

grProfile.addQuery('document', current.getUniqueValue());

grProfile.query();

if (grProfile.next()) {

profileID = grProfile.getUniqueValue();

}

var data = {

message: msg,

group_id: groupID,

from_profile: profileID

};

//add link if we have a valid one

if (linkUrl) {

data.links = [

{short_description: linkName, url: linkUrl}

];

}

var output = JSON.stringify(data, null, 4);

gs.log(output);

return new LiveFeedMessage().postMessage(data);

})(current, previous);

 

Additional Information

Click on the Chat UI action and it will redirect you to the connect support page. Enter some text and hit "Send" in the support conversation. You will see a connect support conversation created with a connect card displaying incident details.

Article Information

Last Updated:2019-09-19 18:03:47
Published:2019-09-20