---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# CriteriaEvaluator - Global

# CriteriaEvaluator - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The CriteriaEvaluator script include provides methods to implement a general-purpose criteria evaluator.

The general use pattern is to construct the class, add as many criteria as needed, then
evaluate.

## CriteriaEvaluator - addCriterion(String lhComparand, String operator, String
rhComparand) {#ariaid-title2}

Adds the criteria to be evaluated.
{#r_CE-addCriterion_S_S_S__table_vtj_t2d_pt__entry__3}

| Name | Type | Description |
|-|-|-|
| lhComparand | String | The left hand comparand. Must be a named value in the left hand values input into evaluate(). |
| operator | String | The operator. Must be one of: equals, starts with, contains, does not contain, ends with, or regex matches. |
| rhComparand | String | The right hand comparand. Can be evaluated either as one of the right hand values input to evaluate() or as a literal string. |
[Table 1. Parameters]

{#r_CE-addCriterion_S_S_S__table_vtj_t2d_pt} {#r_CE-addCriterion_S_S_S__table_wtj_t2d_pt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 2. Returns]

{#r_CE-addCriterion_S_S_S__table_wtj_t2d_pt}

## CriteriaEvaluator - evaluate(Object lhValues, String rhValues, Boolean any) {#ariaid-title3}

Evaluates the criteria.
{#r_CE-evaluate_O_S_B__table_ydl_sfd_pt__entry__3}

| Name | Type | Description |
|-|-|-|
| lhValues | Object | A hashmap of name-value pairs to evaluate the left hand comparands of the criteria. |
| rhValues | String | Optional right hand values to use instead of the literal value in evaluating the right hand comparands. |
| any | Boolean | If true, any criterion matching suffices for a true result. If false, all criteria must match for a true result. |
[Table 3. Parameters]

{#r_CE-evaluate_O_S_B__table_ydl_sfd_pt} {#r_CE-evaluate_O_S_B__table_zdl_sfd_pt__entry__2}

| Type | Description |
|-|-|
| Boolean | True if the supplied values satisfy the criteria, false otherwise. |
[Table 4. Returns]

{#r_CE-evaluate_O_S_B__table_zdl_sfd_pt}

