How to use groovy scripts to clone an issue based on multiple project select choose

Cloud September 11, 2017

Hi Support,

How to use groovy scripts to clone an issue based on multiple project select choose?

I am a begineer for groovy scripts and not familiar with it?

Could you please give me some direction or suggestions?

Or Provides some reference code?

Thank you.

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Cloud September 12, 2017

Hi Support,

This Clones an issue,and links function only support traget single project created,But I want to choose multiple project to create,do you have any suggestions about it?

 

Thank You.

0 votes
Joshua Yamdogo @ Adaptavist
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.
September 11, 2017

Hi Yun,

Could you provide more details as to what you are trying to accomplish?

Let me see if I understand correctly:

  1. You have a custom field of type "Multi-select" list
  2. Users can select types of "Projects" from the Multi-select list
  3. If they select certain projects, you want to clone the issue 

You could accomplish this using a Script post-function. For example, you could add a post-function on the "Create" transition of the workflow.

ScriptRunner already has a built-in function to clone an issue:

Screen Shot 2017-09-11 at 3.21.42 PM.png

You could use a condition like this to check what values are selected in the custom field:

('Project1' in cfValues['Project List']*.value) && ('Project2' in cfValues['Project List']*.value) && ('Project3' in cfValues['Project List']*.value) 

 

Cloud September 13, 2017

Hi Support,

This Clones an issue,and links function only support traget single project created,But I want to choose multiple project to create,do you have any suggestions about it?

TAGS
AUG Leaders

Atlassian Community Events