Condition a validation on the value of a field

Gregory BENARD December 27, 2023

Hello, I am looking to condition the mandatory nature of certain fields of an issue according to the value of one of the fields of the issue for example during a transition trigger a validation action (validator) according to the value of a field and not in all cases. Did someone already do this kind of thing ? Thanks a lot.

2 answers

1 vote
GNarsimhagowda - Empyra
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.
December 27, 2023

Hi @Gregory BENARD 

 

The functionality u are trying can be acheived by third party plugins where u will be able to add the conditional execution, Where if the conditional execution is true then the validator or condition will work.

 

Thanks. 

1 vote
Guilherme Bragatte
Contributor
December 27, 2023

Hi Gregory, 

 

I never have a case like this but, if I could get it right what you need,  I guess you can create diferente transitions for each case (even with the same "from" and "to" statuses) and the use a "Condition" to enable only one transition at a time, according to the field that will define the case. Then, in each transition, you'll be able to configure "Validators", to ensure that others fields are filled. 

Hope that helps! Let us know if it works.

Julien MALLARD October 1, 2024

Hi @Guilherme Bragatte ,

This is the usual way indeed. Smart.

In my case I was not able to implement that because you cannot set several global transitions (from any status) to the same status (the Closed one, in my case, if it matters).
An alternative could have been to turn the workflow into a plate of spaghetti, with 2 additional outgoing transitions from each status.

I chose to rewrite the validator (and its conditions) using a ScriptRunner validator script.

If anyone has a better idea ...

Suggest an answer

Log in or Sign up to answer