Issue Clone Does Not Create Cloned Issue

I'm testing the built-in script workflow function in Script Runner that Clones an issue and links.

I set up basic parameters (e.g. Target Project, Target Issue Type, Issue Link Type/Direction).

The script is configured in a Post Function for one of the transitions in Project A's workflow. It supposed to create a clone of this issue in Project B. Whenever I run that transition, the cloned issue is not generated in Project B.

I'm trying to figure out how to troubleshoot this and how to determine why it's not working. Does the user who is performing the transition in Project A have to have permissions to create issues in Project B?

I also set up a script through Add-Ons > Script Listeners > Clones an issue and links, , which gives me the option to select a project key and an event that will trigger the script (along with the other parameters of the clone). But the issue doesn't get cloned here either.

What am I missing?

3 answers

Hey Julio,

do you also use that event in your workflow? Or are you trying to clone JSD issues ? This doesn't work really well ... but Create on Transition does ok.
If this doesn't help a little more context would be great or some details of the workflows

Bildschirmfoto 2015-03-27 um 08.16.45.png
Bildschirmfoto 2015-03-27 um 08.19.18.png 

@Julio Ochoa you can attach an event in your workflow by editing the standard post function 5. (Fire a Generic Event event that can be processed by the listeners.) Edit this one and change it to your own event . :) Added a screenshot above.

Simon, I performed additional testing yesterday and determined that the reason why the cloned issue was not being created was because the user initiating the transition in the source issue project didn't have create issue permissions in the target project. So far I worked around this by changing the create issue permissions in the target calendar. This is not ideal though. Will the suggestion that you mentioned here preclude the need to change permissions in the target project?


The answer to both questions is No. The issue I'm cloning is in a regular issue from a regular project (not from JSD). Also I didn't find a way to link the event to the workflow, so I created a post function right in the workflow.

I'll attempt to describe the process that I followed.

I have a workflow has 12 statuses. In the transition from one of those statuses, I created a Post Function > Script Post-Function > Clones and Issue and Links.

I then defined the criteria for the script.

There are no other post functions on this transition other than the default ones. There's also a project role based condition and a required field validator.

Below is the excerpt of the XML that the workflow generated after I added the built-in script at that step. My only doubt at this point is whether the user executing the transition has to have issue create permissions in the target project. Let me know if you need additional info.


<step id="10" name="Final for Depts. Release">
      <meta name="">10522</meta>
        <action id="201" name="Release to Depts" view="fieldscreen">
          <meta name="jira.description"></meta>
          <meta name="">10631</meta>
              <condition type="class">
                <arg name="">10304</arg>
                <arg name="">com.atlassian.jira.workflow.condition.InProjectRoleCondition</arg>
            <validator name="" type="class">
              <arg name="contextHandling"></arg>
              <arg name="hidFieldsList">customfield_10554@@</arg>
              <arg name="">com.googlecode.jsu.workflow.validator.FieldsRequiredValidator</arg>
            <unconditional-result old-status="Not Done" status="Done" step="12">
                <function type="class">
                  <arg name="FIELD_TARGET_ISSUE_TYPE">10401</arg>
                  <arg name="full.module.key">com.onresolve.jira.groovy.groovyrunnerrungroovy-function</arg>
                  <arg name="canned-script">com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue</arg>
                  <arg name="FIELD_CONDITION"></arg>
                  <arg name="">com.onresolve.jira.groovy.GroovyFunctionPlugin</arg>
                  <arg name="FIELD_TARGET_PROJECT">MT</arg>
                  <arg name="FIELD_LINK_TYPE">10001</arg>
                  <arg name="FIELD_ADDITIONAL_SCRIPT"></arg>
                <function type="class">
                  <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowupdateissuestatus-function</arg>
                  <arg name="">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg>
                <function type="class">
                  <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowcreatecomment-function</arg>
                  <arg name="">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg>
                <function type="class">
                  <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowgeneratechangehistory-function</arg>
                  <arg name="">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg>
                <function type="class">
                  <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowreindexissue-function</arg>
                  <arg name="">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg>
                <function type="class">
                  <arg name="eventTypeId">13</arg>
                  <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowfireevent-function</arg>
                  <arg name="">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>

I'm looking at the documentation some more, and I'm wondering if I misunderstood how the add-on works.

There are examples of scripts in the documentation. For instance, this page documents the script for cloning an issue (with dependency)

Am I supposed to have the script's code saved somewhere on the JIRA server? I was under the impression that, at least for the built-in scripts, the Add-on would keep those scripts somewhere and I was just providing it the criteria.

Thanks for any help on this...

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,789 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot