Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I use {{#lookupissues}} in the "to" of an email

Tim Foster January 28, 2022

I am trying to send an automated email to the reporters of issues when we release into production. I have the email aspect working nicely when it sends to my email address. I am able to list the epics included in the release by defining a lookup JQL statement.

The body works fine to display the URLs for the epics included in the release. Since my JQL is defined before my email component, and my email component can access the epics without a problem, I can't understand where I'm going wrong with referencing the same smartvalue in the "to" for my email.

My "to" looks like {{#lookupIssues}}{{Reporter}};{{/}} but I get the error:

Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty.

The Reporter field isn't empty, (it's me in this test), so could someone point me in the right direction please?

3 answers

3 accepted

4 votes
Answer accepted
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2022

To help troubleshoot rules, I always like to use the "Audit log" action - in this case to see what your lookupissues smart value expression evaluates to.

In my test, it looks like this:

Screen Shot 2022-01-28 at 11.32.45 AM.png

I'm guessing that's not quite what you expected (it's not an email address). It's actually the user ID, which is what Atlassian uses to identify users.

As noted here, you probably want to write something like reporter.emailAddress instead.

Additionally, you might find problems with the trailing ; character. Remove that in your early testing when there is just one email, to confirm that everything else works in that simple case.

Then you may have to experiment with what works (comma instead of semicolon perhaps?) to support multiple emails. Reference this documentation if you find a need to use separator characters between email addresses but omit the last one.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2022

Hi @Tim Foster -- Welcome to the Atlassian Community!

Yes, and...to the other responses: You may be getting an issue from any trailing delimiters, so you can selectively add the delimiter like this:

{{#lookupIssues}}{{reporter.emailAddress}}{{^last}};{{/}}{{/}}

This will add a semicolon between all the addresses, and leave off the last one.

Kind regards,
Bill

Like Mykenna Cepek likes this
Tim Foster January 31, 2022

Thank you, all of you, for your help. However, I am still not able to get this working correctly.

I have added a Log Action: {{#LookupIssues}}{{reporter.emailAddress}}{{/}} but it displays nothing. I have tried changing this to: {{#LookupIssues}}{{key}}{{/}} but still it displays nothing. The action details shows:

Log action
Log
But with nothing else. In the Associated Items box I can see that LookupIssues finds the correct Jira, and following this url takes me to the correct place. I can see that I am the reporter (and assignee) so all good there. Just no email.
My "To" for the email is identical to the one given by Bill above;
{{#lookupIssues}}{{reporter.emailAddress}}{{^last}};{{/}}{{/}}
But still no email. 
I'm tearing my hair out with this :(
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2022

Hmm, actual screenshots of your rule and the components of interest might help. At this point, all I can say is "works on my box" (works in my cloud?). See below.

Screen Shot 2022-01-31 at 10.25.59 AM.png

Like # people like this
Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

@Mykenna Cepeksince his JQL returns multiple issues would that cause a problem or would automation just loop through all the issues?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

Yes, and...smart values are usually case-sensitive.  So please check if you are using {{lookupIssues}} in your log entries and the email TO address list.  Thanks!

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2022

@Tim Perrault The rule I shared above works fine with multiple issues/emails. I just tested it.

It is unfortunate that the same email may be repeated multiple times. But the effort in Automation to de-duplicate a list would be best handled in a separate post.

Like Tim Perrault likes this
Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

@Mykenna Cepekawesome! Wasn't sure about that. Thanks for checking :)

Tim Foster January 31, 2022

The jql I'm using only returns 1 task for this test. It could, and probably would include more (if I ever get it working!), but the test is only using one.

Everything else in the automation seems good. If I add my hardcoded email into the "to" I get the email with the jira(s) linked nicely, but I'm the only one in the list. I'd be happy if I got mutiple emails for being the reporter and hardcoded at this stage :)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

Mykenna, did you try to actually send the emails?  I just tested and it failed for me too:

  • Can write the values to the audit log, but they collapse to null in the email TO field
  • Tried saving the Lookup Issue values to a single created variable first, and got the same result
  • Tried a separate branch to send to one issue's reporter with {{issue.reporter.emailAddress}} and that worked

It appears there is a problem with Send Email and use of smart values which are not in one issue.

@Tim Foster ...I suggest it may be time to submit a ticket to Atlassian support for this one: https://support.atlassian.com/contact/#/

Like Tim Perrault likes this
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2022

@Bill Sheboy I did not try to actually send emails.

@Tim Foster wasn't even able to get results from the dead-simple Log Action, and I saw no need to go further until he was able to get that to work.

There may be issues with the separator character (semicolon, comma, etc), which I mentioned previously. Again, seemed premature with no actual smart value output.

0 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2022

Hi @Tim Foster and welcome to the community.  Reporter by itself will bring up the user ID.  You want to use this instead:

{{reporter.emailAddress}}
0 votes
Answer accepted
Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2022

Hi @Tim Foster

 

Firstly that's a cool name you got :)

 

Try using this smart value {{reporter.emailAddress}}

 

Thanks,

Tim

Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

@Tim Foster 

Try this smart value and let me know if this works {{issue.reporter.emailAddress}}

 

I was able to send an email, but my automation is very simple.

automation.png

 

Thanks,

Tim

Tim Foster January 31, 2022

Nope, still the same problem. I think I'm going to abandon the idea of the email and just have it post to the Teams/Slack channels instead.

Thanks for your help with this though. I've learned more from these boards, than anywhere else.

Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

Bummer. Are you able to post a screen shot of the steps of your automation? I want to fiddle around with this more on my off time.

Tim Foster January 31, 2022

These are the steps I have. It's not a complex automation by any means

image.png

Like Tim Perrault likes this
Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

@Tim FosterThanks! I'll let you know if I can get something working.

Like Tim Foster likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

Hi @Tim Foster 

Did you note you have some square brackets, not curly ones in your smart values in the image?  The smart values should only use curly brackets.

Thanks,
Bill

Like Tim Perrault likes this
Tim Foster January 31, 2022

I hadn't noticed that, thanks Bill. However, I'm getting the same error after correcting it. I never see the log detail as per the screenshot from @Mykenna Cepek though, so I think something is amiss elsewhere (although that wouldn't have help, so thanks for spotting that)

Tim Perrault
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2022

Wow! Good catch @Bill Sheboy This reminds me when I was connecting to a database one time was using jbdc instead of jdbc :)

Like Bill Sheboy likes this
Ivanna January 9, 2023

Hi @Tim Foster ,

You can try this,

{{lookupIssues.reporter.emailAddress}}

I success to do this,It will sent email to reporters!

messageImage_1673324087802.jpg2.jpg

Like vanderson bessa moreira likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 10, 2023

Hi @Ivanna -- Welcome to the Atlassian Community!

Context is important for automation rules, so I suspect the reason your reference to just Reporter failed is there is no issue at that rule scope.

If you believe it is something else, please create a new question (rather than adding to this one), posting images of your rule and the complete audit log details of the rule run for context.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events