I need to validate a field only if the value in another field matches a certain value.

Floyd Goodell January 22, 2019

I only have access to Jira Workflow Toolbox and need make sure a field isn't blank but only if another field has a certain selection. 

For example: I need to make sure the location field is not blank if "team a" is selected in another field. 

If "team b" is selected the field could be blank. 

Any thoughts? 

2 answers

1 accepted

2 votes
Answer accepted
Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 24, 2019

Hi @Floyd Goodell,

since you already have Jira Workflow Toolbox you can implement the requested behaviour quite easily:

Add a Boolean validator and adapt the following pseudcode to your request.

%{your team field} = "team a" IMPLIES %{your location field} != null

The field codes have to match the fields you're using, obviously.

I hope that helps. Please let me know, if you need further assistance.

Cheers,
Thorsten

Floyd Goodell January 24, 2019

Thank you Thorsten I appreciate it, I was experimenting with Boolean Validators although I hadn't tried "implies". I will have to give it a try.

The problem I ran in to repeatedly is the "Only if" logic ... so anytime I would put in a validator of any kind for that team in that field it would pop the validator when another team was selected as well. For example I want the validator to trigger when finance is the team but not trigger when development is selected... 

Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 24, 2019

Hi @Floyd Goodell,

this is exactly what the function (IMPLIES) is for: if and only if your specific team is selected, then the other field is enforced to be set. So everything should work fine.

If you're experimenting with parser expressions and run JWT 2.4.0 or newer, I'd clearly recommend testing your expressions on the newly added Parser Test Page (see the documentation here: https://apps.decadis.net/display/JWT/Expression+Parser+Test).

You can evaluate your expressions and only deploy the one's to your workflows that are working as expected.

Cheers,
Thorsten

Like Max Foerster - K15t likes this
Floyd Goodell January 24, 2019

Thank you that makes sense. I will let you know how it goes as soon as I can. 

I really appreciate all the help

Floyd Goodell January 24, 2019

@Thorsten Letschert _Decadis AG_ That worked perfectly in test... thank you very much

Like Max Foerster - K15t likes this
Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 25, 2019

Fixed a small typo. Obviously it should read != instead of =.

Doug Slay March 26, 2021

@Thorsten Letschert _Decadis AG_ , I have the same problem mentioned above but when I attempt to use your sample code and replace the {your team field} and {your location field} with my fields I get a script error.  For some reason the Validator does not like the IMPLIES command.

 

 issue.customfield_10002 != null IMPLIES issue.customfield_13432 != null

 

Any ideas?

Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 28, 2021

Hey @Doug Slay ,

could you please - when in doubt - add a screenshot of your configuration? Please ensure, that you're using the correct syntax, especially regarding our field code reference - see https://apps.decadis.net/display/JWTSDC/Field+codes

That said, your expression should probably read:

%{issue.cf10002} != null IMPLIES %{issue.cf13432} != null

 Cheers
Thorsten

Jelmer Tiemessen June 24, 2021

Hi Thorsten,

I tried 'IMPLIES'. However, my validator only returns true now... What might this be? If I run the expressions individually, I do get the right results...

my code:

%{issue.cf58002} = "Yes, ticket already exists" IMPLIES (count(linkedIssues("causes")) > 0)
Jelmer Tiemessen June 24, 2021

Nevermind, it works as intended! Just confused me in the admin section...

Sekhar Chandra September 26, 2022

@Thorsten Letschert _Decadis AG_ 

I really appreciate your help.

We too have same requirement during transition but the reference field is a elements connect SQL live feed field. 

Will this set-up or logic code works for this type of custom field also?

 

Thanks

Chandra

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2019

Hello Floyd,

Welcome to Atlassian community.

I would like to confirm to you which would be the trigger to perform this validation.  I mean, Should it be performed as soon as the field is filled with team A or team B are filled or in a specific workflow transition?

Also, Are you using JIRA Cloud or Server?

It seems that you would like to perform this validation as soon as your field is filled with team A or B, correct?

If that's the case, you will need a plugin to achieve it. My recommendation would be:

 

1 - Split your workflow in two, configuring two workflow transitions:

One with the proper validator to confirm if the location field is set;

 One with no validators.

 

2 - Install  Automation Lite for JIRA (300 free executions) plugin

 

3 - Configure a new automation rule to trigger when the field is filled with team A or B, transitioning the issue for one of the two created transitions of your workflow

 

We will be waiting for your answer to know if we have properly understood your request and give you more instructions in case you need.

Floyd Goodell January 24, 2019

Thank you for your response. Sorry I forgot to include which Jira version and type we are using: Jira server 7.3.6 and Jira service desk 3.5.0.  Ideally this would be triggered on a specific transition. The transition doesn't have to be automated. 

A little more detail... basically in one of our service desks multiple help desk teams and 2nd level teams utilize the workflow... one second level team needs to have a custom field (field is a billing account selection) be anything other than a value of none or "tbd" before moving to a resolution. The rest of the teams don't even utilize the field but I couldn't get any validator available to me to work in a conditional sense (only impacting that team). 

Suggest an answer

Log in or Sign up to answer