.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

workflow 4 correlation / persistence question

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :Windows Application
Hello all, I would like to understand why the following behavior takes place. In most cases my workflow that runs monthly account renewals works just fine. But with selected accounts it gets stuck. What I mean by stuck, is that a record is created in System.Activities.DurableInstancing.InstancesTable (in my persistence db), but IsInitialized remains to be set to 0 (so is IsSuspended, IsReadyToRun). When I step through my workflow, I see that the problematic accounts do not pass InitializeCorrelation activity (I pass an AccountID to initialize AccountIDHandle). What I can't figure out is  where InitializeCorrelation looks to determine if a flow with a given AccountID already runs? I killed all the instances of workflows in the database using DeleteInstance stored procedure, so InstancesTable has no rows. And yet the same problematic accounts trip over InitializeCorrelation activity - a new instance of a workflow will be created and stored in InstancesTable with IsInitialized = 0. Thank you very much, Andrei  

View Complete Post

More Related Resource Links

Persistence not reloading workflow properly

To start with, some background on the project I'm working on. It's basically a todo list. I have a workflow with activities that will send a message to the UI layer to display a todo item to the user when that point in the workflow is reached. The todo activity is set up so that each time the activity context loads, it will send out a request to show the todo item if the activity is in executing status. This is a multiple host environment, so instance ownership is of interest during persistence (I use the SqlWorkflowPersistenceService). I originally was trying to set this to a max timespan. It works ok, except it relies on the closing of the application to call dispose on the workflow runtime in order to remove the ownership. If the application crashes, I have a manual "unlock workflow" functionality. That is a bit of a pain, so I thought I'd try a small ownership duration, but it's not working quite right. When I first load the workflow into the client, everything shows up fine. I have a refresh functionality that also works fine as long as the ownership duration hasn't been reached. Once it is reached, the todo item doesn't show up. I believe the workflow is not even loading from persistence. I've been testing it with a single runtime, so I know there are not any other runtimes taking ownership. Here is what I do during a refresh: for each workflow in run

Workflow persistence with a non-serializable variable

I'm using Entity Framework and WF4. I want to be able to persist a workflow but one of my variables in the workflow is an EF ObjectContext. Is there a way to make the workflow persist-able and when it re-hydrates, has a fancy new ObjectContext instance?Blades Don't Need Reloading...

I need a workflow triggered by a workflow...how do I design this? Beginner question

I've added the Approval workflow to a forms library and it generates the necessary tasks and emails for 2 levels (serial) of Approval on the form. When the form has been approved the 2nd time, I want it to trigger another workflow that notifies a 3rd person of the existence of the form and assigns her a separate non-approval task. I'm creating it in SharePoint Designer, and I can do most of it, but I'm not sure what field I'm looking for, at the beginning in order to start the workflow. Currently, there is no column for Approval Status in the form library, only a column that shows the status of the workflow (In Progress or Approved).  I tried If Workflow Status equals Approved then email.... but that didn't work. Any help is greatly appreciated.  I'm looking for the data source field and the list item field and value, I guess.  

Windows Workflow Persistence Service using Oracle Database



We are using windows state machine workflow. We need to use Oracle for persisteing and tracking workflow instances. Can anyone provide custom services for Oracle?

We have even tried WFTools but not able to connect to Oracle database. Please provide the same code if anyone has tried.





2007 SPD Workflow Question


This may have been asked before, so forgive me if that is the case.

I have a source library with many document fragments that will be used to create master documents.  The idea is to right click on a particular document fragement and select a "Copy Item" workflow for copying the item into a temporary library for constructing the pieces.  There will be several of these libraries and the names will change fairly often.   When executing the workflow, is there a way to prompt the user to choose which of these "construction" libraries to use?.

Many thanks in advance.

Question about Workflow in Document Library with version control and check-in/out enabled



I use Sharepoint Foundation 2010 and have a workflow to set some metadata in a document with version control and check-in/check-out enabled (approval content is not enabled because anyone in the team can be a possible editor of the document).

My metadata is:

- a generated doc id with text+id (example P&D_1)

- a calculated status based in version: minor version = "on development" and major-version="published/approved"

I defined two workflows:

1) is called when item is created to define id and status.

2) is called when item is updated and status is re-calculated if version is major. (It is called in every item change, not only when user wants to publish a major version, because this option doesn't appear in SPD)

I noticed that sharepoint workflow must do a check-out to be able to update metadata, and because of this the version number is incremented. When version is minor, I don't care, but when version is major I have a problem, because just after publishing the version 1.0, the workflow changes metadata and the version to 1.1. and 1.1 means that the document is not approved anymore...


a) Isn't it possible to do the workflow to check-in and override the last/current version to not generate a new version??

b) Or is it possible to stop versi

Workflow in two sides : SQL Persistence in the WCF Service side + Workflow logic in the client side



I'm new in Windows Workflow Foundation 3.5, and I red some documentation.

Now, I would like to know if an architecture is possible in my case :

- WCF service with SQL Service access : put in it the Workflow SQL Persistence. I know that this part can be ok alone.

- Client side (ASP.Net) : put in it the Workflow logic. Ex : know when we are in a given state, and display icons and text related to this state, and know what is the next available step.

Is this architecture possible, and how to manage it in a few words ?


