Hello,
I created a Groovy script to copy the Story Point to Original Estimate.
My script works if the time spent by the user on an issue is not specified. If the time spent is specified, my script can’t change the Original Estimate field.
Here’s my code
String requestJQL = "project = IDMOK AND 'Story Points' is not EMPTY"
ComponentAccessor componentAccessor = new ComponentAccessor()
def user = componentAccessor.getJiraAuthenticationContext().getLoggedInUser();
SearchService searchService = componentAccessor.getComponentOfType(SearchService.class)
SearchResults response = searchService.search(user, new DefaultJqlQueryParser().parseQuery(requestJQL), PagerFilter.getUnlimitedFilter() )
CustomFieldManager customFieldMng = componentAccessor.getCustomFieldManager();
def storyPointValue
Long OriginalEstimateValue
MutableIssue mutableIssue
response.getIssues().each() {
mutableIssue = componentAccessor.getIssueManager().getIssueObject(it.getKey())
storyPointValue = mutableIssue.getCustomFieldValue(customFieldMng.getCustomFieldObject("customfield_10022"))
if (storyPointValue != null) {
OriginalEstimateValue = 86400 * (Long) storyPointValue //Convert
mutableIssue.setOriginalEstimate(OriginalEstimateValue)
componentAccessor.getIssueManager().updateIssue(user, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
Here on the left an issues with time spent (logged) field not specified, the script modify the Original Estimate (Estimated).
On the right an issue with time spent (logged) field specified, the script can’t modify the Original (Estimated).
I read this article, but it has not changed anything Time tracking
How to modify the Original Estimate of an issue that has filled the time spent ?
Thanks.