Forums

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

Create two Clones in Automation. How to Link those together after creation

Aaron Geister _Trundl_
Community Champion
April 20, 2022

I am automating the onboarding for multiple projects. I have an automation that when an issue is created for HR, it then creates two linked clones for Finance & IT. How do I get those two issues created in my automation to link? 

I tried to use the link issue in automation for recently created but it just links the same issue that is the cloned parent. 
image.png

1 answer

1 accepted

3 votes
Answer accepted
Mark Segall
Community Champion
April 20, 2022

Hi @Aaron Geister _Trundl_ - I think you need a couple things here:

  1. After the first clone, create a variable like varIT with a value of {{createdIssue}}
  2. On the second clone, add the following to the More Options:
    1. {"update": {
         "issuelinks": [
            {
               "add": {
                  "type": {
                     "name": "LINKED ISSUE TYPE"
                  },
               "outwardIssue": {
                  "key": "{{varIT}}"
                   }
               }
            }
            ]
         }
      }

       

Aaron Geister _Trundl_
Community Champion
April 20, 2022

Would it look like this?? image.pngimage.png

Mark Segall
Community Champion
April 20, 2022

Yes, but you need to set the link type that you want (e.g. "Relates To", "Blocks", etc.)

Like Aaron Geister _Trundl_ likes this
Aaron Geister _Trundl_
Community Champion
April 20, 2022

Where do I put that at? In the Json? 

Mark Segall
Community Champion
April 20, 2022

Yes - Just replace LINKED ISSUE TYPE in my JSON

Like Aaron Geister _Trundl_ likes this
Aaron Geister _Trundl_
Community Champion
April 20, 2022

Thank you so much been chasing this all day and it was much simpler than I thought. I started by trying to query a global query to do this and link issues after the fact. 

You have saved me many hours!

I appreciate you!

Like Mark Segall likes this
Aaron Geister _Trundl_
Community Champion
April 20, 2022

@Mark Segall 

Can the file look like this so it will carry the cloned issue link from the parent clone plus the clone from the other project? Or is there no need for that if the linked issue is set on the field setting?

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

{"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates"
},
"outwardIssue": {
"key": "{{varIT}}"
}
}
}
]
}
}

Mark Segall
Community Champion
April 21, 2022

Yes you can definitely add the clone link to the trigger issue.  You should be able to perform it in the same update action.  Try this:

{"update": {
   "issuelinks": [
      {
         "add": {
            "type": {
               "name": "clones"
            },
         "outwardIssue": {
            "key": "{{issue}}"
             }
            "type": {
               "name": "relates to"
            },
         "outwardIssue": {
            "key": "{{varIT}}"
             }
         }
      }
      ]
   }
}
Like Aaron Geister _Trundl_ likes this
Aaron Geister _Trundl_
Community Champion
April 21, 2022

Thank you. This is all json correct. I am wanting to learn the format so I can do this daily. I need to look up more how to formulate these. Do you have any suggestions? Good sources.  

Mark Segall
Community Champion
April 21, 2022

I haven't found a single reference for this stuff.  I've found most of my answers searching here in the community. However, ideally you want the "More Options" section to be more the exception than the rule.  Technically, you could have branched into one of the new tickets and used the add link action for this scenario.  I just proposed this approach to reduce the overhead on the rule.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events