Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation should block status change

Pauline Hild
Contributor
April 19, 2023

Hi everyone,

I need an automation that prevents a subtask from being set to "Done" status if certain conditions are not met (customfield ("LIMS") not yet filled and summary contains certain words ("Data Analysis" and "Data Transfer")). If the conditions are not met, the status should automatically be set back to the previous status. There is always a problem with this step (see screenshot error message).

I have already researched and often read that either the actor of the automation does not have the authorization or the transition is not possible in the workflow. Neither applies in my case.

Any ideas what else the problem could be?

Many greetings

Pauline

 

Bildschirm­foto 2023-04-19 um 14.33.12.pngBildschirm­foto 2023-04-19 um 14.33.49.pngBildschirm­foto 2023-04-19 um 14.39.54.png

2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

Hello @Pauline Hild 

Though you say you want to "prevent" the transition with the rule, I see from your additional text that you understand you have to actually undo the transition after it has occurred.

I believe your problem is your use of the smart value {{issue.previous.status}} in this step

Screen Shot 2023-04-19 at 3.21.41 PM.png

Can you show us the details of that step?

Also, can you tell us where you go the idea to use that smart value? I found it mentioned in this post from 2021. However, in that post it becomes clear that it is actually a reference to a custom field named Previous status which has been added to the project issues, and is being filled in during each transition so that there is a record of the previous status for the issue.

Have you created the custom field Previous status and are you setting its value each time the issue is transitioned? If you are setting it, can you provide information about how you are setting it?

Pauline Hild
Contributor
April 20, 2023

I didn't find a way to block the transition, so I thought I could just undo the transition. Is there also a way to prevent the transition directly?

I found the smart value in some other posts, so I thought this must be the right one. However, I don't have a "Previous status" field. Is there a smart value that has this function?

Bildschirm­foto 2023-04-20 um 15.40.35.png

Like John Funk likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2023

Hello Pauline,

As @John Funk mentioned you can't prevent a transition with an Automation Rule. Automation Rules run in reaction to an event. If you want to prevent, rather than undo, the transition you would need to modify the workflow transition to the Done status adding Conditions and/or Validators (or Rules, if you are working in a Team Managed project) to prevent the transition.

I have not worked out if the conditions you specified could all be set up between Transition Conditions and Validators (or Team Managed project Transition Rules) with native functionality.

 

In an Automation Rule, you can use the {{changelog}} smart value to look at changes that were made to the issue. This is mentioned in the documentation for the Issue Transitioned Trigger and more information can be found smart values for Issues documentation .

In this case you would get the numeric value of the previous status using the smart value:

{{#changelog.status}}{{from}}{{/}}

You have to use the Create Variable action to store that in a variable.

Screen Shot 2023-04-20 at 8.43.06 AM.png

Then you can use the variable smart value in the Transition Issue action.

Screen Shot 2023-04-20 at 8.43.40 AM.png

Like # people like this
Pauline Hild
Contributor
April 20, 2023

I created the automation rule as you suggested and with this smart value it actually works, that's awesome! Thank you so much for your help!!!

Like # people like this
Troy Anderson
Contributor
June 30, 2023

Don't forget to reset the Resolution field as well!

2 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

Hi Pauline,

Automation cannot prevent things from happening, it can only react to things that do happen. You would need a Validator (and/or Condition) on the transition in the workflow to keep it from transitioning in certain cases. 

You don't want to just let them move it to Done and then if the criteria is not met, use automation to move it back. Prevent them from moving it in the first place. 

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