Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,451
Community Members
 
Community Events
184
Community Groups

How does the Code for cloning an issue in groovy look like? - usage in post-function

Hi there,

I would like to clone an issue during a post-function of a transition. As I want to clone it more than once, the pre-defined clone post-function won't do it. 

How can I access the clone functionality via groovy?

Cheers

Michaela 

1 answer

0 votes
Daniel Yelamos [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.
Oct 16, 2017

Hi Michaela.

The code would be quite complex. I would recommend you simply use the predefined clone postfunction twice. Would that be an option?

Cheers!

Dyelamos

Hi Dyelamos,

thanks for your answer. Well I thought about this but then I need to do it not twice but more like 10 -50 times. Depending on how often I need the issue. 

Here is what I am trying to do: 

We want to have recurring tasks in Jira, all instances created at once with the appropriate due dates. Therefore I have a Master issue with all the data in it including how often the issue is repeated. On workflow transition "create instances" I create all instances at once using the post-function. Due dates are calculated and set there also. 

I currently don't see a way of calling the post-function each time of cloning an issue. 

Do you have any idea how to do it?

My current solution is to create new issues and copy the fields. Unfortunately this is also a little error prone as I need to add all needed fields by hand.

Daniel Yelamos [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.
Oct 17, 2017

Hi Michaela. 

 

This as I explained before is quite complex. As a client of scriptrunner you have access to all of our code within the JAR. How our functions work are as follows:

1. You have a map of strings to strings with all of the paramethers.

2. You should create an instance of the function that you are using, in this case CloneIssueWithAttachments.groovy if I'm not mistaken.

3. After that, you should call the class's .doScript() function with the params map.

As I said, this might be quite challenging. Could I suggest that you contact our consultancy services to hire help on this?

Cheers!

DYelamos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events