Custom Field Automation
Asked by Ahmed Yousif:

I am trying to copy a custom field value from parent issue (story) to (subtask) when the field value is updated:   

This is what i used for an automation rule and Json code but i get an error ![Screen Shot 2024-08-02 at 3.53.33 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339668iF647176BB603B97B/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.53.33 PM.png")![Screen Shot 2024-08-02 at 3.53.41 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339667i820186E629003136/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.53.41 PM.png")![Screen Shot 2024-08-02 at 3.53.49 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339669iCC7ACD8160CC053A/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.53.49 PM.png")![Screen Shot 2024-08-02 at 3.53.56 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339670i8BEC21FBAF39D0E1/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.53.56 PM.png")![Screen Shot 2024-08-02 at 3.54.04 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339671iA5F0C4621CC9F020/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.54.04 PM.png")![Screen Shot 2024-08-02 at 3.56.21 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339673iB754BEB56BEDCD09/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 3.56.21 PM.png")  

<br />

Can anyone please help with that?


Answers:
author: Marc - Devoteam
body: HI [@Ahmed Yousif](/t5/user/viewprofilepage/user-id/5559300)

Welcome.

What type of custom field is product categorisation, single select, multi select, etc..

Is this field on the screen used by the sub-task?

comments: author: Ahmed Yousif
body: Hello Marc, thanks for your reply!   

yes i made sure it's in the screen used by the subtask, and almost every project/screen where all the issue types are part of. It's a select list (cascading)![Screen Shot 2024-08-02 at 4.09.26 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339678i4249374B9E28BF39/image-dimensions/398x89?v=v2 "Screen Shot 2024-08-02 at 4.09.26 PM.png")![Screen Shot 2024-08-02 at 4.04.59 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339677iE8A789058B5EA915/image-size/large?v=v2&px=999 "Screen Shot 2024-08-02 at 4.04.59 PM.png")


author: Bill Sheboy
body: Hi [@Ahmed Yousif](/t5/user/viewprofilepage/user-id/5559300) -- Welcome to the Atlassian Community!

Adding to Marc's suggestion...

That appears to be a cascading selection field, and so the JSON syntax is different:

<https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Cascading-select-custom-field>

And...you may need to use conditional logic to handle the possibility when the parent-value is set and the child-value is not.

Kind regards,  
Bill


author: Ahmed Yousif
body: Hello Bill,

Thanks for your reply, i have used the cascading Json as suggested and it worked.

now i have couple of rules that do the following seamlessly:

* When creating an epic, and custom field is added, the stories/subtasks created underneath fetch the value (Done) Rule 1
* When a story that has no parent(epic) but already been created before, once added to an epic and has a value of a parent, the story fetches the custom field value from the epic (Done) Rule 2 ![Screen Shot 2024-08-12 at 4.02.01 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/341232i68709FB7D4C4492F/image-size/large?v=v2&px=999 "Screen Shot 2024-08-12 at 4.02.01 PM.png")![Screen Shot 2024-08-12 at 3.57.26 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/341234i64FCB069F22059A8/image-size/large?v=v2&px=999 "Screen Shot 2024-08-12 at 3.57.26 PM.png")![Screen Shot 2024-08-12 at 3.57.33 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/341233i3A8AE7FB4D8FE941/image-size/large?v=v2&px=999 "Screen Shot 2024-08-12 at 3.57.33 PM.png")  

  <br />

One challenge is:

* For an existing epic, when the value of the custom field is updated, the stories underneath copy the value to the story level perfectly, but it doesn't do it automatically for the subtasks of these story ( i have to go and update the stories manually in order to reflect on the subtasks)
* i have added a rule where when the story parent changes (which will be triggered by Rule 2 for an example) to go and update the subtasks custom field value as shown in the screenshots, but seems like it's not working.


author: Bill Sheboy
body: By default, the actions of one rule do not trigger other rules. This is to prevent errors and accidental rule recursion.

For example, you have a rule triggered on updates to the Epic to update the Story, but by default that will not fire the rule triggered on updates to the Story to update the Subtasks.

When you want one rule's actions to trigger another, *in the downstream rule*, enable this option in the rule details, and test fully:
> Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule.

Please try enabling this option in your rule which updates the Subtasks when the Story's field changes.


Tags: cloud

jira-cloud