map work notes from interaction to incident From "Create Incident" UI action in Agent workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2020 08:19 AM
hello
We have Create Incident UI action on interaction table in Agent Workspace.
OOB it maps couple of fields from incident to interaction, I have additional requirement to map work notes from interaction to incident.
I tried using some of below:
//inc.work_notes = current.work_notes; which is not working.
also when i used getJournalEntry(), Incident doesn't get created.
How can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2021 01:48 PM
Hello,
I'm not sure if you were able to find a solution for this, but I was able to get this to work by modifying the OOB script in the UI Action to use "inc.newRecord()" instead of "inc.initialize()". Modifications are in bold:
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(); // Replacing OOB "initialize()" with "newRecord()"
inc.newRecord();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
inc.work_notes = current.work_notes.getJournalEntry(1);
action.openGlideRecord(inc);
}
I only have it populating the Work Notes on the Incident with the most recent Work Note from the Interaction record, but you could modify this to include more entries. Hopefully this will work for you as well.
-Brandon