Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

add a random number with an automation rule

Diego Chavez January 4, 2024

hi.

I want to create an automation rule with a manual trigger to populate a custom field with the issue key + a random number
so far I'm using this JSON:

{
"update": {
"customfield_10755": [
{
"set": "{{issue.key}}"
}
]
}
}

how do I add a random number to it?

thank you in advance

1 answer

1 vote
Trudy Claspill
Community Champion
January 4, 2024

Hello @Diego Chavez 

Jira does not have a true random number generation function.

It does have a function named RANDOM(), but that picks a decimal number between 0 and 1. Refer to this documentation

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

If you are okay with the field looking something like

ABC-123.204820184

...then the Random function will work for you.

You could try using the string concatenation function along with that RANDOM() function, to append the randomly generated number to the issue key string.

{{issue.key.concat(RANDOM())}}

I haven't tested that to confirm it will work.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events