Automation - Is it possible to send a list of issues, to a cf user picker, and only send 1 email
Asked by mrollf:

Hello fellow Atlassian users and admins! I had a request from one of my team leads to automate an email for one of their boards so that stake holders can be notified of QA activity on a card ever so many days.   

<br />

My issue is that I when I test the blow automation, It sends me 4 emails all with the same list, I only want it to send the end user 1 email with only their issue data. What am I doing wrong?  

Thanks for the help in advance!  

I have:  

When: Scheduled, every 2 days.  

Then: Look up issues  
JQL: project = DA and status = QA and statusCategoryChangedDate \> 1 and cf\[10601\] is not empty  

Advanced branching:  
smart value {{lookupIssues.stakeholder.distinct}}  
Variable name: DStake  

Then: Look up Issues:   
JQL: project = DA and status = QA and statusCategoryChangedDate \> 1 and cf\[10601\] = {{DStake}}  

AND: Send Email  

DSTAKE.emailAddress  

Hi {{stakeholder}},

Here is the list of issues that have you as the stakeholder:

{{#lookupIssues}}  
- Issue Key: {{key}}  
- Summary: {{summary}}  
- Status: {{status.name}}

{{/lookupIssues}}

Best regards,  
Admin  

![1.PNG](/t5/image/serverpage/image-id/317308iFB3A2F7599A19EE2/image-size/large?v=v2&px=999 "1.PNG")


Answers:
author: Ste Wright
body: Hi [@mrollf](/t5/user/viewprofilepage/user-id/5407950)

Remove the JQL from the Scheduled trigger.

In effect, that JQL is running the rule once per result.

Ste


author: Kalyan Sattaluri
body: Hello [@mrollf](/t5/user/viewprofilepage/user-id/5407950)

Can you please log {{lookupIssues.stakeholder.distinct}} and show/share what is the output?

\<EDIT\>

Never mind, reviewed this article and seems like your rule is correct..

<https://confluence.atlassian.com/automationkb/automation-rule-to-send-single-email-for-all-issues-per-assignee-due-next-week-1130727622.html>

So not sure why. Apologies.


author: Joseph Chung Yin
body: [@mrollf](/t5/user/viewprofilepage/user-id/5407950) -

Your rule seems OK. Can you confirm that you are getting multiple emails coming from multiple active scheduled triggers rules? Also, if there is only one scheduled trigger rule, can you verify the CRON expression/schedule setup are configured properly?

[@Kalyan Sattaluri](/t5/user/viewprofilepage/user-id/5312306) 's referenced link was an excellent one.

Please advise.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

comments: author: mrollf
body: Once I removed the JQL from the trigger it corrected itself. Which was odd seeing as I tried it with out it, and was still getting the multiple emails. It has all worked out now. Thanks [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739) , [@Ste Wright](/t5/user/viewprofilepage/user-id/1166470) , and [@Kalyan Sattaluri](/t5/user/viewprofilepage/user-id/5312306) for all your assistance helping me.


author: mrollf
body: [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739) , [@Kalyan Sattaluri](/t5/user/viewprofilepage/user-id/5312306) , Thank you both for your reply, To answer Joseph's question, I have 4 cards/issues with myself as the stakeholder custom field. When I run the trigger, it sends 4 emails to me, even when I use the .distinct on my Smart Values. Also Thanks for posting that article [@Kalyan Sattaluri](/t5/user/viewprofilepage/user-id/5312306)That is the exact one I used when I made it.   

I was wondering if it had to do with it being a custom field or not. I wasn't sure but you never know some times.


Tags: automation

cloud

jira-service-management

jira-service-management-cloud