I'm just going to throw this out there..
Can anyone write me a (or copy paste a similar) groovy script that I can use as a post function that will auto-assign the issue based on conditions?
A single post function will need a script with the following logic:
IF Custom Field = "A" AND Issue Type = Story THEN set assignee to 'talexander'
IF Custom Field = "B" AND Issue Type = Story THEN set assignee to 'tsmith'
IF Custom Field = "A" AND Issue Type = Task THEN set assignee to 'bjones'
etc..
Jira 7.10.X
Thanks in advance!
Maybe this could help. try to change instead of custom field value, get the issuetype
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.jira.issue.MutableIssue
def issueManager = ComponentAccessor.getIssueManager();
def userManager = ComponentAccessor.getUserManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def cField = customFieldManager.getCustomFieldObject("customfield_12400");
def cFieldValue = issue.getCustomFieldValue(cField);
if (cFieldValue.toString() == "Security") {
def assignee = userManager.getUserByKey("i849194");
issue.setAssignee(assignee);
}
else if (cFieldValue.toString() == "Operations") {
def assignee = userManager.getUserByKey("i826121");
issue.setAssignee(assignee);
}
else if (cFieldValue.toString() == "Instance Creations/Backups") {
def assignee = userManager.getUserByKey("i825046");
issue.setAssignee(assignee);
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.