How can I automatically log work in Greenhopper?

I am just starting on Greenhopper and we were going to try to just use the original estimates rather than work logging (to reduce overhead). What I was hoping was:

* set original estimate

* when closing ticket, GH sets remaining estimate to zero (this works)

* burndown chart shows the hours burned down.

Instead, burndown charts are flat. GH seems to log a dummy 1 minute work log. Do I need to tell the team to start logging work in detail, or is there a way to make this happen on close? Example:

Original Est: 4 hours

* drag to done

* Sets Remaining Est. to 0 hours

* Logs 4 hours work to make the burndown correct

If this isn't possible I would love guidance on how to log work efficiently without extra issue edits/etc.

1 answer

1 accepted

0 votes
Accepted answer

You can create postfunction with functionality to add worklogs to Issue and add it to resolve transition.

Something similar to this:

    public void execute(Map transientVars, Map args, PropertySet ps) throws FieldValidationException {
WorklogManager worklogManager = ComponentManager.getInstance().getWorklogManager();
WorkflowContext context = (WorkflowContext) transientVars.get("context");
String username = context.getCaller();
Issue issue = (Issue) transientVars.get("issue");
Worklog worklog;
Long timeSpent = issue.getEstimate();
Principal principal = ActionContext.getContext().getPrincipalImpl();
boolean dispatchEvent = false; //Set tot true if you need email notifications
if (timeSpent != null && timeSpent > 0 && principal != null && principal instanceof User) {
worklog = new WorklogImpl(worklogManager, issue, null, username, "Place Log Work Comment Here", new Date(),
null, null, timeSpent);
worklogManager.create((User) principal, worklog, 0L, dispatchEvent);

Moreover you can calculate how long issue was in specific state and log this time as worklog, you can even calculate only working hours between dates.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

43 views 0 2
Read article

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