Automation: Create new task with incremented custom field after another task is transitioned to done

Kasper Ramstafer February 3, 2023

I'm trying to automate creating new task when another task is transitioned to done. Within the "done" task is a custom field that I want incremented up one and included in the new task's custom field.  

My steps so far:

  1. I've created an automated rule that checks for when an Issue is transitioned to Done or close. 
  2. I've created an If statement (If Summary contains ___ and Labels contains ____) 
  3. I've completed the Then: Create a new Issue
  4. I've input all the fields that I want filled out in the new issue (which would basically be the same as the triggered issue)

What's Left:

  1. Take the number from the triggered Issue custom field "annual" and increment it up by 1.
  2. Put the incremented number into the new Issue's custom field "annual"

If anyone could assist I would be extremely grateful. I haven't been able to find information on how to store info from an automation triggered issue then increment and place it within the new issue.

1 answer

1 accepted

2 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2023

Hi @Kasper Ramstafer and welcome to the community!

You would use this in the Annual field for the Create Issue action:

{{#=}}{{triggerIssue.annual}}+1{{/}}
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 4, 2023

Hi @Kasper Ramstafer -- Welcome to the Atlassian Community!

Adding to Mark's answer...

There are built-in math functions for add, substract, etc.: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

So you could also use {{triggerIssue.annual.plus(1)}}

Kind regards,
Bill

Kasper Ramstafer February 6, 2023

Thank you both for your quick responses! It looks like this has worked for me! Quick follow up question if the custom field is two words like Annual Rate would you use quotation marks for the code? Example: {{#=}}{{triggerIssue."Annual Rate"}}+1{{/}} or would it just be all one word?

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 6, 2023

It would be like this:

{{#=}}{{triggerIssue.Annual Rate}}+1{{/}}
Like Kasper Ramstafer likes this
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 6, 2023

Smart values are name, spacing, and case sensitive.  When in doubt of the smart value for a field (or if a field is even supported) please try this how-to article. 

Essentially you identify an example issue with your field, call the REST API from a browser, and search for your field on the page to learn its smart value.

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Like Kasper Ramstafer likes this

Suggest an answer

Log in or Sign up to answer