Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

How to pick up earliest date from Child and copy to Parent

I'm trying to make automation that will choose earliest date from child ticket (start date field) and copy it to Parent ticket start date. 

For instance Parent “Start Date“ = 01.02.2020, Child “Start Date“ = 01.01.2020, Child “Start Date“ = 01.03.2020 → Parent  “Start Date“ = 01.01.2020. 

I've created automation that collecting date from Child and adding to Parent, but it collect just any date,  now it needs to be earliest date. 

If anyone knows some JSON formula or Smart value and wants to share, that would be appreciated. Thank you in advance. 

Current automation looks like this:

Screenshot 2022-12-16 135255.png

2 answers

1 accepted

1 vote
Answer accepted
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.
Dec 16, 2022 • edited

Hi @Sinisa Glusac 

To confirm the problem you are trying to solve...you only want the Parent to change to the earlier date if a Child issue has one.  Is that correct?

If so, couldn't you change your advanced compare condition in the branch to:

  • first value: {{triggerIssue.Start date}}
  • condition: less than
  • second value: {{issue.Start date}}

If instead you need the earliest date among all child issues, consider using Lookup Issues instead with JQL.  That will handle the case of an issue changing parent when the dates do not change...and that may required a couple of rules with different triggers: field value changed for Start Date, and issue updated for a change in parent (both the incoming and outgoing parents could need updates).

Kind regards,
Bill

Hi @Bill Sheboy yes, this is correct, and I tried your solution, it works perfectly. Thank you very much for your help and also thanks to Jack for his suggestion!

Like Bill Sheboy likes this

Hello @Sinisa Glusac 

 

Can you post the automation script 

1 vote
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 16, 2022 • edited

I would need to play with the rule (and if I get some time today I will) but I would approach this way...

update the parent date if empty or if it is > the date in the child issue that triggered the event using the following smartvalue context

{{[date1].compareTo([date2])}}

Compares date1 to date2, to find which date is earlier. Returns: 

  • -1, if date1 is earlier than date2

  • 1, if date2 is earlier than date1

  • 0, if the two dates are the same

Examples

{{issue.duedate.compareTo(now)}}
//returns -1 or 1
{{now.compareTo(now)}}
//returns 0

Hi Jack, 

thank you very much for your quick response!

However, I tried your solution, but it must be that I did something wrong (lack of Jira experience). No error in audit log, just "no action performed". 

Is this how automation should look like:

Screenshot 2022-12-16 163504.png

Suggest an answer

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

Atlassian Community Events