Functions & Options
Use query functions and query target options to modify returned values or refine your search by bypassing default query behavior.
If a document field is included twice, both by itself and modified by a function, you must define an alias for the function. When querying objects, you can only create an alias with the LONGTEXT() and RICHTEXT() functions.
Document Versioning & State Options
Section link for Document Versioning & State OptionsThese options are specifically for querying the documents target and managing version or lifecycle state visibility.
| Name | Syntax | Description | API Version |
|---|---|---|---|
ALLVERSIONS | SELECT {field} FROM ALLVERSIONS documents | Retrieve fields from all document versions. Can only be used when querying documents. | v8.0+ |
DELETEDSTATE() | WHERE status__v = DELETEDSTATE() | Retrieve fields from all documents in a steady, obsolete, superseded, or deleted state. Can only be used when querying documents. | v19.2+ |
OBSOLETESTATE() | WHERE status__v = OBSOLETESTATE() | Retrieve fields from all documents in a steady, obsolete, superseded, or deleted state. Can only be used when querying documents. | v8.0+ |
STEADYSTATE() | WHERE status__v = STEADYSTATE() | Retrieve fields from all documents in a steady, obsolete, superseded, or deleted state. Can only be used when querying documents. | v8.0+ |
SUPERSEDEDSTATE() | WHERE status__v = SUPERSEDEDSTATE() | Retrieve fields from all documents in a steady, obsolete, superseded, or deleted state. Can only be used when querying documents. | v8.0+ |
LATESTVERSION | SELECT LATESTVERSION {field} FROM ALLVERSIONS documents | Retrieve fields from the latest matching version. Can only be used when querying documents. | v8.0+ |
Search Scopes (FIND Clause)
Section link for Search Scopes (FIND Clause)These options are used exclusively within the FIND clause to narrow the search area across documents or objects.
| Name | Syntax | Description | API Version |
|---|---|---|---|
SCOPE ALL | FIND ('{search phrase}' SCOPE ALL) | Search all fields and document content. | v8.0+ |
SCOPE CONTENT | FIND ('{search phrase}' SCOPE CONTENT) | Search document content only. | v8.0+ |
SCOPE {fields} | FIND ('{search phrase}' SCOPE {fields}) | Search one specific document field or up to 25 object fields. | v15.0+ |
SCOPE PROPERTIES | FIND ('{search phrase}' SCOPE PROPERTIES) | Search all picklists and document or object fields with data type String. This is the default scope. | v8.0+ |
User-Personalized Filters
Section link for User-Personalized FiltersThese options filter results based on the currently authenticated user's interactions in Vault.
| Name | Syntax | Description | API Version |
|---|---|---|---|
FAVORITES | SELECT {fields} FROM FAVORITES {query target} | Filter results to those the currently authenticated user has marked as a favorite. | Documents: v22.2+ Vault objects: v23.2+ |
RECENT | SELECT {fields} FROM RECENT {query target} | Filter results to the 20 documents or object records the currently authenticated user has viewed most recently (in descending order by date). | Documents: v22.2+ Vault objects: v23.2+ |
Attachment Field Functions
Section link for Attachment Field FunctionsThese functions allow for the retrieval of metadata from files stored in Attachment type fields (available in v24.3+).
| Name | Syntax | Description | API Version |
|---|---|---|---|
FILENAME() | SELECT FILENAME({field}) FROM {query target}WHERE FILENAME({field}) {operator} {value} FIND ('{search phrase}' SCOPE FILENAME({field})) ORDER BY FILENAME({field}) | Use the file name of an Attachment field file instead of the file handle. | v24.3+ |
FILESIZE() | SELECT FILESIZE({field}) | Retrieve the file size, MIME type, or MD5 checksum of an Attachment field file. | v24.3+ |
MIMETYPE() | SELECT MIMETYPE({field}) | Retrieve the file size, MIME type, or MD5 checksum of an Attachment field file. | v24.3+ |
MD5CHECKSUM() | SELECT MD5CHECKSUM({field}) | Retrieve the file size, MIME type, or MD5 checksum of an Attachment field file. | v24.3+ |
Field Formatting & Transformation
Section link for Field Formatting & TransformationThese functions modify how field values are compared or returned in the result set.
| Name | Syntax | Description | API Version |
|---|---|---|---|
CASEINSENSITIVE() | WHERE CASEINSENSITIVE({field}) {operator} {value} | Bypass case sensitivity of fields in the WHERE clause. | v14.0+ |
LONGTEXT() | SELECT LONGTEXT({field}) FROM {query target} | Retrieve the full value of a Long Text field | v17.1+ |
RICHTEXT() | SELECT RICHTEXT({field}) FROM {query target} | Retrieve the full Rich Text field value with HTML markup. | v21.1+ |
STATETYPE() | WHERE state__v = STATETYPE('{state_type}') | Retrieve object records in a specific object state type. | v19.3+ |
TODISPLAYFORMAT() | SELECT TODISPLAYFORMAT({field}) FROM {query target} | With SELECT, retrieve a field’s formatted value instead of the raw value. | v23.2+ |
TOLABEL() | SELECT TOLABEL({field}) FROM {query target}WHERE TOLABEL({field}) {operator} {value} | With SELECT, retrieve the object field label instead of the name.With WHERE, filter by the object field label instead of the name. | v24.1+ |
TONAME() | SELECT TONAME({field}) FROM documentsWHERE TONAME({field}) {operator} {value} | With SELECT, retrieve the document field name instead of the label.With WHERE, filter by the document field name instead of the label. | v20.3+ |