Hey community I need your help here,
I want to make use of the {{#lookupIssues}} function and use if-condition for further filtering the fetched issues.
Use case:
I want to two lookupIssues lists in a comment or description field.
The first Issue list:
Every fetched issue should be checked whether its "customfield_10110" has the same value as the "customfield_10110" from the current issue, where the automation is triggered from. If it returns TRUE, the issue key should be listed in a bullet point list.
The second issue list should contain all the other issues, where the condition is not met.
FYI: In customfield_10110 we store supplier names. So in other words I want to get a list of other issues, which have the same supplier in the custom field like in the trigger (current) issue.
It seems like I cannot compare a value from the current (trigger) issue with a value of the looked-up issues. The manual triggered automation won't create a comment or post a new description field text.
I tried the following things:
{{#lookupIssues}}
{{#if(equals(customfield_10110,{{issue.customfield_10110}}))}}
* {{key}}
{{/}}
{{#lookupIssues}}
{{#if(equals(customfield_10110,"{{issue.customfield_10110}}"))}}
* {{key}}
{{/}}
{{#lookupIssues}}
{{#if(equals(customfield_10110,{{currentsupplier}}))}}
* {{key}}
{{/}}
Any ideas folks?
Please guys, have a solution for me
Thanks in advance!
Marvin
I just saw your new question, and gave an answer to your other post:
Long-format iterators have a known limitation where they cannot "see" data from outside their scope. And so once inside those {{#lookupIssues}} ... {{/}} iterators, they cannot access other issues, variables, etc.
There are two possible workarounds for your scenario:
Kind regards,
Bill
Hey @Bill Sheboy ,
Thanks for help.
Since option 2 (working with one lookupIssue function) looks like a little too advanced for me, I'll try working with a Lookup Table first. It also would be OK for me working with two lookupIssue functions.
Nevertheless I'm also struggling with option 1. Here's my automation setup so far:
The lookupIssue function in this case returns 4 issues.
Results in the comment:
My goal is to have kind of like a list format with bullet points (or even a table, but this is for later). Kind of like this:
Any ideas how to get the lookup table formatted like this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For that first method, you may store the entire {{lookupIssues}} result in the table, and then use it directly. This is a good technique to have multiple lookup results as it preserves the object structure.
For example:
My First Results:
{{#varFirstTable.get("First")}}
* {{key}} -- {{summary}}
{{/}}
My Second Results:
{{#varSecondTable.get("Second")}}
* {{key}} -- {{summary}}
{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy you are my hero here! Works like charm!
One last question: is it possible to limit the results from the look up table or the lookupIssues function?
In my sql query I ordered the search results by "resolved DESC" and only want to show for example 20 entries. "The last 20 related issues" according to my query, so to say…
Thanks in advance! <3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Filtering for a specific count of items cannot be done in one step because:
A simple workaround to get fewer, but perhaps not exactly 20 items, is to add more criteria to your JQL. For example:
your JQL expression
AND resolved >= -10d
ORDER BY resolved DESC
And repeat the lookup without the additional JQL to get the full count, as needed.
A more complicated workaround requires created variables and dynamic regular expressions. The basic outline is:
If you want to try this, please see this very long article I wrote using the techniques involved for a different use case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Marvin Brand
What is the field type for customfield_10110?
Looking at the example for using If and equals it seems like this should work:
{{#if(equals(customfield_10110,triggerIssue.customfield_10110))}}
{{#lookupIssues}}
{{#if(equals(customfield_10110,triggerIssue.customfield_10110))}}
* {{key}}
{{/}}
{{/}}
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/#equals
I believe you need {{/}} twice; once for the {{#if and once for the {{#lookupIssues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I didn't see @Bill Sheboy 's response before posting my own.
Bill knows way more about the complexities of Automation than I do, so his answer is more likely to be correct than my untested theory.
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.