New automation smart values in Jira Cloud

Hi Atlassian community,

Mark here, Dev Manager for the Automation team. We have just shipped long-requested new functionality for automation smart values that we think will please power users immensely. Amongst the many use cases it solves is the ability to sum up story points of subtasks and new date / time functionality.

 

Warning! This blog is targeted towards Jira automation power users. We get into the real nitty gritty. If you are just getting started with automation, you can check out our beginners or advanced webinar. This new functionality is only available natively in Jira Cloud.

What are smart values?

Before we get into the nitty gritty, let’s have a quick refresh. Smart values allow you to access and manipulate almost any data from Jira. They are a great way to supercharge your basic no-code automation rules. You can access just about any value available through the Jira REST APIs and more importantly, you can use functions to transform strings, dates and various other types into almost any format you want.

But power users were always hankering for more and we’ve heard your call!

What did we do?

ed80957b-6d7c-4113-80ce-01e3abcc7af6.png

Well, we managed to attack the 3rd and 12th highest vote-getters in our public tracker. All up, we’ve resolved 188 votes over 24 tickets! Everything ranging from aggregation functions to extra date manipulation, we’ve got you covered.

Sum, average, max, min

The #1 use case here that people have really wanted, is to sum up story points of subtasks - now you can with a simple smart value like {{issue.subtasks.Story Points.sum}}. You could use this smart value in the Edit issue action, comments, Slack messages, etc.

At the moment, this will only work for summing up the story points of subtasks. It will not work for summing up the story points of an epic.

94809239-fbdf-4e53-bf14-39c0753829bd.png

That’s it! You can do similar tricks like {{issue.subtasks.Due date.max}} to set the parent’s due date to the latest of the subtasks' due dates.

Basic conditions if, equals, not, and, or

A bit more controversially, we’re adding some logic to logic-less templates. Why? At some point, use cases like emailing out Release notes and Notifications will require basic logic to do the simplest things. You might want to show a different icon depending on the field value, for example. You also have comparators like gt, lt, gte, let on number fields so can use the logic to match numerical ranges.

2594c4a8-fe37-4938-a91e-1ad409196ed4.png

Chainable basic number operations, plus, minus, multiply, divide, diff

One of the quirks was that while you could relatively easily chain date operations together, it wasn’t really possible to chain numeric operations together. Now with operations on Number objects themselves, you can do some pretty complex stuff. If you wanted to do things like setting a “Due date” as a formula of the Story points, you now can! Just set the due date to:

{{issue.created.plusBusinessDays(issue.Story Points.multiply(3))}}

The options here are limitless!

New date-time functions

You can now play around with timestamp fields by adjusting fields at hour level. For that, you have two new functions in your pocket: plusBusinessHours and minusBusinessHours. We wanted to take business hours window dynamically from Jira Service Desk, but for now, we assume business hours are 9 AM to 6 PM, Monday to Friday. A few typical use cases can be:

  1. Set the End Date field based on the SLA during ticket creation

  2. Assign tickets to different agents based on business hours left

  3. Set/change priority level based on a deadline

It can be combined with any of the above mentioned basic number operators or condition functions so there are loads of options to exploit. Using these new functions is very similar to plusBusinessDays/minusBusinessDays functions. Just like this:

{{issue.created.plusBusinessHours(issue.Story Points.divide(2))}}

These functions can take negative values, like:

{{issue.fieldName.plusBusinessHours(-3)}} 

These functions can be used anywhere while editing fields in action, inside email bodies, just like you have been using plus/minus functions.

Summing it all up…

So hopefully you’re going to find all the new smart value functions useful! If you have any feedback or suggestion, feel free to post your questions right here in the brand new Automation community space!

Where can I learn more?

27 comments

Lucy Cookney June 11, 2020

Hi

I have used the automated Sum function to update the parent cases remaining estimate field when the child case is updated.  It is changing the time I have recorded as seconds but then saving this as hours.  Eg. I have put 2 days remaining on the child case and it has saved this as 36,000 hours remaining against the parent case.

Thanks

Lucy

Like Dharmesh Barot likes this
Mike June 12, 2020

Are there any plans to enable the business hours (and days) functions be relative to a time zone attribute? For our use case, we want the business hours offset to be relative to the assignee's time zone.

Dharmesh Barot June 16, 2020

 

Facing similar issue as @Lucy Cookney 

Anja Dold June 22, 2020

I am trying to sum up remaining estimates of all issues in the parent epics remaining estimate field. I received the following answer from customer support:

"Unfortunately Automation cannot sum up time tracking of child issues to their parent Epic. We do have a solution now for sub-tasks, described in New automation smart values in Jira Cloud, so hopefully we will have summing up to Epics too in the future."

Is this already on the list?

Like # people like this
Andy Cortwright July 16, 2020

I am a +1 on the request from Anja above. I would like to traverse the Epic child Story items to add up the story points and apply to the Epic.

