Forums

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

Fields required validaor condition

Manvisha Kodali July 10, 2023

Hi

 

In the workflow, using Scriptrunner Field(s) required validator with the following condition.

cfValues['T Shirt Size']?.value != 'S' ||  cfValues['T Shirt Size']?.value != 'M'
It is mentioned about the condition that: Enter the condition for which this function will fire. Blank will evaluate to "true". But the condition is not working (ie., the issue T Shirt Size='S', but still validator fires). Can someone help to fix the condition.

1 answer

1 accepted

2 votes
Answer accepted
Evgenii
Community Champion
July 10, 2023 edited

Hi, @Manvisha Kodali 

You have an error with logic. Let's look at your condition
cfValues['T Shirt Size']?.value != 'S' ||  cfValues['T Shirt Size']?.value != 'M'

It fires True if size is not S OR size is not M.
In your example, T-Shirt = S, ok, first part of condition will fail, but other part will return True
If you want to check, that size is not S and is not M, you need to use 
cfValues['T Shirt Size']?.value != 'S' && cfValues['T Shirt Size']?.value != 'M'
 
Manvisha Kodali July 10, 2023

HI @Evgenii 

Thanks for your answer.

Is that possible to display the transition screen only if T-Shirt is not S and M?

Evgenii
Community Champion
July 10, 2023

No, screen on transition is shown anyway. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.8.1
TAGS
AUG Leaders

Atlassian Community Events