Forums

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

AUTOMATION_Branch Inception_how to extract based on Link of Epic Link. Crazy scenario

Mateusz Janus
Contributor
March 4, 2026

Hello Brothers and Sisters,

to jira.jpg

 

Scenario:

(1.) I have a STORY (ENGI project) which is Issue Linked (flat) with CABR (CABR Project)

(2.) The same CABR has also another Issue Linked (flat) EPIC and

(3.) inside this EPIC there is another Story as a Child of this EPIC (EPIC LINK)

(4.) CABR ticket is going to change the status to Resolve. Once its done

(5.) automatically I open EPIC (ENGI project) and put this epic issue.key in CABR custom field (just for reference). So CABR is approved -> I know the EPIC ID.

The GOAL of this madness:

1. in my perfect dream scenario when CABR is resolved all of LINKED stories are updated with EPIC ID as "EPIC LINK". So i want to make STORIES as a childs of created EPIC

2. Also all Stories which were INSIDE linked EPIC (case number 3) should be updated with EPIC ID as "EPIC LINK"...

 

In case of 1st scenario with direct story linked I made automation and its simple

but

How to update Stories which are Inside EPIC that is linked to CABR....

1 answer

1 vote
Trudy Claspill
Community Champion
March 4, 2026

Hello @Mateusz Janus 

I have a few questions about your scenario.

2. Also all Stories which were INSIDE linked EPIC (case number 3) should be updated with EPIC ID as "EPIC LINK"...

A issue can be the child of only one Epic at a time. Are you wanting to change the children of ENGI-16777 to make them children instead of ENGI-XYZ?

Can you have more than one Epic linked to the CABR issue?

Do you have access to any third party apps (like ScriptRunner) that extend JQL capabilities? Are you able to use the keywords "issueFunction in" to access such JQL extensions?

Multiple steps would be needed to:

1. Retrieve the Epic(s) linked to the CABR issue, and get the IDs of each one

2. Loop over those Epics getting the child issues of each one.

3. Update the child issues of each one.

If you don't have JQL extensions than the easier solution may be to:

1. Add a For Linked Issues branch to loop over the linked Epics.

2. Update each linked Epic with the new Epic key (in some custom field).

3. Have a separate rule that is triggered by update of that custom field which then...

4. Gets the child issues of the Epic and changes their Epic Link.

Mateusz Janus
Contributor
March 4, 2026

hey @Trudy Claspill long time no talk :)

1. Yes!! I want to replace EPIC LINK of STORIES which are in EPIC - 16777 with new EPIC-XYZ which will appear once CABR is approved.

2. Yes there might be CABR with MANY EPICS with Many STORIES inside BUT the automation should NOT care about WHICH epic. Basically ALL STORIES in all EPICS.

 

How do I check if i have JQL extension? You mean scriptrunner functions? If YES then I have it.

What exactly you mean by "looping"? You mean 2 AUTOMATIONS rules that react for eachother?

Marc -Devoteam-
Community Champion
March 4, 2026

Hi @Mateusz Janus 

You mention you have scriptrunner in your DC, then check; https://docs.adaptavist.com/sr4js/latest/features/jql-functions 

Like Mateusz Janus likes this
Trudy Claspill
Community Champion
March 4, 2026

I used "loop" as a generic term for using some method to step through a list of issues. If there is the potential for multiple Epics to be linked to the CABR issue then the solution needs to accommodate that.

Scriptrunner is one of the plugins that extends the native JQL options by providing the "issueFunction in" keywords that give you access to more JQL functions like linkedIssuesOf(). There are other plugins that provide additional functions that can be used in JQL.

Without extended JQL functions you would need to have two Automation rules; one that would update the linked Epics, and another that would be triggered by that update an then update the child items in the Epic.

With extended JQL functionality there may be a function available that would enable retrieval of the child issues of the linked Epics in one action. I'll have to spend some time thinking about that.

What version of Jira Data Center are you using?

What version of ScriptRunner are you using?

What do you estimate is the range for the number of Epics that might be linked to a CABR issue? And what do you estimate is the range for the total number of child items of all those Epics that might need to be updated? Example: there could be 1-10 linked Epics, and each might have 1-10 child issues, meaning there could be as many as 100 child issues needing to be updated. I ask because there may be limitations on the number of issues that can be operated on within a single Automation Rule.

Like Mateusz Janus likes this
Mateusz Janus
Contributor
March 4, 2026

@Marc -Devoteam- @Trudy Claspill 

I really appreciate your help. Hope we can continue

 

Follwoing issue functions I have

1. issueFunction in issuesInEpics("issue=engi-16777")

1. It gives me all stories in EPIC 167777

2.  issueFunction in linkedIssuesOf("issue=CABR-279")

2. It gives me all Linked Tickets to CABR (including my epic 16777)

 

I am trying to execute this as a combination of both

 issueFunction in issuesInEpics(issueFunction in linkedIssuesOf("issue=CABR-279")) 

But i receive error

Error in the JQL Query: Expecting ')' or ',' but got '('. (line 1, character 46) 

So JQL is not smart enough to concatenate 2 functions in one JQL query? 

 

 

jira 2.png

Here is the problem. I have "in" where JQL expects (ENGI-123, ENGI-456)

My Query return results as single query but i dont know whats the FORMAT of results i.e. (abc, efg). 

Trudy Claspill
Community Champion
March 4, 2026

A few corrections:

You want only the linked Epics so #2 should be

type=Epic and issueFunction in linkedIssuesOf("issue=CABR-279")

Second, in the combined statement you need to use quotes around what is inside the parentheses for issuesInEpics. That is why you got the error, I believe.

And sometimes the interpretation gets confused over nested double quotes so I would change the interior quotes for linkedIssuesOf() to single quotes

issueFunction in issuesInEpics("type=Epic and issueFunction in linkedIssuesOf('issue=CABR-279')")

 See if that works.

 

The next test I would do is putting that into a test rule. I would make the test rule one with a manual trigger that you can then trigger from CABR-279 or other CABR issues to check that the JQL works as desired. Add it to a For JQL branch. In the branch use a Log action to just write the key of the found issues to the log; i.e.

{{issue.key}},

That should give you a comma separated list of the issues found.

When you add the JQL to the branch change CABR-279 to {{triggerIssue.key}}

Suggest an answer

Log in or Sign up to answer