Hi Rene,
I havent seen an example of this but you can try to create this in workflow using State machines.
Each status would be your state machine. When you enter a state, set the StartDate-Time variable to current date-time. When the status is changed, then set the EndDate-Time variable with the current date-time. Before jumping out of the state, calculate the difference. You can use same variable in each state. It would let you know how much time you spent on each status. Hope it helps. If unclear, do let us know.
Hello rortiz312000 - This is entirely possible with NintexWF
I would approach it as Kapil Joshi said; using a state machine and doing some date calculations.
You will need to to have a oStateStartDate] and oStateEndDate] for each so that you can calculate the oStateDuration] each time.
Upon entering a state, set oState1StartDate] = {TODAY}.
Just before moving to another state, set oState1EndDate] = {TODAY} and then do a calculation oState1EndDate] - oState1StartDate] and then UPDATE oState1Duration]. This will allow you to add more to it if, for whatever reason, the state machine bounces between states and circles back.
Keep in mind that oState1StartDate] and oState1EndDate] are WF variables, and only the oState1Duration] is what is committed back to your item.
Let me know if you have any questions or want me to mock something up, I can shoot over the .nwf if you need to walk through it!
Hope this helps!
Hi Jesse,
I have never built a "State Machine" workflow, so any examples you can provide, will be really helpful. Thanks!
State Machine by Example
Using State Machine Workflows
Search for state machine on the community and you will get many examples.
Hello rortiz312000 -
Attached you ill find the .nwf file that you can load into a list to see how I mocked it up for you.
Please keep in mind that you will need a list with the following columns (keeping the same names):
The workflow itself has 3 states and I perform the same functions in each state, but I made it so you can change the "Start" and "End" dates and see some examples.
The logic is when the an item enters a state, it set the StateStartDate. You then do your required actions, and just before you exit the state, set the StateEndDate, and then calculate the duration. You will notice that I convert the duration from seconds (this is how it calculates it by default) to days. I also add the duration to the list so that if states repeat, that TOTAL duration is captured, not just the most recent pass.
How this helps!
Let me know how it works out for you or if you need any more help!
Hi Jesse,
This is a great solution. Thanks for providing an example. Do you know how I can change states based on "Status" field change?
Since, it can go back & forth between statuses, I can't direct the workflow to changes "states" in sequential order!
Thanks in advance!
Hello -
Glad that it worked for you.
You can definitely do this!
You will want to use the "Wait for item update" action and wait for the "Status" to NOT EQUAL its current status. So for State 1, like so:
You will then want to have some logic to determine what state to jump to, I recommend using the Switch action and evaluating the Status, like so:
Now, I went back and I made some 'improvements'. I created a new state called "CheckState" and it holds the logic for the switch. This is the state you should move to after you wait and evaluate the change to "Status". This way it keeps it clean, and it reduces the number of actions (create it in one place rather than in every state).
I attached the .nwf file for you again so you can take a look at how I approached it. I used a column name Status and the choices are State 1, State 2, State 3, Complete.
I added Complete so that you can get out of the State Machine and end your workflow if required; simply just mark the item as complete!
Let me know if you need anything else!
Hope this helps!
Hi Jesse, this is a great solution to calculate days in each different status. Is there a way to calculate business days in each status?
Thanks,
Rene