How can I copy agent chat transcript to incident work note?

Chaitanya Kanti
Kilo Contributor

Is there any way to copy the interaction transcript to the Incident work notes? I tried the below-mentioned code in create incident UI action on interaction table and not working. And I am also trying to move the attachments attached in the chat to incident tickets. Please let me know how to solve these issues.

if(current.update()){
	var inc = new GlideRecord("incident");
	inc.initialize();
	inc.caller_id = current.opened_for;
        inc.work_notes = current.transcript;
	inc.contact_type = current.type;
	inc.short_description = current.short_description;
	action.openGlideRecord(inc);
}
13 REPLIES 13

MR1
Tera Contributor

Hi Nayan,

Thanks for your quick response.
I tried that condition and below script . Unfortunately, it didn't copy the transcript to the Incident.. Before it was getting copied twice.

(function executeRule(current, previous /*null when async*/ ) {
	var query = "document_table=incident^interaction.number=" + current.number;
var irc = new GlideRecord("interaction_related_record");
irc.addEncodedQuery(query);
irc.query();
if (irc.next()) {

var inc = new GlideRecord("incident");
if (inc.get(irc.task.sys_id)) {
inc.comments = current.transcript + "";
inc.update();
}

}
// var inc = new GlideRecord('interaction_related_record');
// inc.addQuery('interaction', current.sys_id);
// inc.addQuery('document_table', 'incident');
// inc.addQuery('type', 'task');
// inc.query();
// while (inc.next()) {
// gs.addInfoMessage("test");
// var incident = new GlideRecord('incident');
// incident.addQuery('sys_id', inc.document_id);
// incident.query();
// while (incident.next()) {
// //incident.comments = current.transcript;
// incident.comments = current.internal_transcript.toString();
// incident.update();

// }
// }

})(current, previous);

 

I got it actually my requirement was different. You please change the the BR to a "Before" BR with below conditions and make sure you close the conversation in the virtual agent. Thanks.

 

NayanMahato_0-1680652551155.png

 

Regards,

Nayan

 

 

MR1
Tera Contributor

I tried but it didn't worked.

The condition with before also didn't trigger the BR. 

Could you please make sure that you are ending the virtual agent conversation chat. You can check that on the conversation table as well. Thanks.

 

Regards,

Nayan