Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×

Forums

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

How can I automatically add a related task link issue when creating a task?

Moriarty Chiu August 27, 2023

Hi guys

I would like to achieve the following functionality through automation: when creating an epic, automatically create three tasks (task1, task2, task3). I have already implemented this part of the functionality. Next, I would like these three tasks to have link issue added at the time of creation. Their relationships are as follows: task2 depends on task1 and task3 depends on both task1 and task2. Specifically, task2 is blocked by task1 and task3 is blocked by both task1 and task2. How should I write the automation rule to achieve my goal?

screenshot.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.
August 28, 2023

Hi @Moriarty Chiu 

There is a certain way to do this, and a "I wonder if this will work..." way.

Certain to work:

  • After you create each task, immediately save its key in a created variable, such as varFirstTaskKey set to {{createdIssue.key}}
  • Use those later in your issue linking updates as {{varFirstTaskKey}}, and so forth

"I wonder if this will work...":

  • There is another smart value which contains all recently created issues: {{createdIssues}} (note this one is plural)
  • What I wonder is are the items added to this list in order of creation.  If so...
  • You could reference them in order, as this is a 0-based index list:
    • {{createdIssues.get(0).key}} 
    • {{createdIssues.get(1).key}}
    • {{createdIssues.get(2).key}}

I recommend the first approach, as the order of values in a list is undefined...unless it is forced with an ORDER BY.  (e.g., in Lookup Issues with JQL)

Kind regards,
Bill

Moriarty Chiu August 29, 2023

Dear @Bill Sheboy 

Thanks for your response. I would like to know how to save and retrieve these variables. Could you provide me with an example, please?

 

Best Regards,

Moriarty

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.
August 29, 2023

There is a rule action to Create Variable, which may be used to temporarily store a value for later use in the rule: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable

For your scenario, it could be used to save the created issue keys in a known manner, and the referenced later.  To edit them, you will need to use JSON to add the links.  For example:

  • ...
  • create issue for your first task
  • create variable
    • name: varFirstTaskKey
    • value: {{createdIssue.key}}
  • create issue for your second task
  • create variable
    • name: varSecondTaskKey
    • value: {{createdIssue.key}}
  • create issue for your third task
  • create variable
    • name: varThirdTaskKey
    • value: {{createdIssue.key}}
  • now link the issues, and when you want to provide the key...
Moriarty Chiu August 29, 2023

That's looks great, thank you very much for your help. I'll try it when I'm free.

Regards,

Moriarty

Like Bill Sheboy likes this
0 votes
Mathieu Truchot
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.
August 28, 2023

Hi again,

In the "ceate anew issue" actions : 

"choose fields to set" => Linked issue : 

Capture d’écran 2023-08-28 113423.png

Hope it helps,

Mathieu

Moriarty Chiu August 28, 2023

Hi @Mathieu Truchot 

I wish to implement a dependency structure where "Task2" is blocked by "Task1," "Task3" is blocked by both "Task2" and "Task1," and "Task4" is blocked by "Task3." It seems that this approach cannot be achieved.

 

Regards,

Moriarty

Mathieu Truchot
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.
August 28, 2023

No, you will only be able to create dependency between task 2 and task 1.

I am not sur if we can make task 3 directly linked to task 1

Maybe someone will have a better solution

Moriarty Chiu August 28, 2023

Thank you for your response. However, this issue is particularly urgent for me. Could you please help me get in touch with someone who knows how to resolve this problem?

 

Best Regards,

Moriarty

Suggest an answer

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

Atlassian Community Events