- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2020 11:35 AM
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
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- 5,879 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 06:23 AM
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);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2021 08:03 AM
No, it didn't work for me as a business rule. It did, however, work when I edited the UI Action to Create Incident from Interaction. I also added a u_interaction field on the incident table.
var canCreateIncident = false;
if ((current.isNewRecord() && current.canCreate()) || (!current.isNewRecord() && current.canWrite()))
canCreateIncident = current.update();
else
canCreateIncident = true;
if (canCreateIncident) {
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
inc.cmdb_ci = current.u_ci;
inc.u_interaction = current.sys_id;
inc.work_notes = current.work_notes.getJournalEntry(-1);
//record inserted to incident table
inc.insert();
GlideSysAttachment.copy('interaction', current.sys_id, 'incident', inc.sys_id);
action.openGlideRecord(inc);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2021 04:32 PM
Thanks, this worked for me!
Added it to the UI Action instead of a BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 06:30 AM
How can we modify this for request table because I have to copy the work notes from interaction to requests
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2021 09:21 PM
Hi,
I tried your code and couldnt get it working.
When opening a Interaction, then creating a new Incident from the Interaction it doesnt copy over any fields.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 02:59 AM
This one works like a charm. Thanks! (Rome)