- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 08:32 AM
Hi all,
I have a requirement, copy the work notes content to short description form one catalog task to another catalog task ,copy the work notes to short description form TASK1 to TASK2 and to TASK3.
please help me on this
Thanks,
karishma.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 09:54 PM
Hi
above code is to copy worknotes to another task wornotes.
try below code
var grScTask = new GlideRecord('sc_task');
grScTask.addEncodedQuery("request_item=" + current.request_item +"^sys_id!=" + current.sys_id);
grScTask.query();
while (grScTask.next()) {
grScTask.short_description = "Worknotes from " + current.number + " : " + current.work_notes.getJournalEntry(1);
grScTask.update();
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 08:40 AM
Hi,
Please try this, Only doubt is it is better to copy in description rather than in Short description as short description has character limit. Mark my answer as correct or hit like based on impact.
var gr = new GlideRecord('sc_task');
gr.addQuery('parent', current.parent.sys_id); // Get an sc_task with the same parent as the current one
gr.query();
if (gr.next()) {
current.description = gr.work_notes.getJournalEntry(-1); // Need to set the current comments not the GlideRecords
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 10:24 AM
Hi karishma
when do you want to copy the worknotes content to short description?
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2022 10:10 PM
Hi Rohila Voona,
when I close complete catalog task's, then work notes content should copy to next catalog task's description .
for example ,
Task 1 to Task 2 to Task 3,
please Help Me on this,
Karishma .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2022 02:40 AM
Write a before update BR on catalog task table
filter - state changesto complete
code:
var grScTask = new GlideRecord('sc_task');
grScTask.addEncodedQuery("request_item=" + current.request_item +"^sys_id!=" + current.sys_id);
grScTask.query();
while (grScTask.next()) {
grScTask.work_notes = "Worknotes from " + current.number + " : " + current.work_notes.getJournalEntry(1);
grScTask.update();
}
current.work_notes.getJournalEntry(-1); // -1 for all the work notes value , 1 for latest work notes value
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP