Background script for printing the INC no.'s that ends with 0(zero)

amit71
Tera Contributor

Background script for printing the INC no.'s  that ends with 0(zero). Please guide this how to achieve.

eg: INC1234430

1 ACCEPTED SOLUTION

Ricky S Larsson
Tera Guru

You could achieve this after the query as well by using the regex test function

var gr = new GlideRecord('incident');
var regex = /[0]$/;
gr.query();
while(gr.next()){
    var endsWithZero = regex.test(gr.number);
    if(endsWithZero)
        gs.print(gr.number);
}

View solution in original post

10 REPLIES 10

That's correct. Performance wise it would be better to use conditions in the query though, which you are hinting at.