I'm evaluating on Jira 6.2.7 sp don't know if this applies to the latest Jira, can anyone advise?
On trying to add a Regular Expression Check validator to a state transition the set of fileds available is just: Business Value, Description, Epic Color, Epic Name, External Issue ID, External Issue URL, <a local custom field>, <a local custom field>, Status Whiteboard, Story Points, Summary, <a local custom field>
What controls a field's inclusion in this set?
The field must contain a text based field.
Not dates, numbers or options (select lists and their variants), it's got to be text based. There's no point in reg-exing non-text fields, their values are controlled and validated already, a user can't get them worng.
Thanks, you know that feeling just after you hit 'submit', when you go d'oh!? :-)
However, what drew me into that question was wondering if I could do something like: Make a field mandatory at a transition based on the contents of another field?
E.g. If 'Resolution' has been set to 'Fixed' then make some other field mandatory.
I guess this form of combinational logic isn't supported?
(Additionally as I'd want to do this within the Resolve transition screen, it would rely on the value as cached in the browser as opposed to that in the database)
Yup, I do that at least once a day!
Validators are a bit limited in Jira when you first look at them, but there's a good reason - the combinational logic you're talking about is the sort of thing you can't code a generic approach to. Every installation, every requirement, every transition could need something different, so it's really quite difficult to do.
You can use more than one validator in an "and" pattern ("field X must be filled" and "field Y must be > 7" type things), but for more complex stuff, including providing different validators, you need code.
Personally, I use the script runner for validators because you can build what the heck you want without having to write a whole plugin to do it. "If resolution == fixed and customfield_12345 == "" then return false" is almost a one-liner in the script runner.
As for your thought about the browser/database, this is something that most people don't think about, and hence sometimes they get very confused. It's nice to see someone thinking it through properly for a change! The trick here is understanding the timing cycle - a validator executes between the user clicking "do it" and Jira going "oi, database, here's an update". At that point, it has two sets of data for the issue - the current stored data AND what the user has entered. It's not the value "cached in the browser", it's the value that the browser has posted to Jira, so one step further, but the validator has full access to both versions of the data, and the whole point of the validator is to block the "oi, database" call if the user's entry is not good enough. So, yes, your code has access to what the user entered. And the current Jira values.
Hi I need to add the next regex pattern to check versions:
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot