Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

An automation rule to update an Issues Date Field with the max date of a field from linked issues

Steve White November 1, 2024

This is in relation to using Jira Product Discovery along with Jira Software Projects.

I have a Jira Product Discovery project called "JPD1" with ideas.

I have Jira Software Project "SP1" with epics & stories.

I would like the automation rule to run that when an epic or story from SP1 is linked to an idea via "Delivery" in JPD1 the due date from the story or epic from SP1 will update the delivery date field on the idea.

For example: I have Idea in JPD1, JPD1-20.

There is already an item from SP1 linked to JPD1-20 with a due date of 11/15/2025. I then add another delivery item from SP1 with a due date of 12/20/2025. The delivery date on JPD1 should update to 12/20/2025.

Then I link an additional issue to JPD1-20 with a due date of 12/1/2025. The rule will run, but not update and keep the 12/20/2025 value.

How can I build an automation rule that will update the field in JPD1-20 with the max due date when issues are related to the idea?

Bonus: automation for when a linked issue from SP1 has its due date updated, when a linked issues link is removed, when a linked issue is cancelled.

Thank you!

2 answers

0 votes
Evgenii
Community Champion
November 2, 2024

Hi, @Steve White 

If I understood your question right, this can be achieved by simple comparing of dates. 

When new issue is linked, you are just checking, that in linked issue due date is smaller, and updates it. Made basic example, for describing of my logic:

Screenshot_29.png

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.
November 1, 2024

Hi @Steve White -- Welcome to the Atlassian Community!

What have you tried thus far to solve this need?

 

If you have a rule that is not working as expected, please post:

  • an image of the complete rule, and
  • an image of the audit log details showing the rule execution. 

Those will provide context for the community to offer suggestions.

 

If you have not yet started a rule, I encourage you to try to do so.  Successfully using automation requires learning and experimentation.

To help you get started, there are lots of similar questions in the community for this same scenario.  The extra "wrinkle" for yours is storing the result in a JPD date field, which has a different format than other built-in date picker fields.

Your rule could use the Lookup Issues action to gather the linked issues to the JPD Idea with JQL, and then use get the maximum value for the date to decide / make update.  Setting the JPD date field, you could look at similar questions in the community describing the format, such as this one: https://community.atlassian.com/t5/Jira-Product-Discovery-questions/Populating-JPD-date-field-using-Automation/qaq-p/2664482

For your "bonus" question, you could use a second rule, triggered on a change to an issue in the Jira Software Project, and then track back to the Idea for updates.  Or, with careful use of JQL this could all be done in on one single rule to feed the Lookup Issues action.

Please note well: because a rule like this is accessing issues in multiple projects, it will use either global or multiple-project scope.  Your Jira Site Admin will need to help configure that in the site global automation settings.

Kind regards,
Bill

Steve White November 1, 2024

Thanks Bill! I was hoping you would respond after scouring a few similar questions here in the community with your responses being very helpful.

I have basic experience in using automation, but this seemed more complicated than "Add a comment" type automation.

I only got so far as setting the trigger to be "When: Issue linked", but wasn't sure where to go from there. I tried writing it out for myself in english to understand the steps to include, but have trouble transforming that into steps in the automation.

When an issue is linked to an idea, lookup all issues linked to that idea and set the max due date of all the lookup issues to the due date (or other date field) on the idea.

Ill try and get further along in the automation using the links you provided. Any other help would be greatly appreciated. Thank you.

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.
November 1, 2024

I recommend starting with the JQL: find an example Idea which has linked issues, and write JQL to find them.  That may be used later in the Lookup Issues action.

And try this in steps: first find the issues only linked directly to the Idea.  Eventually you can try to expand that to the next level of linking...but please note: Lookup Issues is limited to 100 issues returned, and so if the "tree" has more than that, another approach will be needed.

Steve White November 1, 2024

I did some more digging around today and am trying to start it much simpler to be able to build on later as Ive seen that there is some date transformation that needs to be done between Jira Software and Product Discovery projects and some different syntax for referencing delivery items in a Product Discovery project (which ill build up to eventually)

Instead I am just starting out with attempting to update an epic due date to the max date (or keep the date thats already on the epic if it is the max) when a new link is created.

I discovered the difference between [issue in linkedIssues()] which returns relationships like "relates to" and "blocked by" vs [linkedIssue in ()] which returns children and childrens children of the issue as well as the issue itself used in the function.

Hoping Im on the right track any help would be great.

Automation Rule Update Epic Due Date with Linked Issue Due Date.png

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.
November 2, 2024

You are getting closer, although there is no need to iterate over the issues with a branch to find / compare dates.  That is where the Lookup Issues action helps.

 

Let's start with some JQL to find the issues needed.  Assuming your Idea has a key of JPD1-20 and the linked Epic has a key of SP1-30

-- get Idea from implements issues
issue IN linkedIssues("SP1-30", "implements") AND issueType=Idea


-- get issues implementing a specific Idea
issue IN linkedIssues("JPD1-20", "is implemented by") AND issueType!=Idea


-- get child issues of Epic
parent=SP1-30

Please note the link types are directional, such as "implements" versus "is implemented by".  Also note the issues are in different projects, and so any automation rule needs to have multiple-project or global scope to work.

 

And so when an Epic is linked to an Idea from the "delivery ticket" view, the {{issue}} will be the Epic and the {{destinationIssue}} will be the Idea.

  • trigger: issue linked
  • smart value condition:
    • first value: {{destinationIssue.issueType.name}}
    • condition: equals
    • second value: Idea
  • branch: to destination issue
    • action: lookup issues with JQL of
      • issue IN linkedIssues("{{issue.key}}", "is implemented by") AND issueType!=Idea
    • action: edit issue to set the date to
      • {{lookupIssues.duedate.max}}

 

This handles the case when issues are originally linked.  Additional cases will have different triggers, and so need the JQL examples I provided to progressively find issues and update fields.  There are many additional cases, so you will need to decide how accurately you want the field AND when you want it updated.

  • when the Idea adds a new linked Epic, update the field
  • when the Idea removes a linked Epic, update the field for the remaining ones
  • when the due date changes in an Epic linked to an Idea, scan again for updates
  • when an Epic is deleted...
  • when someone manually changes the date in the Idea...

 

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