Copy transcript from the interaction to the Incident - Agent workspace/Agent chat

MR1
Tera Contributor

The below BR is working as expected but it's copying the transcription twice in the work notes of the incident.

 

We want copy the chat transcript from the interaction record to comments field of the related incident .

 

We have written an After BR on interaction table

Condition : Transcript is not empty

(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();

}
}

})(current, previous);

1 ACCEPTED SOLUTION

Hi,

I believe you need to change the when to run condition.

AnilLande_0-1682561801307.png

 

It will make sure to run BR only when interaction is closed. At this moment your Business rule is running every time when the transcript changes.

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

10 REPLIES 10

Asha J
Tera Contributor

I created a flow to do this and it works well.