How to copy Virtual Agent conversation into an Incident

chrish5
Giga Guru

I'm trying to use the below script I found to copy the Virtual Agent conversation into the incident that was created from it.  It's copying the conversation into the incident twice and I'm not sure why.  Does anyone have any idea?  

 

(function executeRule(current, previous /*null when async*/ ) {
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()) {
var incident = new GlideRecord('incident');
incident.addQuery('sys_id', inc.document_id);
incident.query();
while (incident.next()) {
incident.comments = current.transcript.toString();
incident.update();
gs.log('Incident updated with transcript');
}
}

})(current, previous);

1 ACCEPTED SOLUTION

SatyakiBose
Mega Sage

Hello @chrish5 

Please refer to the KB article here - "Chat Transcript" in Agent chat

As per the platform design, it is not intended to copy the transcript from the interaction to the incident.

However, we have other community posts where this has been achieved via customization.

Request you to evaluate your script based on the solutions provided here:

  1. How can I copy agent chat transcript to incident work note?
  2. Copy Chat transcript from interaction to related incident
  3. Agent Chat - Copy Interaction to Incident
     
 

View solution in original post

1 REPLY 1

SatyakiBose
Mega Sage

Hello @chrish5 

Please refer to the KB article here - "Chat Transcript" in Agent chat

As per the platform design, it is not intended to copy the transcript from the interaction to the incident.

However, we have other community posts where this has been achieved via customization.

Request you to evaluate your script based on the solutions provided here:

  1. How can I copy agent chat transcript to incident work note?
  2. Copy Chat transcript from interaction to related incident
  3. Agent Chat - Copy Interaction to Incident