Jira Automation - Branch rule for trigger issue

Laura Hanna
Contributor
December 19, 2023

I hope i explain this right...

I have automation that on MAIN story if due date changes it updates the child with due date.

Then creates another story.

I need THAT story to update the trigger story (add comment) So, far I can only get up to Parent of. 

Automation rule 1: Story A auto creates story B, based on component.

Automation 2: Trigger: If due date is added to Story A. Update Story B (with due date) - working

Then create Story C. - working

Then update Story B (comment) - working

Then update Story A (comment) - cant get working

 

I was hoping to insert a branch Rule for trigger issue. All there is is parent. Which basically goes up to Story B.

 

update trigger.jpg

2 answers

0 votes
Laura Hanna
Contributor
December 19, 2023

I tried moving it out. Still does not update the trigger.

I have to be missing something...

Lets try this again...

 

Story A is created, it auto creates story B.

Story A gets a due date, which updates Story B's due date.

(Would like a comment on Story A - that due date was update on Story B)

THEN it creates Story C. 

(Would like a comment on Story A, that Story C was created.)

Then create Story D

(Would like a comment on Story A, that Story D was created.)

         Then Create Story E as child of Story D

(Would like a comment on Story A, that Story E was created.)

 

 

I think i am over complicating things...

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.
December 19, 2023

How are Story A and Story B related?  Are they connected with issue links, or something else?

Laura Hanna
Contributor
December 19, 2023

When I create Story A, it creates Story B. with...

Choose fields to set...

I choose "Linked Issues"  Is Child of... Trigger Issue.

linked issue.jpg

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.
December 19, 2023

Great; that helps!  And so I would expect your two rules to look like this:

Rule 1

  • trigger: issue created
  • action: re-fetch issue (This helps prevent timing problems when using the Issue Created trigger.)
  • action: create issue, linking it to the trigger issue as you show

 

Rule 2

  • trigger: field value changes for Due Date (this is Story A)
  • condition: issue type is Story
  • condition: any other conditions you needed...
  • branch: to linked issue of link type is Child of  (this is Story B)
    • action: edit issue, copying the Due Date from the trigger issue
  • action: comment on trigger issue, referencing that linked issue, Story B:
    • {{#issue.issueLinks}}{{#if(equals(type.name.toLowerCase(),"is parent of"))}}{{inwardIssue.key}}, {{/}}{{/}}
  • action: create Story C
  • action: comment on trigger issue, referencing {{createdIssue.key}} for the most recently created one
  • action: create Story D
  • action: comment on trigger issue, referencing {{createdIssue.key}} for the most recently created one
  • action: create Story E
  • action: comment on trigger issue, referencing {{createdIssue.key}} for the most recently created one

 

Please check all of the link types as I may have them incorrect for your situation.

Laura Hanna
Contributor
December 20, 2023

WoW! Thank you. I am off  today and will test later on! I owe you a coffee ;) Very must appreciated!

Laura Hanna
Contributor
December 20, 2023

Question. Sorry I had to log in and jump right in...

How do I do the:

  • action: comment on trigger issue, referencing that linked issue, Story B:
    • {{#issue.issueLinks}}{{#if(equals(type.name.toLowerCase(),"is parent of"))}}{{inwardIssue.key}}, {{/}}{{/}}

Action? I may be not the sharpest pencil here. But there is no "Comment on trigger"

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.
December 20, 2023

Using the Comment on Issue action, that expression I noted may be used to add the key of the linked issue...without the need to branch or look it up other ways.

Laura Hanna
Contributor
December 21, 2023

I am sorry I am really struggling to understand... My apologies. But, I am new to this. I have been scratching my head on where to enter that action...

  • action: create Story C
  • action: comment on trigger issue, referencing {{createdIssue.key}} for the most recently created one

Create Story C and edit issue.jpg

But, I have no idea how to add comment on trigger?

There is no field for comment...

edit.jpg

Please dont give up on me. I am here for the long haul and would really like to get this working...

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.
December 21, 2023

Going back to the beginning, you described adding a comment to Story A when the Due Date was changed in Story B to match.

That expression I provided will provide the issue key for Story B for your comment.  There was no other purpose for it, and so it is not used in the edit issue action.

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.
December 19, 2023

Hi @Laura Hanna 

You want to update the trigger issue with some information from the most-recently created issue, correct?

If that is the case, you may remove the branch to the most recently created issue.  That will change the scope for what is the "current issue" back to the trigger for your Add Comment action. 

If you need to reference data from that most-recently created issue in the comment, please use the {{createdIssue}} smart value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--createdIssue--

Kind regards,
Bill

Laura Hanna
Contributor
December 19, 2023

No... I dont want to update trigger with some information from the most-recently created issue. Well hmmm.

I just want to put a comment on the trigger issue that Story C was created...

If I move it back then it will break the other create issue, and comments.

Laura Hanna
Contributor
December 19, 2023

Because after Story C is created, And I get that working like I want, I will then be creating Story  D. Then update with comment in Story A.

Then Story E with 4 child Stories after that... If that makes sense...

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.
December 19, 2023

Nope, that is still unclear to me. 

One key thing: if you want to add the comment to the trigger issue that action cannot be inside one of the branches on other issues.

What is the purpose of the comment added to the trigger issue (i.e., Story-A)?  Is it an indicator that "everything is done for this rule" or something else?

Laura Hanna
Contributor
December 19, 2023

I am wondering if a New rule for a "Trigger" would work for this...

What trigger would I use for issue created is child update linked parent story.

Suggest an answer

Log in or Sign up to answer