How can I write a rule to check for updated fields and sync with linked issues and sub-tasks
Asked by Nick Hays:

I have seen the tutorial to sync a value across issues for a specific field change. Is there a way to have a single automation rule when trying to keep issues in sync for many different fields, say 50, and we don't know which field(s) were updated? I have been researching 'changelog' thinking that could help, but have not been able to figure it out.


Answers:
author: Darryl Lee
body: Bah, I could've sworn I wrote up a whole answer involving clever smart value variable manipulation, but in the end, ran into the same old same problem that you can't embed/reference/nest smart values inside of other smart values.  

I wonder what happened to my answer...

comments: author: Darryl Lee
body: I set a created a variable named **changed** set to {{changelog}} and then created another variable named **changelist** and used match() to parse out the list of changed fields:

```
{{changed.match(".*?field='(.+?)', .*?")}}
```

But then I tried to use Advanced Field Editing to set the field values to the parent, and that's where I encountered failure:

```
{
   "fields": {
{{#changelist}} "{{.}}": "{{issue.parent.{{.}}" {{^last}}, {{/}} {{/}}
   }
}
```

Resulting error:
> Error while rendering additional fields.  
> Failed to get value for issue.parent.{{.   


author: Darryl Lee
body: Improvement filed:  
"Possibility to nest smart values in Automation"  
<https://codebarrel.atlassian.net/browse/AUT-2086>  

Related questions:  
<https://community.atlassian.com/t5/Jira-Core-questions/Is-there-a-way-to-concatenate-or-nest-smart-values/qaq-p/1374187>  
<https://community.atlassian.com/t5/Jira-Software-questions/Is-it-possible-to-use-nested-Smart-Values/qaq-p/1423642>


author: Bill Sheboy
body: Hi [@Nick Hays](/t5/user/viewprofilepage/user-id/506428)

That doesn't seem possible yet. There is a suggestion to copy all changes to linked issues:

<https://codebarrel.atlassian.net/browse/AUT-756>

Until then, you may want to reconsider how your issues are organized / populated if there is that much information you want duplicated across the levels. Perhaps it may not all be needed at all levels, and you can simplify what is checked and copied.

Best regards,

Bill


author: Darryl Lee
body: Oooh, that's a neat idea, and I made some headway, but ultimately failed. :-{

I was able to get the list of fields that had changed by:

1. Create smart value variable named **changed**with a value of {{changelog}}
2. Then create a smart value variable named **changelist** , using the match operator, which returns a list:  
   {{changed.match(".\*?field='(.+?)', .\*?")}}
3. But where I got stuck, and where I always seem to get stuck, is that Automation doesn't allow nested or evaluated smart values.

   Then I tried this with [Advanced Field Editing](https://confluence.atlassian.com/automation/advanced-field-editing-993924663.html) on all of the subtasks:

   ```
   {
      "fields": {
         {{#changelist}} "{{.}}": "{{issue.parent.{{.}}}}"{{^last}}, {{/}} {{/}}
      }
   }
   ```

   (Fully recognizing that this will fail for fields that are of list type, etc.)

The idea is that since {{changelist}} is a [list](https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/), then you can iterate through it with {{#changelist}}, where {{.}} is the current item (name of the field that was changed). So I'm trying to get the value by referencing the field name with: **{{issue.parent{{.}}}}**

The problem was accurately described by [joseba.ercilla@gailen.es](/t5/user/viewprofilepage/user-id/3018064) what I'm trying to do is use it on a **property access**:

As he [properly explained](https://community.atlassian.com/t5/Jira-Core-questions/Is-there-a-way-to-concatenate-or-nest-smart-values/qaq-p/1374187):
> We will need either a way to force inline evaluation, or a getter method equivalent to direct property access...

I finally got a bug filed for this: <https://codebarrel.atlassian.net/browse/AUT-2086>

But since it's in Codebarrel's repo, there's no way to vote or comment on it. :-{

This has been previously discussed here:  
<https://community.atlassian.com/t5/Jira-Core-questions/Is-there-a-way-to-concatenate-or-nest-smart-values/qaq-p/1374187>

And here:  
<https://community.atlassian.com/t5/Jira-Software-questions/Is-it-possible-to-use-nested-Smart-Values/qaq-p/1423642>

comments: author: Darryl Lee
body: For the record, here's the error I get:
> Error while rendering additional fields.  
> Failed to get value for issue.parent.{{.

So yeah, it doesn't like that. I don't exactly know the right terminology - eval, nested variable, reference variable, pointer variable. But yeah, I have a few automations where I could really could have used this.