Background Script to check the length of a short description of 100 incidents at one Shot:

hussain h1
Tera Contributor

Hi All,

I wanted to Run a background script where I need to check the short description which has exact length =100 for all incidents.

Kindly suggest on this.

Regards,

Hussain

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Hi,



Please run this script.



var inc = new GlideRecord('incident');


inc.query();


while(inc.next()){


  if(inc.short_description.toString().length == 100){


    gs.print(inc.number);


}


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

7 REPLIES 7

Anurag Tripathi
Mega Patron
Mega Patron

Hi Hussain,



We can write that script but i would like to understand what exactly are you trying to identify?? what is the business case here?



-Anurag


-Anurag

Alikutty A
Tera Sage

Hi,



Please run this script.



var inc = new GlideRecord('incident');


inc.query();


while(inc.next()){


  if(inc.short_description.toString().length == 100){


    gs.print(inc.number);


}


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Just a word of caution here...in the OOB vanilla instance the length of short_description field is 80 chars and not 100.


-Anurag

I do see 160 as default in my instance. I believe the script is for one time purpose for validating.



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response