Automation to email users in a custom field

Jessica Kizmann January 12, 2023

I have a custom field named "Stakeholders" - {{customfield_10114}} which may contain multiple users. I would like users in this custom field to receive an email notification when the issue transitions. 

I've set a fairly simple automation for this, but it's not picking up on the smart value for my custom field. (See screenshots attached) 

 

Any ideas? I suspect the issue is the next gen project type, since custom fields are handled differently, but I'm not sure.

 

custom-1.pngerror.pngstakeholders.png

2 answers

1 accepted

1 vote
Answer accepted
Trudy Claspill
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 12, 2023

Hello @Jessica Kizmann 

You have to tell the automation from which issue has the data in that field that you want to use. When referencing an issue field in Automation you need to prefix it with "issue." like this:

{{issue.<field>}}
{{issue.Stakeholders}}
{{issue.customfield_10114}}

"issue" is the issue currently in context. In your Automation there is no change of context (i.e. branching) so "issue" will work. If there was a change of context (i.e. the action was within a branch) and you wanted to reference data from the issue that triggered the rule, then you would use "triggerIssue".

Jessica Kizmann January 12, 2023

I tried it with both {{issue.Stakeholders}} and with {{issue.customfield_10114}} but I'm still getting, "Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty."

Trudy Claspill
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 12, 2023

I see the same thing when I reference the field with a smart value.

You should not need to use a smart value here.

When you are in the Send Email action and you click in the To field you should see a list of fields to select. Do you see the Stakeholders field in that list? If you don't see it in the list, does it appear if you start typing it in? 

Screen Shot 2023-01-12 at 10.39.37 AM.pngScreen Shot 2023-01-12 at 10.41.10 AM.png

If you can find the field in the list or by typing it in, select it and see if that then sends the email (assuming the field is not actually empty for the triggering issue). When I pick the field itself, then the rule is able to run successfully and does send the email.

I suspect that using the smart value the system may expect that to be explicitly the text of a valid email address, which it is not in this case. When you specify a User Picker field, the Automation knows how to interpret that to get the emails for the specified users.

Jessica Kizmann January 12, 2023

Unfortunately, no, it's not showing there even when typed manually. I assume because it's a field I created and not a default.

userfields.png

Trudy Claspill
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 12, 2023

Ah, I missed an important detail. You're working with a Team Managed project.

Automation for Jira does not yet support the People field used in Team Managed projects, unfortunately. I have found that listed in multiple change requests in the backlog:

https://jira.atlassian.com/browse/JSWCLOUD-22200

https://codebarrel.atlassian.net/browse/AUT-1651

https://codebarrel.atlassian.net/browse/AUT-2248

 

The problem is also mentioned in several community posts. Here is one that mentions a workaround using the Send Web Request action to get the email addresses (thanks @Bill Sheboy ):

https://community.atlassian.com/t5/Jira-questions/Automation-send-email-to-all-users-listed-in-custom-People-field/qaq-p/1807325

Like Jessica Kizmann likes this
Jessica Kizmann January 12, 2023

Thanks for following up, that's what I suspected. I tried Bill's method but that doesn't appear to work either. I'll keep seeing if there's any other methods to notify folks. 

0 votes
Balazs Varga
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2023

Hi all

I was struggling today with the same issue, and found a workaround that worked for us fine, so I wanted to share, maybe it helps others in the future: 

Add a step in the automation before sending the email, to add the people from the custom field ("Travelling" in our case) to the issue watchers.

Then the email can fetch the To field from the Watchers email attribute.

I guess if people don't want to remain watchers, you can add one more step to remove Watchers afterwards. 

Screenshot 2023-07-21 at 13.22.32.png

Guillaume PICOT
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 20, 2023

Works great for me Thanks :)

Emma Sunderland June 28, 2024

Hi all,

Thank you for this thread. It's been helpful as I try to also send an email to the users added to a custom field.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events