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

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") {

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.

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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,152 views 5 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