Field validation on transition when separate custom field value equals X

Justin November 28, 2018

Looking to use JSU to lookup the value of a custom field (value = Client) and then require another field (value = Cost) to be greater than 0 before transitioning to complete.

If the custom field is not true (value = Client), then the issue can be transitioned to complete without restrictions.

I'm able to set a validator for Fields Required on one or the other, but not sure how to do both. It's almost like I want a pre-condition like they have in the post functions option.

Any thoughts on this? Should I use script runner instead?

 

1 answer

0 votes
Olga Videc
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2018

Hello Justin, 

If I understand correctly you have two fields Client and Custome filed (I'll call it field_A)

And Client must be greater than 0,  Client>0, and filed_A != Client

I see you wrote you use JSU, you can use a condition Value Field (JSU) to check the value of cost and a value of field_A.

Add conditions on your workflow transition, you can have multiple conditions.

Justin November 29, 2018

Hi Red, thanks for responding.

When I try to use conditions it only allows transitions to work items meets both of those requirements -- which is good, but if for example the field that has Client has something else in it, then it cannot transition either.

Let me try to reiterate my requirements a bit clearer:

Issue Type of Bug

Field A is a dropdown
Field B is a value

Scenario:

If Field A = Client AND Field B = value greater than 0, user can transition to complete.
If Field A != Client, user can transition to complete.
If Field A = Client and Field B != Value greater than 0, do not allow transition, but rather display a message indicating it needs a value.

Does that help clarify a bit?

Olga Videc
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2018

Hello Justin, 

Thanks for the explanation.

Comparing fields part i think this could help,  add a postfunction insted of condition Precondition: Value Field (JSU) you can add multiple preconditions, when creating preconditions you'll se Combine with Result of previous Preconditions: it has options  Combine with Result of previous Preconditions and options are:

Discard the result of previous precondition
AND
OR

the part about displaying a message indicating it needs a value,  ill look into it

Justin November 29, 2018

Thanks for the follow up, really appreciate your assistance.

I've removed my conditions and moved everything to a postfunction as you suggest, but it doesn't seem to be adhering to any of my rules. Here is a screenshot:

Is there a specific order this needs to be set to function properly?

 

Setup.PNG

Justin December 6, 2018

Resolved this by using ScriptRunner behaviors. Thank you for your help!

Like Olga Videc likes this

Suggest an answer

Log in or Sign up to answer