Auto assign incoming issues based on conditions

Tiffany Linhardt October 22, 2015

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

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2015

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.

0 votes
Jeremy Gaudet
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2015

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.

Suggest an answer

Log in or Sign up to answer