I have a requirement where i need to implement a workflow that will send a list of tasks assigned to a user. This list will only need to include the latest tasks which will imply not sending a list that was previously sent.
There will be no user interaction via a ui to start the workflow so a timer start event will need to be used. There is a incremental task id (lastTaskId
) and i can retrieve the last id via sql from the database. I can then preserve this in a variable on the workflow and use a > lastTaskId
to get all tasks created post the last dispatch. There is no status value i can update back to the database. The taskid is the only value i can use.
The model I have come up with looks like the below,
- Timer starts
- Last task id retreived via task Get last task id
- Get all tasks with id > last task id via task Get Task Info
- Get list of employees
- Send email to employees
The issue here is that as the timer event will start a new instance at the interval set the attempt to preserve the state i.e value of the lastTaskId variable, will fail, thus losing track of the last taskid sent. I need to use a timer event to loop back to the Get last task id but i do not see how that will function considering i will be using a timer start event. What would be the best way to model this workflow ?