We want to log the time an analyst works on a given task. We want a simple Start Timer/Stop Timer action. I've looked at the build in Start Clock/Stop Clock actions but this seems to me to be based on a business calendar as used in Incidents and Changes. I don't see the relevance here with using Tasks. If someone has an answer for using built in Start/Stop clock, then I'm open. In the meantime, I've tried to create my own timer for my tasks.
Basically, I'm proposing a process (as below) that when the action, Start Timer is clicked, it automatically sets the TimerOn value to DateTime.Now. This is accomplished through the automatic action, TimeLog that uses the window below and setting the TimerOn value by using the following calculation:
import System
static def GetAttributeValue(ProjectTask):
Value = DateTime.Now
return Value
When the action, Stop Timer is clicked, it automatically sets the TimerOff value to DateTime.Now. This is accomplished using the same process as above, but now setting the TimerOff value using the same calculation.
The next automatic action, uses the same window and calculates the TimeLogged value using the following calculation:
import System
static def GetAttributeValue(ProjectTask):
DeltaTime = ProjectTask._TimerOff - ProjectTask._TimerOn
if TimeTaskTotal = 0:
TimeTaskTotal = DeltaTime
else:
TimeTaskTotal = TimeTaskTotal + DeltaTime
ProjectTask._TimerOn = 0
ProjectTask._TimerOff = 0
return TimeTaskTotal
So nothing is not working.
- When I click Start Timer, the action says run successful, but doesn't update my TimerOn value
- When I click Stop Timer, the action says run successful, but doesn't update my TimerOff or TimeLogged values
I created a couple of string attributes, strTimerOn and strTimerOff to try and debug the calculation, but they don't show any values when the actions are run.
My process logic seems plausible to me, yet the execution is failing. Anyone care to help?
My Project Task window
My Project Task process