Automatically update spent time when task is {In Progress}

Hi guys, maybe you know how automatically update field "spent time" for the tasks while tasks still in progress? For example update every 5 minutes?
Comment actions Permalink
Hi Anton,

I assume 'workTimer' workflow will help you with the case. Navigate to Administration> Projects> your project> Workflows tab> Attach the workflow.

Thank you.
Comment actions Permalink
Hi, Andrey! Thank you for your answer, but workTimer workflow doing 2 things:
1) When task state becomes {In Progress} -> set value to field Timer timer
2) When task state becomes {Fixed} -> Add Work To Time Tracking

But i want to update time spent field 10 times per day (when task still in progress). Is it possible?
I am already try to add new rule to WorkTimer workflow:

cron: 0 * * ? * * [issue.State == {In Progress}] {

    if (Timer time == null) {
      Timer time = now;

    var duration = now - Timer time;
    var seconds = (duration.millis - duration.millis % 1000) / 1000;
    var minutes = (seconds - seconds % 60) / 60;
    var hours = (minutes - minutes % 60) / 60;
    var days = (hours - hours % 24) / 24;

    issue.applyCommand(l10n ( Spent time   {days + ""} d {hours + ""} h {minutes + ""} m ));

But command "Spent time 2d2h" is converting by youtrack to "Add work 2d2h Today".
And result of this thing is accumulating work records :(
Comment actions Permalink
@andrey tigay, do you know how to do this thing?
Comment actions Permalink
Hi Anton,

Sorry for not responding earlier.
Please use schedule rule instead of cron expression.
You may have one rule which will include 'if' statement checking if the state is In Progress; if it's not, then don't update Spent time.
Speaking of incorrect command, this happens because Spent time couldn't be set manually if Time tracking option is enabled; by default you had 'work' command applied with accumulative values. According to your use case, you may disable Time tracking option (Time tracking tab will be locked, 'work' command will be unavailable).

Hope this helps.

Please sign in to leave a comment.