Display Time to Resolution in message

omar infante October 3, 2019

I'm working on automation that runs on a query for issues that will breach their SLA in the next 5 business days. It runs m-f at 10a and posts the results in a Slack channel. I would like to have the results also display what day/time the ticket will be due but I'll settle for it displaying how much time is remaining.

I've tried the following but unfortunately, time to resolution returns way too much.

{{#issues}}{{key}} - {{time to resolution}} - {{assignee.displayname}}

Instead of giving me a nice 4h left or mm/dd/yy hh:mm I get

SlaFieldBean{completedCycle=[]ongoingCycle=SlaCycleBean{startTime=SlaDateTimeBean{iso8601=Wed Oct 02 18:01:04 EDT 2019, jira=Wed Oct 02 18:01:04 EDT 2019, friendly='Yesterday 6:01 PM', epochMillis=1570053664783}, breachTime=SlaDateTimeBean{iso8601=Wed Oct 09 17:00:00 EDT 2019, jira=Wed Oct 09 17:00:00 EDT 2019, friendly='10/09/2019 5:00 PM', epochMillis=1570654800000}, breachTime=null, breached=false, paused=false, withinCalendarHours=true, goalDuration=SlaTime{millis=144000000, friendly='40h'}, elapsedTime=SlaTime{millis=8118930, friendly='2h 15m'}, remainingTime=SlaTime{millis=135881070, friendly='37h 44m'}}}

I've tried other attributes after {{time to resolution}} but then nothing shows up. I can't find any attributes that I can add to it that works. Anyone know what attributes I can use to get the desired results or how where I can find that field's available attributes?

Note: I'm not sure if attribute is the right term. What I mean, is like how "assignee" above has an attribute of "displayname."

1 answer

1 accepted

2 votes
Answer accepted
Brydie McCoy (CB)
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.
October 3, 2019

Hi Omar,

You are on the right track.  I think the smart value you will need is:

{{time to resolution.ongoingCycle.breachTime.friendly}}

We need to step through each layer of the json object.  The only strange thing is that the data you posted looks like it might have two "breachTime" attributes (though that may just be a result of formatting when you pasted it).   So if the smart value doesn't work you might need to raise a support request with us so we can have a closer look at the data.

Brydie [Automation for Jira]

omar infante October 7, 2019

Ooooh! Yeah, I tried just resolution.friendly but didn't think of the full path. Thank you! I'll try it and let you know if this worked!

Alexa February 27, 2024

Confirming this worked for me, thank you so much! I had made custom SLA goals to use in my email notifications. If you are doing that too, then be sure to update the "time to resolution" section to include the custom goal name instead but keep the "time to resolution" part all lower case. Example:

{{time to resolution and rest of custom SLA goal name.ongoingCycle.breachTime.friendly}}

 Here is how I got it working from end to end in my automation rule:

  1. I used the instructions at the bottom of https://confluence.atlassian.com/jirakb/how-to-find-smart-value-of-sla-component-of-jsm-issues-1167828367.html to build the foundation of the automation rule structure.
  2. For step 3 of those instructions, I used the value in the code block I posted above. I replaced the "and rest of custom SLA goal name" text with the actual custom SLA goal name (everything after "Time to Resolution"). 
  3. I then added another 2 steps at the bottom of the automation rule: re-fetch the data, then send an email. In the email body, I put the variable name from the "Create variable" step in the automation rule (formatted as a smart value; example: {{variablename}}). It then pulled the SLA breach date/time into the email body. 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events