Clone an issue and assign to the reporter

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

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

in the create step...

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

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

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).

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.

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

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

Tom,

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

issueInputParameters.setAssigneeId(issue.reporter?.name)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Apr 30, 2018 in Marketplace Apps

Why moving to Confluence Data Center is only a job half-done

Confluence Data Center is a deployment option that was designed for performance at scale. In other words, Confluence will handle increased traffic much reliably in a clustered environment and yo...

236 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you