Like Carlos Piqueres likes this
Tom Williams
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.
July 20, 2020

Hey @Mark Chaimungkalanont 

 

I've been trying to combine the lookup issues and sum function but not got it to work. Are we limited to using the sum function in subtasks to parent issue? 

Use Case: 

Trigger Schedule -> Action lookup issues (JQL returns Stories created in last X days) -> Action create an email and in the body sum the Story Points of the Stories returned in the list. I've tried the following: 

  1. {{lookupissues.Story Points.sum}} 
  2. {{lookupissues.issue.Story Points.sum}}
  3. {{lookupissues.customfield_10022.sum}}
  4. {{lookupissues.issue.customfield_10022.sum}}
  5. {{lookupissues.issue.fields.customfield_10022.sum}}

Thanks

T. 

Like # people like this
Chad MCCanna September 2, 2020

Tom's comment above would unlock precisely the kind of functionality and versatility that would really make this feature sing. A limitation from parent to subtask isn't just arbitrary; it's not really how typical Scrum works.

Story points aren't tracked at a subtask level. Subtasks typically define implementation steps and other details, but story points are a holistic measurement of the parent ticket.

For the use-case described in the post to really be meaningful, story point summation should be based on an Epic which contains multiple pointed stories, OR (ideally) a queried set of tickets, as defined by a "JQL Matches" trigger component.

Is anything like this on the roadmap? Mathematical operations are a wonderful addition, but the current feature, as-implemented, seems like only a half-measure.

Thanks,

Like # people like this
Alice Sheng October 12, 2020

I'm also looking for what Tom mentioned. Sum or average of a number field of all resulting tickets of a lookupissue JQL query, such as story points. The below script returns 0.0 instead of the expected math value.

 

{{lookupIssues.customfield_13813.average}} <- smart value script that would insert the calculation into the 1st line in the below sample email report:

Screen Shot 2020-10-12 at 7.48.33 PM.png

@Mark Chaimungkalanont 

Like # people like this
Massis Shahmirian November 21, 2020

@Mark Chaimungkalanont 

The example in the screenshot in this article showing how to check a string against a field's value (repeated below) does not work anymore. Did the team change the format? I can't find any documentation about this on the official site.

