Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Use indexOf("searchString") to find a string in a Glide list

Use indexOf("searchString") to find a string in a Glide list

Use indexOf("searchString") to return the location of the string passed into the method if the glide list field, such as a Watch list, has at least one value in it.

If the field is empty, it returns undefined. To avoid returning an undefined value, do any of the following:

  • Force the field to a string, such as: watch_list.toString().indexOf("searchString")
  • Check for an empty Glide list field with a condition before using indexOf(), such as: if (watch_list.nil() || watch_list.indexOf("searchString") == -1)

This site is scheduled for a small content update on Tuesday, December 18th, between the hours of 4:00pm and 8:00pm Pacific Time (Dec 19 00:00 – Dec 19 4:00 UTC). Access to this site may be slightly delayed during that time.