Push/update field data from subtask to task

Quinn Campbell December 8, 2023

I have a subtasks that requires a user to fill in a data field with a value. What is the best methodology to have that data push up from the subtask to fill in that field at the task level?

During the process of an issues life it gets more and more subtasks assigned as it transitions through the workflow fields. Only some of those tasks requiring filling that data field. While not entirely necessary it would be nice if that task level field was updated instantaneously but would be acceptable if it updated on a transition rule i.e only got updated once it transitioned to the next stage in the work flow. Whats the best way to do this?

1 answer

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.
December 8, 2023

Hi @Quinn Campbell 

You could do that triggered on either (or both) the subtask create or issue field update.  Or on the issue transition if that is the point at which your required field needs to be filled.

However...when there are multiple subtasks for an issue, how will you know which one should be used to update the parent issue?

Kind regards,
Bill

Quinn Campbell December 8, 2023

I'm a bit lost as to what youre saying/asking? So would I need to create an entirely new automation that is triggered on issue field update/subtask create?

 

To your second point, would I need to create a new rule for each field that gets updated?

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.
December 8, 2023

My apologies if I was unclear; I will try to clarify...

In general, to copy a field value from the subtask to the parent issue, you would need 2-3 rules:

  1. triggered on issue create, checking if the issue is a subtask, and then editing the parent
  2. triggered on an update of your field, again checking if the issue is a subtask...
  3. [edge case] if you move subtasks from one parent to another, this rule would trigger on a change to the parent issue, and then perform the other steps.  The extra part is deciding what to do with the previous parent's fields.

I thought you originally noted only syncing one field, but if there are several fields the options are: sync all the fields with on rule, or create separate rules for the update of the field case, one for each field

 

The part I am still unclear on: if there are multiple subtasks for an issue, each with a different value in your field-to-sync, which one should be used to update the parent?  Is there some criteria to decide?  For example:

  • Parent story ABC-123
    • subtask ABC-456, with field value of "apple"
    • subtask ABC-789, with field value of "orange"

What value should be used to update the parent, ABC-123?

Quinn Campbell December 8, 2023

yeah I understand your second question, I think the only way is to make a standalone rule that has all the fields that get filled out, and when they are filled out to trigger an update to their parent. 

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.
December 8, 2023

I recommend you trying to create the rule, as that will make it more concrete to observe if it works as you expect.  And then we can adjust if you run into problems.  What do you think?

Quinn Campbell December 8, 2023

So I've started to play with the automation and it works, kinda, but unless I/we can come up with something clever I will need a new automation per value to update. Because as listed below if I have multiple things trigger but not all the values updated from the same subissue the non-updating value is blanked out. 

2023-12-08 16_02_16-Battery Production - Details - Jira.png

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.
December 8, 2023

This is where conditions will help, allowing you to test if the value is non-empty (or changed) before the copy.  I added links to help explain how to do the specifics.

 

Before that, we need to confirm the smart values for your custom fields.  Smart values are name, spacing, and case-sensitive, and often do not exactly match the name displayed on the issue views.  This how-to article will help to find them: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

The steps are:

  1. identify an example issue with your fields
  2. call a REST API function with a browser tab
  3. search for your field on the page, such as with CTRL-F (find)
  4. that will show the correct smart value (and custom field id) to use in your rules

 

Back to your rule...let's assume if the field value in the subtask is changed, you want that value updated in the parent.  And so the pattern of the rule would be this:

  • trigger: value changes for Torque Value or Manifold Spacing
  • condition: issue type equals Subtask (This is missing from your current rule)
  • branch: to parent
  • branch: to parent
    • advanced compare condition: (using conditional smart values)
      • first value: {{#if(exists(changelog.smartValue for Manifold Spacing))}}changed{{/}}
      • condition: equals
      • second value: changed
    • action: edit issue, changing only the Manifold Spacing, to copy from the trigger issue
    • action: Re-fetch issue (This will reload the data before the rule proceeds)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events