We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

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

PavanK960672992
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

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 

PavanK960672992
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