Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage


Hello ,
I want to run the following script every hour with the scriptrunner and send the mail with the url content, if the create time has not been assigned for 60 minutes and there are unresolved records. I can combine several scripts below and send mail. If there is no result, I want it not to send mail and the results returned in the mail content should return as urls. But I couldn't :) I would like your valuable help.


package dk.langhornweb
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.worklog.WorklogImpl
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.mail.Email
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.mail.server.SMTPMailServer
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def searchService = ComponentAccessor.getComponent(SearchService)
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def query = jqlQueryParser.parseQuery("PROJECT = zzz AND assignee is EMPTY AND status = Open AND resolution = Unresolved and created = -60m" )
def results =,query, PagerFilter.getUnlimitedFilter())
results = results.getResults().each() { print "${it.key}"}
def filterId = 15902
def sendToEmail = "zzzzzz@zzzzz.zzzz"
def jiraGroups = [""]
def jiraAuthContext = ComponentAccessor.getJiraAuthenticationContext()
def searchRequestManager = ComponentAccessor.getComponent(SearchRequestManager.class)
def searchRequest = searchRequestManager.getSearchRequestById(filterId)
def searchResult =, searchRequest.query, PagerFilter.unlimitedFilter)
if (searchResult.results.size() > 0) {
String cc = buildcc(sendToEmail, jiraGroups)
"| Atanmamış Kayıtlar Bulunmaktadır",
"Sayın Yönetici,\nEkibinizde atanmamış kayıtlar bulunmaktadır.\n\f$results\n\r Bu mail Yardım Masası tarafından Her gün saat 11:00'da otomatik olarak gönderilmektedir.")

// Build email cc
def buildcc(def defaultEmail, List<String> groups) {
def ccList = [""]
def groupManager = ComponentAccessor.getGroupManager()
groups.each { group ->
Collection<ApplicationUser> memberList = groupManager.getUsersInGroup(group)
memberList.each { member ->
return ccList.join(",")

// Create an email and send
def sendEmail(def emailAddr, def cc, def subject, def body) {
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
if (mailServer) {
Email email = new Email(emailAddr as String)
email.setCc(cc as String)
email.setSubject(subject as String)
email.setBody(body as String)
log.debug("Mail sent")
} else {
log.warn("Please make sure that a valid mailServer is configured")

2 answers

0 votes
Antoine Berry Community Leader Aug 03, 2020

Hi @Ufuk Uysal ,

Have you tried running this script, and have you found any error in the logs ? 

It seems you are not using the query in the script but rather the filter 15902. The mail will be sent if there this filters has results.

hi antoine,

this script is running. The filter id and jql above are the same. I want him to mail if the result is frozen. Even if there is no result, mail is sent as []. If there is a result, the url does not come as follows. How can I fix this situation?

[Documentıssueımpl [issuekey = INFRASTRUCTURE-202]

If you can't get this working in ScriptRunner, you may want to try our app which is built to support this UX from the ground up:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Jira issue check and more advanced commit verifications for Bitbucket DC

Pre-receive hooks that verify the Git commit message, the modified files, and implement similar code change controls used to be requirements of large enterprises working in regulated industries only....

43 views 0 2
Read article

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