Automation rule to prevent defects moving to done if there is no root cause
Asked by Rania Haddadin:

Hello,

I am looking to create an automation rule to prevent a user moving a defect to done if the root cause and root cause description is blank.

Thanks in advance,

Rania


Answers:
author: Trudy Claspill
body: Hello [@Rania Haddadin](/t5/user/viewprofilepage/user-id/4251567)

Automation rules cannot be used to prevent an action from happening. Automation rules are triggered by completion of an action. An Automation Rule could only react after the transition has completed.

Instead you need to modify the workflow transition to the "done" status to add a Validator to confirm that the fields are not empty.

The method to do this depends on:

1. Your Jira hosting type: Are you using Jira Cloud (Atlassian's software-as-a-service product) or Jira Server/Data Center (the product where your company installs the software on their on servers)? If you are unsure, click the Help button in the Jira menu bar and select About, and tell us what that says.

2. If you are using Jira Cloud, are you working with a Team Managed project or a Company Managed project? That information will be available in the Type column on the View All Projects page under the Projects menu.

comments: author: Rania Haddadin
body: Thank you we are using the software and I am working on a team managed project. I have also raised a question/suggestion to see if we can get a global rule set up but haven't heard anything yet


author: Trudy Claspill
body: Hello Rania,

Please be clear that an Automation Rule (global or project specific) cannot **prevent** a transition from happening. That can only be done through the workflow associated with the project.

For a Team Managed project the workflow configuration options are not as extensive as for Company Managed projects. Refer to this documentation:

<https://support.atlassian.com/jira-software-cloud/docs/available-workflow-rules-in-team-managed-projects/>

The workflow rule you would want is:

<https://support.atlassian.com/jira-software-cloud/docs/available-workflow-rules-in-team-managed-projects/#Availableworkflowrulesinnextgenprojects-Restricttowhenanissueisaspecificvalue>

However the fields that can be checked in the workflow to confirm the field has data is limited in Team Managed project workflows. The fields you want to check may not be supported for this type of validation in TM project workflows.


author: John Funk
body: Hi Rania,

You can edit the workflow to add a Field Required Validator for the transition to Done. Then select the two fields. Be sure to save and publish the workflow.

comments: author: Rania Haddadin
body: Thank you


author: John Funk
body: You are welcome.


author: Shawn Doyle - ReleaseTEAM
body: Automation rules work well after an event. If you want to prevent an action, it's best done in the workflow.

However, if you want to do this in Automation, you could transition the issue back if the root cause description is blank, assuming the workflow supports this transition.

comments: author: Rania Haddadin
body: Thank you


author: Rania Haddadin
body: I was able to play around in UAT and got one created to move it back to in progress, then send the email to the assignee to update the field. Thanks again


Tags: jira-unknown-hosting-type

unknown-hosting-type