Hi all,
I would like to get a list of work items that contain an attachment that has a filename longer than 50 chars. Then, I'd like to send this list as an email.
What I tried is:
Smart value comparison:
Conditional expression
({{#if(issue.attachment.filename.length.gt(50))}} {{lookupIssues}} {{/}}
or
{{#lookupIssues}}
* {{#if(attachment.filename.length.gt(50))}} {{key}} {{/}}
{{/}}
I can't seem to be able to get the syntax right.
What does everyone think? I'm tempted to tag the automation goat @Bill Sheboy , I think you might like this.
Hi @Pavol Sočuvka -- Welcome to the Atlassian Community!
One challenging part of this scenario is the nesting lists (i.e., work items and their attachments) and distinguishing between what I call "section breaks" versus the built-in "list filtering":
When one filters too early, no other data is available, such as the work item key.
You want "section breaks" to identify the work items meeting the condition, and perhaps to then list the specific keys and attachment filenames. For example, with extra line breaks to help explain it:
items with longer than 50 char attachments:
{{#lookupIssues}}
{{#if(attachment.filename.length().gt(50).join(",").split(",").match("(true)").size.gt(0))}}
{{key}}:
{{#attachment}}
{{#if(filename.length().gt(50))}}
{{filename}},
{{/}}
{{/}}
{{/}}
{{/}}
How that works is:
I helped someone last year with a similar scenario to create a worklog report by user, spanning multiple work items to sum logs, as a table. As with your scenario, this only works because the test value 50 can be hardcoded. If the 50 was dynamic, a more complicated approach is needed, as described in this article.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.