Fix Script

Ram012
Tera Contributor

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

Dnyaneshwaree
Mega Sage

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

Vrushali  Kolte
Mega Sage

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👍!