Hello Erveryone,
As default you can see the under the tab "Time Tracking" the values for "Estimated:", "Remaining" and "Logged" Hours.
But when you are create a worklog you have the option to choose between "Worked" and "Billed" Hours.
I now want to create an extra field with the "billed" hours under the "Time Tracking" Tab but I wasn't able to with a custom field. (see attchated screenshots)
Is it possible? (I couldn't image why not) and if yes how to?
There is no way to show billed hours in the JIRA issue. If you are using the billed hours in Tempo, you can add them to the Timesheet Report view. This view can be accessed through the Issue by clicking the "Report" button in the Tempo section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
if you are using the script runner add-on, maybe following code of a scripted field would be a solution for you
import java.util.List; import java.util.Map; import org.ofbiz.core.entity.GenericValue; import com.atlassian.core.util.collection.EasyList; import com.atlassian.core.util.map.EasyMap; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.ofbiz.OfBizDelegator; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.worklog.Worklog; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.SimpleDateFormat; long returnValue = 0; for (Worklog worklog : ComponentAccessor.getWorklogManager().getByIssue(issue)) { long abrechenbarerAnteil = getWorklogBilledSeconds(worklog.getId()); if (abrechenbarerAnteil == -1L) abrechenbarerAnteil = worklog.getTimeSpent(); returnValue += abrechenbarerAnteil } return formatNumber(returnValue / 3600) private String formatNumber(Double number) { number = Math.round(number * 100) / 100; DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US); DecimalFormat df = new DecimalFormat(); df.setDecimalFormatSymbols(symbols); return df.format(number); } public long getWorklogBilledSeconds(long worklogId) { GenericValue genericValue = get(generateWorklogParameters("Tempo.WorklogBilledHours", worklogId)); if (genericValue == null) return -1L; String stringValue = genericValue.getString("value"); if (stringValue == null || stringValue.length() < 1) return -1L; return Long.parseLong(stringValue); } private Map generateWorklogParameters(String key, long worklogId) { return EasyMap.build("entityName", "Tempo.Worklog", "entityId", Long.valueOf(worklogId), "propertyKey", key, "type", Integer.valueOf(5)); } private GenericValue get(Map fields) { OfBizDelegator delegator = ComponentAccessor.getOfBizDelegator(); List<GenericValue> peList = delegator.findByAnd("OSPropertyEntry", fields, EasyList.build("id")); GenericValue pe = null; if ((peList != null) && (peList.size() > 0)) { pe = (GenericValue)peList.get(peList.size() - 1); } if (pe != null) { String tableName = getTableName(fields); return delegator.findByPrimaryKey(tableName, EasyMap.build("id", pe.get("id"))); } return null; } private String getTableName(Map fields) { String tableName = "OSPropertyString"; Integer fieldType = (Integer)fields.get("type"); if ((fieldType != null) && (fieldType.intValue() == 6)) { tableName = "OSPropertyText"; } else if ((fieldType != null) && (fieldType.intValue() == 2)) { tableName = "OSPropertyNumber"; } return tableName; }
Hope this helps
Cheers Julian
Tip:
With our SumUp add-on for JIRA, you can calculate the issue's values in the issue navigator with an easy click
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As the code above did not work for me, I figured out a better way to get Tempo Billable time from the worklogs using Scriptrunner. Added the code here: https://community.atlassian.com/t5/Jira-Software-questions/Getting-Tempo-billable-hours-for-issue-in-a-ScriptRunner/qaq-p/1312330#U1399106
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Julian Riedinger [Decadis AG]
Thanks
Your code has solved many doubts and I was able to apply it to my problem
but there is a problem, never enter this function
long abrechenbarerAnteil = getWorklogBilledSeconds(worklog.getId());
And I can't know for what reason
Could you help me?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
this is not possible as the "Time Tracking" section in the Issue view is a JIRA feature. It displays information that is available to JIRA. Hours logged in Tempo use the same database table as hours logged in JIRA, so all logged hours are displayed. As Billing is a Tempo feature is is not displayed.
Kind regards,
Susanne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hank you for your quick answer :-) Is it then possible to create a standard custom field for billed hours with the data from the tempo database? Or any other way to display the billed hours in a jira issue? (without selecting the timesheet itself)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you for your quick answer :-) Is it then possible to create a standard custom field for billed hours with the data from the tempo database? Or any other way to display the billed hours in a jira issue? (without selecting the timesheet itself)
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.