Need help with an automation logic

Priyanka Agrawal
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!
January 30, 2025

How to write an automation in jira such that If a story’s start date is updated, the automation should update Epic’s start date to the earliest start date of all the stories linked to the Epic. Additionally, if a story is removed from an Epic, the automation should update the Epic’s start date based on the remaining stories linked to the Epic.

I managed to write an automation (and it is working as expected) for the linked stories but could not write a logic for when a story is removed from an Epic. Kindly help.

image.png

2 answers

0 votes
Vishal Biyani
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.
January 31, 2025

@Priyanka Agrawal 

To make the update work from StandardIssue -> Epic -> Initiative, see below

instead of using portfolioChildof need to use triggerIssue to reach the Initiative key from Standard Issue

snip1.png

Hopefully it will work in your use case.

 

Thanks a lot @Trudy Claspill for your insights.

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 30, 2025

Hello @Priyanka Agrawal 

Welcome to the Atlassian community.

For the case where an issue is removed from an Epic you would need to start with the Field Value Changed trigger and monitor the Parent field.

With that trigger you get access to the {{fieldChange}} smart value, which allows you to access the value of the field before it was change and the new value of the field. Refer to:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

Using those values you can create a FOR JQL branch to change focus to the previous Parent Epic and execute the steps to change its start date.

You can also use the steps you have in your first rule to update the start date for the trigger issue's new Parent Epic.

Priyanka Agrawal
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!
January 30, 2025

Could you please help me know in detail, how can I use {fieldChange}} smart value? At which step?
Can I add this clause to my current automation? Or would this require a new rule?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 30, 2025

You need a separate rule to monitor for a change to the "Parent" field.

You can make a copy of the existing rule as a starting point, and change the field monitored in the Trigger to Parent. The structure you have would then handle the update of Start Date for the issue's new parent Epic.

Did you review the information in the link I provided, to figure out how to access the previous value of the field?

Priyanka Agrawal
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!
January 30, 2025

Yes, I managed to write the below logic-
But this seems to remove the value from the Start date. What should I change here?

image (1).png

Priyanka Agrawal
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!
January 30, 2025

 

Sorry the automation actually seems to do nothing.
When I add a new story to an Epic, it just removes the start date. How can I handle that case as well?

image (2).png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2025

I recommend this structure.

Screenshot 2025-01-31 at 12.00.37 AM.png

 

Branch 1 handles the scenario where an issue has been added to an Epic. If the issue has been simply removed from an Epic then Branch 1 will be skipped.

Condition 2 evaluates if the issue was previously associated to an Epic. If it was, then the subsequent branch will handle updating the issue's previous parent Epic. If it was not previously associated with an Epic, then the subsequent branch is not executed.

I don't believe you need to condition to compare toString and fromString. If they are not different, then there has been no change to the Parent field and the rule would not have triggered.

Priyanka Agrawal
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!
January 31, 2025

You just made my day! It's working as expected. Thank you very much, Legend!

Let me run this through couple of use cases and I will come back if I get stuck somewhere. Thanks again, man!

Like Trudy Claspill likes this
Priyanka Agrawal
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!
January 31, 2025

I was just trying to use the same logic for Epic-Initiative relationship. Works fine for Epic addition but doesn't work for Epic deletions from Initiatives. 
Could you please suggest?


image (3).png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2025

In what way does it not work?

Is the rule getting triggered when an Epic is changed?

How is the change being made to the epic; manually or by another automation rule?

What is the output in the Audit Log?

Did you create a second rule, or are you expecting the one rule to work for changes to a child of an Epic, and when an Epic is changed and is the child of an Initiative?

Priyanka Agrawal
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!
January 31, 2025

Initiative is the highest in the hierarchy and all the Epics are linked to Initiative as Child issues.

The automation should update Initiative’s start date to the earliest start date of all the Epics linked to the Initiative and the logic should hold true when an epic is added or removed from the Initiative.

The audit log says successful but when I removed the parent link from one of the epics, the Initiatives start date was set to None, removing the previous value. (See Screenshots)

This is a new rule that I've created but if there is a possibility to achieve this using 1 rule that would be great. (Find the new rule in the screenshot below)

All the changes made to Epic are manual.


image (6).png

image (5).png
image (4).png

Like Vishal Biyani likes this

Suggest an answer

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

Atlassian Community Events