Write email to user in customfield
Asked by Christopher Dick:

Hello there,

Unfortunately it is not possible for me to select a customfield as recipient of an email.

I tried the following values as the recipient of the email without success: {{customfield_11520}}, {{customfield_11520.value}}, {{issue.customfield_11520}}, {{issue.customfield_11520.value}}

Before that I check with an extended comparison condition (\^null$\|\^$) if the field {{issue.customfield_11520}} ("Testauftraggeber") is not empty.

**Error message:**   
Send email  
The email could not be sent because the "To" field is empty. If you referenced a field, it may be empty.

**Screenshot: Automation**

**![2023-01-06 08_23_17-Email notification to issue creator (project A) af....png](https://community.atlassian.com/t5/image/serverpage/image-id/233271i529141F6FED7DF36/image-size/large?v=v2&px=999 "2023-01-06 08_23_17-Email notification to issue creator (project A) af....png")**

**Screenshot: Customfield**

**![2023-01-06 08_34_11-Testmanagement (_) - Vorgangstypen - JIRA.png](https://community.atlassian.com/t5/image/serverpage/image-id/233273iD8AB089ECB1B1638/image-size/large?v=v2&px=999 "2023-01-06 08_34_11-Testmanagement (_) - Vorgangstypen - JIRA.png")**

Many Greetings,

Christopher


Answers:
author: Alex Koxaras _Relational_
body: Hi [@Christopher Dick](/t5/user/viewprofilepage/user-id/5110195)

Try simply with {issue.CUSTOMFIELDNAME}}. E.g. I have a paragraph field called "Paragraph". To get the value of this text field I used {{issue.Paragraph}} and the send email worked just fine. What type of field is your field?

![send email.png](https://community.atlassian.com/t5/image/serverpage/image-id/233274i44552DB207CEFA07/image-size/large?v=v2&px=999 "send email.png")

comments: author: Christopher Dick
body: Hi Alex,

Unfortunately, that didn't work out.

I still get the same error message that the field is empty.

I have already removed the comparison condition.

In my first post you can see a screenshot of the field.

Please see also screenshot:

![2023-01-06 09_10_27-.png](https://community.atlassian.com/t5/image/serverpage/image-id/233275iBBBD92542C79FE0A/image-size/large?v=v2&px=999 "2023-01-06 09_10_27-.png")


author: Christopher Dick
body: The custom field contains a user from another project.

That means there is a manual trigger in project A and the triggering user creates a new task in project B. The new task contains a custom field to store the triggering user.


author: Alex Koxaras _Relational_
body: [@Christopher Dick](/t5/user/viewprofilepage/user-id/5110195)

The field you are using is a user picker field. Meaning that behind it Jira uses the account id of the user and not any other information. To acquire this type:

```
{{issue.Testauftraggeber.emailAddress}}
```


author: Christopher Dick
body: Unfortunately, that didn't work out.

I still get the same error message that the field is empty.


author: Christopher Dick
body: When copying from project A to project B, can't I pass the email address of the user who is firing the trigger into a new text field?

Unfortunately, the text field remained empty in the following attempt:

{  
"fields": {  
"customfield_11520": \[{"id": "{{initiator.accountID}}" }\],  
"customfield_11523": \[{"id": "{{initiator.emailAdress}}" }\]  
}  
}


author: Alex Koxaras _Relational_
body: [@Christopher Dick](/t5/user/viewprofilepage/user-id/5110195) can you explain/break down your rule please? It doesn't make any sense not to work the above smart value I gave you. I mean I tested it and I have successfully received the email. The only thing I can think of, is that this user field is being copied after the email has been sent. Soo... try adding a re-fetch component before sending the email.


author: Christopher Dick
body: I found a spelling error, but the problem still persists:

{  
"fields": {  
"customfield_11520": \[{"id": "{{initiator.accountID}}" }\],  
"customfield_11523": \[{"id": "{{initiator.emailAd**d**ress}}" }\]  
}  
}


author: Alex Koxaras _Relational_
body: "customfield_11523": \[{"id": "{{initiator.emailAd**d** ress}}" }\]

You are trying to add an email address to an id. This can't happen :)


author: Christopher Dick
body: I am unfortunately still new to the topic.

How can I pass the email into a text field?

By the way, the email cannot be sent even after refreshing the process again. Furthermore, an empty field is mentioned as an error.

![2023-01-06 09_57_01-Einstellungen - JIRA.png](https://community.atlassian.com/t5/image/serverpage/image-id/233288i440E891160EDA98A/image-size/large?v=v2&px=999 "2023-01-06 09_57_01-Einstellungen - JIRA.png")


author: Christopher Dick
body: Both rules at a glance.

On the left, Project B for sending e-mails.

Right Project A for creating a new task in Project B.

![2023-01-06 09_58_25-.png](https://community.atlassian.com/t5/image/serverpage/image-id/233290iC91CEABFE345DB46/image-size/large?v=v2&px=999 "2023-01-06 09_58_25-.png")


author: Christopher Dick
body: Thanks now everything works :)


Tags: custom-field

email

regex