Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

problem running script groovy for tempo

gorya82@mail.ru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2019

 

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)



 

4 answers

0 votes
Alexander Eck [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 14, 2020

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

0 votes
Alexander Eck [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2020

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

0 votes
Alexander Demchenko November 5, 2019

Having the same issue. Any solutions, guys?

0 votes
carlos lugo
Contributor
February 12, 2019

Struggling with this issue as well. Have you opened up a ticket with the scriptrunner people?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events