You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello
I am completely new to JIRA administration, we are using script runner to schedule different jobs, and one of the requirement is, based on the certain filter condition results, a job needs to be scheduled on certain time frame to send email with the customized body, JIRA ticket number etc,.
What i have tested so far is just simple email sending code which is as follows..
import com.atlassian.mail.Email
import com.atlassian.mail.server.SMTPMailServer
import com.atlassian.jira.component.ComponentAccessor
def emailSubject = "JIRA CHECK"
def emailBody = "Test CHECK"
def emailAddress = "<emaild id>"
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
if (mailServer) {
Email email = new Email(emailAddress)
email.setSubject(emailSubject)
email.setBody(emailBody)
mailServer.send(email)
} else {}
Hello Helmy
Sorry about the late reply, i would try your option and let you know whether it helps.
I already have an flter_id eg 123, i want to see whether 123 returns me any result, if yes, then with the content of the Customized email message, i want to send to the respective recipients.
Thank You.
Hi Nagappan,
We don't yet support customized bodies, but we support everything else you said out of the box with Notification Assistant for Jira (a Staff Pick). And we have customized notification templates coming in the next month!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagppan,
Thank you for using ScriptRunner.
Can you clarify what you meant by "Filter Condition"? Providing examples would help too!
As for the scheduled script, you could use Script Jobs by ScriptRunner. It accepts cron expression to define the interval a job is run at.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Helmy
For example
issuetype = Issue AND status in ("In Progress", Open) and created < -10w
I want to scan the results from the above filer (have saved the filter too and have the filter id with me), and if the filter returns any result, then would like to sent Email to certain email id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagppan,
You can execute a JQL query in your code and then do a simple checking:
if (search.results) {
// send email
}
I hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Helmy
Thanks for the link, it really helped and i was able to send the custom email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.