The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Trudy P 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.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events