Postfunction is not assigning

Robin Weiß January 17, 2019

Hey there,

 

I'd like to write a postfunction script  with Adaptavist ScriptRunner witch sets an assignnee automatically. 

could someone please tell me whats wrong about this code:

def user 
if(condition1){
user = "test1"
}else(condition2){
user = "test2"
}
log.warn(user) // tells me that there is an user
issue.setAssignee(userManager.getUserByName(user))

All tickets are not assigned after running throw this script although the script is not failing.

 

I read the script runner documentation but I couldn't find a solution.

Thanks for your help beforhand.

 

1 answer

1 accepted

0 votes
Answer accepted
Joshua Yamdogo @ Adaptavist
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.
January 17, 2019

Hi Robin,

What is the order of your post-functions? Have you tried moving this script post-function as the last item on the list?

Also, have a look at this script on our Library website:

https://library.adaptavist.com/entity/update-the-assignee-of-an-issue-in-jira

You may need to use the updateIssue() method.

Regards,

Josh

Robin Weiß January 18, 2019

Hi Joshua,

 

thanks you a lot. Now it works fine.

For all interested:

def user 
if(condition1){
user = "test1"
}else(condition2){
user = "test2"
}
log.warn(user) // tells me that there is an user
issue.setAssignee(userManager.getUserByName(user))

issueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED,false)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events