Forums

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

how to send mail to a project role base on a custom datetime field value?

ClaireYang
Contributor
April 15, 2019

In our issue, I set several datetime field, for example KeyMilestone Date1, KeyMilestone Date2, KeyMilestone Date3 and KeyMilestone Date4.

I want to send mail to project role "JM" when today's date reaches the value in above datetime custom fields.

Can anyone help me?

1 answer

1 accepted

0 votes
Answer accepted
PD Sheehan
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.
April 16, 2019

Hi Clair

Keeping in mind that issues are not aware of date changes. This doesn't generate any workflow or issue event.

So your solution will be based on some sort of scheduling mechanism.

Your first option (no scriptrunner needed) is with a few saved filter/subsriptions. https://confluence.atlassian.com/jiracoreserver/constructing-cron-expressions-for-a-filter-subscription-939937790.html

The probelm with that is that you can't set a project role as the recipient. You can only use a jira group. But you could set the subscription to a large group and then retric the notificaiton using clever JQL.

project in porojectWhereUserHasRole("JM") and "KeyMilestone Date1" > -1d

 This will return all the issues where the keyMilstone Date1 is within 1day of the current date and will be filtered for the current user being a member of the JM role. Then when you create a subscription and assign it to jira-users or some other large role, only users of the role will receive the list of matching ticket. Repeat for each milestone and define the timing of the subscription.

The other option, with scriptrunner, is to use the escalation service where you can define both the JQL to identify which tickets to act on and the interval to run it daily. But this would require you finding a way to trigger the emailing part yourself. You could do this by triggering a workflow transition, then in that transition, add a scriptrunner post function to "Send a custom email". Another way would be to use some scripting to fire a custom event, and have a scriptrunner listener watch for that event and use the Send a custom email built-in script

ClaireYang
Contributor
April 16, 2019

Hi @PD Sheehan , thank you.  I can use escalation service.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events