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

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.

2 answers

1 accepted

This widget could not be displayed.

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("")
}

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) ?

This widget could not be displayed.

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")
}

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.

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.

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")

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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

171 views 1 3
Join discussion

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