- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 09:52 AM
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.
Solved! Go to Solution.
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2022 11:48 AM
Hi Anji,
I just tested again and it is working:
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 11:43 PM
Hi,
This is not happening for me in my personal instance. Can you check if you have written any other BR which runs on update of work notes or you have used current.update() in a before business rule.
There is no issue with this script and the functionality you are trying to achieve. We now need to look into some other areas.
Regards,
Deepankar Mathur

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 10:28 AM
Strange.
Try below & confirm the infomessages you get.
gs.addInfoMessage('BR works');
var inc = new GlideRecord('incident_task');
inc.addQuery('incident.sys_id', current.sys_id);
inc.query();
gs.addInfoMessage(inc.getRowCount());
while (inc.next()) {
gs.addInfoMessage('Inside loop works');
inc.work_notes = current.work_notes.getJournalEntry(1);
inc.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 09:32 AM
Hii Jaspal, I have sorted it out but if I post worknotes in parent incident then in activity logs the worknotes message is appearing 2times in parent incident and in incident tasks worknotes is displaying correctly.
Please tell me how to sort it out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 09:34 AM
Can you paste the final script you using now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2022 09:35 AM