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.
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
Hopefully it will work in your use case.
Thanks a lot @Trudy Claspill for your insights.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I managed to write the below logic-
But this seems to remove the value from the Start date. What should I change here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I recommend this structure.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.