Live Agent chat, user adds attachment but its not associated to the Interaction record, how to get and port to Associated Records?

Amego1
Tera Guru

When someone adds and attachment in the VA after connecting to a Live Agent, those attachments are not being added to the Interaction record.
How are attachment to be moved over to the associated record(s) systematically?
FYI, we were able to create a solution with Connect chat, to sync attachments. But without a hard link to the interaction record, this seems to be challenging.

1 ACCEPTED SOLUTION

Amego1
Tera Guru

I found a solution.

After the Transcript has posted, BR to:

From Interaction Record, grab the channel_metadata_document ID if the channel_metadata_table is sys_cs_conversation, then query sys_cs_conversation_task table where conversation is the value in channel_metadata_document. in While statement, if record has an attachment then query the interaction_related_record(s) that are in scope for the attachment copy, use the standard copy attachment script.  Outlined below:

var xstrCon = current.channel_metadata_document;
if (!JSUtil.nil(xstrCon)) {
var message = new GlideRecord('sys_cs_conversation_task');
message.addQuery('conversation', current.channel_metadata_document);
message.setLimit(10);
message.query();
while (message.next()) {
var xbolAtt = message.hasAttachments();
gs.print('Has Message:' + xbolAtt);
if (xbolAtt == true) {
xobjList = new GlideRecord('interaction_related_record');
xobjList.addQuery('interaction', current.sys_id);
xobjList.addNotNullQuery('task');
xobjList.setLimit(5);
xobjList.query();
while (xobjList.next()) {
GlideSysAttachment.copy('sys_cs_conversation_task', message.sys_id, xobjList.task.sys_class_name, xobjList.task.sys_id);
}
}
}
}

View solution in original post

2 REPLIES 2

Amego1
Tera Guru

I found a solution.

After the Transcript has posted, BR to:

From Interaction Record, grab the channel_metadata_document ID if the channel_metadata_table is sys_cs_conversation, then query sys_cs_conversation_task table where conversation is the value in channel_metadata_document. in While statement, if record has an attachment then query the interaction_related_record(s) that are in scope for the attachment copy, use the standard copy attachment script.  Outlined below:

var xstrCon = current.channel_metadata_document;
if (!JSUtil.nil(xstrCon)) {
var message = new GlideRecord('sys_cs_conversation_task');
message.addQuery('conversation', current.channel_metadata_document);
message.setLimit(10);
message.query();
while (message.next()) {
var xbolAtt = message.hasAttachments();
gs.print('Has Message:' + xbolAtt);
if (xbolAtt == true) {
xobjList = new GlideRecord('interaction_related_record');
xobjList.addQuery('interaction', current.sys_id);
xobjList.addNotNullQuery('task');
xobjList.setLimit(5);
xobjList.query();
while (xobjList.next()) {
GlideSysAttachment.copy('sys_cs_conversation_task', message.sys_id, xobjList.task.sys_class_name, xobjList.task.sys_id);
}
}
}
}

Kalyani28
Tera Contributor

On what table we need to write the BR