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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,000
Community Members
 
Community Events
176
Community Groups

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

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

0 votes

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

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

Atlassian Community Events