Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,621
Community Members
 
Community Events
165
Community Groups

Create job on JIRA for daily email reminder

Edited

Hi,

Is it possible to create a custom job on JIRA to send a daily email reminder?

I have looked into adding a post-function once an issue moves to the status but this would just be a once off email reminder. 

We cannot add add-ons to our instance so 3rd party apps do not work and automation on server does not seem to cater for this.

I have this script that could work and run as a daily job based on the JQL query of when those tickets are in the specific status. 

The JQL query is as follows: "project = XXXXXX AND status = "Line Manager Approval"

The only thing is the email to be sent is to different people.
The names of the people who the email is sent to is under a custom field called "Requestors Approving Manager/Executive" on the issues.

This custom field is configured as follows :
User Filtering:
Filtering users by the following:
Project Role: Approvers

How do I edit the below script to include the above information and send the email to the right people?

import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.component.ComponentAccessor;
 
def subject = "Manager Approval for ${issue.key}"
def body = "Hi ${issue.assignee.displayName} \n\nReminder for approval for the following issue: {issue.key} - ${issue.summary}. \n\n"
def emailAddr = issue.getAssignee().getEmailAddress() //this is where I am having trouble configuring for the custom field email address
 
def sendEmail(String emailAddr, String subject, String body) {
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();
if (mailServer) {
Email email = new Email(emailAddr);
email.setSubject(subject);
email.setBody(body);
mailServer.send(email);
} else {
// Problem getting the mail server from JIRA configuration, log this error
}
}
 
sendEmail (emailAddr, subject, body)

2 answers

1 accepted

0 votes
Answer accepted

Hi @Drishti Maharaj ,

 

Can you provide more details of your requirement. 

 

Regarding sending daily reminder, have you tried to filter subscription ?

 

More details of subscription @ 

https://confluence.atlassian.com/jiracoreserver085/working-with-search-results-981157534.html#Workingwithsearchresults-subscribeSubscribingtoyoursearchresults

Hi @Sreenivasaraju P , yes we have tried that but the user who need to receive the email reminders do want that method. 

Hence I am trying to find another solution.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

267 views 0 6
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you