Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to clone issue to different project based on custom field value

Tamil December 15, 2020

Hi,

I want to clone issues to different project based on Custom filed value.

For example if custom field value is A, then it should be cloned to Project A and if custom field value is B, then it should be cloned to Project B.

I am using "Create / Clone Issue(s) Post-function" by JMWE where i need to chose specific project to choose for cloning. Instead is there a way to chose project based on condition of custom field value?

Based on custom field value, i need to clone to different projects(5 or more). Is there a way to chose project to clone based on condition?

2 answers

0 votes
David Fischer
Community Champion
December 15, 2020

Hi Tamil,

you can simply choose "Calculated:" as the destination project, and then provide a Groovy script that returns a project key based on the value of the custom field, such as:

switch (issue.getAsString("custom field")) {
case "A": return "PROJA"
 case "B": return "PROJB"
}
0 votes
Haddon Fisher
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.
December 15, 2020

I have a very similar use-case (we use an "Escalation Team" field to identify which team should be owning an incident), and the way we worked around this issue was to:

1) Include the project key of the destination in the custom field options. As example our team "Optimus Prime" uses the JIRA project with the key "PRIME" so their value in the field is "Optimus Prime (PRIME)".

2) We use Automation as opposed to JMWE for this, but when the logic is triggered it uses string parsing to pull out the project key for use ("PRIME").

This approach saves us a lot of maintenance, since adding a new team or destination is as easy as adding a new value.

Suggest an answer

Log in or Sign up to answer