Stepped validator against two variables

Bill Goetz
Contributor
May 24, 2023

I have a validator check setup that always returns TRUE when using the OR (||) option.  Is there a way to logically validate the reporter accountId first and then proceed to the sub-task check if it evaluates to false?

This is what I have 

issue.reporter.accountId != '<number_Id>' || issue.issueType.name != 'Sub-task' 

Ideally, I'd like to first check the accountID if it is True then validate. If it is False, then proceed to the issueType validation.

Hope I am making sense.

Thanks in advance

2 answers

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2023

Hi @Bill Goetz 

Which Validator type are you using, i.e. where are you using this script? Also, what is exactly the condition under which validation should succeed?

Bill Goetz
Contributor
May 26, 2023

Field required validator in a workflow. We want to make sure an Epic link is entered when creating a ticket.

Exceptions:

If a the issue is a sub-task, allow it to be skipped.

OR

If the reporter is a specific account ID (for a service account) allow it to be skipped.

 

2023-05-26_09-58-15.png

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2023

It depends on the language and the interpreter. Most interpreters would process it starting with the leftmost expression, and if that evaluates to true, then wouldn't care about other expressions at all.

Are you 100% sure that in this case it works differently?

(You could either ask the app's developer or maybe add a print("left") kind of statement to the left expression and an print("right") to the right one and check the output whether you  see "right" printed when the left one evaluates to true.)

Suggest an answer

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

Atlassian Community Events