Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,397
Community Members
 
Community Events
184
Community Groups

How to make a field required during a workflow transition?

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.

4 answers

10 votes
Rachel Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2017

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.)

Implementation

  1. Open your workflow for editing
  2. Click on one of your transitions
  3. Click on the "Validators" tab 
  4. Click the "Add Validator" link on the right (see screenshot)
  5. Add for the validator called "Field Required Validator" and choose the specific field make required

validator.png

Tips:

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!

Rachel Wright

 

Rachel,

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?

Screen Shot 2017-05-22 at 9.40.58 PM.png

Does anyone still have an answer to Fred's last question? I am facing the same problem.

Like Mohammad RahmaniNasab likes this
Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Dec 17, 2018 • edited

Hi @Micha,

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.

Cheers,
Thorsten

Like # people like this

Just found this answer... Is this true? Jira Server is not able to perform this simple and basic task that we have to rely on a 3rd party developer and a PAID plugin?

 

Im getting this right, Jira Server is not able to make a transition validator based on its own fields, yes?

Like # people like this

That's right. Jira server does not have filed required validator pre-install. 

That is ridiculous as a missing feature.

Like # people like this
4 votes
JamieA
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.
May 22, 2017

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.

Like Tanja Schmidt likes this

I can explain how to make a custom field required during workflow transition. You can refer the detailed steps on my below blog post,

https://codetolive.in/jira/How-to-make-custom-fields-required-in-a-workflow-transition-in-jira-script-runner

Is there any way to apply this validation only for a specific Issue Types?

Not sure about Adaptivist stuff, but in Jira itself different issue types can use different workflows. You can e.g. couple IssueTypeX with WorkflowX, then make a copy of WorkflowX (hereinafter WorkflowXa), add the validator to WorkflowXa (but not to WorkflowX), then couple IssueTypeY with WorkflowXa. The downside is that you'll need to update both workflows separately even if the validator is the only intended difference...

Like Alex Bowell likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events