Forums

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

How do I increment the number part of an issue key, store in a smart value and add to an email?

Alison O'Donnell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 28, 2022

I have created an automation rule that is manually triggered from a Jira Item I have created that create 9 more Jira items - one for each language I am translating into. 

I now want to use automation to send an email to the translation company, listing the 9 different Jira items. The Dutch Jira item is always the base Jira item + 2, the German is always base + 3, and so on

 

I need to get the number part of the issue.key and add an integer to it, but this is not valid. For example, when I try creating a smart value NLIssueKey:

{{#=}}{{issue.key}}+2{{/}}

I get this error:

Create variable
Error rendering smart-values when executing this rule:
Unknown operator or function: TRAN: TRAN-2406+2

 

I understand why, but don't know how to fix it. Any ideas?

2 answers

1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2022

This won't work.  It's not working because it has not been coded for, because you can't code for it in the way you are assuming things work.

There's nothing to "fix" here because you're trying to do something that can't be done.

You are assuming that "create an issue in this project" will create a series of issues that will be sequentially numbered after the current issue (so when you create ABC-123, then create three subtasks in it, they will be ABC-124, ABC-125, ABC-126).  They are not.

In the most common cases, they will be, but when you're using a Jira with lots of active people, there's a growing chance that someone will be creating issues alongside yours,so they might grab a number you were assuming your sub-tasks might take.

You need to stop guessing what issue ids Jira might create, and instead gather the ids it actually creates after it has finished doing it, then gather them together into a mail.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2022

Hi @Alison O'Donnell 

Yes, and...to what Nic and Joe noted:

What you can do to solve this is use the {{createdIssues}} smart value in your automation rule which creates the issues to get the keys.  For example:

Here are the created issues' keys:
{{#createdIssues}}{{key}}{{^last}}, {{/}}{{/}}

Please look here for more information about that smart value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--createdIssues--

Kind regards,
Bill

Alison O'Donnell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 1, 2022

Thank you. This could be useful in my alternative automation since it isn't possible to do what I had hoped to.

0 votes
Joe Pitt
Community Champion
February 28, 2022

The key is generated when the issue is created. You can't control it

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events