Copy cascade field from epic to issue by automation

Krister Broman _Advania_
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 26, 2021

I am trying to update a cascade custom field in an issue by copying data from the issues epic. The field is context formatted with a default setting for the value. I get successful executions on the rule, but what happens is that instead of copying data from the epic, the context data is removed and the field is blank. 

Any suggestions?

Automation setup below (the field is named Process):

WHEN: Issue Created

IF: Related Issue: Epic
     Condition: Exists

THEN:

{
  "update": {
     "Process": [
         {"set": {"value": "{{issue.parent.fields.Process.value}}",
           "child": {"value": "{{issue.parent.fields.Process.child.value}}"}
         }}
      ]
   }
}

3 answers

3 votes
larry.lowe June 20, 2021

This JSON worked for me:

{
"update": {
"CascadeFieldName": [
{
"set": {
"value": "{{issue.epic.fields.CascadeFieldName.value}}",
"child": {
"value": "{{issue.epic.fields.CascadeFieldName.child.value}}"
}
}
}
]
}
}

Reference (Smarter Smart-Values!): https://blog.codebarrel.io/synchronize-parent-and-sub-task-issues-with-automation-for-jira-bdcca6c9d453

Vinay March 16, 2022

Thanks it works for me also :)

Like John Funk likes this
0 votes
Sean Bridgeman July 20, 2023

@larry.lowe I should buy you a coffee for how much time you just saved me.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 26, 2021

Hi Krister - If you want to retain the current value and just append the new value in, then place {{issue.Process}} before the new value. That way it will keep the current value and add the new value. Of course, you can switch the order around if you want the new value first. 

Krister Broman _Advania_
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 26, 2021

The value stated in the epic should replace any value in the child issue. The current value should not remain, i mentioned it having a value through the context partly if it can have an effect since this takes place at the time of creation and the thought was that there may be an issue where they collide or something. The other part of mentioning it is that it shows that something does happen it does not however copy the values as intended.  

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 26, 2021

Have you tried to update the field just using the standard field update and not JSON?

Krister Broman _Advania_
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 26, 2021

Cascading fields are not supported by the standard field update as far as i have been able to find. 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 26, 2021

Ah, that makes sense then. 

What type of project is this? 

I assume that you are firing this on the child getting created and you want to copy down the value from the Epic. Correct?

Krister Broman _Advania_
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 26, 2021

Entirely correct, this is a scrum project and the field is one of many metrics that are filled out which we want to be inherited as default to reduce time and errors in the issue creation process.  In 90%+ of the cases the issue should have the same as the epic so making it default to that would reduce the amount of errors. Simply setting it as a mandatory field gets us the data but it has a much higher error ratio. 

Krister Broman _Advania_
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 26, 2021

I also know that its possible create this solution with the workflow but there is two issues with that.

The first being that this is a standardized system with multiple projects using the same workflow so its not always the case that we want this rule to fire. To the greatest extent possible using automation is therefore the go to solution for adapting projects. 

The second issue is that this is just the first part of the rules that we intend to create there will be if statements and different cases where it will do other things, I just thought to keep the question simpler by not having that extra complexity.   

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 26, 2021

Since you are populating 90% plus with the Epic data, why not add automation to Clone the Epic to another Issue Type, and then Edit the Clone? 

Just as a side note, there is no Scrum type of project, just Scrum boards. Project types are either Classic Software or Next-gen in this case. 

With Classic Software, I would try the Epic Link instead of the Parent. But for Next-gen you need the Parent wording instead. 

One final option would be to try the code without the word fields. I am not sure about the JSON for that, but using Automation you would not use that. So it would be:

{{issue.parent.Process.value}}

Suggest an answer

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

Atlassian Community Events