Attachments attached from Chat Live agent from Portal is not attached to HR case created during Live chat

Yashaswini
Tera Expert

Attachments attached from Chat Live agent from Portal is not attached to HR case created during Live chat. We could see a message "User has uploaded a file" in activity stream of HR case, but attachment is not visible.

Thanks in advance.

 

3 REPLIES 3

ryan_pope
Mega Guru

We had to write a business rule on the "interaction_related_record" table to map attachments from the chat session to the end ticket. Here's the conditions for the BR:
find_real_file.png

You'll probably need to just updated the Document table condition to point to the HR Case table (I use Live Agent for ITSM, not HRSD). And here is the script:

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

    //Copy attachments from chat to related record
    var message = new GlideRecord('live_message');
    message.addQuery('group.name', 'CONTAINS', current.interaction.number);
    message.addQuery('has_attachments', true);
    message.query();
    while (message.next()) {
        GlideSysAttachment.copy(message.sys_class_name, message.getUniqueValue(), current.document_id.sys_class_name, current.document_id.sys_id);
    }

    //Copy transcript from interaction to related record
    var interaction = new GlideRecord('interaction');
    interaction.addQuery('number', current.interaction.number);
    interaction.query();

    while (interaction.next())
        if (interaction.transcript) {
            var transcript = interaction.transcript;
            var relRecord = new GlideRecord('task');
            relRecord.addQuery('sys_id', current.document_id.sys_id);
            relRecord.query();

            while (relRecord.next()) {
                relRecord.work_notes.setJournalEntry(transcript);
                relRecord.update();
            }

        }
})(current, previous);

Thanks Ryan, this helped me in getting the attachments to the task that gets created. I did it slightly different on the interaction table but this helped me a lot so a big thank you!!! 🙂

Yen

Yashaswini
Tera Expert

interaction_related_record" table does not contain HR cases. The live chats are updated to chat Queue Entry table. But unable to establish relation between chat Queue Entry table and Live message table.

Is there any other way?

 

Thanks,