addUserQuery(fieldName, op, value)

Helper method to append to encoded query in a more functional way. Instead of building a String and adding with addEncodedQuery, a user can append to the query by providing parameters like addQuery('name', 'STARTSWITH', 'john').

Extends the same functionality as the addQuery() method. However, there are stricter ACL enforments on the query. Good for testing in lower instances.

Parameters:

  • fieldName: String
  • op: Option
  • value: String

Returns: String

Returns the encoded query equivalent to what was provided in the methods parameters. Seems to be a bit unrelyable, see example...

Mutates Self?

Yes, the GlideRecord's internal encoded query will be modified.

Operators

Number Operators

  • =: Equals
  • !=: Does not equal
  • >: Greater than
  • >=: Greater than or equal to
  • <: Less than
  • <=: Less than or equal to

String Operators

  • =: Equals
  • !=: Does not equal
  • STARTSWITH: Any String that starts with
  • ENDSWITH: Any String that ends with
  • CONTAINS: Any String that contains
  • LIKE: Any String that contains
  • DOES NOT CONTAIN: Any String that does not contain
  • NOT LIKE: Any String that does not contain
  • IN: Any string that is equal to one of the comma delimited Strings within
  • NOT IN: Any string that is not equal to one of the comma delimited Strings within
  • INSTANCEOF: Any record that is a child class of the class provided in

Examples:

Script

var userGr = new GlideRecord('sys_user');
gs.print(userGr.addUserQuery('name', 'CONTAINS', 'john'));
gs.print(userGr.getEncodedQuery());

Output

nameLIKEjohn
nameCONTAINSjohn