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

0 votes
Accepted answer

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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,946 views 19 22
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