Need to copy worknotes from incident to incident tasks

Anjaneyulu1
Giga Contributor

Hii All,

I have written script like this,

when to run - after update

condition - work notes changes

script -

var inc = new GlideRecord('incident_task');
inc.addQuery('incident.sys_id', current.sys_id);
inc.query();
while (inc.next()) {
inc.work_notes = current.work_notes.getJournalEntry(1);
inc.update();
}

my script is not working but in place of worknotes if i place comments then it is working.

i don't know why it is happening like that.

please help me where i have written mistake here.

 

1 ACCEPTED SOLUTION

Hi Anji,

I just tested again and it is working:

find_real_file.png

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

View solution in original post

20 REPLIES 20

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

Script seems fine. Is it happening only for some users or Admins as well & for all cases

Hii Jaspal, It's happening for admins also and all cases.

Hi,

I have used the same script in my PDI and it is working for me. Refer screenshot below

find_real_file.png

find_real_file.png

Can you check if you have other business rule which is restricting it. Script is working perfectly fine.

Regards,

Deepankar Mathur

Hii Mathur,

I have sorted it out but if I post worknotes in parent incident then in activity logs the worknotes message is appearing 3times in parent incident and in incident tasks worknotes is displaying correctly.

Please tell me how to sort it out.