Example scripts
To homepage
Jira

Link a Tempo Account
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira (8.0 - 8.19)

ScriptRunner For Jira (7.10.0)
Language |
groovy
import com.adaptavist.hapi.jira.projects.Projects
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.tempoplugin.accounts.account.api.Account
import com.tempoplugin.accounts.account.api.AccountBuilderFactory
import com.tempoplugin.accounts.account.api.AccountService
import com.tempoplugin.accounts.link.api.AccountLink
import com.tempoplugin.accounts.link.api.AccountLinkService
import com.tempoplugin.platform.api.user.UserAuthenticationContext
@WithPlugin('is.origo.jira.tempo-plugin')
@PluginModule
AccountService accountService
@PluginModule
UserAuthenticationContext userAuthenticationContext
@PluginModule
AccountBuilderFactory accountBuilderFactory
@PluginModule
AccountLinkService accountLinkService
def accountTemplate = accountBuilderFactory
.createBuilder('CYBER', 'Cyberdyne Systems', userAuthenticationContext.authenticatedUser, Account.Status.OPEN)
.build()
def account = accountService.createAccount(accountTemplate).get()
def associatedProjectId = Projects.getByKey('SR').id
def accountLink = new AccountLink.Builder(
AccountLink.ScopeType.PROJECT, associatedProjectId, account.id, AccountLink.LinkType.MANUAL
).build()
accountLinkService.addLink(accountLink, account)
Having an issue with this script?
Report it here