- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 07:12 AM
Hi All,
In below notes i am trying to copy worknotes from change request to remediation task table, but i am getting worknotes in next line, which i want on the same line like below
worknotes: ABC
Now i am getting for below code
worknotes:
ABC
var rtask = new GlideRecord('sn_vul_vulnerability');
rtask.addQuery('sys_id', current.parent);
rtask.query();
if(rtask.next()){
var onlywn = current.work_notes.getJournalEntry(1).match(/\n.*/gm).join("\n");
rtask.work_notes = "Change " + current.number + " has been cancelled.\n" + " Work notes: "+ onlywn ;
if(rtask.state != '1')
rtask.state = '2';
rtask.update();
}
Much appreciated your help in this context.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 08:53 AM
Hi, please replace
rtask.work_notes = "Change " + current.number + " has been cancelled.\n" + " Work notes: "+ onlywn ;
with
rtask.work_notes = "Change " + current.number + " has been cancelled.\n" + " Work notes: "+ onlywn.replace(/^\n+/, "");
and test again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 09:14 AM
Hi @Gayathri5 ,
Use below Line to print worknote :-
rtask.work_notes ="Change " +current.number + " has been cancelled.\n" + "Work notes: "+ onlywn.replace(/\n/g, "")