Querying Tempo specific information from another issue within JIRA: what would be the best strategy?

Rina Nir Solutions Partner Jun 03, 2014


Using the TEMPO Plugin for reporting work on an issue A. We use the native JIRA field as well as "billed hours" field (which is TEMPO specific).

Within issue B we would like to display within a text field all the worklogs of issue A, and also have a calculated field showing the sum of billed hours of issue A.

Being rather newbie to the many options I am not sure if the best strategy would be to:

1) Use a scriptrunner field with REST API?

2) Implement a plugin which will access the "not public but existing" TEMPO REST API

3) Implement a plugin which will access the official TEMPO servlets? I think this should be doable but I am not sure which plug-in type I should use for this purpose and could not find any example providing clues on how to do it.

4) anyt other way?

Any leads and recommendations would be very much appreciated,


2 answers

1 accepted

0 votes
Answer accepted
Rina Nir Solutions Partner Jul 22, 2014

After implementing a solution to the above with Groovy (Script Runner), I am sharing the bones of it here:

1) The script accesses TEMPO through the TEMPO public API (service based API) . This is done using curl. BTW: this means that the same method may be used to query between two different JIRA systems- if that is required:

tempoParams="&format=xml&addBillingInfo=true&addIssueSummary=true&addParentIssue=true&addIssueDetails=true&dateFrom="+dateFrom+"&dateTo="+dateTo+"&issueKey="+linkedKeyAndSubtasks[i]processStr="curl -X GET http://"+systemURL+"/plugins/servlet/tempo-getWorkLog/?tempoApiToken="+token+tempoParamsdefprocess=processStr.execute()process.waitFor()

Note that using the TEMPO API is required only if you need to obtain TEMPO specific 
fields (such as the Billing info). If you just need the simple JIRA worklogs use the 

2) The data which is obtained through the TEMPO service can be parsed using Groovy's 
xml parser:
	def worklogs = new XmlParser().parseText(process.text)
	worklogs.worklog.each{ ......


3) Once updating the target custom field with the total billing information, be sure to
do the necessery for storing it to the database (thanks to some good answers I found here :
MutableIssue myIssue = issue

//Update hoursSummaryStringCustomFieldhoursSummaryString=customFieldManager.getCustomFieldObjectByName(hoursSummaryStringFieldName)myIssue.setCustomFieldValue(hoursSummaryString,billingStr)Map<String,ModifiedValue>modifiedFields1=myIssue.getModifiedFields()FieldLayoutItemfieldLayoutItem1=ComponentManager.getInstance().getFieldLayoutManager().getFieldLayout(myIssue).getFieldLayoutItem(hoursSummaryString)DefaultIssueChangeHolderissueChangeHolder1=newDefaultIssueChangeHolder()finalModifiedValuemodifiedValue1=(ModifiedValue)modifiedFields1.get(hoursSummaryString.getId())hoursSummaryString.updateValue(fieldLayoutItem1,myIssue,modifiedValue1,issueChangeHolder1)

4) For our implementation, this script was added as a postfunction.

Hi Rina

I don't understand the use case, why would you want to sum up worklogs and billed hours for issue A to display in a different issue?

1) I am not familiar with the script runner - so I don't know how you would use that in this case.

2) There is currently no REST API in Tempo to get billed hours per issue but that would definitely be the recommended solution I think if it existed :).

3) You can implement a plugin to do this. You should go through the JIRA dev documentation to figure out how to proceed. https://developer.atlassian.com/display/JIRADEV/JIRA+Plugin+Guide There are different ways to add data to the JIRA issue view. You could use the 'issue tab panel' or 'web panel' modules.

Hope this helps


Rina Nir Solutions Partner Jul 21, 2014

In regards to the use case: The idea is to summarize the hours of many issues and prepare for invoicing withing an "invoicing" JIRA project. The "invoicing" project has different access rights and thus makes sense to seperate it from the "main" project.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 14 hours ago in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: https://www.icloud.com/keynote/0RyJ4VEdNUpjDpGfMhfZx9fEg#Confluence_Security_Advisor More details: https://co...

25 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you