Forums

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

Restrict the creation of subtasks by the type of the parent ticket

Manar El Kefi August 1, 2024

 

 

Hello, I want to restrict the creation of subtasks by the type of the parent ticket. For example, I don't want a story type parent ticket to have a subtask. How can I do this using automation?

2 answers

1 vote
Hans Polder _Devoteam_
Community Champion
August 1, 2024

HI @Manar El Kefi ,

Why would you want to use Automation for this? Could you share a bit more context about the use case/situation you want to solve?

Please keep in mind that natively in Jira this is not supported: https://jira.atlassian.com/browse/JRACLOUD-7990

0 votes
Annie@DevSamurai
Atlassian Partner
August 1, 2024

Hi @Manar El Kefi

To restrict the creation of subtasks based on the parent ticket type, you can follow the automation rule below on how to set it up. 

  1. Navigate to Automation:

    • Go to your Jira project.
    • Click on Project Settings in the sidebar.
    • Select Automation from the settings menu.
  2. Create a New Rule:

    • Click on Create Rule.
    • Choose the Issue Created trigger. This sets the rule to activate whenever a new issue, including subtasks, is created.
  3. Add a Condition:

    • Click on New condition.
    • Select Issue fields condition.
    • Configure the condition:
      • Field: Issue Type
      • Condition: equals
      • Value: Sub-task (or the specific name of your subtask type)
  4. Branch Rule/Related Issues:

    • Click on New branch.
    • Select Parent. This creates a branch that allows you to evaluate the parent issue of the subtask.
  5. Add Another Condition:

    • Within the parent branch, click on New condition.
    • Choose Issue fields condition.
    • Set the condition:
      • Field: Issue Type
      • Condition: equals
      • Value: Story (or the specific issue type you want to restrict)
  6. Add an Action:

    • Click on New Action.
    • Choose one of the following actions based on your requirements:
      • Delete Issue: This action will delete the subtask if it meets the conditions.
      • Send Email: To notify users via email.
      • Send Slack Message: To notify users via Slack. You will need to configure the message and provide a Slack webhook URL.
  7. Save and Enable the Rule:

    • Once you have configured all the components, click on Save to save your rule.
    • Ensure the rule is enabled by toggling the switch if needed.

Here is the automation flow that I set up based on your requirements above: 

  • Screenshot 2024-08-01 at 17.49.35.png

 

I hope this may help!

Annie

Annie@DevSamurai
Atlassian Partner
August 1, 2024

To test the rule, you can create a Story issue and create a subtask under it. Then you can see the subtask is automatically deleted.

Manar El Kefi August 1, 2024

image.png

Manar El Kefi August 1, 2024

Annie@DevSamurai I did the same steps but when I create for example a subtask for a task parent , it's created. I don't know why

Annie@DevSamurai
Atlassian Partner
August 1, 2024

@Manar El Kefi have you enabled the rule yet?

You can go to Project settings > automation > then Click on the Enable button as the screenshot below

Screenshot 2024-08-02 at 09.38.05.png

Manar El Kefi August 2, 2024

Yes Annie@DevSamurai  , the rule is enabled but it didn't work

Annie@DevSamurai
Atlassian Partner
August 2, 2024

@Manar El Kefi There are 2 possible scenarios where it didn't work:

1. Subtasks Created Before Rule Activation: If subtasks were created under a parent task before the rule was enabled, enabling the rule afterward will not retroactively apply to these existing subtasks.


2. New Subtasks After Rule Activation: When you enable the rule and create a new Story and then a subtask under it, you may still see the parent task.

However, when you click on the Issue Key, you can't access it anymore,(as the screenshot below) or try reloading the page. You might find that the subtask has already been deleted. 

Screenshot 2024-08-02 at 15.22.15.png

 

Annie@DevSamurai
Atlassian Partner
August 2, 2024

Also you will get an email notification from Jira that your issue has been deleted like that one:Screenshot 2024-08-02 at 15.42.46.png

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