field required if assignee is not unassigned

I have fast track setup, so if there is an assignee, goes to another status.

But It's being blocked by that the new status requires a field, where it's not requered when the ticket is created.

Is there a way, when creating a ticket, to make a field required if thier is an asignee?

Tryig it with a script Validator but now sure what to put. Since issue/Assignee is only filled after i hit "create issue"

1 answer

1 accepted

Hi kjacobs,

At the transition,

  1. Go to the validators
  2. Select the Script Validator
  3. Click on Simple scripted validator
  4. At the condition field, you can add the following script

import com.atlassian.jira.ComponentManager;

def componentManager = ComponentManager.getInstance();
def customFieldManager = componentManager.getCustomFieldManager();

def cassignee = issue.getAssignee() //or user = issue.assginee

def cfield = customFieldManager.getCustomFieldObjectByName("customfield")

def cfieldv = issue.getCustomFieldValue(cfield);

def passesCondition = false;
if (cassaginee != null && cfieldv != null)
  passesCondition = true;

5. Error line, Type the error text you want.

6. At the field, select the field you are planning to set

I added this on the "Create" validator

It worked when I had a user in the assignee field, but but i have unassigned in the assignee field, it did not.

As I create the issue, i only want it to require a field if the asignee field is not unassigned.

Normal Path:

Create -> Open -> Dev

Going from Open to Dev adds a requirement of Resolution. If I fast track from Create to Dev, it wont work because Resolution is not filled in and does not even get the user the option to fill it in, or tell them it's even required.

Wanted Path:

If Assignee is not unassigned

Prompts user to fill in Required field Resolution

Create -> Dev

If Assignee is Unassigned

Create -> Open

The assignee value "Unasigned" means that the assignee value is null.

Also, Create status does not hold two tranistions, It must this way Create > Open > Dev.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

166 views 1 10
Read article

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