# IRPCObjectOperations.GetWorkflowStatesAndTransitions

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Objects, versions, properties and files](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetWorkflowStatesAndTransitions/

Badges: `Vault API / core` `read` `session or assertion` `idempotent` `returns metadata structure version`

Gets the states and transitions of the given workflow.

- **Service:** [Objects, versions, properties and files](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/index.md) `MFiles.IRPCObjectOperations`
- **gRPC method:** `/MFiles.IRPCObjectOperations/GetWorkflowStatesAndTransitions`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-workflow-states-and-transitions`
- **Request:** [`GetWorkflowStatesAndTransitionsRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetWorkflowStatesAndTransitions/index.md#request)
- **Response:** [`GetWorkflowStatesAndTransitionsResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetWorkflowStatesAndTransitions/index.md#response)
- **Book and level:** Vault API, core
- **Kind:** read
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** yes
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

Returns all states of the workflow and the transitions out of `current_state`. Without
`current_state`, `transitions` is empty, even if `obj_ver` is set. Each transition's
`id` can be set as State transition (99), a lookup into value list 17, with
[SetProperties](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/SetProperties/index.md); setting Workflow State (39) to
the target state works too. An unknown workflow returns empty lists.

Example from the Sample Vault: workflow 102 with `current_state` 108 returned all five states,
with the two reachable ones and the current one selectable, and the two transitions from state 108.

<a id="request"></a>

## Request: GetWorkflowStatesAndTransitionsRequest

Request for getting workflow states and transitions.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `workflow_id` | `int32` | The workflow, the item ID of a Workflow (38) value. |
| `current_state` | [`TypedValue`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.TypedValue/index.md) | The object's current state as a lookup value into value list 8. Required to get any transitions. |
| `current_state.is_null_value` | `bool` | True if the value is empty. `data` is then unset. |
| `current_state.type` | [`Datatype`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.Datatype/index.md) | The data type of the value. |
| `current_state.data` | [`TypedValueUnion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.TypedValueUnion/index.md) | The value, in the member that matches `type`. Unset for an empty value. |
| `current_state.data.text` | `string` (oneof data) | The value of `DATATYPE_TEXT`. |
| `current_state.data.integer` | `int32` (oneof data) | The value of `DATATYPE_INTEGER`. |
| `current_state.data.real_number` | `double` (oneof data) | The value of `DATATYPE_REAL_NUMBER`. |
| `current_state.data.decimal_number` | `string` (oneof data) | Fixed precision number. |
| `current_state.data.date` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) (oneof data) | The value of `DATATYPE_DATE`: midnight UTC of the date. |
| `current_state.data.time` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) (oneof data) | Time. |
| `current_state.data.timestamp` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) (oneof data) | The value of `DATATYPE_TIMESTAMP`, in UTC. |
| `current_state.data.boolean` | `bool` (oneof data) | The value of `DATATYPE_BOOLEAN`. |
| `current_state.data.lookup` | [`Lookup`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Lookup/index.md) (oneof data) | The value of `DATATYPE_LOOKUP`: one value list item or object. |
| `current_state.data.multi_select_lookup` | [`MultiSelectLookup`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.MultiSelectLookup/index.md) (oneof data) | The value of `DATATYPE_MULTI_SELECT_LOOKUP`: any number of value list items or objects. |
| `current_state.data.integer64` | `int64` (oneof data) | Integer (8 bytes). |
| `current_state.data.filetime` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) (oneof data) | FILETIME (64-bit integer). |
| `current_state.data.multi_line_text` | `string` (oneof data) | The value of `DATATYPE_MULTI_LINE_TEXT`. |
| `current_state.data.acl` | [`AccessControlList`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AccessControlList/index.md) (oneof data) | Access Control List. |
| `obj_ver` | [`ObjVer`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjVer/index.md) | The object the transitions are for. Needed only when permissions depend on the object. |
| `obj_ver.obj_id` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | The object. |
| `obj_ver.obj_id.type` | `int32` | The object type ID, for example 0 for documents. In a lookup value, the value list ID (for a lookup to objects, the object type ID). |
| `obj_ver.obj_id.item_id` | [`ItemID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ItemID/index.md) | The ID of the object within its type, in `item_id.internal_id`. |
| `obj_ver.version` | [`ObjVerVersion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjVerVersion/index.md) | The version. Usually `OBJ_VER_VERSION_TYPE_SPECIFIC` with `internal_version`. |
| `obj_ver.version.type` | [`ObjVerVersionType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ObjVerVersionType/index.md) | What `internal_version` means. `OBJ_VER_VERSION_TYPE_SPECIFIC` for a version number. Values: `OBJ_VER_VERSION_TYPE_UNINITIALIZED` (0), `OBJ_VER_VERSION_TYPE_LATEST` (1), `OBJ_VER_VERSION_TYPE_ANY` (2), `OBJ_VER_VERSION_TYPE_ALL` (3), `OBJ_VER_VERSION_TYPE_SPECIFIC` (4), `OBJ_VER_VERSION_TYPE_VALUE_LIST_ITEM` (6), `OBJ_VER_VERSION_TYPE_OBJECT_LEVEL_REFERENCE` (7). |
| `obj_ver.version.internal_version` | `int32` | The version number, starting from 1, when `type` is `OBJ_VER_VERSION_TYPE_SPECIFIC`. The server returns -1 with `OBJ_VER_VERSION_TYPE_LATEST`. |
| `obj_ver.version.external_repository_version` | `string` | Used only for objects in external repositories. Leave empty. |
| `obj_ver.version.external_repository_sort_key` | `int64` | Used only for objects in external repositories. Leave 0. |

<a id="response"></a>

## Response: GetWorkflowStatesAndTransitionsResponse

Request for getting workflow states and transitions.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `states[]` | repeated [`StateBasic`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.StateBasic/index.md) | All states of the workflow, in order. |
| `states[].id` | `int32` | The state ID: the item ID of a Workflow State (39) value (value list 8). |
| `states[].name` | `string` | The name of the state. |
| `states[].can_current_user_select` | `bool` | True if the caller can move an object into this state from the `current_state` given in the request. Without `current_state`, every state is true. |
| `states[].are_state_permissions_object_specific` | `bool` | Specifies if the selectable flag is affected by pseudo users. If true, the selectable flag can be trusted only if the available state transitions are requested for a specific objver. |
| `states[].description` | `string` | The user description of the state. |
| `transitions[]` | repeated [`StateTransitionBasic`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.StateTransitionBasic/index.md) | The transitions out of `current_state`; empty if it is unset. |
| `transitions[].id` | `int32` | The transition ID: the item ID of a State transition (99) value (value list 17). |
| `transitions[].name` | `string` | The name of the state transition. |
| `transitions[].from_state_id` | `int32` | From state ID. |
| `transitions[].to_state_id` | `int32` | To state ID. |
| `transitions[].can_current_user_select` | `bool` | True if the caller can use this transition. |
| `transitions[].are_state_transition_permissions_object_specific` | `bool` | Specifies if the selectable flag is affected by pseudo users. If true, the selectable flag can be trusted only if the available state transitions are requested for a specific objver. |
| `transitions[].description` | `string` | The client description of the state transition. |

<a id="related"></a>

## Related methods

- [SetProperties](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/SetProperties/index.md): Adds, replaces or removes property values of an object.
- [GetWorkflowStates](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/GetWorkflowStates/index.md): Gets the states of the given workflow in the appropriate order.
