Hi,
I am working on a release notification email that includes items that are separated by categories. Is there a way to return only the value specified for the smart value provided? For example, if the category values include:
Would there be a way to specify which one to return? Currently it returns all with the following:
{{#lookupIssues}}{{customfield_10530}}
..and it would be nice to have it get the specified value instead of the entire list to separate the categories based on the email template being used which has separated scetions based on the issue category.
I have tried many functions listed in some of the documentation though none have worked thus far.
Any advice would be appreciated. Thanks.
Hey @Keith Vedol - did you get this solved?
Hi @Keith Vedol
When you have known criteria for your groups, such as Issue Type, there are at least two ways to do this:
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.
Hi @Bill Sheboy
I tried one of the examples in the documentation you linked me to with changes to look for the custom field value and no results are returned:
{{#issue.customfield_10530}}
{{ #if(customfield_10530, "New Feature")}}{{key}}{{ / }}
and another (exists and non-exists):
{{#issue.customfield_10530}}
{{#if(not(exists(name.match("(/New Feature/g)"))))}}{{key}},{{/}}{{/}}
{{#issue.customfield_10530}}
{{#if(exists(value.match("(/New Feature/g)")))}}{{key}},{{/}}{{/}}
I have replaced 'name' with 'value,' and 'defaultValue' to no avail.
I would just like the issues that contain this value in the custom field returned as a list and it is proving to be quite the task to do so.
The documentation only discusses how to return a comment body, but doesn't go into detail of how to return different values such as key, summary, description, etc.
Is there something I am missing here? Also I think the documentation could be updated to provide better examples for those who are newer to using smart values. Thanks.
Also, for point 2, do you mean having 3 {{#lookupIssue}} actions in one rule with one being for each category such as: (ex. fixVersion = '{{version.name}}' AND "Category[Dropdown]" = "New Feature" ORDER BY cf[10530] ASC, key ASC) and so on?
And if so, after each Lookup component I would need to add a Create Variable component?
Regards,
Keith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing, it is helpful to use this how-to article to confirm you have the correct smart values for your fields: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Next, please try using the filtering on the lookup issues results, not on the individual issue. Something like this for some HTML in an email with keys and summary as URLs:
Here is the list:
<ul>
{{#lookupIssues}}
{{#if(equals(customfield_10530.name,"New Feature"))}}<li><a href="{{url}}">{{key}} - {{summary}}</a></li>{{/}}
{{/}}
</ul>
And...you should be able to reference any of the fields this way.
For option #2, yes...You would call lookup issues with different JQL, storing the results in a created variable as HTML, and then just include those in the email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
The first option worked as I am now able to separate them accordingly (Thanks!). Is there a way to return a string if no issues were found for that value as opposed to being blank (ex. "No items matching that value were found.")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I believe this would do that when using Lookup Issues as the source of issues. Just put this as a separate section, or use conditional logic to build the content in a created variable
{{#if(equals(lookupIssues.size|0,0))}} No items matching that value were found {{/}}
{{#if(lookupIssues.size.gt(0))}}
Here is the list:
<ul>
{{#lookupIssues}}
{{#if(equals(customfield_10530.name,"New Feature"))}}<li><a href="{{url}}">{{key}} - {{summary}}</a></li>{{/}}
{{/}}
</ul>
{{/}}
How this works:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Using the code provided, I get an empty section:
{{#if(equals(lookupIssues.size|0,0))}} <b><span
style='font-size:9.0pt;font-family:Montserrat;color:white'>No fixes were included in this release.</span></b></p> {{/}}
{{#if(lookupIssues.size.gt(0))}}
<ul>
{{#lookupIssues}}
{{#if(equals(customfield_10530.value,"Test"))}}<li><a href="{{url}}">{{key}} - {{summary}}</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.
Okay, I just tried that with a couple of different custom fields (text and single-select) and it worked for me. Let's try some diagnosis...
(A) What is the type of your custom field?
(B) When you write the following to the audit after a lookup issues action, what do you observe?
{{#lookupIssues}}{{key}}:{{customfield_10530}}{{^last}}, {{/}}{{/}}
(C) When you write the following to the audit after a lookup issues action, what do you observe?
{{#lookupIssues}}{{key}}:{{customfield_10530.value}}{{^last}}, {{/}}{{/}}
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
A) The field type is single-select dropdown.
B) {{#lookupIssues}}{{key}}:{{customfield_10530}}{{^last}}, {{/}}{{/}} produces all 8 issues in question covering the different category types.
TESTDNA-1:New Feature, TESTDNA-37:New Feature, TESTDNA-22:Improvement, TESTDNA-8:Bug/Defect, TESTDNA-26:Bug/Defect, TESTDNA-35:Bug/Defect, TESTDNA-21:Technical Debt, TESTDNA-34:Technical Debt
C) {{#lookupIssues}}{{key}}:{{customfield_10530.value}}{{^last}}, {{/}}{{/}} produces the same result:
TESTDNA-1:New Feature, TESTDNA-37:New Feature, TESTDNA-22:Improvement, TESTDNA-8:Bug/Defect, TESTDNA-26:Bug/Defect, TESTDNA-35:Bug/Defect, TESTDNA-21:Technical Debt, TESTDNA-34:Technical Debt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for those tests! They verify we have both the correct smart value and references to its attributes.
Now your prior test was checking for a value of "Test", and I do not see that as one of your options. In only see: New Feature, Improvement, Bug/Defect, and Technical Debt.
Please try to change "Test" to one of those values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Technical Debt and having no issues with that category, I still get blank return.
{{#if(equals(lookupIssues.size|0,0))}} <b><span
style='font-size:9.0pt;font-family:Montserrat;color:white'>No fixes were included in this release.</span></b></p> {{/}}
{{#if(lookupIssues.size.gt(0))}}
<ul>
{{#lookupIssues}}
{{#if(equals(customfield_10530.value,"Technical Debt"))}}<li><a href="{{url}}">{{key}} - {{summary}}</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.
Let's try to rule some more things out...
What is the JQL you are using for your Lookup Issues, and if you use that stand-alone does it return what you expect?
Is the value "Technical Debt" correct, or are there any leading/trailing spaces in the drop-down list value?
Have you tried a value other than "Technical Debt"?
And, let's try this with no HTML formatting, like this:
{{#if(equals(lookupIssues.size|0,0))}}No fixes were included in this release.{{/}}
{{#if(lookupIssues.size.gt(0))}}{{#lookupIssues}}{{#if(equals(customfield_10530.value,"Technical Debt"))}}{{key}} - {{summary}}{{/}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JQL being used is fixVersion = '{{version.name}}' ORDER BY cf[10530] ASC, key ASC.
I have tried 'Improvement' as well with same result.
Using the snippet above with no HTML returns blank email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only other suggestion I have is the rule is "glitched"...sometimes rules get broken by adding/removing components after too many edits.
Try disabling this rule, and re-create it from scratch to see the impact.
If that still does not help, I suggest submitting a ticket to Atlassian Support to take a look as they have access to logging customers cannot see. You are the site admin on a paid Jira license and so can do that here: https://support.atlassian.com/contact/#/
I recommend including a link to this thread so they can see what has been tried thus far, and when you hear back from them, please post what you learn. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok it didn't work with a new rule and the above code snippet only. The code:
{{#if(equals(lookupIssues.size|0,0))}}No fixes were included in this release.{{/}}
just seems to be ignored completely even when used by itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just a hunch...would you please post an image of your complete rule one more time? Perhaps we are missing something obvious in the rule's structure/order of components.
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.
Before the send email action, please write this to the audit log and note the results:
Count of issues is: {{lookupIssues.size|0}}
So your rule would be:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Results below (still blank email):
Note that when I change the code to this:
{{#lookupIssues}}
{{#if(equals(lookupIssues.size|0,0))}}No fixes were included in this release.{{/}}
{{#if(lookupIssues.size.gt(0))}}{{#if(equals(customfield_10530.value,"Improvement"))}}{{key}} - {{summary}}{{/}}{{/}}{{/}}
I get this in the email:
No fixes were included in this release. No fixes were included in this release. No fixes were included in this release. No fixes were included in this release. No fixes were included in this release. No fixes were included in this release. No fixes were included in this release. No fixes were included in this release.
So with the change, it send a message for each one it checks and doesn't find the desired value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would advise against testing the full {{lookupIssues}} inside of iterating on that...which I why I split it into the two parts: no issues found and some issues found.
And...I think I figured this out: are you using a team-managed project (TMP) or company-managed project (CMP)?
When testing with CMP it worked for me...but I just ran the same test with TMP and smart value list filtering does not work. Which means you have discovered a bug, and I recommend submitting that to Atlassian support.
Your work-around is to use separate lookup calls, one by one with JQL meeting your needs, and saving the results in created variables. Then reference the variables in your email body.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The test project being used is CMP.
With the workaround how would that change the snippet you provided? Sorry for all of the question but I was hoping this would work as expected according to documentation and the examples you provided. I only did one so far and hoping I am on the right track before I continue. So I would need to create another lookup and variable after the first variable is created as shown below correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are on the correct track...And if the original is not working for you with CMP there is still a problem with your rule/Jira site, which I suggest you report.
The work-around pattern would be this:
Improvements:
{{varImprovement}}
Bugs:
{{varBugs}}
First get that to work, showing all categories.
Then you can add some conditional processing, such as below...including handling the case of no issues:
{{#if(exists(varImprovement))}}
Improvements:
{{varImprovement}}{{/}}
{{#if(exists(varBugs))}}Bugs:
{{varBugs}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I got them to appear with:
{{#if(exists(varFeature))}}
Features:
{{varFeature}}{{/}}
{{#if(exists(varImprovement))}}
Improvements:
{{varImprovement}}{{/}}
{{#if(exists(varBug))}}
Bugs:
{{varBug}}{{/}}
I am getting closer with this:
{{#if(equals(varFeature.size|0,0))}}<b>No new features were included in this release</b>.{{/}}
{{#if(exists(varFeature))}}
{{varFeature}}{{/}}
However, it will return the message even when issues matching the category are found:
No new features were included in this release.
TEST-1 New Feature 1
TEST-2 New Feature 2
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.