Copy Worknotes from one task to another

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 01:45 AM
Hi Everyone,
I have this requirement where I have two catalog task in which when 1 task updated their worknotes it should reflect to the other task.
The issue is, since they are on the same table sc_task. Whenever i tried to do a gliderecord and update it will reflect back to the current updated record. Causing it to be duplicated.
My Approach is an On Before Business Rule.
with the following script:
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.request_item);
gr.addQuery("number", "!=", current.number);
gr.query();
if (gr.next()) {
gr.work_notes = current.work_notes;
gr.update();
}
Is there a way to update without causing the current record to be updated again? I already tried setworkflow(false) but its not working.
Thanks in advance!
Tadz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 01:55 AM
use after business rule
adding thread here. please refer that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 02:03 AM
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.request_item);
gr.addQuery('sys_id','!=',current.sys_id);
gr.orderByDesc('number');
gr.query();
while(gr.next())
{
gr.work_notes = current.work_notes;
gr.update();
}
Note: use After Business rule and set the condition worknotes changes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 02:15 AM
Hi TADZ,
Update code with following function:
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.request_item);
gr.addQuery("number", "!=", current.number);
gr.query();
if (gr.next()) {
gr.work_notes = current.work_notes; //Update code with gr.work_notes=current.getJournalEntry(1);
gr.update();
}
Thanks,
Bhojraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 03:19 AM
I tried but it does not working.
I believe it should be current.work_notes.getJournalEntry(1);