---
sourceDocument: Zurich API Reference
sourceDocumentLink: https://www.servicenow.com/docs/r/zurich/api-reference

 Release :

    - zurich

ft:locale :

    - en-US

ft:publication_title :

    - Zurich API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideQueryCondition - Scoped

# GlideQueryCondition - Scoped {#ariaid-title1}

* Release version: Zurich
* 
* Updated July 31, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 10 minutes to read

The scoped GlideQueryCondition API provides additional `AND` or `OR` conditions that can be added to the current condition, allowing you to build complex queries.  
Build complex queries such as:

    category='hardware' OR category='software' AND priority='2' AND priority='1'

In the case of addCondition(), an implied `AND` is added.  
This class has no constructor. A GlideQueryCondition object is returned by the following methods:

* addActiveQuery()
* addInactiveQuery()
* addJoinQuery()
* addNotNullQuery()
* addNullQuery()
* addQuery()
{#c_GlideQueryConditionScopedAPI__ul_xyz_nsg_qz}

If there is a complicated set of `AND` and `OR` queries, a single encoded query containing all conditions simplifies the query creation. To simplify the query creation, create a query in a list view,
right-click the query, and select Copy query. It creates a single encoded query string to return your result set. Use that string as a parameter in an addEncodedQuery() call.

Always test queries on a
sub-production instance prior to deploying them on a production instance. An incorrectly
constructed encoded query, such as including an invalid field name, produces an invalid
query. When the invalid query is run, the invalid part of the query condition is dropped,
and the results are based on the valid part of the query, which may return all records from
the table. Using an insert(), update(),
deleteRecord(), or deleteMultiple() method on bad
query results can result in data loss.

You can set the glide.invalid_query.returns_no_rows system property to true to have queries with invalid encoded queries return no records. In some cases, the query may still
return records in API results even when glide.invalid_query.returns_no_rows is set to true. This happens in queries where an invalid query term is used with a WHERE operator. In such queries, the WHERE
operator ignores the invalid term(s) but still interprets and returns the rest of the query statement. For more information about this system property and its functionality, see [Available system properties](https://www.servicenow.com/docs/access?context=r_AvailableSystemProperties&version=zurich&pubname=zurich-platform-administration&ft:locale=en-US).

## GlideQueryCondition - addCondition(String name, String oper, Object value) {#ariaid-title2}

Adds an AND condition to the current condition.
{#r_ScopedGlideQueryConditionAddCondition__table_vy2_525_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of a field. |
| oper | String | Optional. The operator for the query. If you do not specify an operator, the condition uses an equals operator. |
| value | Object | Value to query on. |
[Table 1. Parameters]

{#r_ScopedGlideQueryConditionAddCondition__table_vy2_525_jq}  
{#r_ScopedGlideQueryConditionAddCondition__table_mxx_f5b_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | Reference to a GlideQueryConditon that was added to the glide record. |
[Table 2. Returns]

{#r_ScopedGlideQueryConditionAddCondition__table_mxx_f5b_2r}  

    var now_GR = new GlideRecord('incident');
    var qc = now_GR.addQuery('category', 'Hardware');
    qc.addCondition('category', 'Network');
    now_GR.addQuery('number','INC0000003');
    now_GR.next();
    now_GR.number;
    gs.info(now_GR.getEncodedQuery());

## GlideQueryCondition - addOrCondition(String name, String oper, Object value) {#ariaid-title3}

Appends a two-or-three parameter OR condition to an existing
GlideQueryCondition.
addOrCondition() works in conjunction with any of the [addQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#r_ScopedGlideRecordAddQuery_String_String_Object "Provides the ability to build a request, which when executed, returns the rows from the specified table, that match the request.") methods to `OR` the specified query parameters to the query previously
constructed using addQuery().

addOrCondition() is typically called with three parameters; table field,
operator, and comparison value. It can be called with only two parameters, table field and
comparison value, such as `qc.addOrCondition('category', 'software');`. The
operator in this case is assumed to be "equal to".  
{#r_ScopedGlideQueryConditionAddOrCondition__table_vy2_525_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Field name |
| oper | String | (Optional) Query operator. The available values are dependent on the data type of the <var class="keyword varname">value</var> parameter. Numbers: * = * != * \> * \>= * \< * \<= {#r_ScopedGlideQueryConditionAddOrCondition__ul_qyb_rbt_3y} Strings (must be in upper case): * = * != * IN * STARTSWITH * ENDSWITH * CONTAINS * DOESNOTCONTAIN {#r_ScopedGlideQueryConditionAddOrCondition__ul_egz_vbt_3y} |
| value | Object | Value on which to query (not case-sensitive). Note: All passed in arrays must contain a minimum of two elements. Single element arrays are not supported. |
[Table 3. Parameters]

{#r_ScopedGlideQueryConditionAddOrCondition__table_vy2_525_jq}  
{#r_ScopedGlideQueryConditionAddOrCondition__table_w2h_w2c_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | A reference to a GlideQueryConditon that was added to the GlideRecord. |
[Table 4. Returns]

{#r_ScopedGlideQueryConditionAddOrCondition__table_w2h_w2c_2r}  

    var now_GR = new GlideRecord('incident');
    var qc = now_GR.addQuery('category', 'Hardware');
    qc.addOrCondition('category', 'Network');
    now_GR.addQuery('number','INC0000003');
    now_GR.next();
    now_GR.number;
    gs.info(now_GR.getEncodedQuery());

To group AND/OR statements to make complex queries, such as "All incidents with a (state
less than 3 OR greater than 5) AND (priority is 1 OR priority is 5)

    var myObj = new GlideRecord('incident');
    var q1 = myObj.addQuery('state', '<', 3);
    q1.addOrCondition('state', '>', 5);
    var q2 = myObj.addQuery('priority', 1);
    q2.addOrCondition('priority', 5);
    myObj.query();

## GlideQueryCondition - addSystemCondition(String name, String oper, Object value) {#ariaid-title4}

Adds an AND condition to the current condition.
Use this method to bypass query access.
Use this method when system-level access is intended, so that query ACL enforcement is explicitly bypassed for the user. Use [addUserCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addUserCondition_S_S_O "Adds an AND condition to the current condition. Use this method to enforce query access based on the user.")
to enforce query access.  
Additional methods for system-level access that bypass query ACL checks:

* [addSystemOrCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addSystemOrCondition_S_O_O "Appends a two-or-three parameter OR condition to an existing GlideQueryCondition. Use this method to bypass query access.")
* [GlideRecord - addSystemEncodedQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemEncodedQuery_S "Adds a query using an encoded query string. Use this method to bypass query access.")
* [GlideRecord - addSystemOrderBy()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemOrderBy_S "Specifies an orderBy column. Use this method to bypass query access.")
* [GlideRecord - addSystemOrderByDesc()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemOrderByDesc_S "Specifies a descending orderBy column. Use this method to bypass query access.")
* [GlideRecord - addSystemQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table, that match the request. Use this method to bypass query access.")
{#SGQC-addSystemCondition_S_S_O__ul_znd_wlp_53c}
{#SGQC-addSystemCondition_S_S_O__table_vy2_525_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Field name |
| oper | String | (Optional) Query operator. The available values are dependent on the data type of the <var class="keyword varname">value</var> parameter. If you do not specify an operator, the condition uses an equals operator. Numbers: * = * != * \> * \>= * \< * \<= {#SGQC-addSystemCondition_S_S_O__ul_qyb_rbt_3y} Strings (must be in upper case): * = * != * IN * STARTSWITH * ENDSWITH * CONTAINS * DOESNOTCONTAIN {#SGQC-addSystemCondition_S_S_O__ul_egz_vbt_3y} |
| value | Object | Value on which to query (not case-sensitive). Note: All passed in arrays must contain a minimum of two elements. Single element arrays are not supported. |
[Table 5. Parameters]

{#SGQC-addSystemCondition_S_S_O__table_vy2_525_jq} {#SGQC-addSystemCondition_S_S_O__table_mxx_f5b_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | A reference to a GlideQueryConditon that was added to the GlideRecord. |
[Table 6. Returns]

{#SGQC-addSystemCondition_S_S_O__table_mxx_f5b_2r}  
To group AND statements to make complex queries, such as getting 20 incidents with a (state less than 3 AND not 2) and (priority is greater than 1 AND priority is not 5).

    var myObj = new GlideRecord('incident');
    var q1 = myObj.addSystemQuery('state', '<', 3);
    q1.addSystemCondition('state', '!=', 2);
    var q2 = myObj.addSystemQuery('priority', '>', 1);
    q2.addSystemCondition('priority', '!=', 5);
    myObj.setLimit(20);
    myObj.query();

    while (myObj.next()) {
      gs.info('Incident: ' + myObj.getValue('number') + ' State: ' + myObj.getValue('state') + ' Priority: ' + myObj.getValue('priority'));
    }

Output:

    Incident: INC0011238 State: 1 Priority: 4
    Incident: INC0010127 State: 1 Priority: 2
    Incident: INC0010143 State: 1 Priority: 2
    Incident: INC0011760 State: 1 Priority: 2
    Incident: INC0010708 State: 1 Priority: 3
    Incident: INC0013048 State: 1 Priority: 4
    Incident: INC0010658 State: 1 Priority: 2
    Incident: INC0012021 State: 1 Priority: 3
    Incident: INC0013308 State: 1 Priority: 4
    Incident: INC0010155 State: 1 Priority: 3
    Incident: INC0013312 State: 1 Priority: 4
    Incident: INC0013049 State: 1 Priority: 3
    Incident: INC0010068 State: 1 Priority: 4
    Incident: INC0010135 State: 1 Priority: 2
    Incident: INC0010132 State: 1 Priority: 4
    Incident: INC0010700 State: 1 Priority: 3
    Incident: INC0013311 State: 1 Priority: 2
    Incident: INC0011758 State: 1 Priority: 4
    Incident: INC0012278 State: 1 Priority: 3
    Incident: INC0013306 State: 1 Priority: 4

## GlideQueryCondition - addSystemOrCondition(String name, String oper, Object value) {#ariaid-title5}

Appends a two-or-three parameter OR condition to an existing GlideQueryCondition.
Use this method to bypass query access.
Use this method when system-level access is intended, so that query ACL enforcement is explicitly bypassed for the user. Use [addUserOrCondition](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addUserOrCondition_S_O_O "Appends a two-or-three parameter OR condition to an existing GlideQueryCondition. Use this method to enforce query access based on the user.")
to enforce query access.  
Additional methods for system-level access that bypass query ACL checks:

* [addSystemCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addSystemCondition_S_S_O "Adds an AND condition to the current condition. Use this method to bypass query access.")
* [GlideRecord - addSystemEncodedQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemEncodedQuery_S "Adds a query using an encoded query string. Use this method to bypass query access.")
* [GlideRecord - addSystemOrderBy()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemOrderBy_S "Specifies an orderBy column. Use this method to bypass query access.")
* [GlideRecord - addSystemOrderByDesc()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemOrderByDesc_S "Specifies a descending orderBy column. Use this method to bypass query access.")
* [GlideRecord - addSystemQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table, that match the request. Use this method to bypass query access.")
{#SGQC-addSystemOrCondition_S_O_O__ul_znd_wlp_53c}

The addSystemOrCondition() method works with the [GlideRecord addSystemQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addSystemQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table, that match the request. Use this method to bypass query access.") method to `OR` the specified query parameters to the query previously constructed using addSystemQuery().
{#SGQC-addSystemOrCondition_S_O_O__table_vy2_625_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Field name |
| oper | String | (Optional) Query operator. The available values are dependent on the data type of the <var class="keyword varname">value</var> parameter. If you do not specify an operator, the condition uses an equals operator. Numbers: * = * != * \> * \>= * \< * \<= {#SGQC-addSystemOrCondition_S_O_O__ul_qyb_rbt_3y} Strings (must be in upper case): * = * != * IN * STARTSWITH * ENDSWITH * CONTAINS * DOESNOTCONTAIN {#SGQC-addSystemOrCondition_S_O_O__ul_egz_vbt_3y} |
| value | Object | Value on which to query (not case-sensitive). Note: All passed in arrays must contain a minimum of two elements. Single element arrays are not supported. |
[Table 7. Parameters]

{#SGQC-addSystemOrCondition_S_O_O__table_vy2_625_jq} {#SGQC-addSystemOrCondition_S_O_O__table_w2h_w2c_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | A reference to a GlideQueryConditon that was added to the GlideRecord. |
[Table 8. Returns]

{#SGQC-addSystemOrCondition_S_O_O__table_w2h_w2c_2r}  
To group AND/OR statements to make complex queries, such as getting 20 incidents with a (state less than 3 OR greater than 5) AND (priority is 1 OR priority is 5).

    var myObj = new GlideRecord('incident');
    var q1 = myObj.addSystemQuery('state', '<', 3);
    q1.addSystemOrCondition('state', '>', 5);
    var q2 = myObj.addSystemQuery('priority', 1);
    q2.addSystemOrCondition('priority', 5);
    myObj.setLimit(20);
    myObj.query();

    while (myObj.next()) {
      gs.info('Incident: ' + myObj.getValue('number') + ' State: ' + myObj.getValue('state') + ' Priority: ' + myObj.getValue('priority'));
    }

Output:

    Incident: INC0000001 State: 7 Priority: 1
    Incident: INC0000004 State: 7 Priority: 1
    Incident: INC0000012 State: 7 Priority: 5
    Incident: INC0000013 State: 7 Priority: 1
    Incident: INC0000024 State: 7 Priority: 5
    Incident: INC0000028 State: 7 Priority: 5
    Incident: INC0000031 State: 2 Priority: 1
    Incident: INC0000057 State: 7 Priority: 5
    Incident: INC0000057 State: 2 Priority: 5
    Incident: INC0000058 State: 7 Priority: 5
    Incident: INC0000058 State: 2 Priority: 5
    Incident: INC0000059 State: 7 Priority: 5
    Incident: INC0000060 State: 7 Priority: 5
    Incident: INC0000061 State: 7 Priority: 5
    Incident: INC0000062 State: 7 Priority: 5
    Incident: INC0000064 State: 7 Priority: 5
    Incident: INC0000065 State: 7 Priority: 5
    Incident: INC0000066 State: 7 Priority: 5
    Incident: INC0000069 State: 7 Priority: 5
    Incident: INC0000072 State: 7 Priority: 5

## GlideQueryCondition - addUserCondition(String name, String oper, Object value) {#ariaid-title6}

Adds an AND condition to the current condition.
Use this method to enforce query access based on the user.
This method returns only records that the current user has query access to (based on ACLs).  
Related methods:

* [addCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#r_ScopedGlideQueryConditionAddCondition "Adds an AND condition to the current condition.") provides the same functionality without ACL enforcement.
* [addSystemCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addSystemCondition_S_S_O "Adds an AND condition to the current condition. Use this method to bypass query access.") bypasses query access checks.
{#SGQC-addUserCondition_S_S_O__ul_i2h_csq_53c}  
Additional methods for enforcing query ACL checks:

* [addUserOrCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addUserOrCondition_S_O_O "Appends a two-or-three parameter OR condition to an existing GlideQueryCondition. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserEncodedQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserEncodedQuery_S "Adds a query using an encoded query string. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserOrderBy()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserOrderBy_S "Specifies an orderBy column. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserOrderByDesc()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserOrderByDesc_S "Specifies a descending orderBy column. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table that match the request. The calling user must have access to perform the specified query operation on the field for this request to be added. Use this method to enforce query access based on the user.")
{#SGQC-addUserCondition_S_S_O__ul_znd_wlp_53c}
{#SGQC-addUserCondition_S_S_O__table_vy2_525_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Field name |
| oper | String | (Optional) Query operator. The available values are dependent on the data type of the <var class="keyword varname">value</var> parameter. If you do not specify an operator, the condition uses an equals operator. Numbers: * = * != * \> * \>= * \< * \<= {#SGQC-addUserCondition_S_S_O__ul_qyb_rbt_3y} Strings (must be in upper case): * = * != * IN * STARTSWITH * ENDSWITH * CONTAINS * DOESNOTCONTAIN {#SGQC-addUserCondition_S_S_O__ul_egz_vbt_3y} |
| value | Object | Value on which to query (not case-sensitive). Note: All passed in arrays must contain a minimum of two elements. Single element arrays are not supported. |
[Table 9. Parameters]

{#SGQC-addUserCondition_S_S_O__table_vy2_525_jq} {#SGQC-addUserCondition_S_S_O__table_w2h_w2c_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | A reference to a GlideQueryConditon that was added to the GlideRecord. |
[Table 10. Returns]

{#SGQC-addUserCondition_S_S_O__table_w2h_w2c_2r}  
To group AND statements to make complex queries, such as getting 20 incidents with a (state less than 3 AND not 2) and (priority is greater than 1 AND priority is not 5).

    var myObj = new GlideRecord('incident');
    var q1 = myObj.addUserQuery('state', '<', 3);
    q1.addUserCondition('state', '!=', 2);
    var q2 = myObj.addUserQuery('priority', '>', 1);
    q2.addUserCondition('priority', '!=', 5);
    myObj.setLimit(20);
    myObj.query();

    while (myObj.next()) {
      gs.info('Incident: ' + myObj.getValue('number') + ' State: ' + myObj.getValue('state') + ' Priority: ' + myObj.getValue('priority'));
    }

Output:

    Incident: INC0011238 State: 1 Priority: 4
    Incident: INC0010127 State: 1 Priority: 2
    Incident: INC0010143 State: 1 Priority: 2
    Incident: INC0011760 State: 1 Priority: 2
    Incident: INC0010708 State: 1 Priority: 3
    Incident: INC0013048 State: 1 Priority: 4
    Incident: INC0010658 State: 1 Priority: 2
    Incident: INC0012021 State: 1 Priority: 3
    Incident: INC0013308 State: 1 Priority: 4
    Incident: INC0010155 State: 1 Priority: 3
    Incident: INC0013312 State: 1 Priority: 4
    Incident: INC0013049 State: 1 Priority: 3
    Incident: INC0010068 State: 1 Priority: 4
    Incident: INC0010135 State: 1 Priority: 2
    Incident: INC0010132 State: 1 Priority: 4
    Incident: INC0010700 State: 1 Priority: 3
    Incident: INC0013311 State: 1 Priority: 2
    Incident: INC0011758 State: 1 Priority: 4
    Incident: INC0012278 State: 1 Priority: 3
    Incident: INC0013306 State: 1 Priority: 4

## GlideQueryCondition - addUserOrCondition(String name, String oper, Object value) {#ariaid-title7}

Appends a two-or-three parameter OR condition to an existing GlideQueryCondition.
Use this method to enforce query access based on the user.
This method returns only records that the current user has query access to (based on ACLs).

The addUserOrCondition() method works with the [GlideRecord addUserQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table that match the request. The calling user must have access to perform the specified query operation on the field for this request to be added. Use this method to enforce query access based on the user.") method to `OR` the specified query parameters to the query previously constructed using addUserQuery().  
Related methods:

* [addOrCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#r_ScopedGlideQueryConditionAddOrCondition "Appends a two-or-three parameter OR condition to an existing GlideQueryCondition.") provides the same functionality without ACL enforcement.
* [addSystemOrCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addSystemOrCondition_S_O_O "Appends a two-or-three parameter OR condition to an existing GlideQueryCondition. Use this method to bypass query access.") bypasses query access checks.
{#SGQC-addUserOrCondition_S_O_O__ul_i2h_csq_53c}  
Additional methods for enforcing query ACL checks:

* [addUserCondition()](https://www.servicenow.com/docs/p8pf24IAVAq3SSy2Fpgcvw#SGQC-addUserCondition_S_S_O "Adds an AND condition to the current condition. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserEncodedQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserEncodedQuery_S "Adds a query using an encoded query string. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserOrderBy()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserOrderBy_S "Specifies an orderBy column. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserOrderByDesc()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserOrderByDesc_S "Specifies a descending orderBy column. Use this method to enforce query access based on the user.")
* [GlideRecord - addUserQuery()](https://www.servicenow.com/docs/XnhzR4LTwK_VVBTm5Iii4g#SGR-addUserQuery_S_O_O "Provides the ability to build a request, which when executed, returns the rows from the specified table that match the request. The calling user must have access to perform the specified query operation on the field for this request to be added. Use this method to enforce query access based on the user.")
{#SGQC-addUserOrCondition_S_O_O__ul_znd_wlp_53c}
{#SGQC-addUserOrCondition_S_O_O__table_vy2_625_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Field name |
| oper | String | (Optional) Query operator. The available values are dependent on the data type of the <var class="keyword varname">value</var> parameter. If you do not specify an operator, the condition uses an equals operator. Numbers: * = * != * \> * \>= * \< * \<= {#SGQC-addUserOrCondition_S_O_O__ul_qyb_rbt_3y} Strings (must be in upper case): * = * != * IN * STARTSWITH * ENDSWITH * CONTAINS * DOESNOTCONTAIN {#SGQC-addUserOrCondition_S_O_O__ul_egz_vbt_3y} |
| value | Object | Value on which to query (not case-sensitive). Note: All passed in arrays must contain a minimum of two elements. Single element arrays are not supported. |
[Table 11. Parameters]

{#SGQC-addUserOrCondition_S_O_O__table_vy2_625_jq} {#SGQC-addUserOrCondition_S_O_O__table_w2h_w2c_2r__entry__2}

| Type | Description |
|-|-|
| GlideQueryCondition | A reference to a GlideQueryConditon that was added to the GlideRecord. |
[Table 12. Returns]

{#SGQC-addUserOrCondition_S_O_O__table_w2h_w2c_2r}  
To group AND/OR statements to make complex queries, such as getting 20 incidents with a (state less than 3 OR greater than 5) AND (priority is 1 OR priority is 5).

    var myObj = new GlideRecord('incident');
    var q1 = myObj.addUserQuery('state', '<', 3);
    q1.addUserOrCondition('state', '>', 5);
    var q2 = myObj.addUserQuery('priority', 1);
    q2.addUserOrCondition('priority', 5);
    myObj.setLimit(20);
    myObj.query();

    while (myObj.next()) {
      gs.info('Incident: ' + myObj.getValue('number') + ' State: ' + myObj.getValue('state') + ' Priority: ' + myObj.getValue('priority'));
    }

Output:

    Incident: INC0000001 State: 7 Priority: 1
    Incident: INC0000004 State: 7 Priority: 1
    Incident: INC0000012 State: 7 Priority: 5
    Incident: INC0000013 State: 7 Priority: 1
    Incident: INC0000024 State: 7 Priority: 5
    Incident: INC0000028 State: 7 Priority: 5
    Incident: INC0000031 State: 2 Priority: 1
    Incident: INC0000057 State: 7 Priority: 5
    Incident: INC0000057 State: 2 Priority: 5
    Incident: INC0000058 State: 7 Priority: 5
    Incident: INC0000058 State: 2 Priority: 5
    Incident: INC0000059 State: 7 Priority: 5
    Incident: INC0000060 State: 7 Priority: 5
    Incident: INC0000061 State: 7 Priority: 5
    Incident: INC0000062 State: 7 Priority: 5
    Incident: INC0000064 State: 7 Priority: 5
    Incident: INC0000065 State: 7 Priority: 5
    Incident: INC0000066 State: 7 Priority: 5
    Incident: INC0000069 State: 7 Priority: 5
    Incident: INC0000072 State: 7 Priority: 5


