Skip to content

Instantly share code, notes, and snippets.

View ServiceDeskComments.groovy
/**
* 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
View CurrentTeams.groovy
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
View stack.text
!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)
View components.groovy
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
View Scratch.groovy
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
View PriorityOf.groovy
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
View Scratch.groovy
package examples
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption
IssueEvent event = event
def issue = event.issue
View CreateMasterBranchOnRepoCreation.groovy
import com.atlassian.bitbucket.event.repository.RepositoryCreatedEvent
import com.atlassian.bitbucket.event.repository.RepositoryPushEvent
import com.atlassian.bitbucket.scm.git.GitAgent
import com.atlassian.bitbucket.scm.git.command.GitCommandBuilderFactory
import com.atlassian.event.api.EventPublisher
import com.atlassian.sal.api.component.ComponentLocator
import com.onresolve.scriptrunner.canned.bitbucket.bulkedit.StringCommandOutputHandler
import com.onresolve.scriptrunner.canned.bitbucket.util.BitbucketBaseScript
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import groovy.transform.BaseScript
View UpdateLinkedInitiatives.groovy
package examples.answers
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.onresolve.scriptrunner.runner.customisers.ContextBaseScript
import groovy.transform.BaseScript
@BaseScript ContextBaseScript context
View ProjectCategoryWebItemProvider.groovy
import com.atlassian.jira.bc.project.ProjectAction
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.UserProjectHistoryManager
import com.atlassian.jira.util.I18nHelper
import com.atlassian.jira.util.velocity.VelocityRequestContextFactory
import com.atlassian.plugin.web.api.model.WebFragmentBuilder
def historyManager = ComponentAccessor.getComponent(UserProjectHistoryManager)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
You can’t perform that action at this time.