Forums

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

How to set an automation rule based on a cron job to create a task then some subtasks?

Hassan Shahin January 25, 2024

I have created the following steps:

  • Set a trigger as a cron job (0 0 9 29 3,6,9,12 ?).
  • Create a task in some project I specified.
  • Create 5 subtasks of the task I created in the previous step.

Jira indicated that I had to specify a JQL for my trigger. I tried different options, including specifying the fields of the subtasks (which converts the subtasks creation to create an issue) and passing {{createdissue.key}}. This worked for the first subtask but gave an error for the rest. The error meant that the parent couldn't be a subtask. So, I tried to be "smart" and use {{createdissue.key - x}}, where x is 1, 2, 3, 4, but with no luck.

To cut short a long story: How can I get the JQL string that I should use in my case?

Thanks.

3 answers

3 accepted

1 vote
Answer accepted
Najm Polaris
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 25, 2024

Hi @Hassan Shahin

I tried the following and it seemed to work for me. 

I changed the branch condition and only created two tasks for testing. 

 

screenshot-najmpolaris.atlassian.net-2024.01.26-08_53_07.png

Hassan Shahin January 25, 2024

Thanks @Najm Polaris

This also makes sense, and I see your point. In my case, I wanted to hit 2 birds with one stone:

  • Use a corn job.
  • Create the automation rule.

But, thanks anyway.

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.
January 25, 2024

Hi @Hassan Shahin 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

I hypothesize your rule is missing a branch and using the Create Subtasks action.

That action requires an issue to be in scope to become the parent, and your rule does not have JQL for the Scheduled Trigger, leading to that error / symptom.

The solution for your scenario is to add a branch to the most recently created issue before creating the subtasks.  For example:

  • trigger: scheduled
  • action: create task
  • branch: to most recently created issue
    • action: create subtasks...

 

Kind regards,
Bill

Hassan Shahin January 25, 2024

@Bill Sheboy and @Trudy Claspill 
I am sorry I didn't include any images of my automation. That would have made my request clearer. I am including some now after I applied what Bill suggested.

automation_1st_image.png

As for the JQL, I used:
created = 1m AND summary ~ "Quarterly Satisfaction Survey"

Do you think I am doing things right now?

Many thanks for your patience and understanding.

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.
January 26, 2024

Based on your original question, this looks correct.

Does it work as you expected when you tested it?  If not, what does not?

Hassan Shahin January 26, 2024

Yes. It worked. Thanks, Bill.

Like Bill Sheboy likes this
1 vote
Answer accepted
Trudy Claspill
Community Champion
January 25, 2024

Hello @Hassan Shahin 

Can you show us the details of the rule you created? It is very difficult to advise on what might need to be changed without that information.

A Scheduled trigger can be set up to select issues against which the rest of the rule actions will operate, or to not select issues.

If the trigger does not select the issues, then the actions in the rule have to be correctly configured.

You can accomplish what you want. It is probably that there is some error in the type of actions you selected, or how you organized them, or how you are trying to use smart values.

When you show us the details of your rule we can provide better advice.

Hassan Shahin January 26, 2024

Thanks, @Trudy Claspill

Suggest an answer

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

Atlassian Community Events