Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Using smart values to automatically fill in parameters in Automation Log work causes errors

Hi

I plan to use the Log work module in Automation to automatically calculate the work time between when an issue is transitioned (Issue transitioned).

My Automation uses

[When:Issue transitioned]→[Log work]

In Logwork, I use smart values to fill in the Time Spent and Date Started parameters as follows:

Time Spent:{{now.diff(issue.changelog.status[“WIP”].lastUpdated, businessDays.hours)}}h
Date Started:{{issue.changelog.status[“WIP”].lastUpdated.format(“dd/MMM/yy h:mm a”)}}

The main purpose is to calculate the work time from the last update to WIP status to the trigger of Automation as Time Spent. And set the last update to WIP status as Date Started.

image.png

However, an error occurred during execution, as shown in the figure:

image.png

 

2 answers

0 votes
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.
Oct 20, 2023

Hi @Simon Xiao -- Welcome to the Atlassian Community!

Within an automation rule, the {{changelog}} only refers to the fields which changed and lead to the trigger.  That smart value does not have any other information from the issue history...which is what you appear to be attempting.

The syntax you show for using the date diff() function is incorrect.  Please look here to learn how to use that function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

To do what your scenario is apparently asking, you would need to try: parsing the issue history (based upon REST API calls), parsing the time tracking logs, or use custom fields and math expressions.  The complexities in doing this in an automation rule (or by hand) are one of the reasons there are marketplace addons for this need.

Kind regards,
Bill

Hi @Bill Sheboy 

I'm very grateful for your reply. Regarding the grammatical issues you mentioned, I will check the support documentation. I'll try your solution.

0 votes
Marc Koppelaar
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.
Oct 20, 2023

Hi @Simon Xiao 

I expect the issue is with the date notation. Do you instance use the date format as presented in your smart value and is the Date started a date time field, or just a date field?

What you could do is to also set a log action for the time spent and date started field, this will make it easy to debug where the issue is.

Hi @Marc Koppelaar 

Thanks for your reply, I will try your solution.

Suggest an answer

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

Atlassian Community Events