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
‎04-21-2020 12:35 PM
No updates on this as yet. Still waiting.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 03:09 PM
Hello,
Someone responded at least today, but I mean waiting 4 months and you having no success on your own?
What have you tried on your end?
Where is your question posted on the forums (your own question not piggybacking off of another thread), etc.?
Thanks...
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 02:58 PM
I believe you want to copy entire work notes of TASK1 to TASK2 when the TASK1 closes.
In this case , condition of business rule would be TASK1 state changes to close and script would be.
Please mark my answer correct/useful , if it helped you
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.getJournalEntry(-1);
// to disable businesss rules on this record we can use setwrokflow false
gr.setworkflow(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 10:09 PM
What is -1 in current.getJournalEntry(-1);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 03:55 AM
(1) is to copy the latest comment
(-1) is to copy all the comments
***Mark Correct or Helpful if it helps.***