Smart value not working!

Francisco Rivero Molina
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 12, 2021

Hello! I have this problem:

I have attached a screenshot to this message [IMG...], I would love to show the time value that appears in SLA Time to resolution (customfield_10070 the green arrow) in the freshly created field SInA SLA (marked with a red arrow). I want to do that in order to create automatic reports of time of the cards.

We think we should use a smartvalue in order to accomplish that using the field id of SLA Time to resolution (customfield_10070) the green arrow field. But no matter what we never get a time value in the SInA SLA red arrow created field.

Time since first response: {{customfield_10070.getElapsedTime}} this is one of the examples we're trying to use to make it appear. Also we tried with issue.fields.customfield_10070.ongoingCycle.elapsedTime...

Finally I will attach a screenshot of the automation rule we are executing to try to make it work.Captura de pantalla 2021-02-12 a las 14.04.19.pngCaptura de pantalla 2021-02-12 a las 13.49.53.png

1 answer

0 votes
Kian Stack Mumo Systems
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 12, 2021

Note: Original answer wouldn't post as I wanted, so I had to add bits and pieces in as it would let me.

I don't know exactly what value you want copied in there, so I'll just tell you how to work with large objects like this:

Typically what I do if I want to access information on large objects is to first check the JSON that they return if you just call them. So in this case, I started with a manual trigger and set it to add a comment to my ticket so I can explore the object I'm working with.
Screen Shot 2021-02-12 at 9.37.32 AM.png

 

Then I run the rule and check what it added to my ticket. You could also do this with the Log Action action, I just have a lot of test environments so I don't mind logging comments to some of my tickets.


I then run the rule for the first time to see what I get. For an SLA custom field, here's what I got:

 

SlaFieldBean
{completedCycle=[]
ongoingCycle=SlaCycleBean{
startTime=SlaDateTimeBean{
iso8601=Tue Jan 12 19:13:19 UTC 2021,
jira=Tue Jan 12 19:13:19 UTC 2021, friendly='12/Jan/21 1:13 PM',
epochMillis=1610478799148},
breachTime=SlaDateTimeBean{
iso8601=Wed Jan 13 19:13:19 UTC 2021, jira=Wed Jan 13 19:13:19 UTC 2021,
friendly='13/Jan/21 1:13 PM', epochMillis=1610565199148},
breachTime=null, breached=true, paused=false, withinCalendarHours=true,
goalDuration=SlaTime{millis=28800000, friendly='8h'},
elapsedTime=SlaTime{millis=648796361, friendly='180h 13m'},
remainingTime=SlaTime{millis=-619996361, friendly='-172h 13m'}}}

 

 

You can drill into these different areas using the "." notation. So to get the value for elapsedTime, I used the smart value

{{issue.customfield_10047.ongoingCycle.elapsedTime}}

 

This returned the value

 

SlaTime{millis=649279403, friendly='180h 21m'}

 

If you want the friendly value you could get it by calling

 

{{issue.customfield_10047.ongoingCycle.elapsedTime.friendly}}

 

This particular call will only work when the SLA is currently running. If you want the rule to apply to both running and completed SLA's, you'll probably need to write an if/else condition to check if it is done running, and handle it with a different smart value path.

 

I hope this helps!

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 12, 2021

Hi @Francisco Rivero Molina  -- Welcome to the Atlassian Community!

Yes, and... to what @Kian Stack Mumo Systems noted...

When puzzling if I have the right fields in the JSON, I call the REST API with an example issue to confirm I am looking at the correct fields.  Here's how to do that:

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

Best regards,

Bill

Suggest an answer

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

Atlassian Community Events