map work notes from interaction to incident From "Create Incident" UI action in Agent workspace

Nikita35
Kilo Guru

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?

 

5 REPLIES 5

Nikita35
Kilo Guru

Please find OOB UI action code:

find_real_file.png

Here I want to map the work notes as well.

Please suggest.

 

if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.short_description = current.short_description;
//inc.work_notes = current.work_notes;
//var wn = current.work_notes.getJournalEntry(-1);
//inc.work_notes = wn;
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', current.sys_id);
gr.addQuery('element', 'work_notes');
gr.query();
while(gr.next())
{
var worknote = gr.value.toString();
>>>>>gs.info("I am testing incident work notes 12" +worknote);

}
//inc.work_notes += worknote;
//gs.info("I am testing incident work notes 34" +wn);
action.openGlideRecord(inc);
}

 

Here see >>>> log correctly shows the work note but when I try to do 

inc.work_notes += worknote; or inc.work_notes = worknote; 

Incident doesn't get created from Interaction.

Is it like action.openGlideRecord(inc); doesn't support this or Am I missing something?

Developer3
Tera Expert

Hi,

I am also facing the same issue, Have you found a solution for this?

Hello

So to map worknotes, you can use getJournalEntry() to map worknotes.

But at the same time it will not map if Incident is not already created.

Hence add current.insert() to insert the incident in the same UI action "Create Incide".

But if you are using Agent workspace, this may lead you to creation of duplicate incidents.

Hope this helps.