Using smart values in the sending email's recipient

Denny Pujo June 1, 2022

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

1 accepted

1 vote
Answer accepted
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 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?

Denny Pujo June 1, 2022

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

Denny Pujo June 1, 2022

image.png

Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 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.

Denny Pujo June 1, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 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
Denny Pujo June 9, 2022

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
AUG Leaders

Atlassian Community Events