Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Rina Nir (AC)
Solutions Partner
Solution Partners provide consulting, sales, and technical services on Atlassian products.
June 3, 2014

Hi,

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,

Rina

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Rina Nir (AC)
Solutions Partner
Solution Partners provide consulting, sales, and technical services on Atlassian products.
July 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 
JIRA API.

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{ ......
defentity=it
 totalBilled+=entity.billed_hours.text().toDouble()

}

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.

0 votes
Kristin Hreinsdottir [Tempo] June 10, 2014

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

Kristín

Rina Nir (AC)
Solutions Partner
Solution Partners provide consulting, sales, and technical services on Atlassian products.
July 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.

Like dmitry1308 likes this
TAGS
AUG Leaders

Atlassian Community Events