Greetings everyone. I'm still fairly new to my JIRA admin role, so please bear with me. Does anyone have any experience using Behaviours (or anything else) to make a field required based upon a workflow transition? For example, we want the field "Removed Reason" to be required when the state of an issue is changed to "Removed". Ideally, the expected result would be a screen that pops up and prompts the user to populate the newly required field before the transition completes. I've been experimenting w/Behaviours (which is a part of ScriptRunner). I've been able to get a field to change to required, but that happens after the transition occurs. Any thoughts or ideas would be welcome.
Hi Fred, no need to worry about new admin questions. We were all new once and we all had this same question, believe me!
You can do this with a workflow validator. I believe these days this function comes with JIRA and doesn't require installing a specific plugin. (I just checked a Cloud instance with no plugins and it's there.)
Validators are checked and must return true before the transition completes.
Unlike requiring a field on a create screen, no asterisk (*) symbol will display for a field required by a workflow. The end user will receive an error message however, if the field is not completed.
As you mentioned, it's a good idea to add a transition screen (not pictured) to allow the user the oportunity to set or update the required field. Otherwise, if the filed has no value, the user will get a workflow error.
Now, if you want to do something fancy that's where Scriptrunner for JIRA comes in! Here's a link to their documentation on workflow functions: https://scriptrunner.adaptavist.com/latest/jira/custom-workflow-functions.html
Hope this helps!
Thanks again for such a quick reply. I tried to apply this on my hosted JIRA instace (7.3.0) and on my Add Validator screen, I don't see a "Field Required Validator" in the list. I only see the following (see screenshot below). Does it make a difference that I'm adding the validator on an "All" transition for a state?
whether you're dealing with an 'All' transition or not does not make a difference here. While a 'Field required' validator is available on Jira Cloud by default, Jira Server relies on 3rd party apps in order to provide such a functionality.
I suspect the reason why Rachel found it in the cloud instance is because "Suite Utilities for JIRA" is pre-installed...
You can do this with ScriptRunner easily using a Simple Scripted Validator, but if you don't need any conditional or programmatic logic, you may as well use SUJ which is a free plugin AFAIK.
You mention you have this on the All transition, but it would be simpler to put it on the specific transition you care about, then use Fields Required Validator.
Plan and track how teams spend their time and effort may represent a rocket science for many team leaders. Not rarely they need to deal with a considerable amount of variables to “hit the tar...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events