Forums

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

Setup Automation to copy a specific phrase from an epic description to a child description

Tamara MacPherson
Contributor
February 1, 2024

I'm trying to create an automation that will add a specific phrase (i.e.  from the Epic Description to an Issue description when the issue is updated. I need to be able to copy the specific phrase from the epic description, which is unique to each epic.  Therefore, I can't simply use the advanced field editing of:

{
"update":
{
"description":
[{
"add": {{issue.epic.description}}
}]
}
}

However, I've only been able to get it to copy the entire description, thus overwriting the issue description. 

 

Any suggestions on how to copy over only the specific text using a dynamic search/match?

1 answer

0 votes
Mikael Sandberg
Community Champion
February 1, 2024

You can use the substring smart values to get the specific text if the description in the epic always have the same before and/or after text, something like this:

{{issue.description.substringAfter("Some text ")}}

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, 2024

Hi @Tamara MacPherson 

Yes, and...to Mikael's answer:

Context is important for automation rules, and all of the parent epic's fields are not directly accessible to their child issues.  Instead they may be found with branching, the lookup issue action, etc.

Please post an image of your complete rule and the audit log details.  Those will help the community to suggest adjustments for your scenario.

Until we see those, an example to do what you ask would be:

  • trigger: some rule trigger (assuming on the child issue)
  • action: lookup issues with JQL to get the parent epic for the trigger issue
  • smart value condition: check if an epic was found, comparing {{lookupIssues.size|0}} to 1
  • action: edit issue for the description field, typing in the smart value needed to extract the specific phrase with text functions: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

Kind regards,
Bill

Like Mikael Sandberg likes this
Tamara MacPherson
Contributor
February 1, 2024

Thank you for the quick responses.  I've tried a few variations but still no luck.  :(  

Here is a copy of what I'm wanting the automation to do:

 

AUtomation.JPG

Tamara MacPherson
Contributor
February 1, 2024

Basically we have certain text between HAPPY and HAPPY in the Epic description that needs to be copied to the child issues when the issue has the label Feature.  

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, 2024

The description field is not a list: it is a text field, and so that is the incorrect syntax for the JSON.  Regardless, that JSON is not needed as the text and smart values can be entered directly when editing the description field.

You originally noted copying information from the trigger issue's parent: an epic.  Your rule no longer seems to match that. 

Let's clarify some things:

  1. What is your issue hierarchy, and how are you associating issues?
  2. What do you want to happen to the original trigger issue's description after copying from the Epic: replace it, add it before, add it after, something else?  Providing an example of before / after may help.
  3. What do you want to happen when there is no parent issue when the rule is triggered?

 

Like Tamara MacPherson likes this
Tamara MacPherson
Contributor
February 2, 2024

Thank you for the questions Bill.  

1. The issue hierarchy is Epic - Issue (Story, Task, Bug) - Subtask (where applicable).

2. The desired outcome for the trigger issue's description is to have the "HAPPY some text HAPPY" statement copied from the Epic Description to the end of the child Issue Description.

     Trigger (child) Issue Description beforeL

          User Story details & AC

     Trigger (child) Issue Description after:

          User Story details & AC

           HAPPY some text HAPPY

3. As for a child issue not being assigned to an Epic, we have other automations and audit processes to capture these.  So if the trigger Issue does not have a parent Epic at the point that this rule is run, then I do not want anything added. 

The main issue is that I cannot wrap my head around how to format the automation step to have the "HAPPY some text HAPPY" statement added to the end of the trigger issue description and what format / syntax the JSON should be (if any).  

I appreciate your assistance in this.  Thank you.

 

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 2, 2024

Thanks for clarifying...putting together what Mikael and I suggested, these changes could help:

  • trigger: manual
  • condition: label contains Feature
  • action: edit the Description field, entering this in the field
{{issue.description}}
{{issue.parent.description.substringAfter("HAPPY").substringBeforeLast("HAPPY")}}

This will add the extracted section from the parent's description after the trigger issue's description.

 

Please note: in this case, the parent's description is available.  Not all fields of the parent are available to a child issue, and so testing is needed for other fields.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events