{{#if(eq(issue.issuetype.name, “Bug”))}} Content {{/}}

Like # people like this
Massis Shahmirian November 23, 2020

Hi all,

An update on yesterday's issue.

I reached out to support and they sent me the following:

{{ #if(eq(issue.issuetype.name, "Task")) }} This is a task {{ / }}

Which to my surprise worked! I tried it formatted like the one from this article again to understand why:

{{#if(eq(issue.issuetype.name, "Task"))}}This is a task{{/}} 

And it once again did not work. Turns out, you MUST put a space in front of #if and the / in the closing mustache, like so:

{{ #if(eq(issue.issuetype.name, "Task"))}}This is a task{{ /}}

A bit strange because I haven't seen spacing like that affect the completion of a smart value, but hey, I'm glad I can use it now.

@Mark Chaimungkalanont  @William Sheboy 

Like Hauke Bruno Wollentin likes this
Massis Shahmirian November 23, 2020

@Tom Williams @Chad MCCanna 

They might have updated something, but what you're looking for does work at the present moment. However, you must capitalize the "I" in "lookupIssues" like so:

{{lookupIssues.Story Points.sum}}

@Alice Sheng 

The problem you're running into is that customfields aren't supported with a lookup yet. Only the following fields will work:

Available properties:

  • {{key}} - Returns the issue key

  • {{url}} - Returns the issue url

  • {{summary}} - Returns the issue summary

  • {{assignee.displayName}} -  Returns the assignee

  • {{reporter.displayName}} -  Returns the reporter

  • {{status}} - Returns the status

  • {{issueType}} - Returns the issue type

  • {{resolution}} - Returns the resolution status

  • {{fixVersion}} - Returns the fix version

  • {{created}} - Returns the date the issue was created

  • {{updated}} - Returns the date the issue was updated

  • {{Story Points}} - Returns the story points for the issue (classic Jira Software)

  • {{Story point estimate}} - Returns the story points for the issue (next-gen Jira Software)

Documentation 

Like # people like this
Massis Shahmirian November 23, 2020


@ Mike: If I'm understanding your use case correctly, you can use something similar to the following:

{{now.convertToTimeZone(assignee.timeZone).plusBusinessHours(-3)}}

 

Like Mike likes this
jeremy thebault December 4, 2020

Hello,

@Massis Shahmirian  I try to set some condition in my email automation but it doesn't work : 

1/  i create a lookupissues block with my jql request (return multiple tickets)
2/ in my email i put : 

{{#lookupIssues}}
{{status}}
{{/}}

it works : sending me the status of every lookupIssues


if i try to add conditions : 

{{#lookupIssues}}
{{ #if(eq(status.name, "10001")) }} {{key}} is a done ticket {{ / }}
{{ #if(eq(status, "10001")) }} {{key}} is a done ticket {{ / }}
{{ #if(eq(status.name, "10002")) }} {{key}} is a TODO ticket {{ / }}
{{/}}

It always returns the 3 conditions as true :

DTSIN-61 is a done ticket
DTSIN-61 is a done ticket
DTSIN-61 is a TODO ticket
DTSIN-60 is a done ticket
DTSIN-60 is a done ticket
DTSIN-60 is a TODO ticket
...

it seems the condition is not considerate

My goal is to send a mail like : 


Done tickets : 
list of done tickets

TODO tickets :
list of todo tickets


Do you have any ideas about this issue or other solution to do this ?


thanks,

Massis Shahmirian December 15, 2020

@jeremy thebault 

Unfortunately, as far as I can tell, conditions don't work inside a lookup. There is a work around for what you're trying to achieve though!

 

You'll have to do the following:

1. Lookup action to grab the issues in a particular status, such as:

project = "POL" and statusCategory = "To Do"

2.  Create a variable to hold the information from the lookup action. You can do so by entering the following as the contents of the variable:

{{#lookupIssues}}{{#first}}<ul><li>{{key}} {{summary}}</li>{{/}}<li>{{key}} {{summary}}</li>{{#last}}<li>{{key}} {{summary}}</li></ul>{{/}}{{/}}

Note: The above includes HTML that will create a bulleted list in your email.

 

At this point, you need to repeat steps one and two to create a separate variable to hold the information from a lookup action that retrieves issues that have a "Done" status.

Then you'll be able to call both the variables in your email which should enable you to create two bulleted lists: one for issues in a "To Do" status and one for issues in a "Done" status.

Like # people like this
Jeremy THEBAULT December 17, 2020

@Massis Shahmirian 

Wow it works perfectly, thanks for sharing this work around .


Thanks again for your help.


Happy Christmas and New Year !

G subramanyam
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2021

Great stuff. Thank you for the article and the post @Mark Chaimungkalanont 

Jonathan Rosenberg February 5, 2021

Hi @Mark Chaimungkalanont, Do you know if there are any plans on bringing these features to Datacenter versions? We would love that! Thank you

Enrique Gutierrez February 17, 2021

@Massis Shahmirian do you know if your recommendation for Tom and Chad

{{lookupIssues.Story Points.sum}}

 

also works for Next Gen Jira
I've been trying different variations of this, but I can't get it to work.

{{lookupIssues.Story point estimate.sum}}
Massis Shahmirian February 17, 2021

@Enrique Gutierrez 

This works for me. It adds 5 + 5 together for 10.

image.png

Enrique Gutierrez February 18, 2021

@Massis Shahmirian thanks!

I finally managed to set this up.

On change of a task or bug, the Story Point Estimate of my Epic (Jira Next Gen) gets changed to the remaining story points of the epic's children.

 

Screenshot 2021-02-18 180421.png

Like # people like this
Matt Mace March 29, 2022

@Massis Shahmirian - Here is an automation I put together following your example on how to roll up subtask story points. I've tried various different configurations but none of them have worked. I want to recalc the parent Story whenever a subtask adds or changes story points. We are a data center version of Jira if that makes a difference or not.

So, first question, not being an expert in smart values yet. In your example you have "{{issue.subtasks.Story Points.sum}}". Is "subtasks" a fixed database variable that must be used as spelled or am I supposed to use the actual issuetype name we gave it; "Sub-task"?

Here is the rest of the automation: Do I need something more for the trigger?Automation.jpg

@Massis Shahmirian - Thank you for sending me the link. It worked perfectly.

Massis Shahmirian March 29, 2022

@Matt Mace Hi Matt, here is a walkthrough of how to roll-up subtask story points — https://www.atlassian.com/software/jira/automation-template-library/sum-up-story-points

Like Matt Mace likes this
Matt C_ Wilson April 2, 2022

For anyone coming here looking for a way to do updates to Epics when an Epic Link is changed on a ticket, you can start with this how-to: https://community.atlassian.com/t5/Jira-Software-questions/Jira-Automation-How-to-identify-what-Epic-a-Story-was-linked-to/qaq-p/1924599

Basically, you have to use Issue Updated (or Multiple Issue Events) as the trigger, and then look at the special {{changelog}} smart value to see if it was an Epic Link change.

Some additional background: https://codebarrel.atlassian.net/browse/AUT-1264?focusedCommentId=107261

Khushbu Sinha September 26, 2022

Hi Everyone 

I have tried using Sum up story points but its not showing updates in Parent's Story point .

Even if the SP for subtasks is updated , Story Point is not updated in parents ticket.

 

Please help to resolve this

Khushbu Sinha September 27, 2022

The automation is not working for me , can someone help . I am trying to sumup the story points for parent ticket based on subtasks

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events