Forums

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

Scriptrunner: Validate Certain Values Not in Custom Fields on Issue Edit

Dorian Workman
Contributor
April 29, 2020

Hi all

I figured out how to validate that custom fields do not contain certain values using Scriptrunner simple scripted validators on workflow transitions.  Shown in the attached are two examples that I have working, the first for a text entry custom field (that has the same name as another field so I had to implement it using the custom field ID), and the second for a multi-select list.

My question is, can I implement these checks on issue edit (not create), rather than on a workflow transition?  I think the right way to do this is using a Scriptrunner Behavior on the fields, but copy/pasting these scripts as behaviors does not work.  Any suggestions please?

Thanks!

Validator Examples.png

3 answers

1 accepted

0 votes
Answer accepted
Dorian Workman
Contributor
April 29, 2020

Actually, the error message is displayed, it's just displayed down the bottom of the Edit screen, instead of below the field being validated (shown with red arrow).  And there's a colon displayed at the start of the error.  Any ideas why???

Thanks.

Error Message.png

0 votes
Dorian Workman
Contributor
April 30, 2020

I'm going to accept an answer above as I solved the original problem.  I'll post a separate question about the error message location and formatting.

0 votes
Dorian Workman
Contributor
April 29, 2020

Well I've made good progress in that I got a Behavior working to the point that it will not allow me to save a change to an issue when a defined value is present in the custom field.  The only issue I'm having is that the error message I've defined in .setError() is not being displayed on the screen at all.  Any ideas please?

 

Behavior.png

Suggest an answer

Log in or Sign up to answer