Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I write a rule to check for updated fields and sync with linked issues and sub-tasks

Nick Hays
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 14, 2021

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.

3 answers

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2021

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

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2021

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

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2021
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 15, 2021

Hi @Nick Hays 

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

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2021

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 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, 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 what I'm trying to do is use it on a property access:

As he properly explained:

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

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2021

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events