Scriptrunner (Jira Cloud) transition cloned Issue when cloned by Issue, is transitioned

Romel April 1, 2021

Requirement: When a new issue is created in Project A,  I want to create a clone in Project B ( all ready accomplished) I'm facing challenges transitioning the cloned issue along with the parent issue (cloned by). for e.g. when the parent issue (cloned by) in Project A transitions from one status to another,  I want the cloned issue in project B to transition along with it as well, so its outward link direction.  

I'm still learning groovy and found this script but its for the inward link direction clones --> cloned by. 

https://bitbucket.org/snippets/Adaptavist/8exo75/script-console-transition-an-issue-when

Note: The cloned issue is just a place holder in  project B and wont be acted upon and should just transition along with the parent (cloned by) issue in project A. Also, both projects share the same workflow, so having different statuses wont be a problem

I even tried doing this with Jira automation but looks like I need to write rules for each transition and cannot be accomplished with just one rule (If-else).

Any help in the regard is highly appreciated.

3 answers

1 accepted

0 votes
Answer accepted
Romel April 1, 2021

@Juan Manuel Ibarra appreciate your response. I tried the exact same thing but got an error:

Action details:

Transition issue

Destination status could not be resolved. If using a smart-value ensure this resolves to a numeric status ID or untranslated name for issues (with current status):

Juan Manuel Ibarra
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.
April 2, 2021

That error seems to be because the flows of both projects do not share a similar status or at least they do not have a way to get to the destination state from the state that is there now. Could you share the workflows?

Romel April 4, 2021

@Juan Manuel IbarraI was using different workflows for the projects. Changed it to use a common one and it worked! thanks for your help!!

0 votes
Kate Kabir
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.
April 4, 2021

Hi @Romel 

Thank you for the question.

You can modify this script to be a post function and to transition an issue it will work as long as the transition id that you specifies is a valid transition in the workflow that the issue can take from its current status as you can only transition an issue if a valid transition exists as the API's require this. 

Thank you.

Kind Regards

Kate

0 votes
Juan Manuel Ibarra
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.
April 1, 2021

Hello, In this case, if both tickets have the same flows, it is not necessary to do an if else.

In the trigger you can leave the two options blank so that it is executed in all cases.

20210401_145539.jpg

 

Then within the branch of the related ticket you can select "Copy from trigger issue" so that it goes to the same status as the ticket triggered the automation

20210401_145511.jpg

Romel April 1, 2021

@Juan Manuel Ibarra appreciate your response. I tried the exact same thing but got an error:

Action details:

Transition issue

Destination status could not be resolved. If using a smart-value ensure this resolves to a numeric status ID or untranslated name for issues (with current status):

Juan Manuel Ibarra
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.
April 2, 2021

That error seems to be because the flows of both projects do not share a similar status or at least they do not have a way to get to the destination state from the state that is there now. Could you share the workflows?

Suggest an answer

Log in or Sign up to answer