Display JQL Result in Custom Email Postfunction

Hi,

I would like to know if it's possible to send a JQL result and extract custom field values from the results using the 'Send Custom Email' post function.

Business Case:

One ticket will track a business workflow and this will trigger several emails along the workflow. However there are certain post function emails that have to be tailored based on a JQL result.

So the goal is to display the JQL result as a table in the email template with specific custom fields as the columns and the issues as the rows, basically what you can do when you search for issues in JIRA, and define the 'To'/'CC' based on custom fields from the issues that are a result of the JQL.

Currently I use this post function for other applications that involve only information from the ticket that is being used to generate the email and I have no issues with this case. However I would appreciate to see if my scenario is possible or not, and if possible to have some assistance in how to achieve it. 

Thanks,

Francisco

2 answers

0 vote
Ignacio Pulgar Community Champion Dec 21, 2017

Hi Francisco,

The functionality you are describing seems to be better covered by a filter set to show the custom fields of your choice, subscribing to it afterwards.

Note this is JIRA native functionality so, if you can stick to it, you will avoid getting technical debt.

Besides, sending the email immediately with the filter subscription approach can also be triggered by a mouse click on Run Now:

run-now.png

Do you think this can work for you? If that's not the case, why?

Hi Ignacio,

A subscription to a filter kind of covers the display of the required custom fields for the desired JQL, however it does not cover the need of having a customized list of recipients which is the goal. Based on the results from the JQL, certain emails will be obtained for the resulting tickets (assignee, custom field 1, custom field 2, etc.), hence the email won't be sent to a fixed group(s), but a variable one depending on the JQL result.

Thanks

Ignacio Pulgar Community Champion Dec 21, 2017

Hi Francisco,

Filter subscriptions execute the filter's query one time for each user subscribed to it as if executed by such user.

This means that you can still cover your needs subscribing a large group of users (jira-users?) to a filter which includes something like:

(assignee=currentUser() OR cf[1]=currentUser() OR cf[2]=currentUser())

Just ensure you keep unchecked the checkbox 'Email this filter, even if there are no issues found':

subscription.png

Of course, if you could narrow the group of users to any other group(s) smaller than jira-users, it would be better.

As you were expecting the email to be sent during a transition, you may want to represent that condition in your filter by adding a JQL fragment similar to this one:

...AND status changed FROM 'In Progress' TO Done AFTER -15m...

Hope it helps.

Hi Ignacio,

Appreciate the suggestion, however having a fixed group is what I am trying to avoid. The reason is that the items in the query will be different every week, therefore changing the audience I want to notify. The audience will always be stakeholders from the specific tickets in the query result, so I just want this set of users to receive the email. 

i.e. Week 1 has a query with Tickets 1 - 5 with Persons A - E, so I just want the email to be sent to Persons A - E, not a fixed group that will contain Persons A-Z. 

Thanks for the help, if there is no way to accomplish what I am trying to do, I will definitely follow your suggestion. 

Regards,

Francisco Ayala

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 48m ago in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

40 views 3 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you