Forums

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

How do I automatically link a new issue to an epic if certain fields match?

Zach Handzlik June 19, 2023

I've been trying to create an automation in jira to automatically link a new issue to an epic if certain fields match. I thought this would be simpler, but for some reason I'm not finding an obvious way to do this. Below is as far as I've made it. I've tried a few different methods including issue linking, but I don't see a way to make a newly created issue match to an epic based on a criteria.

 

The fields I'm looking to match are custom fields (customfield_10127). What I want to do is when an issue is created, check all the Jira issues to see if it can find a value whereto trigger issue's customfield_10127 matches the value of customfield_10127. Then if these fields do match and the matching issue is an epic, then I want to link this newly created issue to the epic as a child issue. Is this possible?

 

Screenshot 2023-06-19 at 10.35.46 AM.png

 

 

1 answer

2 votes
Frederik Vantroys
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.
June 19, 2023

Hi @Zach Handzlik ,

  • Click on the "Create rule" button to start creating a new automation rule.
  • Choose the trigger for the rule. In this case, select the trigger "Issue created" to trigger the rule whenever a new issue is created.
  • Configure the rule's conditions. Add a condition to check if the custom field customfield_10127 of the newly created issue matches a specific value. You can use the condition "Compare condition" or "Field value condition" depending on the available options in your Jira instance.
  • Under "Actions," click on the "Add action" button and choose "Link issues" or "Link issue(s)" depending on your Jira version.
  • In the "Link issues" action configuration, specify the target issue (epic) to link the newly created issue to. You can provide the issue key of the epic directly or use JQL (Jira Query Language) to dynamically find the epic based on specific criteria, such as issuetype = Epic AND customfield_10127 = '{{issue.customfield_10127}}'.
Zach Handzlik June 19, 2023

@Frederik Vantroys thanks for the assist. I added the condition, but when I got to the action step there is no option for link issues action configuration. Also, I am not sure your suggestion will provide what is needed. I don't want to just link an issue, I want to make this newly created issue a child of an epic if a field on the new issue and the epic match. It seems like your suggestion would only link the issues together but not as a child of the epic.

John Funk
Community Champion
June 20, 2023

Hey Zach - can you share the rule that you have so far?

Zach Handzlik June 29, 2023

@John Funk  sorry for the delay - Here is my cobbled together effort to do this. I'm not sure how I would link a newly created issue as a child issue. With this attempt I was at least trying to see if I could manually do an automation on an issue to go out and "search" Jira for any matching issues that have the same custom field value and link to that. Not sure where to go from here.

John Funk
Community Champion
June 30, 2023

Take a look at the post below creating a variable to grab the key of the Epic. 

Then use that variable code for the Epic Link field. 

What happens if more than one Epic meets the condition? Or doesn't meet the condition? Just doesn't get linked? 

https://community.atlassian.com/t5/Jira-Software-questions/varEpic-for-cloning-issues/qaq-p/240073

 

Zach Handzlik July 12, 2023

@John Funk the post you linked doesn't look right - the title says "Dees Confluence 3.4.9 support Oracle JDK 1.7"

John Funk
Community Champion
July 13, 2023

Weird why it is doing that redirect. Maybe you can search for some key words in the link name and track it down. 

Marc Isikoff
Contributor
June 21, 2024

I am also struggling to find an eloquent automation to assign an epic link to a story upon story creation with matching on a custom value (from story to epic).

A few options that have not panned out:

1. Creating a variable: why? They can only hold a string value. Good for the matching string value of your custom field, but that's about it.

2. Branching on JQL: why? Has to be run in global, if you are crossing projects as your current project will be appended to the JQL ==> project = current and (project = epicproject....) will be no values returned.

3. Branching on current issue: why? This would have no way to set it's epic link to the right key

Hence I am struggling... the basic functionality is:

1. Run on trigger (issue created)

2. Determine Epic key to use

    a. Epic is in a different project, is of issuetype = epic, and has it's summary ~ the issue's custom field (JQL entry as a filter works 100%)

3. Link epic key from 2.a. to trigger issue: epic link

4. Enjoy life.

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