Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to find the list of records whose character length has exceeded 80 from question choice table

Suvetha S
Tera Contributor

Hi All,

 

We have to fetch the list of records from the question_choice table whose length exceeded 80. Please help with the fix script

2 ACCEPTED SOLUTIONS

Saurav11
Kilo Patron
Kilo Patron

Hello

 

Please use the below script

 

var inc = new GlideRecord('question_chooce');

inc.query();

while(inc.next()){

  if(inc.replacethefieldnamewhichyouwanttocompare.toString().length > 80){

    gs.print(inc.sys_id);

}

}

 

Please mark answer my answer as correct based on impact 

View solution in original post

Pavankumar_1
Mega Patron

Hi @Suvetha S ,

Try below script

var grch = new GlideRecord('question_choice');
grch.query();
while(grch.next()){
  if(grch.text.toString().length > 80){
    gs.info(grch.sys_id);
}
}

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

3 REPLIES 3

Saurav11
Kilo Patron
Kilo Patron

Hello

 

Please use the below script

 

var inc = new GlideRecord('question_chooce');

inc.query();

while(inc.next()){

  if(inc.replacethefieldnamewhichyouwanttocompare.toString().length > 80){

    gs.print(inc.sys_id);

}

}

 

Please mark answer my answer as correct based on impact 

Pavankumar_1
Mega Patron

Hi @Suvetha S ,

Try below script

var grch = new GlideRecord('question_choice');
grch.query();
while(grch.next()){
  if(grch.text.toString().length > 80){
    gs.info(grch.sys_id);
}
}

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Suvetha S
Tera Contributor

Thank you both