Clone Issues , entering infinite loop

Sk Rajim Ali January 21, 2019

I have two projects - Proj1 and Proj2 and one issue type IT1 for both the projects. I have requirement like if IT1 is created from Proj1, then there would be another cloned issue type under Proj2 and vice versa.

I have written two scriptrunner listeners for two projects to clone issue. I have written condition as below:

issue.issueType.name == 'IT1' &&
!issueLinkManager.getInwardLinks(issue.getId())*.issueLinkType.name.contains('Problem/Incident')

And in "Issue Link Type / Direction" , I have mentioned "causes" as the link type( where the name of the link type is "Problem/Incident" ).

But unfortunately while I'm trying to create the issue, it's entering into infinite loop. Can anyone please help me here?

 

1 answer

0 votes
Jobin Kuruvilla [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.
January 21, 2019

Maybe just add an additional check, before creating a clone, to see it doesn't already have a "causes" issue link type?

Or populate a custom field, if it was created from a clone and check for that? You will need this only if the above option doesn't work for you.

Sk Rajim Ali January 22, 2019

I don't want to add another custom field for this until it is not possible to achieve with the normal way.

Regarding your first option, I already have written the condition as it is mentioned in the above question. But it's not working any how. So I want to know what's going wrong.

Jobin Kuruvilla [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.
January 22, 2019

Oops, missed that condition. When are you creating the issue link? Is it after the issue is created? If so, the create listener is probably triggered already and the issue wouldn't have a link at that time?

Sk Rajim Ali January 22, 2019

the issue link is created within listener.

Jobin Kuruvilla [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.
January 23, 2019

So, you have a listener for create events. And, within the listener, you:

1. Clone the issue in the other project

2. Create a link back to the original issue

Is that how it is done now?

If so, #1 will trigger the new "Issue Created" event and that might execute before #2 is done, right? Probably that explains why it gets in a loop?

Suggest an answer

Log in or Sign up to answer