Forums

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

Looking for Syntax for Groovy Post Function

Don Schier March 14, 2018

I am trying to selectively reassign an issue based on the original reporter of the issue once the issue has been resolved. However, I'm missing something, obviously, because this simple script is not working--

 

if (issue.get("reporter").getUsername() == 'admin') {
  issue.setAssignee('user_id')
} else {
  issue.setAssignee(issue.get("reporter").getUsername())
}

 

We are using the option Set field value (JMWE add-on) and then choosing a value type of Groovy Expression.

 

Thanks in advance.

1 answer

0 votes
Payne
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 14, 2018

I think that setAssignee() expects a user object, and you're supplying a string. setAssigneeId() expects a string argument. For the first assignment I'd try issue.setAssigneeId('user_id'), and for the second I'd try issue.setAssignee(issue.get("reporter"))

Hope this helps,
Payne

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events