my jira version is 4.4.1.
i tried to use workflows' Validators (Field Required for Time Spent),but failed.
even i have log work,"Workflow Error" still says Time Spent is required when Resolve
anyone can help?
Use Script Runner plugin and add a validator to check whether the total spent time is more than zero.
This link may help with the code https://answers.atlassian.com/questions/101423/time-spent-in-in-progress-open-statuses-how-to
Actually for anyone checking in this is better as it allows you to log work in the edit screen as opposed to fabbys solution which requires already logged work prior to triggering the transition:
import com.atlassian.jira.issue.Issue issue.getTimeSpent() || issue.getModifiedFields().get("worklog")
I have been using "
)" in a script validator for a workflow transition to determine if a user has added 'time worked' in the transition. This has been working fine for several months. I have recently upgraded to ScriptRunner v126.96.36.199 and the ScriptRunner editor now gives me the following error on this code "Cannot find matching method com.atlassian.jira.issue.Issue#getModifiedFields()." I find "getModifiedFields()" in the MutableIssue class, see https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/MutableIssue.html, and my understanding was that this came into the script in the binding for scripts in the workflow transitions. Do I need to declare a new mutable issue from the issue passed in the script binding and then use "getModifiedFields()"? I am wondering if anyone has a solution to this that works with the newer version of ScriptRunner? Thank you for ant help.
@Will and @Dayna,
We were with this same case and were able to resolve with following code:
import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue def mIssue = issue as MutableIssue return mIssue.getTimeSpent() || mIssue.getModifiedFields().get("worklog")
It worked for us against JIRA 7.1.9 :D
How about making the log work fields compulsory on resolve screen refer https://confluence.atlassian.com/display/JIRA/Logging+Work+on+an+Issue#LoggingWorkonanIssue-Loggingworkand/orspecifyingtimeestimatesonthesameJIRAscreen
As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...
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!
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
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot