> For the complete documentation index, see [llms.txt](https://docs.rewst.help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-get-statuses.md).

# \[Rewst Master v2] PSA-Datto: Get Statuses

This building block workflow retrieves all available ticket status options from Datto PSA by querying the platform's field definitions and picklists. It serves as a critical utility component in larger automation processes by providing dynamic access to current ticket status values rather than relying on hardcoded values that may change. MSPs would find this valuable when building ticket lifecycle automations, status-based reporting, client portal integrations, or any process requiring accurate ticket status mapping between systems. Technically, this workflow executes a single API call to Datto PSA's field definitions endpoint, retrieving the complete set of valid ticket statuses that can then be referenced by more complex workflows to ensure they're always using current, valid status options.

This workflow contains 1 task.

### Inputs

* **choose\_variable** - string

### Outputs

* **options**: Array of status objects.

### Key tasks

* **get\_statuses**: Data retrieval

### Jinja example

#### Example

```jinja
{{-
        {
            "id": status.value,
            "name": status.label,
            "current_default": status.value|int == ORG.VARIABLES[CTX.choose_variable]|d|int
        }
    for item in CTX.all_statuses_collected.fields
    if item.isPickList == true and item.name == "status"
    for status in item.picklistValues
    if status.isActive == true
-}}
```

This is used in publishing the all\_statuses data alias.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-get-statuses.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
