Calculated Text Field using Original Estimate ("timetracking")

I want to be able to use the value of Original Estimate or "timetracking" so that when I put a value of "1h" the Original Estimate field a new field "Shirt Size" (this field's formula down below) will populate accordingly

So far I haven't had any success. In fact, the field "Shirt Size" doesn't even show up in any of my ticket screens.

Is not possible to pull from "timetracking" since it's a special field?

Here is my code:

<!-- @@Formula:

var = issue.get("timetracking")

if (var >= 1h and var <= 1.75h)

return "XS";

if (var >= 2h and var <= 4.75h)

return "S";

if (var >= 5h and var <= 7.75h)

return "M";

if (var >= 8h and var <= 11.75h)

return "L";

if (var >= 12h and var <= 14.75h)

return "XL";

if (var > 14.75h)

return null;

-->

1 answer

1 accepted

First of all, "timetracking" is not a field. Maybe the field you want is "aggregatetimespent"?

Also, Java doesn't have a notion of "time", so a value such as "14.75h" is invalid.

Note that you can see the errors in atlassian-jira.log.

Well, I inspected the element of Original Estimate and it gives me the id of "timetracking" which is also what the field is called when I add it into screens.

I had a feeling the "h" on the variable would throw it off, that being the case is this custom field not compatible with Time Tracking?

"timetracking" is a "virtual" field, not an actual field that holds some value. There are real fields behind it that hold the actual data, such as the one I suggested, which returns the aggregate time spent on the issue and its subtasks. There's also the "timespent" field that returns the time spent on the issue only. Both fields return a Long, which is a number of milliseconds.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

853 views 2 9
Read article

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