Copy Chat transcript from interaction to related incident

pavithrap311
Kilo Explorer

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;
incident.update();

}
}

})(current, previous);

This is not working.

Please help

Thanks

1 ACCEPTED SOLUTION

Just tried your exact code on my PDI. Only added .toString()

incident.comments = current.transcript.toString();

Works fine with .toString(), without it doesn't work.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

20 REPLIES 20

Did you ever get the issue with the duplicate entries of copying the transcript resolved?  I am having the same issue and cannot figure this out...

Any luck on what I mentioned?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

It works now

Thank you so much

Alekhya5
Tera Contributor

Hi

I tried using the same code actually it is populating the transcript in my incident but it is updating twice do anyone know the reason?

MR1
Tera Contributor

Hi Alekhya,

 

Did you find the solution for that issue?