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

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 Join to answer
Community showcase
Louis De Jaeger
Posted yesterday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

158 views 12 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot