Send e-mail to a group with Jira Automation
Asked by Jira Guy:

Hello all

In my JSM project, I have an Asset custom field called Team. It stores multiple objects of type "Team" from the CMDB. Among the attributes of the "Team" object, I have an attribute called "team_members" which stores multiple Jira users.

I'm having trouble building the following automation:

Whenever a new team is added on the ticket, send an e-mail to all jira users stored in the "team_members" attribute.

I've tried adding the following smartvalues in the "To:" section of the action:

{{Team.team_members}}

{{Team.team_members.accoundId}}

{{Team.team_members.emailAddress}}

The error I'm receiving is:

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

Any ideas of how I could make it work?


Answers:
author: Mikael Sandberg
body: Hi [@Tudor Tofan](/t5/user/viewprofilepage/user-id/2904480),

Welcome to Atlassian Community!

What type is the attribute? User? If that is the case and it accept multiple values then you have to use a branch so that you can iterate over each user in the attribute, similar to this branch that I use to set Business Approvers:

![Screenshot 2024-07-26 at 8.39.54?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/338210i2ECDBE96329EBEE1/image-dimensions/298x192?v=v2 "Screenshot 2024-07-26 at 8.39.54?AM.png")

I would use {{Team.team_members.emailAddress}} to set the smart value in the branch and then use it in the To field.


author: Bill Sheboy
body: Hi [@Tudor Tofan](/t5/user/viewprofilepage/user-id/2904480) -- Welcome to the Atlassian Community!

First, have you confirmed the asset, smart value contains the information needed?

Next, when a list, smart value is referenced like this:

```
{{Team.team_members.emailAddress}}
```

By default, it joins them with commas. However the Send Email action wants multiple values delimited with semicolons. Perhaps try forcing that with this:

```
{{Team.team_members.emailAddress.join(";")}}
```

Kind regards,  
Bill


author: Victor - Modus Create
body: Hi [@Tudor Tofan](/t5/user/viewprofilepage/user-id/2904480) ,

From what I understood of your request, it seems that you would find an alternative for this using Notification Assistant for Jira Cloud:

- [https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=cloud\&tab=overview](https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=cloud&tab=overview)

The app allows you to send notifications to multiple users that could help you with the task at hand.

Hope it helps.  
Cheers,  
Victor \| Modus Create


author: Jira Guy
body: Thanks for the suggestions guys. It was actually the problem with the e-mail address visibility. It seems that none of the users from that attribute (including myself), had the e-mail address set as public. As soon as I set my own e-mail address as public, it started working like a charm with

```
{{Team.team_members.emailAddress}}
```


author: Jim Knepley - ReleaseTEAM
body: Hi [@Tudor Tofan](/t5/user/viewprofilepage/user-id/2904480)

You might be able to discover the structure of the smart value for that custom field by [using the issue API](https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/).


Tags: cloud

jira-service-management

jira-service-management-cloud