Forums

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

How to add multiple conditions on JMWE validator

lmollentze@gew.co.za April 11, 2022

Good morning all,

I am new to adding custom validators for JMWE. I would like to add a validator that does 2 checks

1. If the customer request type = "New user application" - if this is true then (2)

2. Does email address field contain "@"

I have tried the following but it seems to only evaluate one statement & not both. So the validator is being applied to all request types & not just new user applications.

issue.get("Customer Request Type")?.name == "New user application" && issue.get("Email address").contains ('@')

Any assistance would be appreciate!

2 answers

1 accepted

3 votes
Answer accepted
David Fischer
Community Champion
April 12, 2022

Hi lmollentze@gew.co.za 

the correct script in that case is:

issue.get("Customer Request Type")?.name != "New user application" || issue.get("Email address").contains ('@')

which means:

- either the customer request type is not "New user application" (in which case the validator should pass)

- or if the customer request type is "New user application", then if the Email address contains @ the validator passes, else it fails

lmollentze@gew.co.za April 12, 2022

Hi @David Fischer 

Thank you for your feedback! This makes sense :) I have implemented and tested - all seems to be working as expected.

0 votes
Vikrant Yadav
Community Champion
April 12, 2022

Suggest an answer

Log in or Sign up to answer