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

Ankur Bawiskar
Tera Patron
Tera Patron

@Chaitanya Kantipudi 

There is already BR to append the Transcript on interaction table

When interaction is closed it does copy

Please check that once.

BR Name: Append Chat Transcript

URL: https://instanceName.service-now.com/nav_to.do?uri=sys_script.do?sys_id=ce1a06123b721300a0bd8cd834efc4b8

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

But this BR is not moving the transcript to incident work notes. It is only moving to IMS ticket.

Pranesh072
Mega Sage
Mega Sage

that will be complex i thing because you want use the transcript field, transcript is populated when interaction moved to closed state and agent will moslty create an incident during the ongoing interaction. If agent creates incident after the closing of interaction then you use a UI action to populate transcript on incident. 

Also BR will not work in this case because there is not OOB field on incident or interaction that will keep the source means you cannot identify the incident and interaction relation later. 

Nayan Mahato
Tera Guru

Hi Chaitanya Kantipudi

I wrote the below after-update BR on the interaction table and it did work. Please have a look. Thanks.

The condition of the BR should be the transcript is not empty.

*********

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

// Add your code here
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.work_notes = current.transcript + "";
inc.update();
}

}

})(current, previous);

********

Regards,

Nayan