Propagate text field from all sub-tasks to parent and format

Craig Easton September 30, 2022

I would like to use Jira automation to propagate a text field from all sub-tasks to the parent. Let's assume it's a "status update" field. I'd like the field from each sub-task to propagate to the parent ticket and include formatting.

I am including below what I'm currently attempting but:

a) The formatting doesn't work

b) It prints out each sub-task key then each issue summary and then each issue status update instead of the desired result of first sub-task key, first sub-task summary, first sub-key update and so on.

h1. {{issue.subtasks.key}} - {{issue.subtasks.summary}} - {{issue.status update}}
h4. {{issue.subtasks.status update}}

Additionally will it be possible to make this field read only on the parent task?

1 answer

1 accepted

2 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 30, 2022

Hi @Craig Easton 

By using {{issue.subtasks.*}} you're going to bring in information from all subtasks.  You'll likely need to use branching or list behavior to retrieve only what you want to see (e.g. {{issue.subtasks.key.get(0)}}.  Can you please share a screenshot of the rule so we can have further context into the issue you're facing and help determine the right solution?

As for the second part of your question... To Make the field read only on the parent task, you'd need to do something like this:

  1. Create a new screen with just the custom field in question
    This will be used as a transition screen later
  2. If you don't already have one, create a new screen that is inclusive of all fields (including the custom field) that you'll want viewable for a given issue.
  3. Add the screen created in step 2 to your project's screen scheme with the VIEW action.
  4. Create a transition on your workflow (recommend a loopback) that can be used to set the custom field
    1. Add a condition that this transition is only available to project admins
    2. Add the screen created in the first step as a transition screen

The combination of the steps above will enable you to make the field view only when generally navigating.  Automation would then perform a transition to set the field.  

Craig Easton September 30, 2022

Hi @Mark Segall thanks for the response. Here is what my rule looks like

rule.jpg

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 30, 2022

So if you're only looking to capture information on the sub-task that triggered this issue, you'd change up your smart values to look like this:

h1. {{triggerIssue.key}} - {{triggerIssue.summary}} - {{triggerIssue.status update}}
h4. {{triggerIssue.test guidelines}}

Craig Easton September 30, 2022

I'd like to capture the information from all subtasks.

The parent field should always contain the text from ALL the subtasks field.

Craig Easton September 30, 2022

In the example above with test guidelines, assignees will enter test guidelines on each sub-task. They will then be propagated to the parent ticket and be shown as:

Sub-task 1:

Test this

Sub-task 2:

Test this

...

Like Valeria Andrea Piñero likes this
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 30, 2022

Got it... Thanks for the added context.  

You should be able to do something like this:

{{#}}{{issue.subtasks}}
h1.{{key}} - {{summary}} - {{customfield_10602.distinct.AsJsonArray.remove("[").remove("]").remove("\")}}
h4.{{test guidelines}}
{{/}}
Craig Easton September 30, 2022

I took out the customfield to simplify as it wasn't relevant... I am unfortunately getting an error with it

Error rendering smart-values when executing this rule:

Token is empty: {{#}}{{issue.subtasks}} h1.{{key}} - {{summary}} h4.{{Test Guidelines}} {{/}}
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 30, 2022

whoops syntax error on my part.  Sorry!

{{#issue.subtasks}}
h1.{{key}} - {{summary}}
h4.{{Test Guidelines}}
{{/}}
Like # people like this
Craig Easton September 30, 2022

Thank you so much. It now works as expected :).

A couple more questions for you if you don't mind:

1. Where am I able to find documentation about the {# and {##}, I don't quite understand what is going on :(. Googling such terms is not easy :)

 

2. "As for the second part of your question... To Make the field read only on the parent task, you'd need to do something like this:"

Do you have any suggestions on where I can find more information about this, once again Google has failed me and I don't understand the 4 steps you outlined and how they accomplish what I need.

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2022

 

1. Where am I able to find documentation about the {# and {##}, I don't quite understand what is going on :(. Googling such terms is not easy :)

Here's the official documentation on it.  Note the navigation links at the top right of the screen are very useful for a broader understanding of Smart Values.  I have it bookmarked myself.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/

2. "As for the second part of your question... To Make the field read only on the parent task, you'd need to do something like this:"

Do you have any suggestions on where I can find more information about this, once again Google has failed me and I don't understand the 4 steps you outlined and how they accomplish what I need.

This is really a culmination of a bunch of different functionality in Jira and I'm not sure that there's any documentation that links all of it together.  As long as you have an understanding of the below key configuration areas, it's just a matter of making them work together in the right way.

  • Configuring Screens
  • Configuring Screen Schemes
  • Setting up Workflows - I'm not sure that there's a lot of formal documentation on loopback transitions.  I only found out about them by seeing solutions offered here in the community.  A loopback transition is when you transition an issue back to itself.  Your use case is a good one for this.
  • Automation

 

 

Like Craig Easton likes this
KUMIKO_PERCIVAL_EXT June 23, 2023

Hi, 

I am trying to do the same with a custom Select List (single choice) field (id=10083) from the sub-tasks into a custom Text Field (single line) on the parent task/story (along with the sub-task issue key & summary). 

When I try the following for the Edit issue field component for the parent within the automation rule, 

{{#issue.subtasks}}
h1.{{key}} - {{summary}}
h4.{{"value": customfield_10083}}
{{/}}

it produces the following error.

ErrorMessageFromAuditLog.png

Any help on this would be much appreciated! 

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2023

Hi @KUMIKO_PERCIVAL_EXT 

You're close... It would be this:

{{#issue.subtasks}}
h1.{{key}} - {{summary}}
h4.{{customfield_10083.value}}
{{/}}
KUMIKO_PERCIVAL_EXT June 27, 2023

Hi @Mark Segall 

Thank you for the super prompt response! It looks like I'm getting a different kind of error ("Error while parsing additional fields. Not valid JSON.") with the above-mentioned edit. 

I am very new to automation, so I'm wondering if I've made a fundamental misstep somewhere...JSONErrorforAutomationRule.png

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 5, 2023

Sorry for the delay, I've been on vacation the past week.  So that this question doesn't get cluttered, can you please create a new question (you can @mention me to ensure I don't lose visibility) and include a screen shot of your edit issue action.  I was just re-reading your question and there may be a bit of a difference between your configuration and the original question here.

Thanks!

Suggest an answer

Log in or Sign up to answer