Is there a way to default the original estimate field to a value based on the issue type selection?

Phil Foster March 6, 2013

Is there a way to default the original estimate field to a value based on the issue type selection? In other words, if I create a new issue with the type 'new feature' is there anyway to assign a default estimate value (let's say 16 hours) without requiring the end user to enter one?

Thanks for your response.

3 answers

1 accepted

1 vote
Answer accepted
Dave Hergert March 7, 2013

Pretty sure you can do this with the JIRA Behaviors Plugin. For example, you could have a Validator Class and Method that would look at the issue type and based on that, set the initial estimate.

This is complete pseudo-code, but you get the idea.

FormField issueType = getFieldById("issueType").getValue()
FormField oEstimate = getFieldByName("timetracking_originalestimate")
 
if ( issueType.equals("1001") ) {
    oEstimate.setFormValue("12h")
}
else {
    oEstimate.setFormValue("")
}

Miguel De Dios February 11, 2014

Is it possible to set a Original Estimate based off a customfield say "Shirt Size" (customfield_10104) so something like this..

FormField oEstimate = getFieldByName("timetracking_originalestimate").getValue()

FormField var = getFieldById("customfield_10104")

if (oEstimate >= 1.0 and oEstimate <= 1.75) ) {

var.setFormValue("S")

}

if (oEstimate >= 2.0 and oEstimate <= 4.75) ) {

var.setFormValue("M")

else {

var.setFormValue("L")

}

Or will this not work because javascript has no notion of time (h/m/dd) ?

0 votes
Shivi Gupta March 25, 2020

Hello ;

I want to autofill the original estimate field if the priority is set .I used the following code , but its showing error (**)  , What's wrong ???

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.fields.CustomField

**FormField Priority = getFieldByName("Priority")
**FormField OE = getFieldById("timetracking_originalestimate")
String Compl_Value = (String) formPriority.getFormValue()

if ( formPriority.getValue()==("Critical") )
{ formOE.setFormValue("24h")
}
else if ( formPriority.getValue()==("High") )
{ formOE.setFormValue("3d")
}
else if ( formPriority.getValue()==("Medium") )
{ formOE.setFormValue("24d")
}
else if ( formPriority.getValue()==("Low") )
{ formOE.setFormValue("48d")
}
else
{
formOE.setFormValue("0h")
}

0 votes
Stefania Stradi March 25, 2013

Hello,

I need to do almost the same thing setting original estimates depending on the value of a custom field.

I've used the plugin Behaviours to create a script, but if I try to set a filed for example 'Description' everything works instead if I use the same code to set 'original estimates' it's not working.

Where is the mistake?

FormField formComplexity = getFieldById("customfield_10000")
FormField formOE = getFieldByName("originalEstimate")
//FormField formRE = getFieldById("Remaining Estimate")
String Compl_Value = (String) formComplexity.getFormValue()
//String Compl_Value = formComplexity.getFormValue() as String

if ( formComplexity.getValue()==("05. Very Very Easy") )
{ formOE.setFormValue("1d") 
}
else if ( formComplexity.getValue()==("10. Very Easy ( 0.5a | 2d | 1.5t )") )
{ formOE.setFormValue("4d") 
}
else if ( formComplexity.getValue()==("20. Easy ( 1a | 4d | 2t )") )
{ formOE.setFormValue("7d") 
}
else if ( formComplexity.getValue()==("30. Easy/Medium ( 2a | 8d | 2t )") )
{ formOE.setFormValue("12d")
}
else if ( formComplexity.getValue()==("40. Medium ( 2a | 15d | 3t )") )
{ formOE.setFormValue("20d")
}
else if ( formComplexity.getValue()==("50. Medium/Complex ( 4a | 20d | 4t )") )
{ formOE.setFormValue("28d") 
}
else if ( formComplexity.getValue()==("60. Complex ( 5a | 30d | 5t )") )
{formOE.setFormValue("40d") 
}
else if ( formComplexity.getValue()==("70. Very Complex") )
{ formOE.setFormValue("60d") 
}
else
{
formOE.setFormValue("0")
}

David Hergert _PAYX_ March 26, 2013

Looks like you're using getFieldByName instead of getFieldById... have you tried it with different combinations of byId or byName using "originalEstimate" or "Original Estimate", etc.

Stefania Stradi March 26, 2013

Yes, I've tried to use also byId, but it's not working.

I think I've tried amlost every combination and no one works. I think it's a problem related to the type of field (that is like 1w 3d...), but I don't know how to solve this.

Dave Hergert March 26, 2013

To modify the original estimate, the field id is "timetracking_originalestimate". It sure would be nice if there was a guide somewhere that listed all the available JIRA field IDs. I couldn't find anything and only figured this out by inspecting the HTML source of the edit form.

FormField formOE = getFieldById("timetracking_originalestimate")

MarcoC March 26, 2013

Thank you very much! This is working finally!!

I've tried to search for some documentation, but I haven't find anythig..I agree with you that wolud be nice if they put some guide about it.

Thank you again,

S.

Suggest an answer

Log in or Sign up to answer