Forums

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

Jira Automation - Linked Issue Macro ?

Matt Lind August 14, 2024

i write a lot of JIRA Automation rules to connect JIRA to SLACK, based on triggered events occurring in JIRA. 

I'm looking for two things:
1. the basic macro that lists out all LINKED ISSUES.
  i've been trying to use {{issue.issuelinks.first.inwardIssue.key}} but that returned a blank/NULL

2. macro for most-recent / new linked issue. 
this way i can program an initial alert for ALL LINKED ISSUES, and then a second alert if a new linked issued is linked. 

--COPY OF MY AUTOMATION JIRA TEXT WITH CURRENT MACROS--

*---NEW LINKED ISSUE----* 
*JIRA:* {{issue.key}} *
Link:* <https://tihealth.atlassian.net/browse/{{issue.key}}>

Program Status is now set to: {{issue.status.name}}

---
Linked Issues: {{issue.issuelinks.first.inwardIssue.key}}  <--this doesnt work
---
Tag Type Setting: {{issue.fields.customfield_11182}}
---
::DCM IDs:: Profile: {{issue.fields.customfield_11269}}
SubProfile: {{issue.fields.customfield_11270}}
Campaign: {{issue.fields.customfield_11271}}
Partner ID: {{issue.fields.customfield_11289}}
Auction ID report scheduled: {{issue.fields.customfield_11272}}
-------------------------------

1 answer

1 vote
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.
August 15, 2024

Hi @Matt Lind -- Welcome to the Atlassian Community!

Some issue link types are directional, and so the inwardIssue attribute will not include all of the issue links.

If you only wanted the inward links, please try this:

{{issue.issuelinks.inwardIssue.key}}

If you only wanted the outward links, please try this:

{{issue.issuelinks.outwardIssue.key}}

 

FYI, I recommend using this how-to article for finding all smart values, and testing with an example issue, to learn more about the structure of the smart values within an issue: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Kind regards,
Bill

Matt Lind August 22, 2024
Thanks Bill,
All my issues are linked using the "relates to" type. 
this does not appear to have an inward or outward type. for example, all the other linked-types such as "blocks" or "created" have two selections:
- blocks
- is blocked by
OR
- creates
- is created by
 
So, what would the right Macro be for Linked Issues using the "relates to" type?  

 

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.
August 22, 2024

If you only want the linked issues for a specify type, your two options are:

Matt Lind September 17, 2024

Thanks Bill, but can JIRA automation use JQL?

I've been using Automation macros which uses {{xxxx.xxx}} syntax.

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.
September 17, 2024

Yes...

The Lookup Issues action may use JQL to gather a set of issues.

To process issues individually, branching on JQL is possible.

Additionally, there are rule conditions which may use JQL.

Like Matt Lind likes this
Matt Lind September 17, 2024

i figured out "Relates To" does have background Inward Issues vs Outward issues types, even though there is only one drop down...

if you link Ticket B as a "relates to" linked issue while you are within ticket A, its Outward for any Automation rules pertaining to issue A, but it would be an Inward issue if writing rules pertaining to Ticket B -- and vice-versa.

These were both relevant since users sometimes link issues on either side of Ticket A/B divide.
And, that also means you need to write 2 automation rules if the linked issues are across Projects if (like me) your automation rule permissions limit you to a single Project at a time. 

 

{{issue.issuelinks.inwardIssue.key}},{{issue.issuelinks.outwardIssue.key}}

 

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.
September 17, 2024

Yes, and...

In my experience, I have not found rule behavior consistent (i.e., deterministic) regarding which issue is the "trigger" versus "destination" when the trigger was Issue Linked.  And when a specific link type is specified for cross-project issue linking, the rule scope also impacted behavior.  Worsening this, some Jira behavior occurs in multiple steps (i.e., not one event) and so the links are added / modified after another rule may have triggered by an event.  E.g., cloning with links.  Although I admin it may be the behavior is deterministic, but just not documented well / unambiguously.

 

When the link direction matters with this trigger type, I include rule logic to handle both possible paths in a single rule, when possible :^)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events