Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you set Assignee in Create transition based on Label

danna deaton
Contributor
March 26, 2019


The script will be a post function in Create transition
If Label == STAR, assignee should be Able Brown
If Label == SIMULS, assignee should be Charlie F Dern
If Label == HELO, assignee should be Evan CTR Faulks
Else, assignee == component lead

FAILED #1- Made Assignee the Project Lead (No errors occur when compiling or during transition)

import com.atlassian.jira.component.ComponentAccessor

def containsLabel = "STAR" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Able Brown') }
else {
containsLabel = "SIMULS" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Charlie F Dern') }
else {
containsLabel = "HELO" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Evan CTR Faulks') }
else
{ issue.setAssignee(null) }
}
}


FAILED#2 - Issue remains unassigned (No errors occur when compiling or during transition)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser
MutableIssue issue = issue;

def containsLabel = "STAR" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Able Brown') }
else {
containsLabel = "SIMULS" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Charlie F Dern') }
else {
containsLabel = "HELO" in issue.getLabels()*.label
if ( containsLabel )
{ issue.setAssigneeId('Evan CTR Faulks') }
}
}

1 answer

0 votes
Ravi Sagar _Sparxsys_
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.
March 28, 2019

Hi @danna deaton 

Just wondering why are you not using Components for doing this? 

Ravi

danna deaton
Contributor
March 28, 2019

The project needing this uses both labels and components.  First I have the post function to assign the issue to the component lead, but if there is a specific label, it has to be assigned to someone else on the team. Basically the labels are being used as a subset of the components, as far as I can ascertain.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events