Hi
I'm working on a script that will give me the average time (in days) from one state in a workflow to another.
My idea was to use the milestone dates ([01] and [06]) which seems to work fine using this script:
But in order not to get wrong data, I'm only interested in items that is closed ([06] Done). So my idea was to use the milestone status to tell me if the milestone event was reached or not, and only include the ones where the milestone event was actually reached.
I have been searching all over the forum and help pages, but i can't seem to find anywhere that tell me how to reach the milestone status???
My guess was that i could reach it through item.milestones[i].milestoneStatus; but this doesn't seem to be right? I'm just getting a result saying it's undefined..
Hope someone can help me here..
Kasper
I tried the following (based on the Help)
var myVar = item.milestones[0]; println("milestoneDate: " + myVar.milestoneDate); println("milestoneType: " + myVar.milestoneType ); println("progress: " + myVar.progress); println("warnThreshold: " + myVar.warnThreshold); println("workflowState: " + myVar.workflowState); println("workflowStateName: " + myVar.workflowStateName);
And I got the following
milestoneDate: Sat Sep 20 2014 00:00:00 GMT-0400 (EDT) milestoneType: ENTER progress: 10 warnThreshold: 5 workflowState: undefined workflowStateName: Concept
So you can read the workflowStateName and the Progress, but I don't think you can read status (it might be a representation of the progress).
Does that help?
That's is the same conclusion i came to, but I need to think about where I can get a verification of whether the workflow state is actually reached or not.
Without the verification I run the risk of getting wrong statistics, since the date is populated with the target date which might not be the same as the actual closing date.
So I guess i might need to have the script look at the workflow in order to make sure the closed state is reached.
Kasper
what you need is the milestones[i].status or milestones[i].actualCompleteDate,
status = Done means actualCompleteDate not null means it's finished means the green tick in the Status column.
status = Awaiting means actualCompleteDate = null means the clock in the Status column