# asNumber in Jira Automation: syntax and examples

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

asNumber converts a text value to a number when the text is a number. Use it on pieces of text you cut out with other functions, such as the digits of an issue key, before you do math on them.

## Syntax

```
{{text.asNumber}}
```

## Works on

- Fields: any text value, for example the result of substringAfter() or split().
- Returns: a number, or an empty value when the text is not a number.

## Examples

```
{{issue.key.substringAfter("-").asNumber}}
```

Take the numeric part of the issue key as a number. With a work item key of WEB-44 it gives 44.

Result:

```
44
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#=}}{{issue.key.substringAfter("-").asNumber}}+1{{/}}
```

Compute the next issue number from the current key inside a math expression.

Result:

```
45
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.key.substringAfter("-")}}
```

The same cut without asNumber: it looks identical in a comment, but it is still text.

Result:

```
44
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.asNumber}}
```

Check what a summary that is not a number gives: nothing.

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.split(" ").first.asNumber}}
```

Try the first word of the summary. Hello is not a number, so the result is empty.

Run on Jira Cloud on 29 Nov 2026.

## Where the documentation differs

- `{{issue.summary.asNumber}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `Null`, the actual result is ``.

## Pitfalls

- Text that is not a number renders as an empty string, not as the word Null that the Atlassian page shows (checked on Jira Cloud, November 2026). Test for an empty result if the next step needs a number.
- Cut the number out first. The summary `Hello World!` gives nothing, while the digits taken from a key with `substringAfter("-")` convert.
- In a math expression the smart value goes inside `{{#=}}...{{/}}` and asNumber makes sure you add numbers, not join text.

## Related

- [{{#=}} math expressions](https://goingstellar.ro/reference/smart-values/math-expressions/)
- [substringAfter(), substringBefore(), substringBetween()](https://goingstellar.ro/reference/smart-values/substringafter-substringbefore/)
- [split()](https://goingstellar.ro/reference/smart-values/split/)
- [isAlpha(), isAlphanumeric(), isNumeric()](https://goingstellar.ro/reference/smart-values/isalpha-isnumeric/)
- [gt(), gte(), eq(), lt(), lte()](https://goingstellar.ro/reference/smart-values/number-comparisons/)

## Sources

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

