Forums

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

Postfunction to clone issue and then set Assignee as the Reporter of source issue

Duane Cronkite
Contributor
January 3, 2019

I need to figure out the correct code to set Assignee as the Reporter (of source issue), within the additional issue actions code box of the Clones issues and Links scripted Post-Function.

1 answer

1 accepted

0 votes
Answer accepted
Carmen Creswell [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 4, 2019

Hi Duane, 

You can use this code to set the Assignee as the Reporter within the Additional Issue Actions box: 

issue.reporter = issue.assignee
Duane Cronkite
Contributor
January 4, 2019

I tried this and the issue was assigned: "Anonymous" 

Carmen Creswell [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 4, 2019

Okay, I just did some testing and got "Anonymous" in my instance. The way I set mine up originally was that under "Fields to Copy" in the Post-Function, I selected "Assignee." This ensures that the Assignee field will be available in the newly created issue. However, this also means that the new issue is automatically assigned to the same person it was before (and they are made the reporter). Does this work for your implementation?

Carmen Creswell [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 4, 2019

Oh, also, the issue that you transition actually has to be assigned to someone for this to work. 

Duane Cronkite
Contributor
January 4, 2019

"Fields to copy" doesn't appear to be an option for the post function Clone issues and Link. 

What I am trying to accomplish is Reporter of Task A becomes Assignee of Clone A and ideally Cloner of Task A becomes Reporter of Clone A

 

Thanks,

Carmen Creswell [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 4, 2019

Okay, I think this code should do what you need: 

issue.assignee = sourceIssue.reporter
issue.reporter = currentUser

This will make the Original issue's reporter the Cloned issue's assignee, and it will make the current user (the cloner) the Cloned issue's reporter.  

Like Duane Cronkite likes this
Duane Cronkite
Contributor
January 7, 2019

Initial testing is showing positive results!!! 

 

Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events