# length() in Jira Automation: syntax and examples

URL: https://goingstellar.ro/reference/smart-values/length/

length() counts the characters in a text value, spaces and punctuation included. Use it to check a title against a limit, to measure a description before copying it somewhere with a size cap, or as a number inside a math expression.

## Syntax

```
{{issue.summary.length()}}
{{issue.summary.length}}
```

## Works on

- Fields: any text value, such as summary, description or a comment body
- Returns: a whole number, as text

## Examples

```
{{issue.summary.length()}}
```

Counts the characters of a summary. Hello World! has 12, because the space and the exclamation mark count.

Result:

```
12
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.description.length()}}
```

Measures a description before it is posted to a channel or system that cuts long text.

Result:

```
61
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.length}}
```

The same count without the brackets, which is how the usual smart value style writes properties.

Result:

```
12
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.concat("   ").length()}}
```

Shows that trailing spaces are counted, which explains a title that looks short but fails a length check.

Result:

```
15
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.remove(" ").length()}}
```

Chains remove() first, so only the characters that are not spaces are counted.

Result:

```
11
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}{{issue.summary.length()}} + 8{{/}}
```

Uses the count inside a math expression, for instance to reserve room for a prefix.

Result:

```
20
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- Spaces at the start or end are part of the count. Run `trim()` first when you want the length of the visible text.
- An empty or missing field gives an empty result, not `0`. Checking `issue.environment.length()` on a work item with no environment text produced nothing at all (checked on Jira Cloud, November 2026), so test for an empty value before you compare numbers.
- The count is of the value as the smart value sees it. After `abbreviate(8)` the length is 8, because the three dots are part of the shortened text.

## Questions and answers

### Does length() work without the brackets?

Yes. `{{issue.summary.length}}` gave the same number as `{{issue.summary.length()}}` when checked on Jira Cloud in November 2026.

## Related

- [abbreviate()](https://goingstellar.ro/reference/smart-values/abbreviate/)
- [trim()](https://goingstellar.ro/reference/smart-values/trim/)
- [isEmpty() and isNotEmpty()](https://goingstellar.ro/reference/smart-values/isempty-isnotempty/)
- [{{#=}} math expressions](https://goingstellar.ro/reference/smart-values/math-expressions/)
- [substring()](https://goingstellar.ro/reference/smart-values/substring/)

## Sources

- [Jira smart values: text fields (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/)

