I am trying to create a rule so when someones moves a card from one column to the next on my kanban board, it forces them to log the time spend resolving the issue.
I already have the Time Tracking and Log Work fields showing on the issues. I have tried to add the following Validator onto my workflow but even when I log time on the card it doesn't let me progress the issue:
"Field Time Spent should be modified during the transition"
Can anyone tell me how I can achieve this?
It should be "Time Spent" field set as required during transition.
i.e. Fields Required -> Time Spent
My understanding is that on Cloud you should have this validator included by default as per the article, on Server you'd need a plugin as far as I know, such as JIRA Suite Utilities (JSU).
(Although there are others that can do this as well, not just JSU.)
Hi there, I use the Jira Cloud and I put the validator on my workflow to require Time Spent, but although people have logged time, that does not appear to get calc'd and it will not allow us to progress the Issue, as it shows the "Please Log Time" comment.
Has anybody found a workaround to this?
Found a solution, via answer a ticket that I sent to Atlassian:
Once you have the validator "field required" or "field value changed" for Time Spent, since this validation happens during a transition, you need to register that change during, not before.
For that you can Edit the transition with that validator and add a screen with the Time Spent/Work log (is the same) field. I even created a new screen to show only that field once.
It seems counter-intuitive, because the same reasoning could be applied to any other field, but well, it worked for me.
Hope it helps!
In case it's useful to anyone, I've finally found a way to achieve it the way I needed it.
I first tried with either ScriptRunner's Simple Script Validator or JMWE's Fields Required Validator but faced the issue Patrick has mentioned.
The only way to bypass this was to add a new screen with the Log Work field on the transition, but that wasn't working for me as we needed to restrict it to one project and didn't want to split our aligned workflow, but most importantly, it was enforcing the need to provide a new value for the field on transition even when a prior work was already logged for the issue.
So the solution was to rely on the Scripted (Groovy) Validator from JMWE with the following :
!!issue.get("timespent") && issue.get("project")?.key == "ZYX"
Now I'm still able to transition without triggering the validator when there's already some work logged and I can restrict this to one or more projects. I prefer that solution to Scriptrunner's Custom script validator as it allows me to spare my brain with the method importing and stuff
Edit >> It didn't work eventually, somehow the project condition wasn't taken into consideration and my users also asked it to be restricted to some issuetypes and couldn't get it working. So I ended up changing one script made by my awesome groovy savvy colleague Mujibur Rahman to adapt it using the issue.get("timespent") as above. Can't share it here as it's not my IP, but it's a simple if else one.
Disclaimer: I work for the vendor providing the following solution.
If you are interested in validating whether the time was reported **before** the transition (but not necessarily **during** transition) and you can afford the cost of extra app, you might take a look at our Clockwork Pro. It comes with a custom workflow validator for ensuring some worklog has been reported before transiting an issue to next status.
Have you tried the solution given from fran_quintero? That worked for me.
I will give you some screenshots of what I have done and everyone is forced to log time.
I added a screen named mandatory time tracking.
Then I went to my workflow and added this screen to my transitions
Also I added a validator on the transition that needs the Time Spent to be modified during the transition
That's all !!!
That's the idea!
The check from a validator triggers during transitions, so if you want to force a value in a custom field to be written (i.e. Time Spent), you can add a screen in that same transition, only showing those fields that you want to be filled, and the check will be effective.
@Orestis Michos is given a marvelous, step by step, with screenshots, here :)
I ran into the same problem.
If you don't mind using an add-on (paid one), here is a solution.
We are using JMWE add-on and it includes this validator:
Field Required Validator (JMWE app)
It works correctly, when looking at the field 'Time spent'.
BTW, the built-in Jira validator (the problematic one) displays this logged time field as 'sigma time spent', which confused me, as there is no such field defined in Jira.
Yet another example of Jira product managers not talking to each other. Sigh.
Same problem. Workflow Validator is not recognizing that Time Spent has a value even though I verified it with a JQL "key = ABC-18845 AND timespent != null" returned my test issue ABC-18845 which has a several log work entries on it. However, the workflow transition keeps failing on the validator for Time Spent has a value.