How to copy worknotes from interaction to Request table on Agent Workspace

Black Coder
Tera Guru

I need to copy the work notes from interaction to Request when we create a request. How can I do that

2 REPLIES 2

Tushar
Kilo Sage
Kilo Sage

Hi @Black Coder 

 

I think you can use BR or Script/BR combo Include to implement this requirement.

 

Sample BR -

 

(function executeRule(current, previous /*null when async*/) {
    // Check if this is a request created from an interaction
    if (current.source == 'Interaction') {
        // Copy work notes from the interaction to the request
        current.work_notes = current.interaction.work_notes.getJournalEntry(1);
    }
})(current, previous);

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

 

 

The above code didnt help. in the agent workspace, we have two ui actions in the Interaction form to create incidents and requests. we got the requirment to copy the work notes from interaction to incident and request. 

we managed to copy the work notes to "Incidents" using below code for  "create incident" ui action

var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.u_contact_number = current.u_contact_number;
inc.location = current.u_location;
inc.short_description = current.short_description;
inc.contact_type = current.type;
inc.work_notes = current.work_notes.getJournalEntry(-1);// Copy the work notes
inc.insert();

action.openGlideRecord(inc);
}

 

But when we checked the Create request ui action it is bit difficult to add the code to copy the work notes because it redirect the user to catalog items form