Forums

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

Clone specifc issue and link it to recently created issue

Matus K February 18, 2023

Hello, 

Let me set the scene: 

TEST-1: - Issue which is holding multiple templates in mutliple fields as well as some other content saved in 3rd party app panels 

TEST-2: - Issue recently created 

TEST-3: - to be created clone of TEST-1 to be linked to TEST-2 

What I want to achieve is that once issue is created (TEST-2) and is matching specific conditions based on IF/ELSE block automation would access TEST-1 issue and create a clone out of it = TEST-3 and linking this clone to TEST-2.

(TEST-1 will remain untouched within the project and will continue to be template issue for this automation).

What should be the best approach?

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
February 18, 2023

Hi @Matus K 

Would you please post images of your rule and of the audit log details showing the execution details?  That may provide context for the community to offer suggestions.

If you have not yet started...I believe what you described is possible as long as you can find your TEST-1 issue based on JQL from data in issue TEST-2.  For example...

  • trigger: issue created (i.e, your TEST-2)
  • action: re-fetch issue
  • branch: on JQL to get your TEST-1 issue
    • action: clone the issue into TEST-3
  • action: link issue (TEST-2) to the most recently created one (TEST-3)

 

Kind regards,
Bill

Matus K February 19, 2023

Hello back Bill, 

Had similar idea unfortunately your suggestion is resulting in an error: 

At least one of "id" or "key" is required to identify an issue.

Tried couple of re-fetches added before the action, but to no avail. 

Kind of out of options.. 

Bill Sheboy
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.
February 19, 2023

Please post images of your automation rule and the audit log details showing the execution and error.  Those may provide context to help explain this symptom.

Matus K February 20, 2023

image.pngimage.png

Bill Sheboy
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.
February 20, 2023

Ah...branches!

Branches which could be on more-than-one-issue run in parallel and asynchronously.  There is no guarantee of when the branch will finish, up to the very last step of a rule.

So the cause of that error is the Link action runs before the issue is created.

A possible work-around is to add a Re-fetch action before you try to link.  That will slow down the rule, possibly giving enough time for the create before the link action.

If that does not work, we will need to rethink the problem to find a new solution.

Matus K February 20, 2023

Hey Bill, 

As I have mentioned in my last comment: 

Tried couple of re-fetches added before the action, but to no avail. 

Tried 3. 

Should I go for 5-6? :D

Bill Sheboy
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.
February 20, 2023

Nope...it appears the Link action is so much faster than the clone that the re-fetch will not help.

Let's do this a different way, moving the link closer to the clone:

Matus K February 20, 2023

Yep, completely forgot about advanced formatting. Thank you, that should do the trick, Bill.  :)

Like Bill Sheboy likes this
Matus K February 24, 2023

Heya @Bill Sheboy 

 

One more thing.. 
Is there a possibility to create and set the issue.property within the cloning action advanced formatting? Would you be able to find me the correct syntax for this? 


{
"update": {
"labels": [
{
"add": "cloned"
}
],
"issuelinks": [
{
"add": {
"type": {
"name": "Cloners"
},
"outwardIssue": {
"key": "{{issue.key}}"
}
}
}
]
}

??? set and update issue property ??
}

 
Thank you in advance
Matt

Bill Sheboy
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.
February 24, 2023

Do you mean entity properties, such as for issues: https://developer.atlassian.com/cloud/jira/platform/jira-entity-properties/

If so, I do not know how to do that with JSON from a rule, and there are no examples of this on the advanced edit documentation for rules. 

A work-around would be to call the REST API after the Clone action with a Web request action, referencing {{createdIssue.key}} to set/add the property.

Suggest an answer

Log in or Sign up to answer