Iam looping all the files and trying to sum up the last 60 minutes files but seems loop [{{issue.attachments}}] to sum up the size of the attachmets it comes empty outisde of the loop
{{totalSize.default(0)}}
loop:
{{#=}}{{totalSize}} + {{attachment.size}}{{/}}
results inside of loop: 500,1000
totalSize comes empty
Hi @MIchalis Motis -- Welcome to the Atlassian Community!
As Trudy describes, seeing your entire rule and audit log details will provide context for the community to offer better suggestions.
Until we see those...
It appears you are trying to use branching and a Created Variable to iterate over the attachments. That will not work because of how branches work: processing in parallel and asynchronously over the items, and so a variable would be repeatedly recreated with each pass through the looping.
Instead, you may get the sum of the sizes for the attachments added in the last 60 minutes using a math expression, the long-format of list iteration, and list filtering:
total size of attachments added in last 60 minutes:
{{#=}}0
{{#issue.attachments}}
{{#if(created.diff(now).minutes.lte(60))}}
+ {{size}}
{{/}}
{{/}}
{{/}} bytes
How that works, describing from the inside toward the outside:
Please adjust this as needed depending upon how you want to use the sum value.
Kind regards,
Bill
Dear Bill,
Thank you so much! this works from my end. I was thinking to loop via iterration in jira and this would solve my issue if i declare the variable on top. I see your logic and seems very reasonable.
Once again thank you so much for the help :) this does work!
Best Regards,
Michalis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @MIchalis Motis
Welcome to the Atlassian community.
Can you provide screen images showing your entire automation rule, please? Sometimes unexpected results are due to the context of the steps.
How are you obtaining the result inside the loop and then determining that {{totalSize}} outside the loop is empty? This could have something to do with the structure of your rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.