Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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

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?

Hi Bill, I knew i am missing something.

2. Update the subtask from parent

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

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...

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
Community showcase
Published in Apps & Integrations

How we use Jira Service Management for our recruitment process! - Part 2

It is never about setting up a process and being done with it. Rather, the focus should always be on optimizing it for the best outcomes. Thus, we didn’t stop at setting up JSM for our recruitment pr...

183 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you