Forums

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

How to get link id when issue linked in automation rule

Semin Chang July 25, 2024

I want to create an automation rule.

1. When: Issue linked

2. Then: Send web request

    Webhook body: Custom data

    {

      "parent" : "{{issue.Key}}",

      "child" : "{{destinationIssue.Key}}",

      "linkID": "{{}}",

      "type": "{{linkType}}"

     }

 

But I could not find proper information to get id of the created link.

Plz give some information.

Thanks.

2 answers

1 vote
Gaurav Arora
Community Champion
July 25, 2024

Hi @Semin Chang ,

Have you tried using below? It works perfectly on data-center as well as on Cloud.

Inward Issue is {{issue.issuelinks.inwardIssue}}

Outward Issue is {{issue.issuelinks.outwardIssue}}

You can find more details on this page -> https://confluence.atlassian.com/automation/smart-values-for-issue-links-in-automation-for-jira-1384120362.html 

BR,

Gaurav 

Semin Chang July 25, 2024

Hi @Gaurav Arora ,

In Project Automation page, Jira provides several data for easy handling.

Rule executes when an issue is linked to another issue. {{issue}} will always refer to the source issue, so if ISSUE-A is blocked by ISSUE-B, this rule will execute on ISSUE-B. To access ISSUE-A, use {{destinationIssue}}, and to access the link type, use {{linkType}} (e.g. {{linkType}}='Duplicate').

So I use {{issue}} and {{destinationIssue}} and {{linkType}}, and I need to get the link id when link is created, also. 

I can access links by using {{issue.issuelinks}}.

But if there are several links then how can I get the proper link id in the automation rule page?

0 votes
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.
July 26, 2024

Hi @Semin Chang -- Welcome to the Atlassian Community!

The smart value {{issue.issuelinks}} contains the information for all of the links.  Please try using that one with smart value, list filtering to access the link id for your specific issue link: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Kind regards,
Bill

Semin Chang July 28, 2024

Hi @Bill Sheboy ,

I tried to use the below codes, but destinationIssue.Key is null in if-condition. Because "inside of an iterator, nothing above that level of scope is visible".

{{#issue.issuelinks}}
  {{#if(exists(outwardIssue))}}
    {{#if(equals(outwardIssue.Key, destinationIssue.Key))}}
      {{id}}
    {{/}}
  {{/}}
{{/}}

As an alternative, link id and outwardIssue.Key are sent in pairs, and the receiving side filters them with child.

{
  "parent" : "{{issue.Key}}",
  "child" : "{{destinationIssue.Key}}",
  "link": "{{#issue.issuelinks}}{{#if(exists(outwardIssue))}}{{id}}:{{outwardIssue.Key}}{{^last}},{{/}}{{/}}{{/}}",
  "type": "{{linkType}}"
}

Is there any good suggestion?

Thanks,
Semin.

Suggest an answer

Log in or Sign up to answer