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?
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
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="jira.status.id">10522</meta> <actions> <action id="201" name="Release to Depts" view="fieldscreen"> <meta name="jira.description"></meta> <meta name="jira.fieldscreen.id">10631</meta> <restrict-to> <conditions> <condition type="class"> <arg name="jira.projectrole.id">10304</arg> <arg name="class.name">com.atlassian.jira.workflow.condition.InProjectRoleCondition</arg> </condition> </conditions> </restrict-to> <validators> <validator name="" type="class"> <arg name="contextHandling"></arg> <arg name="hidFieldsList">customfield_10554@@</arg> <arg name="class.name">com.googlecode.jsu.workflow.validator.FieldsRequiredValidator</arg> </validator> </validators> <results> <unconditional-result old-status="Not Done" status="Done" step="12"> <post-functions> <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="class.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> <function type="class"> <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowupdateissuestatus-function</arg> <arg name="class.name">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg> </function> <function type="class"> <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowcreatecomment-function</arg> <arg name="class.name">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg> </function> <function type="class"> <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowgeneratechangehistory-function</arg> <arg name="class.name">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg> </function> <function type="class"> <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowreindexissue-function</arg> <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg> </function> <function type="class"> <arg name="eventTypeId">13</arg> <arg name="full.module.key">com.atlassian.jira.plugin.system.workflowfireevent-function</arg> <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg> </function> </post-functions> </unconditional-result> </results> </action> </actions> </step>
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) https://jamieechlin.atlassian.net/wiki/display/GRV/Post+Functions+With+Comments#PostFunctionsWithComments-Cloneissuewithdependencylink
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...
Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...
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!
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