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

Meenal Gharat
Giga Guru

Hi All,

how can we copy worknotes from Interaction to Incident on agent workspace?

I tried editing with below UI Action yet no luck, can someone help me with this.

if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
var worknotes = inc.work_notes.getJournalEntry(1);
//inc.work_notes = current.work_notes;
worknotes = current.work_notes;
action.openGlideRecord(inc);
}

 

Thank you.

Regards,

Meenal

 

1 ACCEPTED SOLUTION

Audrey Deruere
Mega Expert

Hello,

 

For those who wants the solution :

- Create a business rules on the table "interaction_related_record", before insert with order of 400 and copy this code :

(First part has been taken from another OOB business rules, it's because BR run twice on insert ....)

var existingRelationship = new GlideRecord("interaction_related_record");
existingRelationship.addQuery("interaction", current.interaction);
existingRelationship.addQuery("document_id", current.document_id);
existingRelationship.setLimit(1);
existingRelationship.query();

if (existingRelationship.next()) {
current.setAbortAction(true);
}else{
var grTask = new GlideRecord(current.document_table);
grTask.get(current.document_id);

grTask.work_notes = current.interaction.work_notes.getJournalEntry(-1);
grTask.update();

var attachment = new GlideSysAttachment();
attachment.copy('interaction', current.interaction.sys_id, current.document_table, current.document_id);
}

 

 

 

View solution in original post

22 REPLIES 22

kheller
Tera Contributor

Same problem here after upgrade to Tokyo. Did you manage to fix it ?

Black Coder
Tera Guru

Can someone help me how can we copy the work notes from interaction to request when the time we create request from interaction

kimreverman
Tera Guru

NOTE: This recommended solution does not work if you have the property "Create Incident in saved state from Interaction" set to false.  You will get an empty frame with "Record not found"

Property: com.snc.incident.create_from_interaction.save
Value: false

For a better solution of copying the interaction work notes to incident. See the incident on display business rule "Set WorkNote as created from Interaction"