Skip to content

By default, object queries retrieve fields from all object records in any state. In v19.3+, use the STATETYPE() function with the WHERE clause to filter object records by lifecycle state (state__v) associated with an object state type. Learn more about object record state types in Vault Help.

SELECT {fields} FROM {query target} WHERE state__v = STATETYPE('{state_type}')

You can only use the STATETYPE() function with the state__v field. The {state_type} parameter must be the name of a state type and must be enclosed in single quotes.

The following are examples of queries using STATETYPE().

The following query returns the ID and lifecycle state of all Product records in a lifecycle state associated with the Initial state type:

SELECT id, state__v FROM product__v WHERE state__v = STATETYPE('initial_state__sys')
{ "responseStatus": "SUCCESS", "responseDetails": { "pagesize": 1000, "pageoffset": 0, "size": 2, "total": 2 }, "data": [ { "id": "00P000000000508", "state__v": "draft_state__c" }, { "id": "00P000000000509", "state__v": "draft_state__c" } ] }