v_query – Scoped, Global
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API reference
The v_query API provides methods to obtain information about a scriptable object that represents a query running against a remote table.
This API requires the Remote Tables plugin (com.glide.script.vtable) to be activated. For additional information, see Retrieving external data using remote tables and scripts.
Remote table rows are created using the v_table API.
v_query - getCondition(String field)
Gets an encoded query string for the specified field.
See also v_table API.
Name | Type | Description |
---|---|---|
field | String | Name of the field. |
Type | Description |
---|---|
String | Returns an encoded query string for the given field. |
Example
The following example shows results for a field with an encoded query of
number=INC0001^active=true
.
Output:
v_query - getEncodedQuery()
Returns the query against a remote table as an encoded query string
For details, see Encoded query strings .
See also v_table API.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | The encoded query as a string. |
Example
The following example is a snippet from Retrieving specific records from a third-party source.
Output:
v_query - getParameter(String field)
Gets the value of a field in an equality query condition.
Name | Type | Description |
---|---|---|
field | String | Name of the field to be queried. |
Type | Description |
---|---|
String | Value of the field in the query condition. For example, if
name=John is the encoded query, then
getParameter("name") returns "John" . |
Example
The following example shows how to get the value of a caller ID field.
Output:
v_query - getSysId()
Returns the sys_id value in a get query.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Sys_id value in the get query, for example, if sys_id=123 ,
this method returns 123. |
Example
The following example is a snippet from Retrieving specific records from a third-party source.
Output:
v_query - getTextSearch()
Gets a text search query parameter.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Text search query parameter, for example email. |
Example
In the following example, the method returns true if the query contains a text query
parameter, such as GOTO123TEXTQUERY321=email
.
Output:
v_query - isGet()
Determines if the query is a get query, that is, a query that retrieves a record by sys_id.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag indicates that query for a specific record has sys_id= as
the query format. Valid values:
|
Example
In the following example, if the encoded query is
sys_id=d1954c744662010bd7e061e67a6776e
, the
v_query.isGet() method returns true. If the encoded query is anything
else, such as Number=INC0000001
, the v_query.isGet()
method returns false.
v_query - isTextSearch()
Indicates if the query contains a text query parameter.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether the query contains a text query parameter. Valid
values:
|
Example
In the following example, the method returns true if the query contains a text query
parameter, such as GOTO123TEXTQUERY321=email
.
v_query - setLastErrorMessage(String message)
Sets the last error message in the GlideRecord.
Name | Type | Description |
---|---|---|
message | String | Error message. |
Type | Description |
---|---|
None |
Example
The following example shows the basic structure used to set an error message.
Example
The following example shows how to set the last error message in a REST API.