Making a field required ONLY when closing a ticket?

How can I find out the status of this: (I don't want to use a validator)

  • Be aware that there is a feature request (JRA-5783) to make a field required for only one transition. If you are interested, please watch that issue for status updates.

4 answers

This widget could not be displayed.

Unfortunately, using validator is the only option now. Any reason why you can't do it?

Indeed.  I don't quite understand "I don't want to use the method that is designed to meet this need, and is the only way to do it"

This widget could not be displayed.

The only difference between a validator and a required field is that you get a red * on fields that are required in a regular way.  When using a validator it does not show a red *.  I agree that this is a minor thing, but my user base has complained about it to me, that it is inconsistent. I explained that the red dot means it is required at all times, and not just during the transition, but I got blank looks back.  It would be a neat feature to have the validator add the red star whenever the conditions are met to make the field required but that would be some work, as the scripts can be fairly complicated.

OK, off the soapbox.

Next smile

Robert

Joe Pitt Community Champion Mar 26, 2016

If they can't be trained for this minor difference dump them. I find it best to only put required fields on transitions. If you do that it will make the training simple, if it's on the screen it is required for the transition. If they don't fill in the field the transition won't proceed and they get a message they need to fill it in. The exception would be the comment field JIRA automatically adds to all transitions. You'll never be able to code around all user errors.

I'd like the red * to get rid of the handful of "it didn't tell me" complaints, but as someone who has used JIRA for <mumble> years, I don't really care.    I fill in the fields I think I want to, click go, and when I miss a mandatory one, it tells me (unless the admin has set up a bad validator that doesn't)

Totally agree it's a very "nice to have".  But given the stuff I want Atlassian to do, it's a hundred and eleventy twelve on the list...

Agreed Nic.  a hundred and eleventy twelve lol never heard that one before.   Just pointing out why someone might not want to add a validator.  And Joe, I cannot dump my users as that is my customer, but I can tell them hey that is just the way it is, live with it.    Yeah it is so minor that I will not even create a change request. 

I have heard it a lot that I ended writing this: http://www.j-tricks.com/tutorials/silly-javascript-hacks-or-is-it

Wow Jobin, very cool.  Though neither your javascript nor Jamie's work for me.  sad I copied and pasted directly into my custom field's description, and then changed the customfield number to match mine and no luck.  here is the code I added:

<script type="text/javascript">
AJS.$("#customfield_10500").parent().children('label').append('<span class="aui-icon icon-required"></span>');
</script>

No star, on the transitions it is required and non on the ones it is not.  THis one is required on create when the custom field "who found" = customer.

I also tried:

if (!AJS.$("#issue-workflow-transition input[name=action]").val()) {
AJS.$("#customfield_10500").parent().siblings('label').append('<span class="aui-icon icon-required"></span>');
document.getElementById('customfield_10500').value = getCurrentUserName();
}

no bueno...

I also tried it on a less complicated one that was only required on a transition (no script for the validator) and still no star.  I really do not know js enough to know why...

The DOM elements might have changed over the versions. Also, the elements are different for different custom field types. You might find some examples in the comments section. You just need to find the one in your JIRA version, for you custom field and modify the script accordingly.

There is a difficulty here.   In a lot of cases, validators are simple.  "What is the flight speed of an unladen swallow"?  The answer is mandatory, so you can and, exactly as you say, tell the user that somehow (like the red asterisk)

But it fails for more complicated validators.  Field is mandatory is one of the simple cases, but if you code a validator for "If it's Tuesday and it's an African swallow instead of a European one, and it may or may not be carrying a coconut shell" - how do you decide to put the red asterisk in.  Or a validator that says "date must be empty or in the future". Or. Or. Or.

I am absolutely 100% behind the idea of "if field is mandatory, tell the user".  Much as I love Atlassian stuff, there are two big howling flaws in JIRA right at the top of my "seriously? just fix it" list.  One is resolutions/done (discussion not relevant here), and the other is the way fields are handled.  I would NOT change validators.  But I'd throw "field is mandatory" validators in the same scrap-heap as "field configurations" and move all of that junk into screens.  If you could flag a field as mandatory in a screen instead of a config or a validator, the problem goes away because the screen knows it's needed and can pop the red flag.

This widget could not be displayed.
This widget could not be displayed.
Joe Pitt Community Champion Mar 25, 2016

They won't implement it. The supported jira-suite-utilities gives you the ability. They've already pointed to it as reason not to implement it or something else it does.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

165 views 1 3
Join discussion

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you