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

Set a custom field based on Original Estimate?

Miguel De Dios February 23, 2014

Is it possible to set a custom field based on Original Estimate?

For instance, I have a custom field called "Shirt Size" and if the Original Estimate is in the range of 0h - 1.75h then Shirt Size will automatically set to "XS" (xtra-small) if OE is in the range of 2h - 4.75h then Shirt Size will automatically set to "S" and so on so forth

"XS" => 0h - 1.75h

"S" => 2h - 4.75h

"M" => 5h - 7.75h

"L" => 9h - 11.75h

"XL" => 12h - 14.75h

else

null if greater than 15h

Is something like this possible?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Henning Tietgens
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.
February 24, 2014

Yes, you could use a scripted field from Script Runner plugin to easily implement such a field. The script is something like this.

Long oe = issue.originalEstimate
String result = null
if (oe) {
    oe = oe/1000/60  // milliseconds to minutes
}
switch (oe) {
    case [0..105]: result = "XS"; break
    case [106..285]: result = "S"; break
    // ...
}

return result

Miguel De Dios February 24, 2014

I placed the script into the Calculated Text field and the field didn't show up on my create screen nor when I created the issue after filling out the Original Estimate.

Do you suppose I have to re-index?

Henning Tietgens
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.
February 25, 2014

A calculated text field seems to be another plugin, right? The script is for a scripted field from the Script Runner plugin.

Scripted fields doesn't show up on create or edit screens, only on view screens.

After the scripted field creation is complete you only need a reindex for existing issues (if they are affected). You could use the builtin reindexing script for this (or a background reindex). Newly created issues (or edited issues) should already hold the correct value for the scripted field.

Sri Kanth April 15, 2015

Thx Hennins and Jamie. Super implementation. //For others who like to get value of a custom field def extCost = getCustomFieldValue("customfield_15102") // this fails def extCost_ = getCustomFieldValue("External cost (EUR)") // this works

TAGS
AUG Leaders

Atlassian Community Events