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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tom,
Do you have an insight into the error I am seeing by using?
issueInputParameters.setAssigneeId(issue.reporter?.name)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why don't you update the workflow in the different project by adding a post function and use the "Assign to Reporter" option?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in the create step...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If someone creates this tickets manually, I don't want it to assign to reporter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.