Can't generate user's email addresses

Christian simpson June 29, 2021

I am trying to create an automation rule for a template I'm creating that automatically send users in a custom field an email.  

When an issue is transitioned in my automation rule i select the the "Send Email" component.  In the To: box I entered this code to generate the user's email addresses taken from the users in a custom user field called "Stakeholders".  

{{issue.Stakeholders.emailAddress}}

I don't know why this doesn't generate the user's email addresses found within my user field called Stakeholders.  

When I type in 

{{issue.Stakeholders.displayName}} it works just fine so I know "Stakeholders" is being recognized.  

 

Any ideas?  

3 answers

1 accepted

2 votes
Answer accepted
Christian simpson June 30, 2021

There is an open defect that team-managed project custom fields do not expose/return the email address (I am guessing through the API) to the smart values:

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

 

It's a bug so this is unresolvable currently.  

Nathan Cunningham October 20, 2021

That ticket shows it was closed on 10/13/2021 as "Won't Do". Was this issue resolved by other means or are we just dead in the water? Because I'm having the same problem. We have an issue type with a custom people chooser field for "Manager". I want to CC the Manager on automation emails if the assignee doesn't get it completed after X number of days. So I need the email address of the Manager in that custom people chooser field.

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.
October 20, 2021

Hi @Nathan Cunningham 

If you are still seeing the issue they probably didn't map the field.

I haven't tried this for team-managed projects: a work-around you can try if you have the accountId of the user in that field is to call the REST API from the rule to get their email address.  Here are a couple of documentation links if you want to try that:

Doing this technique will probably add a few seconds (at least) per rule execution.

Kind regards,
Bill

2 votes
John Funk
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 29, 2021

Hi Christian - Welcome to the Atlassian Community!

Why type of field is the Stakeholders custom field? 

Christian simpson June 29, 2021

It is a multiuser user picker.  

John Funk
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 29, 2021

Not sure this will work, but might be worth a try. So I would think this would send an email to each person in the list.

{{#issue.Stakeholders}} ({{emailAddress}}) {{/}}

What I am not sure about is if there needs to be some type of separator between them. 

OR if this functionality will even work in the TO field of an email for a multi-select field. 

Christian simpson June 29, 2021

I've tried something similar but user isn't the name of the custom field, "Stakeholders" is so doesn't seem to do anything.  

Christian simpson June 29, 2021

One other thing to note is that this is a Team Managed project and not a company managed project.  Not sure if that makes a difference.  In the TO: box for the create email action there are certain fields like Reporter and Assignee that when selected they do generate the email addresses.  It's only when I try and target the users in a custom field that it doesn't work.  

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.
June 29, 2021

Hi @Christian simpson 

John has you on the correct track, and I suggest a small adjustment to add semicolon delimiters, except for the last value in the list:

{{#issue.Stakeholders}} {{emailAddress}} {{^last}} ; {{/}} {{/}}

But first, have you confirmed that value is the correct smart value of your field name?  You may check that with the information in this how-to article:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Best regards,
Bill

Like John Funk likes this
Christian simpson June 29, 2021

Thanks for the suggestion Bill, unfortunately it did not return their email addresses.  I wonder if their is no smart value for the field when it's created within a team-managed project versus a company-managed project. 

One way I confirmed that I labeled the field correctly was by testing it this way

{{issue.Stakeholders.displayName}}  and that does return the display names of everyone with the "Stakeholders" field so I know I referencing it correctly. 

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.
June 29, 2021

Interesting... that is why I was suggesting that how-to article.  Basically you find an example issue which has your data, look it up with the REST API...

https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names

And then search for your data and field name.  If it is present, the smart value probably will work.

UPDATE: oops, and sorry for the bad guidance, as there is an open defect that team-managed project custom fields do not expose/return the email address (I am guessing through the API) to the smart values:

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

Like # people like this
Christian simpson June 29, 2021

OK I will look into that more, thank you.  

Like John Funk likes this
Christian simpson June 29, 2021

Ahhhhh ok, well at least I'm not crazy lol!  Thank you for at least giving me some kind of resolution on the issue.   

Like # people like this
1 vote
Jack Brickey
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 29, 2021

I haven’t used stakeholders before. I went to the documentation for Smart values but I didn’t see stakeholders. I assume you have validated it? I see your last comment seems to indicate it’s valid but my question is does it actually produce results?

Christian simpson June 29, 2021

Sorry "Stakeholders" is a custom multi user field I created.  It's populated with a set number of users I would like to send emails to but I can't seem to figure out how to generate their email addresses.  Other things seem to work just fine like displayName for example.  

Suggest an answer

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

Atlassian Community Events