Skip to content

Instantly share code, notes, and snippets.

import com.atlassian.jira.bc.user.UserService
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.userManager
def userService = ComponentAccessor.getComponent(UserService)
[
'anuser',
'otheruser',
// add more as required
import com.atlassian.greenhopper.service.sprint.Sprint
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.pyxis.greenhopper.jira")
import com.atlassian.jira.bc.JiraServiceContextImpl
import com.atlassian.jira.bc.filter.SearchRequestService
import com.atlassian.jira.bc.portal.PortalPageService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.permission.GlobalPermissionKey
import com.atlassian.jira.permission.GlobalPermissionType
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.sharing.SharePermissionImpl
import com.atlassian.jira.sharing.SharedEntity
import com.atlassian.jira.sharing.search.SharedEntitySearchParametersBuilder
def subtasks = issue.subTaskObjects
if (issue.isSubTask() || !subtasks) {
return null
}
def resolved = subtasks.count { it.resolution }
"${resolved} / ${subtasks.size()}"
/**
* This script should be added as a Custom Script Listener, listening for ServiceDeskCommentEvent
*
* It will send attachments to the reporter and participants by email.
*/
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.util.AttachmentUtils
import com.atlassian.mail.Email
import com.atlassian.mail.queue.SingleMailQueueItem
package com.onresolve.jira.groovy.jql
import com.atlassian.jira.JiraDataType
import com.atlassian.jira.JiraDataTypes
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.operand.QueryLiteral
import com.atlassian.jira.jql.query.QueryCreationContext
import com.atlassian.query.clause.TerminalClause
import com.atlassian.query.operand.FunctionOperand
!ENTRY org.eclipse.equinox.registry 4 1 2018-01-15 08:34:44.823
!MESSAGE Plug-in org.codehaus.groovy.eclipse.ui was unable to load class org.codehaus.groovy.eclipse.editor.GroovyDocumentSetupParticipant.
!STACK 0
java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.codehaus.groovy.eclipse.ui (36).
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:112)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:446)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
package examples
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.metadata.JiraMetadataDSL
import groovy.transform.BaseScript
def customFieldManager = ComponentAccessor.getCustomFieldManager()
@BaseScript JiraMetadataDSL delegate
package com.onresolve.jira.groovy.jql
import com.atlassian.jira.JiraDataType
import com.atlassian.jira.JiraDataTypes
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.jql.operand.QueryLiteral
import com.atlassian.jira.jql.query.QueryCreationContext
import com.atlassian.jira.user.ApplicationUser