Forums

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

JMWE Validator - block if Original Estimate null or zero

Paul Alexander
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.
September 29, 2022

Goal: Block access to a transition if the original estimate is zero or is empty.

I'm struggling to get this one operational for some reason. Using JMWE (jira misc workflow extensions) on a Validator within a step of a workflow, I use the 'Build-your-own (scripted)' type and supply this statement. When testing (within the configuration console) an issue without an original estimate, it yields true. When testing an issue whose original estimate is zero, this also returns true. I've further validated I get a false answer when the condition is not met (which is correct).

issue.originalEstimate == null || issue.originalEstimate == 0

When I publish the workflow and execute the transition through the UI, an issue who should answer true bypasses this validator and is allowed through.

I took it one step further and tried the 'Field Required - JMWE App' type as a validator. Here I use the same custom logic but it too fails to trap the issue (that returns false while testing from the console) so it bypasses validation.

I took things a third step further and tried just one side of the conditions logic (a section before or after the or statement) but it, too, results in the same bypassed validation.

There must be something unique about the `original estimate` property; I did a load of googling without an answer. Innovalog folks - you rock as always!

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
September 30, 2022

Hi @Paul Alexander ,

unfortunately, when you use a "build-your-own" validator, all JMWE does is pass the Jira Expression to Jira, and Jira runs the expression on its own during validation. Therefore, if there is a problem during the evaluation, it can only be Jira's fault.

In this particular case, when you test the validator, is the Original Estimate supposed to change during the transition, or are you really testing the existing Original Estimate?

Paul Alexander
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.
September 30, 2022

The Original Estimate value must be set during this transition and it must not be null or zero. I can get the workflow step to operate if the value is null (by requiring it to not be empty) but I cannot find a way to also prevent the user from supplying a value of "0". Thanks David.

David Fischer
Community Champion
September 30, 2022

Hi @Paul Alexander 

I assume the script you used is the following?

issue.originalEstimate != null && issue.originalEstimate > 0
Paul Alexander
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.
September 30, 2022
David, using the Build-your-own (scripted) validator type, your logic just above this post works great and solves the need. I guess I need more practice in these areas ;). Thanks very much.
 
Of note for others, using this logic with the Field Required Validator (JMWE app) validator type will not work for this.

Suggest an answer

Log in or Sign up to answer