Forums

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

How do I restrict a status workflow validation to a single issue type?

Lucas Ferreira
Contributor
February 19, 2024

Hey everyone!

We have some custom fields around here, specificly for the different issue types, such as:

  1. Epic - we have the field Region
  2. Story & Task - we have the field Type of Work 
  3. Sub-task - we don't have any custom field/validation

And when creating those custom fields, I went in the configurations and made sure it was only applicable to that specific issue type (i.e.: Specific for Epics like the figure 1 below)

Figure 1.jpg


Now I'd like to also include a validation in the workflow, to prevent the Issue to be moved to Done if that field hasn't been filled yet (I've made it required in the field creation from now on, but we still have a lot of 'past issues' already created without those fields being filled).

However, when I added the validation for that [Field Required Validatior], the system is considering that the user have to fill both (Type of Work & Region) to be able to move the issue to done, even though it is an Epic issue and should only be necessary to fill Region, once Type of Work is only 'assigned' to Stories and Tasks. And it gets worse, it is also preventing the user of moving the Sub-tasks to done, and these ones don't even have Region or Type of Work 'assigned' to it.

*I've tried to add Workflow Conditions instead of Validations as well, but the problem kept happening.

I would guess it might be related to Issues Layout / Screens / Screen Schemes somehow, and I've tried to make some changes on that too, but got no success.

Could anyone give me a hand here? Sorry if it the explanation is a little bit confusing, but I hope I was able to transcript my problem.

 

2 answers

1 vote
Mikael Sandberg
Community Champion
February 19, 2024

You cannot make a condition in the workflow to only apply to a specific issue type. The condition will apply to all issues types that are assigned to that workflow. The workflow does not know or consider the context that you have set up for custom fields.

Matt Parks
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.
February 19, 2024

Technically, if you have the JSU plugin, you could use the JQL Condition (JSU) condition and write a convoluted query that would accommodate certain fields having a value depending on their issue type, but it's really easy to mess that query up, so I wouldn't recommend it unless you do a LOT of testing with the query to make sure it behaves how you want.

But, having separate workflows for the different issue types and creating the appropriate field required validator on each workflow is the better solution.

Like # people like this
1 vote
Matt Parks
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.
February 19, 2024

In general, you want to use validators to enforce that fields have a value. However, it sounds like you're using the same workflow for Epic/Story/Task/Sub-task.

My recommendation would be to split these up into separate workflows (you could probably keep Story and Task using the same workflow for now) and then only put in the Field Required Validator for the appropriate field, depending on the issue type (or no validator at all for the Sub-task issue type).

Lucas Ferreira
Contributor
February 20, 2024

Awesome!! Thank you very much, @Matt Parks !!

Suggest an answer

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

Atlassian Community Events