Can a scripted listener on resolve see work logged during the resolve transition?

So I have a listener that is trying to get the value of the total time spent on an issue, being triggered on the Issue Resolved event.

We have the ability for users to set a worklog on the Issue Resolve screen. Unfortunately when the user adds time in this transition, the listener is not returning the time accurately because it's not taking into account the work log generated during the resolve transition.

I've tried this same kind of thing on a script post-function too, and it also doesn't return the accurate time spent; it ignores the resolve-transition added worklog just like the listener does.

Is there something I'm missing, or is there just no way to get the listener (or post-function) to see this on-resolve worklog?

Thanks!

1 answer

1 accepted

This widget could not be displayed.

Hi Nick,

I don't know if this helps you but here is a script post-function that shows the worklog added during the transition:

import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.MutableIssue
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.issue.fields.WorklogSystemField

Map<String,ModifiedValue> modifiedValues = ((MutableIssue)issue).getModifiedFields()

if (modifiedValues.containsKey("worklog")) {
ModifiedValue worklog = modifiedValues.get("worklog")
WorklogSystemField.WorklogValue worklogSystemField = (WorklogSystemField.WorklogValue)worklog.getNewValue()
UserMessageUtil.success('Added worklog: ' + worklogSystemField.timeLogged())
}

 My Jira version 7.1.2 (Jira Server)

That's exactly what I needed!


Only thing I did was since the .timeLogged() function returns a string, I just wrapped it up inside the JiraDurationUtils .parseDuration() function to give me the seconds value and boom, exactly what I wanted.

Thank you so much!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

81 views 1 0
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