Move Task to Epic based on Task Name matching Existing Epic Name

Michael de Marigny January 30, 2025

Hi

I have built an automation is triggered when a task is created.  Part of the automation is to rename the Summary field based on the custom fields chosen.

Summary Field in Edit Issue

{{issue.fields.ROC Race Location.value}} - {{issue.fields.ROC Race Location.child.value}} : {{issue.customfield_10251}}

That all works and no issue.

What I would like try and do is add the created task to an existing epic.

I have a set of Existing Epics of locations, eg "Sydney Race Course" etc ... When the above automation is created and the location is = Sydney, I would like to move the Issue to the corresponding EPIC.

I assume this will be a JSON file type of rule where it would say if

issue.fields.ROC Race Location.child.value is equal to Sydney then move to EPIC called Sydney Race Course and so on.

Is any one able to help build the syntax, and then I should be able to adapt it.

Note that there are multiple locations that I would need to query.

Thank you in advance

 

2 answers

1 accepted

1 vote
Answer accepted
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.
January 31, 2025

Hi @Michael de Marigny 

I recommend using a Lookup Table for a scenario like this: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798

This would greatly simplify the rule and make maintenance easier / safer. 

 

For example:

  • trigger: issue created
  • action: re-fetch issue (I recommend always adding a re-fetch after the issue created trigger to prevent racetrack errors.)
  • action: create lookup table, mapping your values to the epic keys.  Let's name it varEpicKeyMap
    • row
      • key: Victoria - Caulfield
      • value: EPIC-123
    • row
      • key: NSW - Sydney
      • value: EPIC-456
    • ...
  • action: create variable
    • name: varSummaryValue
    • smart value: 
{{issue.ROC Race Location.value}} - {{issue.ROC Race Location.child.value}}
  • action: create variable
    • name: varEpicKey
    • smart value:
{{varEpicKeyMap.get(varSummaryValue)}}
  • smart value condition: This is to confirm a value was found.
    • first value: {{varEpicKey}}
    • condition: does not equal
    • second value: leave this empty
  • action: edit issue, updating...
    • the Summary to {{varSummaryValue}}
    • the Parent field from the dropdown and setting it to {{varEpicKey}} as there is no need to use JSON for this

 

Please note well: 

  • You do not show your entire rule, so modify the above example, as needed
  • Smart values are name, spacing, and case-sensitive...

 

Kind regards,
Bill

Michael de Marigny January 31, 2025

Hi Bill

Thank you ... I've just logged in and will give it a try.  I was reading about this last night and wanted to give it a go.  Ill let you know how I go.

thanks

Michael de Marigny January 31, 2025

Hi Bill ... Thank you so much, that worked as expected and it is so smooth.

Thanks again

Like Bill Sheboy likes this
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.
February 1, 2025

Awesome; I am glad to learn that helped!

0 votes
Vishal Biyani
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.
January 30, 2025

@Michael de Marigny 

Assuming you have defined set of epics.

For the created issue (Standard Issue Type), you want to link this issue to the epic.

So, within the same rule, you can add if/else condition

if location matches Sydney

Then add Edit Issue Condition, with following rule in 

{
"fields": {
"parent": {
"key": "EPIC-123"
}
}
}

I am assuming there is no field in the issue being created to give you the actual issue key of the epic and hence suggesting a hard coded value of epic for each location. 

Michael de Marigny January 30, 2025

Thank you for responding

I do apologies, I am struggling to understand what you are proposing.  This is what I have put together 

Screenshot 2025-01-31 at 16.41.59.png

 

Vishal Biyani
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.
January 30, 2025

In the edit issue fields parent, 

you need to provide a key to make the current issue child of epic.

So, you can add this under more options. replace EPIC-123 with your actual value

{
"fields": {
"parent": {
"key": "EPIC-123"
}
}
}

Michael de Marigny January 31, 2025

Thanks I got that to work.  However I have about 30 locations to build and I wont be able to do it as a single automation using the IF match and Edit option.

 

I was hoping to be able to write up a single edit issue option and then write up a json file to do the if check then update parent ... something like

 

if {{issue.fields.ROC Race Location.value}} - {{issue.fields.ROC Race Location.child.value}} = Victoria - Caulfield

then

{
"fields": {
"parent": {
"key": "EPIC-123"
}
}
}

 

elif

if {{issue.fields.ROC Race Location.value}} - {{issue.fields.ROC Race Location.child.value}} = NSW - Sydney

{
"fields": {
"parent": {
"key": "EPIC-ABC"
}
}
}

 

And so on ... is that do able?

Vishal Biyani
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.
January 31, 2025

i don't think JIRA automation supports that :-(

you will need to use to If or else block

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