How to add a condition about subtasks created in automation rules

Raquel Muñoz Gutiérrez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2025

Hi!

I want to create subtasts automatically but only once.  I created a rule to create several subtastks with the "manual" trigger.

The problem is that I wanted to add a condition so the subtasks only can be created the first time you action the rule, so the subtasks aren't duplicated,  but I don't get how to configure that condition.

Any idea?

2 answers

2 accepted

1 vote
Answer accepted
Atlass Monster
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 16, 2025

@Raquel Muñoz Gutiérrez  Hi hi to you.

This should work

Screenshot 2025-01-16 185538.png

Raquel Muñoz Gutiérrez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2025

Thank you!!! I was searching something like this but I wasn't using the functions properly. 

0 votes
Answer accepted
JM Perrot
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 16, 2025

Hello @Raquel Muñoz Gutiérrez and welcom among us!

I think you can add a hidden (or visible, your choice) numeric custom field and incorporate two steps into your automation.

  1. At the end of your automation, set this field to "1" to indicate that the automation has already been executed.
  2. After the trigger, check the value of this field. If it is already set to "1," the rule will not execute further.

This approach should help prevent duplicate executions of the rule. Let me know if you need further clarification!

Step-by-Step Guide:

  1. Create a Numeric Custom Field:

    • Go to Settings > Issues > Custom fields.
    • Create a new Numeric custom field, e.g., "Subtask Created Flag"
    • Associate it with the appropriate screens.
  2. Modify Your Automation Rule:

    • Trigger: Set the trigger as "Manual" (you already have this).

    • Condition: Add a Condition step right after the trigger:

      • Select Advanced Compare Condition Or issue field Condition.
      • if you choose Advanced Compare Condition, set it to:
        {{issue.Subtask Created Flag}} != 1
        
        This condition ensures the rule won't proceed if the flag is already set to 1.
    • Actions:

      1. Add the actions to create subtasks as usual.
      2. Add an action at the end of the rule to Edit Issue:
        • Set the "Subtask Created Flag" field to 1.

Optional Tweaks:

  • Make the Field Hidden: If you don't want users to see this field, you can:
    • Remove it from all screens.
    • Use Jira's API to check or reset the value if needed.
  • Reset the Field: If you ever need to allow the subtasks to be recreated, you can manually or automatically reset the custom field to 0.
Raquel Muñoz Gutiérrez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2025

Wow! Thank you so much! It's a simple and easy solution, I can't believe I didn't get to it myself.

JM Perrot
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 16, 2025

You're very welcome, Raquel! Sometimes the simplest solutions are the hardest to spot when you're deep in the problem.

Don't hesitate to reach out if you have more questions or need help fine-tuning your automation.

Suggest an answer

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

Atlassian Community Events