Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,803
Community Members
 
Community Events
165
Community Groups

Using smart values in the sending email's recipient

Hi, I added a dropdownlist field into my issue type. The options for the dropdownlist are "Internal" and "External". The field name for this dropdownlist is "Notification Type".

 

Then I created an automation that would send an email, and the "To" field is based on the "Notification Type". so this is how I write the "To" field

 

{{#if(eq({{Notification Type}}, "Internal"))}} xxxx@xxxx.xx.xx{{/}}

 

then when I tried it, in the issue logs, it shows that 
"Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty."

What could be wrong in here? Thank you

1 answer

0 votes
Curt Holley Community Leader Jun 01, 2022

 I would use a if else condition to handle your custom field,

If Notification type = Internal do whatever

Else Notification type = External do whatever

but then, how/where are you getting your email addresses from?

how to use the if else condition?
actually I'm following this link https://community.atlassian.com/t5/Automation-articles/New-automation-smart-values-in-Jira-Cloud/ba-p/1402775  which stated multiple IF rather than IF Else.


what I want to do, when (Notification type = Internal), then I will input the list of emails manually. something like this

{{#if(eq({{Notification Type}}, "Internal"))}} xxxx@gmail.com{{/}}
{{#if(eq({{Notification Type}}, "Internal"))}} yyyy@gmail.com{{/}}
{{#if(eq({{Notification Type}}, "External"))}} aaaa@gmail.com{{/}}
{{#if(eq({{Notification Type}}, "External"))}} bbbb@gmail.com{{/}}

but above is not working

Curt Holley Community Leader Jun 01, 2022

I don't think putting all of that in the "To" section will work.

What does the rest of your automation look like (what conditions?)

What happens if you just put the relevant email addresses in? as, although smart values are supported in the "To" field, my hunch is, the net result of using any in there would have to simply = "an email address" and all other logic needs to be handled in the conditions of the rule.

The condition is an issue is transitioned to another status. I think I get what you mean, let me try it first.

Like Curt Holley likes this
Simmo Atlassian Team Jun 05, 2022

Hi @Denny Pujo

An interesting one this one! So, the reason that it isn't working is that I think when the smart value doesn't match you get an empty string as one of the addresses and that doesn't go down well.

What I think you could do is to use the Create Variable action to get a smart value and then use that smart value.

Your smart value could be something like:

{{#if(eq({{Notification Type}}, "Internal"))}}xxxx@gmail.com, yyyy@gmail.com{{/}}{{#if(eq({{Notification Type}}, "External"))}}aaaa@gmail.com, bbbb@gmail.com{{/}}

But I think it is important that you keep it on one line. If you use that in a Create Variable action and then refer to that as one smart value in the email action it should work.

Cheers,

Simeon.

Like Denny Pujo likes this

Hi Simmo, thank you for the reply. Actually Curt already helped me with this one. Because I didnt know that the automation could also use an If else into the logic itself. Now im using the automation's build in if else logic, and it is actually much more easier to read. 

Like Curt Holley likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Atlassian Automation

Jira Automation: Sum Up Story Points Roundup (Initiatives -> Epics -> Story/Tasks -> Subtasks)

Hi Everyone, In this roundup we combine all the jira automation rules to sum up story points across different issue types. We start from the lowest level, summing up story points from sub-tasks t...

1,911 views 2 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you