I have created a workflow, and Im running it via WorkflowInstance.Run(). This workflow has numerous bookmarks, and I would like to be able to query it for which bookmark is responsible for the current idle-state.
How might I do this?
Thanks
I have created a workflow, and Im running it via WorkflowInstance.Run(). This workflow has numerous bookmarks, and I would like to be able to query it for which bookmark is responsible for the current idle-state.
How might I do this?
Thanks
for workflow 4.0
You can get the Bookmarks from the WorkflowInstance
IEnumerable<BookmarkInfo> bookMarks = workflowInstance.GetAllBookmarks();
Only active bookmarks, that is bookmarks that are actually waiting for something will be listed. In a sequential workflow without parallel activities that will tell you the one that is waiting. But in many situations there will be more than one bookmark waiting for input. You can't tell which one caused an idol state.
You might be able to get more information by hooking something up to the WorkflowInstance.OnIdle event. It's not quite a true .NET event, but it accomplishes the same thing. That won't tell you exactly why you hit the Idle state, but hopefully knowing the timing will tell you more.
for workflow 3.0
I'm not sure this will help, but since you have a WorkflowInstance you can ask it for a collection of WorkflowQueueInfo objects by calling GetWorkflowQueueData(). The WorkflowQueueInfo class will tell you which activities are subscribed to the queue and if the queue has items in it. An empty queue with activities subscribed to it could show you what you need. Those activities are waiting for something but there is nothing to do. That should be the bookmark you are looking for.