Is it possible to have a cron job with SQL Query which will list issues and comment details if it exceeds certain size? This Job with SQL Query should also notify via email to keep a watch if any new comments are created
Hi @Uday Kiran Raparthy
Just to check, why do you want to use the SQL query to get the issues and comments? This can be done by doing a basic iteration of the issues list. For example:-
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.comments.Commentimport com.atlassian.jira.project.Project def commentManager = ComponentAccessor.commentManagerdef projectManager = ComponentAccessor.projectManagerdef issueManager = ComponentAccessor.issueManagerdef comments = [] as ArrayList<Comment>projectManager.projectObjects.each { Project project -> def issues = issueManager.getIssueIdsForProject(project.id) issueManager.getIssueObjects(issues).each { comments.addAll(commentManager.getComments(it)) }}comments.each { if (it.body.length() > 50) { log.warn "====>>> Comment Length Exceeded" } }null
Please note that this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.
Also, the null is added at the end of the code to clear up any values and to avoid the error message from the Scheduled Job.
I hope this helps to solve your question.
Thank you and Kind regards,
Ram
It looks like you're new here. Sign in or register to get started.