Auto assign incoming issues based on conditions

I'm working on a workflow with JIRA Service Desk for our onboarding process. I'd like for the issue to automatically assign to one team if a particular custom field is selected and to a different team if it is not.  

I've configured triggers from an Open status to an In Progress status that effectively do this but do not do it automatically from issue creation (the assignments are correct though if you take the issue and click the appropriate transition button), but I cannot seem to have multiple transitions from the Create Issue status to allow for the conditional element.  

Is there something I'm missing here?

2 answers

This widget could not be displayed.

I think the right place/method to do that is a custom script post-function on the create transition.  Something like:

import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
 
ComponentManager componentManager = ComponentManager.getInstance();
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();
CustomField yourCustomField = customFieldManager.getCustomFieldObjectByName("Your Custom Field");
 
editableIssue = (MutableIssue)issue;
 
if (issue.getCustomFieldValue(yourCustomField) == "Value 1") {
	editableIssue.setAssignee();
}

setAssignee() takes an ApplicationUser; it may be easier to use setAssigneeId() if you can figure out what that is, as it just takes a string.  I don't have a sample handy for building an ApplicationUser from a userID.

This widget could not be displayed.

A more non-programming solution would be to use the conditioning support in the Update issues post function from Update on Transition for JIRA. See How to update issues after initial issue create.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

115 views 2 0
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