Fix Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 09:43 PM
Display change records numbers which is in Scheduled state don't need Active records in Script.
Using Fix script but script is not working.
var gg = new GlideRecord('change_request');
gg.addQuery('state=-2');
gg.query();
while(gg.next()){
gs.print('Active change records '+ gg.number);
}
Any idea how to build above scenaior code.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 09:56 PM
Hello @Ram012 ,
If don't need Active records in Script then please try this by adding one more below query in your fix script line 3:
gg.addQuery('active', false);
Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 10:16 PM
Hello @Ram012 ,
try below script, it should work -
var gr = new GlideRecord('change_request'); // The table for change requests
gr.addEncodedQuery('state=-2'); // Filter records in the "Scheduled" state
gr.addQuery('active', false); // Exclude active records
gr.query();
while (gr.next()) {
gs.print('Change Record: ' + gr.number);
}
Please check the backend value of scheduled state.
If my answer solves your issue, please mark it as Accepted✔️ & Helpful👍!