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 Join to answer
Community showcase
Pedro Felgueiras
Asked 35m ago in Jira

Clone a Zephyr issue

When I try to clone a Zephyr issue only a popup showing the issue id and nothing more shows.  On the browser console I see:  RTE not registered Error: No jira/editor/registry at c...

9 views 0 0
View question

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot