Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation: Send email to address in custom field

Jessica Golden
Contributor
September 15, 2020

I am attempting to send an email upon resolution to an address listed in a custom field on the issue.  

I have tried using the field name as well as the field ID and both seem to be failing in the mail log. 

{{issue.sender email address}} AND {{issue.customfield_xxxxx}} AND {{issue.customField_xxxxx}}

If I enter a regular email address on the automation rule, it sends fine. But the smart value isn't working.

3 answers

1 accepted

0 votes
Answer accepted
Jessica Golden
Contributor
September 17, 2020

We were finally able to confirm that the data was pulling correctly, but the email was being blocked on our email server. Should have been the first place I looked, but was convinced I was doing something wrong. Thank you kindly for your help!

0 votes
Haddon Fisher
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.
September 15, 2020

Take a look at the issue using the REST API ("yourjiraurl.com/rest/api/latest/issue/[issuekey]") and see if it is storing the email address as a basic string or if there's something else going on?

For example, if your custom field is a 'user' type field, the field is actually an object with a bunch of values. As example, the assignee field:

assignee": {
"self": "...",
"name": "gus",
"key": "gus",
"emailAddress": "gus@somedomain.com",
"avatarUrls": {
"48x48": "...",
"24x24": "...",
"16x16": "...",
"32x32": "..."
},
"displayName": "Gus IsMyName",
"active": false,
"timeZone": "America/Havana"

To get at Gus' email, I think you would need to use the smart value:

{{issue.customfield.emailaddress}}
Jessica Golden
Contributor
September 15, 2020

Thank you for that! I have confirmed that it's storing it as a string as intended. Is it possible that it has something to do with the address not being associated to a user?

Haddon Fisher
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.
September 17, 2020

I wouldn't think the type of field would matter much except how you access the info...What type of custom field are you storing the email address in? Have you tried {{issue.customfield.value}}? 

 

Jessica Golden
Contributor
September 17, 2020

Thank you for your help and feedback! We figured it out - it wasn't JIRA or me... it was the email server config.

Haddon Fisher
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.
September 17, 2020

Phew!!!!

Like Jessica Golden likes this
0 votes
Niranjan
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.
September 15, 2020

Hi @Jessica Golden ,

I am unsure of exact requirement, but if you are looking to send a custom email to an email address  (for a workflow transition) specified in a text field, you may try using

issue.getAsString("customfield_ID")

Jessica Golden
Contributor
September 15, 2020

Do I replace the "Customfield_ID" with the id number?

Niranjan
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.
September 15, 2020

yeah it should be customfield_12345.

issue.getAsString("customfield_12345")

Like Paul Sowels likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events