Forums

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

Clone an issue and assign to the reporter

Kevin Lynch April 16, 2014

I have a post function CloneIssue.groovy that kicks off when a certain value is present. This creates a ticket in a different project. What I need to do is make the assignee in the new ticket the reporter.

For the 'Additional issue actions', I put

issue.assigneeId = issue.reporterId

this does not work as it makes the assignee Unassigned.

I verified that the reported is there. I've made the assignee a cfValue field before, but the reporter is NOT a custom field.

4 answers

0 votes
Tom Moors
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.
April 17, 2014

Hi Kevin,

if I understand you correctly, you want to clone ticket A to ticket B and set the assignee of ticket B to the reporter of ticket A?

You can get the value of the current reporter, i.e. the reporter of ticket A by using:

issue.reporter?.name

(The question mark will protect you against a NullPointerException)

To set the assignee in ticket B, you can make use of the issueInputParameters:

issueInputParameters.setAssigneeId("John Doe")

So if you want to set the assignee of ticket B to the reporter of ticket A, you enter the following line:

issueInputParameters.setAssigneeId(issue.reporter?.name)

Hope this solves your problem!

Tom

Kevin Lynch April 17, 2014

The transition fails and I get the following in the catalina log

/secure/CommentAssignIssue.jspa [onresolve.jira.groovy.GroovyFunctionPlugin] Error executing post-function
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: issueInputParameters for class: Script9

Kevin Lynch April 21, 2014

Tom,

Do you have an insight into the error I am seeing by using?

issueInputParameters.setAssigneeId(issue.reporter?.name)

0 votes
Mehmet Kazgan
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.
April 16, 2014

Yes. You can handle that by adding a custom event and fire that up in Project 1 as a post function and add this event as a condition in Project 2 workflow.

0 votes
Tom Moors
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.
April 16, 2014

Hi Kevin,

Setting the reporter works a bit different than setting the custom fields, therefore you might be unsuccessful in your efforts. Can you try to set the reporter with the following line in the "Additional issue actions" textbox:

issueInputParameters.setReporterId(issue.reporter?.name)

To get a better insight, this script is using the InputParameters for creating a new issue, which has some basic JavaDoc here: https://docs.atlassian.com/jira/6.2.3/com/atlassian/jira/issue/IssueInputParameters.html#setReporterId(java.lang.String)

Tom

Kevin Lynch April 17, 2014

I want to reference the value of reporter and assign to another field. I just need to command(s) that will pull the current reporter (during this clone process).

0 votes
Mehmet Kazgan
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.
April 16, 2014

Why don't you update the workflow in the different project by adding a post function and use the "Assign to Reporter" option?

Mehmet Kazgan
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.
April 16, 2014

in the create step...

Kevin Lynch April 16, 2014

If someone creates this tickets manually, I don't want it to assign to reporter.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events