> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# arrayToString

> Use the arrayToString task to return a string representing the contents of an array.

The `arrayToString` task returns a string representing the contents of a given array. Each array element is separated by a comma in the string representation. The task returns `null` if the array is empty.

## Potential use case

If a recent query into a ticketing database has populated an array with open ticket numbers, you could use this task to convert the array and send an email containing a comma-separated list of those ticket numbers.

## Properties

| Input | Type  | Description                                                 |
| :---- | :---- | :---------------------------------------------------------- |
| `arr` | Array | Required. The array and its elements to return as a string. |

| Output        | Type   | Description                           |
| :------------ | :----- | :------------------------------------ |
| `arrayString` | String | A string representation of the array. |

## Example

The input variable (`arr`) is shown in Task History (accessed from Jobs in Operations Manager).

![](/_fern-img/46932219672a021e30f3ea8c9403c2658a5fcbcb52d8929c79fdaf1e829c508c.webp)![](/_fern-img/8127905802a38ed4084a00629426781020de64c58d95725f2a42c9cb28f2d26e.webp)

The return variable shows each element in the array separated by a comma. In this example, no spacer variable was set, so no white space is included.

![](/_fern-img/438b247a827b002cc9ee6245c5482d6cb73d7f08b9e9fee81a477c05704b5a9c.webp)