Workflow used with : WCF + Persistence + Tracking : how to manage ?



My question is simple : how to manage both all these technologies in the same project ?

Framework : Workflow 3.5 VS2008

What files are in the Workflow WCF Project :

- the interface for methods exposed.

- the Workflow C#.

- the app.config file.

What I already know how to do :

- Workflow WCF with SQL persistance and activate SQL Tracking

What I don't know how to do :

- Publish WCF methods in the same project for querying the tracking database (C# classes used : SqlTrackingQuery and SqlTrackingQueryOptions)

How to manage it ?

Thank you.

Question about Workflow Termination


I have read that if an user terminate a workflow, all the tasks associated with that workflow will be deleted. But, I think it is important to keep all the task details for future reference.

How do i prevent deleting tasks? Or atleast how can I prevent users terminating workflows?





Question on retaining workflow data after upgrading to SP 2010



After upgrading from SP 2007 to SP 2010, will the workflow data be retained? I mean, if there are any workflows that are started but are yet to be completed, will there be any issues with those after upgrade? I tried finding about this in the Internet, but couldn't find any.

Workflow with id "xx" not found in state persistence store.


I have a state machine workflow having around 15 states. In few of the states I am using SqlWorkflowPersistenceService to persist the workflow instance into the database. Workflow is using WorkflowInstance.Unload() method to manually persist the workflow instance and UnloadOnIdle is set to false. Workflow service is hosted as WCF service on a windows service.

Problem: The states which implements SqlWorkflowPersistenceService to persist the wf instance calls another WCF service (which may take a lot of time) and then persists the instance. WCF service when finished with its processing responds the Workflow service by calling the operation contract associated with the Receive Activity in the next state of Workflow Service. Everything runs fine if the WCF service takes some time to respond the Workflow back. But sometimes it happens that WCF service has nothing to process and it responds immediately to the workflow, in this case workflow throws the error "Workflow with id “xxxxx” not found in state persistence store." 

What I think here is when WCF service reponds back to the WF immidiately then WF is still busy in persisting the WF instance. WF Runtime finds no wf instance in memory and checks into the persistance database. Since WF instance is still in the process o

Architectural insight for a workflow persistence/tracking problem

I'm working for a client who has many (~200) SQL databases containing client information.  My client would like to store each of their customer's workflow persistence/tracking information within their respective database.  This is needed because the databases need to be portable so they can be moved from a client site to a hosted environment and vice versa.  They want to handle all of the workflow processing from a single Windows service.  My initial thought is that I'll need to rewrite the SqlWorkflowPersistenceSerivce and SqlTrackingService services to be able to handle this requirement.  This rewrite would include the ability to scan all of the databases on a periodic basis for workflow events that need to be processed.  This sounds like a bit of challenge, and I want to make sure that I'm not overlooking something simple.

Any expert opinions on this?
Matt Ruwe

Correlation, persistence and WorkflowServiceHost conspire to give a NullReferenceException

Hi there,

In the thread at:

I was advised that I should use the WorkflowServiceHost to get Delay working in a persisted Pick. In trying to get that done, I have come across another problem.

I now have a simple WCF client that sends messages to my System.ServiceModel.Activities.WorkflowServiceHost. I have SQL persistence configured, and I have it set to unload instances after a 5 second timeout.

I have the client send messages with an instance-specific ID, and I have correlation set to use this ID to pick the proper instance.

The persisting seems to work (there's something in the Instances' XmlData column that looks appropriate).

The correlation seems to work (messages do go to the proper instance).

But it all falls apart when the instance is unloaded.  If I send a message before the instance is unloaded, it's (repeatedly) handled properly. If it's unloaded, I get the following exception:

System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Object reference not set to an instance of an object. (Fault Detail

Error while executing workflow persistence


I get the following error while running my workflow, on average of about 1 in 200 instances.

An error processing the current work item has caused the workflow to abort.  See the inner exception for details. InnerException Message: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error.


An error processing the current work item has caused the workflow to abort.  See the inner exception for details. InnerException Message: The operation did not complete within the allotted timeout of 00:00:00. The time allotted to this operation may have been a portion of a longer timeout.

The problem seems to be with persistence not happening within 0 seconds, but I wouldn't have a clue where i can increase this???  Remember that this workflow normally runs fine????

Jason Bolstad

WSS 3.0 workflow question


I'm currently using wss 3.0.  I've got a list on site a and a list on site b. 

Site b is external and used to gather feedback from customers.  Site a is internal and processes the feedback data. 

I've got workflow on site a that sends out notifications and assignments any time a new list item is created on site a. 

I've got workflow on site b to move the item to the list on site a. 

Everything is working upto this point. 

What is not working is that workflow on site a is not activating when an item is moved to site a from site b. 

I've tried creating workflow that looks for specific words in an additional comments field.  I've even set a "sent" field on site b to be checked on site a but nothing is happening unless I manually start the workflow.

Can any help me figure out how to get my workflow to start on site a when an item is moved to it from site b?



Workflow - CodeActivity and Persistence



 I want to know is there any mechanism/configuration that the persisted workflow instance can resume a code activity from where the lat unloading happened?

Eg: I have a code activity which is long running code and meanwhile I will unload the instance if any service shutdown happened. Now how can i resume/restart the same code activity on loading the workflow?


Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend