You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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!
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.