Hi. please help me !
I have last version Tempo 9.2 and ScriptRunner for JIRA Version:5.4.45 and jira 7.12
I used an example from the scriptrunner documentation,
{code}
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.tempoplugin.core.workattribute.api.WorkAttributeService
import is.origo.jira.plugin.common.TempoWorklogManager
import com.tempoplugin.core.datetime.api.TempoDateTime
import com.atlassian.jira.component.ComponentAccessor
@WithPlugin("is.origo.jira.tempo-plugin")
@PluginModule
TempoWorklogManager tempoWorklogManager
@PluginModule
WorkAttributeService workAttributeService
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
// calculate the time we entered this state
def changeHistoryItems = changeHistoryManager.getAllChangeItems(issue).reverse()
def timeLastStartProgress = changeHistoryItems.find {
it.field == "status" && it.toValues.values().contains("To Do")
}?.created
//def triageType = workAttributeService.getWorkAttributeTypes().returnedValue.find { it.name == "WorkType" }
//def attributes = workAttributeService.getWorkAttributesByType(triageType).returnedValue // set the Tempo Worktype attribute
def timeInProgress = (new Date()).time - timeLastStartProgress.time // this is in millis
def timeToLog = Math.round(timeInProgress.longValue() / 1000) // so round to seconds
def remaining = issue.estimate ? (issue.estimate - timeToLog) : 0 // calc remaining estimate
tempoWorklogManager.create(issue.key, TempoDateTime.now(), "Auto-created worklog", timeToLog, 0, null, ApplicationUser, [:])
{code}
as a result, I get an error
2019-02-06 20:14:13,001 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2019-02-06 20:14:13,002 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: ATLASSIAN-12, actionId: 21, file: <inline script> groovy.lang.MissingMethodException: No signature of method: is.origo.jira.plugin.common.TempoWorklogManager.create() is applicable for argument types: (java.lang.String, com.tempoplugin.core.datetime.api.TempoDateTime, java.lang.String, java.lang.Long, java.lang.Integer, null, com.atlassian.jira.user.DelegatingApplicationUser, java.util.LinkedHashMap) values: [ATLASSIAN-12, 2019-02-06T20:14:12.996, Auto-created worklog, ...] Possible solutions: grep() at Script368.run(Script368.groovy:33)
Just got an answer from Adaptavist support:
1) The current version are using different packages in the import.
2) There is a new
@PluginModule annotation for the
WorkAttributeService is added in the current version.
3) The attributes variable is initailised differently
4) And also, if you look at the tempoWorklogManager.create method, there are differences in the invocation.
Hope that helps
I got the information that the documentation has changed/amended to work with the most current version of Tempo.
So the function to create the worklog needs parameters like below.
tempoWorklogManager.create(issue.key, TempoDateTime.now(), "Auto-created worklog for triage", attributes, timeToLog, 0, remaining, currentUser, [:])
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Struggling with this issue as well. Have you opened up a ticket with the scriptrunner people?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.