> 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-task-psa-cw-list-company-locations.md).

# \[REWST - TASK] PSA-CW: List Company Locations

This workflow pulls a full list of client locations from ConnectWise PSA, making it a key tool for any automation that depends on site data. MSPs can use it to route techs, assign locations to tickets, or create location-based reports and inventories. It uses the ConnectWise API to grab standardized site info, removing the need for manual lookups and powering smarter, multi-site automations.

This workflow contains 5 tasks.

### Inputs

* **psa\_location\_id** - string
  * If known, we pass a specific ID into the sub which will return the details specifically for that location rather than returning all locations

### Outputs

* **automation\_log**: Standardized Rewst automation log
* **locations**: A list of locations for the organization that the workflow was run for.
* **location\_lookup\_details**: Location details are returned if a specific ID was provided to the workflow via the `psa_location_id` field.

### Key tasks

* **set\_output\_var**: Core integration: noop
* **psa\_list\_sites**: ConnectWise PSA integration: List Sites

### Jinja examples

#### Example 1

```jinja
inactiveFlag={{ False }}
```

Used for writing the condition in the Conditions field of the psa\_list\_sites action.

#### Example 2

```jinja
{{ CTX.psa_company_id|d or ORG.VARIABLES.cw_manage_company_id|d }}
```

Used for populating the Company field of the psa\_list\_sites action.


---

# 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-task-psa-cw-list-company-locations.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.
