Hi,
When I create an issue I have replaced the time tracking with an Interval Custom Field called 'Proposed Estimate'. The intention is that a user would create the issue with a proposed time and the PM would approve it. When the Issue is approved I want to copy the value from 'Propsed Estimate' in to 'Original Estimae' and 'Remaining Estimate'. I have a number of plugins providing me with these possiblilities but they all seem to have an issue that I can't copy a interval in to a number field.
Is there a way of getting the numerical value from the Interval Field? I noticed somthing about SIL in conjunction with Interval Fields, could this help?
Are there any other solutions to this?
Thanks
This comment from Radu Dumitriu
was my solution, here is the scipt I created in the end...
import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.ComponentManager import com.atlassian.jira.project.Project import org.apache.log4j.Category def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction") log.setLevel(org.apache.log4j.Level.DEBUG) log.info("Starting GroovyScript MoveProposedEstToOrigEstimate") MutableIssue issue = issue Project project = issue.getProjectObject() log.debug("Working with Issue " + issue.getKey() + " ("+project.getName()+")") ComponentManager componentManager = ComponentManager.getInstance(); CustomField proposedEstimateCustomField = componentManager.getCustomFieldManager().getCustomFieldObjectByName("Proposed Estimate") CustomField budgetedEstimateCustomField = componentManager.getCustomFieldManager().getCustomFieldObjectByName("Budgeted Estimate") def proposedEstimate = issue.getCustomFieldValue(proposedEstimateCustomField) log.debug("Proposed estimate is "+proposedEstimate) issue.setOriginalEstimate(proposedEstimate.round()) issue.setEstimate(proposedEstimate.round()) issue.setCustomFieldValue(budgetedEstimateCustomField,proposedEstimate) budgetedEstimateCustomField. issue.store() log.debug("New original estimate is "+issue.getOriginalEstimate()) log.debug("New remaining estimate is "+issue.getEstimate()) log.debug("New budgeted estimate is "+issue.getCustomFieldValue(budgetedEstimateCustomField))
Happy to be of any help ! That was easy, wasn't it ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radu I used above script to copy value from custom field(number) to original estimate, it is copying, but shows in seconds, how to convert that to hours, thanks for your help Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The interval custom field from KCF is in fact a number custom field that is displayed differently, so the value stored for it in the database is numeric (in seconds). However, it's designed so that its string representation uses the interval format ("1d 2h"). What plugins are you trying to use to accomplish this ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your quick response;
I have a few plugins for workflow transitions
From these I have tried to use the following post functions for this...
The first one at least let me configure the post function, when I tested it though it gave an error saving somthing along the lines of invalid workflow contact your admin.
The second one indicated the error in the workflow view, gave an XML error but I believe the real error is to do with trying to move an invalid value type in to the original estimate.
If you know of a valid post function to achieve this it would be great!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Normally we'll use that to do cross-sales with JJupin or Blitz Actions =) LOL
The idea is very simple, as my colleague told you, the stored value is the interval, in seconds, but this is a double value, from what I see in the code (this is to provide better support for one of the above plugins ).
The reason it doesn't work is that you will need to transform the value provided by the CF into something meaningful for your destination CF, i.e. you need to call something like (pseudocode):
Double val = (Double) issue.getCustomFieldValue(cfDesc);
issue.setOriginalEstimate(val.longValue());
//save the issue.
For that, I may suggest Jamie's Script Runner (which is free). Of course (cause I cannot skip over the cross-sales thing :) ), in JJupin the above is done like this:
originalEstimate = customfield_12345;
or:
originalEstimate = #{Proposed Estimate};
Edit: Let us know if you have issues with that (email us if you need more info, etc ...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help, I have the script runner installed and am currently writing some scripts for it. I figured that I would have to go down this route. Will be in touch if I have any questions!
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suspect that my main issue was caused by the Original Estimate expecting a long and the Interval Csutom Field containing a double.
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.