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
Community Members
Community Events
Community Groups

Can I require a field be populated based on specific resolution values?

We have a text field we would like to be populated on resolve/close but only when the resolution is fixed, complete, or cannot reproduce.  Is this possible?

1 answer

0 votes

you could create 2 transitions: 

  • fixed, complete, or cannot reproduce
  • other

And use 2 diferent transition screens and validators.


Thanks, but that's really not what we're looking for.  We need a validator that incorporates conditional logic.

This is a script for simple script validator:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField

switch (issue?.getResolutionObject().getName()){
    case "fixed": case "complete": case "cannot reproduce":
        CustomField textField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("field name")
        return issue?.getCustomFieldValue(textField) != null;
        return true;           

For the transitions that go to the Resolved status (or whatever name you use for that status), you need to have a screen that includes the fields you want to validate and any other fields that you want to allow the agents to edit during the transition.

Using a Validator in the workflow will not put the "required field" asterisk next to those fields, but you can provide a message that will display if the validation fails. You can check each required field in a separate validator, or combine multiple fields in a single validator. The validators will be gone through in order, but only one validator's message will display. If there are multiple missing required fields, only the message for the first missing required field will display.

Thanks @Vasiliy Zverev but that organization didn't have ScriptRunner.

@Archer Vanwormerson I think if I were to try to solve this now (I've not been with that team in years) then, assuming I was using Jira Cloud (which has built in automation) I would create an automation rule to populate the field under those conditions.

Five years ago, when I wrote this, that wasn't an option.  Though, even if we could do so in Cloud, we were using Jira Server.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events