Send email when issue is created automatically
Asked by Teresa Ruiz-Rico G?mez:

Hi all,

When I parameterize that an issue is created automatically (in the automotion tab), then I have configured that an email is sent to the assignee. In the audit log it always appears that there is an error in sending the email for the following reason:  
"As there is no issue present, cannot get the value of the field:  
assignee  
Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty."  
How can I solve this, as I the issue has been created with its corresponding assignee?


Answers:
author: Rilwan Ahmed
body: Hi [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730) ,

Is the ticket being auto-assigned to anyone as soon as it is created ? Or atleast before the rule is run ?

comments: author: Teresa Ruiz-Rico G?mez
body: The issue is created and it is assigned to a specific person always.

![Capture_email3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270304i2A394B1C76580A3B/image-size/large?v=v2&px=999 "Capture_email3.PNG")![Capture_email1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270302i5605A86E7EA2FD2D/image-size/large?v=v2&px=999 "Capture_email1.PNG")![Capture_email2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270303i4683058F0DC8C0B9/image-size/large?v=v2&px=999 "Capture_email2.PNG")


author: Rilwan Ahmed
body: Hi [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730) ,

1. How is the ticket being assigned to specific users ?  
Is it by automation rule OR project default settings OR Components lead ?

Seems rule is running before the ticket gets assigned to the Assignee.


author: Teresa Ruiz-Rico G?mez
body: [@Rilwan Ahmed](/t5/user/viewprofilepage/user-id/716861) Look, it is correctly assigned:

![Capture_email5.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270310iC78E62896107AE37/image-size/large?v=v2&px=999 "Capture_email5.PNG")


author: Rilwan Ahmed
body: Hi [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730) ,

As informed earlier, the rule is triggered before the ticket is being assigned. Even I was able to reproduce the issue.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/270312iF796856087DB6B38/image-dimensions/172x90?v=v2 "image.png")


author: Teresa Ruiz-Rico G?mez
body: Then [@Rilwan Ahmed](/t5/user/viewprofilepage/user-id/716861) do you have any proposal on how I can solve this?


author: Rilwan Ahmed
body: **Workaround:**

Add a JQL condition in Scheduled issues trigger  
i.e. Project = \<Your Project\>

Create Component "**FOR EACH: Create a Branch**" --\> Branch rule/ Related issues --\> Send Email.

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


author: Teresa Ruiz-Rico G?mez
body: Thanks! [@Rilwan Ahmed](/t5/user/viewprofilepage/user-id/716861) now it works :).

But I can enter this function when some cases are lauched at the same time? This could cuase any error?

Thank you in advance for your response.

Best regards,


author: Teresa Ruiz-Rico G?mez
body: Hi [@Rilwan Ahmed](/t5/user/viewprofilepage/user-id/716861) I mean I have the possibility to do this. This is the correct way?

Thank you in advance for your response.

![Capture_branch.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270384i584863D14A290F4F/image-size/large?v=v2&px=999 "Capture_branch.PNG")


author: Rilwan Ahmed
body: Hi [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730)

I suggest, create different rules for daily and weekly scheduled jobs. It would be easy for you to identify and check the audit logs in future.


author: John Funk
body: Hi [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730)

Can you share a screenshot of your entire rule?

comments: author: Teresa Ruiz-Rico G?mez
body: Sure: [@John Funk](/t5/user/viewprofilepage/user-id/7148)

![Capture_email1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270296iCA8C12DEB39CABD9/image-size/large?v=v2&px=999 "Capture_email1.PNG")


author: John Funk
body: Do you have a JQL statement in your Scheduled trigger part? Can you share that?


author: Teresa Ruiz-Rico G?mez
body: No, this is my schedule part:

![Capture_email3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270298i98770F05C155C6A2/image-size/large?v=v2&px=999 "Capture_email3.PNG")


author: John Funk
body: Okay, let's try putting a Branch between the last two actions. Use Most recently created issue for the Branch type.

Then move the Send Email action under the branch.

I am assuming that in the Create issue action you are setting the value of the assignee.


author: Teresa Ruiz-Rico G?mez
body: Hi [@John Funk](/t5/user/viewprofilepage/user-id/7148) I have this problem:

![Capture_email4.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270305i51FDAC6D757E2CB6/image-size/large?v=v2&px=999 "Capture_email4.PNG")


author: Teresa Ruiz-Rico G?mez
body: Hi, it is correctly assigned [@John Funk](/t5/user/viewprofilepage/user-id/7148)

![Capture_email5.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/270306i404C688C950AEA64/image-size/large?v=v2&px=999 "Capture_email5.PNG")


author: Teresa Ruiz-Rico G?mez
body: [@John Funk](/t5/user/viewprofilepage/user-id/7148) , then how can I resolve this?


author: John Funk
body: Sorry, use Current Issue instead of most recently created. And don't forget to move the Sent email action underneath the branch.


author: John Funk
body: [@Teresa Ruiz-Rico G?mez](/t5/user/viewprofilepage/user-id/5273730) - Did you try this latest?


author: Teresa Ruiz-Rico G?mez
body: yes, now it works :)


author: John Funk
body: Yay!


Tags: cloud

jira-work-management-cloud