Hi
i've been looking for a while for a way to filter out all attachments in issue and email this filtered list to someone.
It basically works when I'm trying to achieve this via automation. ISmply putting this in content:
<ul>
{{#issue.attachment}}
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
</ul>
but maybe someone knows how to filter attachments added ONLY BY user who is not REPORTER of current issue?
Regards
Hi @Pablo
You may need to doublecheck my syntax, but I think you could do something along the lines of this:
<ul>
{{#issue.attachment}}
{{#if(not(equals(attachment.author,issue.reporter)))}}
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
{{/}}
</ul>
hi
thanks for this reply
unfortunatelly this is not working
in Your suggestion (as far as i know) this parts:
attachment.author
issue.reporter
are empty
i found that attachment.author should be just author - it returns atlassianId - which is good enough so I've also tried other ways like this etc
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,issue.reporter)))}}
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
{{/}}
</ul>
but still i have no idea why inside this part <ul>HERE</ul> issue reporter is empty
{{issue.reporter}} <<== works here
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,issue.reporter)))}} <<== issue.reporter returns empty value
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
{{/}}
</ul>
but outside of is - this smart value works perfectly;/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good catch on removing "attachment." from the smart value. You're already inside the attachment so it only requires author and I think this is related to the other issue at play. Because you're inside the attachment, it's looking for attachment.issue.reporter which obviously doesn't exist and thus the empty string. Maybe you can surround issue.reporter with curly braces like this:
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,{{issue.reporter}})))}}
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
{{/}}
</ul>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Before we give up on this, let's try this approach... I think the issue is that the rule is struggling to navigate into the attachment then back up to the parent issue within the same sequence. In my test environment, I added a variable just before the send email action to capture the reporter. This seems to work in my limited testing:
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,varReporter)))}}
<li>
<a href="{{content}}">{{filename}} </a>
</li>
{{/}}
{{/}}
</ul>
Again, this was with limited testing, but it does seem to work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The result was the same how? You had errors or it ignored the if condition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sure - clarifying :)
i've tried this code
{{varReporter}}
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,varReporter)))}}
<li>
<a href="{{content}}">{{filename}} - {{varReporter}} - {{author}}</a>
</li>
{{/}}
{{/}}
</ul>
and Mail I've received looked like this
so
this means (as far as i uderstand that this code wors preety much like this
{{varReporter}} - this works
<ul>
{{#issue.attachment}}
{{#if(not(equals(author,varReporter)))}} <<== here varReporter returns null
<li>
<a href="{{content}}">{{filename}} - {{varReporter}} - {{author}}</a> <<== here {{varReporter}} returns null
</li>
{{/}}
{{/}}
</ul>
sorry - i don't know how to explain this other way;/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the added context. It appears that we're encountering the exact same issue then with the variable as we did trying to navigate out of the attachment as the rule is likely reading varReporter as attachment.varReporter which would return nothing. Let me think on this one a little bit more. We may need to attack this in a different way. There are also several other smart value ninjas in the community who may chime in.
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.