Automation to Copy cascade field values from Parent to Sub-task doesn't override the default value

Natalia Trofimov
Contributor
January 10, 2022

The following advanced JSON block is not working if the subtask has the default values set on creation. It shows success but it doesn't work, the values are not copying and keeping the default values. The automation using this JSON works though if you update the parent, then the values are copying to sub-tasks.

the select cascade field is common for other projects so I don't want to change the default value for subtasks

{
  "update": {
    "Sample Cascade": [
      {
        "set": {
          "value": "{{triggerIssue.fields.Sample Cascade.value}}",
          "child": {
            "value": "{{triggerIssue.fields.Sample Cascade.child.value}}"
          }
        }
      }
    ]
  }
}

 

1 answer

0 votes
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 10, 2022

Hi @Natalia Trofimov 

Would you please show images of your complete rule and audit log details for context?  That may help the community to offer ideas.  Thanks!

Until then, if you are using the issue created trigger I wonder if this is a timing issue with the event firing before the data is available.  The way to check that is to add a Re-fetch action after the trigger to slow the rule a bit.

Kind regards,
Bill

Natalia Trofimov
Contributor
January 11, 2022

Hi Bill, here it is:

Screen Shot 2022-01-11 at 7.16.08 AM.pngScreen Shot 2022-01-11 at 7.18.15 AM.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.
January 11, 2022

Hi, Natalia, and thanks for that information.

Would you please clarify what you are trying to update?  Your rule shows updating the trigger issue with the same values from itself.  (There is no branching to other issues.)

Which are you trying to accomplish?

  1. Update the parent from the subtask
  2. Update the subtask from the parent
  3. Something else?
Natalia Trofimov
Contributor
January 11, 2022

Hi Bill, I knew i am missing something.

2. Update the subtask from 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.
January 12, 2022

Thanks, and in that case you can probably simplify your rule:

  • trigger: issue created
  • issue fields condition: issue type is sub-task 
    • Note this is the simplest condition component and I think you were trying to use the if/else
  • action: edit issue field, for your custom field, and select to Copy From Parent from the ... at the right side of the field in the rule component
Natalia Trofimov
Contributor
January 13, 2022

Hi Bill, yes it is easy if i had an option to copy the cascade field from parent but the cascade fields can be set only with JASON block. I am missing something: another if statement or diff JASON...

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 13, 2022

Sorry, I don't use that field type often and forgot that.  There is a suggestion to add built-in support for those field operations: https://jira.atlassian.com/browse/JRACLOUD-74280

Until that is available...

The work-around if you are using Jira Cloud is to branch and capture the parent values for the field in created variables.  And then use those directly in the JSON edit on the sub-task.

If you have Server/Data Center, it does not have created variables.  In that case I would suggest inverting the problem: add an indicator to the parent issue, telling it to update the specific sub-task. (Perhaps with a comment for the sub-task key.)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events