Forums

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

Smart value for SLA's completedCycle not working

CSPTech
August 10, 2023

For an automation, I am trying to get the elapsed time of a completed SLA called "Tempo de resolução"

 

When logged, the smart value {{issue.Tempo de resolução}} returns the following:

SlaFieldBean{completedCycle=[SlaCycleBean{startTime=SlaDateTimeBean{iso8601=Wed Dec 11 17:05:26 UTC 2019, jira=Wed Dec 11 17:05:26 UTC 2019, friendly='11/dez/19 2:05 PM', epochMillis=1576083926055}, breachTime=null, breachTime=SlaDateTimeBean{iso8601=Wed Dec 11 17:05:44 UTC 2019, jira=Wed Dec 11 17:05:44 UTC 2019, friendly='11/dez/19 2:05 PM', epochMillis=1576083944552}, breached=false, paused=false, withinCalendarHours=false, goalDuration=SlaTime{millis=14400000, friendly='4h'}, elapsedTime=SlaTime{millis=18497, friendly='0m'}, remainingTime=SlaTime{millis=14381503, friendly='3h 59m'}}]ongoingCycle=null}

 

However the smart value {{issue.Tempo de resolução.completedCycle}} returns nothing. What am I doing wrong?

1 answer

0 votes
Ludwig Einicke
May 26, 2026

@CSPTech 

I had the same issue today - luckily i can share my findings with you and everyone who stumbles here after serching google for help.

 

TL:DR

try

{{issue."Tempo de resolução".completedCycles.get(0).elapsedTime.friendly}}

or better

{{issue.customfield_[yourFieldID].completedCycles.get(0).elapsedTime.friendly}}

 

Long: Constructing the Smart Object step by step

issue. -> nothing special, just accessing the current issue looked at by the automation

customfield_[yourFieldID]. -> more robust than using a name because it is independent of language settings and changes

completedCycles. -> Completed SLA Cycles get stored as an Array (of completed Cycles). They can be accessed by [...].completedCycles (of course it needs be ...Cycles, not ...Cycle, because lets be mean to anyone not knowing exactly what they are doing). This then needs to get told, which item of the array to fetch:

get(0). -> "get the first item from the array"

elapsedTime. -> get the elapsed time of this first item

friendly -> choose option "friendly" from available options inside elapsedTime [millis / friendly]

Complete for elapsed Time:

{{issue.customfield_[yourfFieldID].completedCycles.get(0).elapsedTime.friendly}}

 

This works for the "SLA target Date" (called breachTime) aswell:

[...]get(0). -> (see above)

breachTime. -> get the breachTime of this first item

jira -> choose option jira from available options inside breachTime [friendly / jira / iso8601 / epochMillis]

(usually I find myself wanting option jira when it gets handed over to fields/etc.)

Complete for breach Time:

{{issue.customfield_[yourfFieldID].completedCycles.get(0).breachTime.jira}}

 

hope this helps!

kind regards,
Ludwig

EDITS: readability and some errors

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events