- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2022 09:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2022 11:57 PM
Hi Ravi,
Refer below script (tested in background script, working as per your requirement)
var priority1Arr =[];
var updatedP3;
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.addQuery('priority',1);
inc.query();
// pulling all p1 incident sys_id
while(inc.next()){
priority1Arr.push(inc.getUniqueValue());
}
// setting those id in any P3 incident work notes
var incp3 = new GlideRecord('incident');
incp3.addActiveQuery();
incp3.addQuery('priority',3);
incp3.query();
if(incp3.next()){
updatedP3 = incp3.number;
incp3.work_notes += priority1Arr;
incp3.update();
}
gs.print("Done Updated in " + updatedP3); // getting record where all sys_id are setted
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2022 11:39 PM
Hi Ravi,
If its a one time task you can use the background script and save all the P1 incident sys_id on any P3 incident of your choice.
OR
If its based on scheduled like every week then you can use a scheduled job for this.
I hope it helps you.
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2022 11:57 PM
i want this for one time only and i used background script but it is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2022 11:57 PM
Hi Ravi,
Refer below script (tested in background script, working as per your requirement)
var priority1Arr =[];
var updatedP3;
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.addQuery('priority',1);
inc.query();
// pulling all p1 incident sys_id
while(inc.next()){
priority1Arr.push(inc.getUniqueValue());
}
// setting those id in any P3 incident work notes
var incp3 = new GlideRecord('incident');
incp3.addActiveQuery();
incp3.addQuery('priority',3);
incp3.query();
if(incp3.next()){
updatedP3 = incp3.number;
incp3.work_notes += priority1Arr;
incp3.update();
}
gs.print("Done Updated in " + updatedP3); // getting record where all sys_id are setted
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2022 12:10 AM
Hi chetan i will refer and update you.
Thanks.