.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

Set State of workflow in code

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :WPF
Hi, i have instance of StateMachineWorkflowActivity and i cannot figure out how to change its State in code. Is there any way to do this?   Thank you in advance for your help!

View Complete Post

More Related Resource Links

create task using c# code in state machine workflow


hi all;

i need to create task activity using c# code under specific condition to more than one person (parallel task)

any idea and if u please could u support me with samples as i'm new in workflow using VS2010


thanks in advance

WF How-To: Building State Machines with Windows Workflow Foundation


State Machine workflows represent a different way of visualizing program logic. Rather than flowing from activity to activity like sequential workflows, State Machines transition from state to state. Learn about uses for State machines and see how to design and build a State Machine workflow with Windows Workflow Foundation.

Keith Pijanowski

MSDN Magazine February 2008

Change the Workflow Status through code


HI Folks,

I have a scenario where i need to develop a 6 stage approval workflow(sequential) using WWF and depoly it to sharepoint. Everythigns fine till here.

Now we look ahead to change the Status field on the documents library which actually has the Workflow Name as the column name and its value being In Progress, depending on the stage of approval. Like(Approved 1, Approved 2, Approved 3.)

And if rejected the status should be rejected than Completed. Any idea how can we update this column of the List item.

I have tried item[workflowProperties.Workflow.ParentAssociation.Name]="Approved 1";

But this throws an error saying input string is not in a correct format.

Any information would be of great help :)


Sreeharsha Alagani

Infopath form return XMl code during workflow task


1.     Review 7777.xml.

2.     Perform the specific activities required for this task.

Use the Edit this task button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click here to request access.

Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




Create Content Type in State Machine Workflow

Hi, I created a state machine workflow in share point 2007 with default associated task list. This is working fine. Now I want to add a custom content type to task in which I want to show 3 fields on task form : Title, Description, status And also I want to set some default values in these fields. How can I create and add this custom content type in state machine workflow ? G. Goyal

state machine workflow project creation error

Hi,   I have a dev environment which i had sharepoint 2007 and now i upgraded it to sharepoint 2010. Now when i try to create a state machine workflow project it gives me an error Object Reference not set to an object. I uninstalled Sharepoint extensions 1.3 (as i 64bit win2008 vm) and when i am trying to install it. In one of the installation screens where it asks for the port no  and the select the app pool it only shows the sharepoint central v3 app pool . i was expecting to have sharepoint 2010 product app pool in the drop down. I know that there should be a app pool on port 80. Since i upgraded sharepoint to 2010. I want sharepoint visual studio extensions 1.3 to point to sharepoint 80 app pool . Please can you tell me how i can do it.    

How to create custom task form in state machine workflow?

Hi, I want to create custom task form in state machine workflow. How can I create & install?  G. Goyal

can't debug anymore a state machine workFlow in Visual Studio

Hi, I have an issue with debuging a workFlow with visual studio when it should start the workFlow when I create an item nothing happen and sharepoint stay stuck : I can't refresh any lists, visual studio rich 40% of the CPU, no exception on log. At the same time if i deploy without debugging it works. Please help me. Thanks, Patrice  

Three state workflow is possible?

Can I use Three state work flow for this scenario? ·        When the user submits a request email needs to be generated to notify help team that there is a request that requires action ·        After a request for new access is completed by team, the requestor needs to receive a notification email with the details. ·        After a request to change access is completed by   team, the requestor needs to receive a notification email informing them the request is completed ·        After a request to terminate access is completed by   team, the requestor and HR department needs to receive a notification email.   Any help isppareciated. Thanks

workflow 4 state machine load

Hi, I'm using StateMachine for WF4 from codeplex. I can save it to file very well, but when I load it again I see only the states not the connectors also. Same behavior can be reproduced by double clicking a state and then coming back to whole state machine. Could you please help me? Thank you very much

Delay Activity is not working with SharePoint state machine workflow

Hello,   I have a problem with Delay Activity in Sharepoint state machine workflow. This issue is kind of common to many people but so far I haven't come accross any working solution. In one of the workflow states, I want to add a delay activity to send email notification if no action is taken after certain time. Below is what I have done:   In the targeted state: 1) add one eventDriven activity to handle the normal process (approve the item) 2) add another eventDriven activity to send the reminder email. In this eventDriven activity, I first add a delayActivity, set it to 2 minutes for test purpose. Then I add a Sharepoint SentEmail activity.   With my test, the Dealy Activity is never invoked after timeout period. What should I do to make the delay activity work in the SharePoint state machine workflow? Is there any work around if the delay activity is simply not working there?   Any suggestions are appreciated.

SharePoint Three-state workflow messages

I want to assign tasks to users without notifying them the task is assigned. But I DO want to notify them when the state changes (I am changing it behind the scenes based on their due dates and the current date. It looks like  have two choices - don't send emails, or send emails with all three state changes. If my interpretation above is correct, then does anyone have a suggestion how to contrive system to trigger SharePoint to send people a message when a date in a list is within one week? Without sending three additional messages, that is!

State Machine Workflow XOML issue

"Please help me out this problem" "Its too urgent" I have modified State Machine Workflow XOML file and upload again with my application. Now i am getting error while calling CreateWorkflow(). I am getting the following error. "Wokflow Validation Failed" "Activity 'handleExternalEventActivity1' validation failed: Property 'InterfaceType' is not set." If i am uploading the existing XOML file then it is working fine without any error. What i have to do and where i did mistake?

Input parameters from Workflow No-Code Or Xaml Only

I have many activities and a customized workflow Only Xaml and I can not pass a value to a property of a custom activity, following the example of Workflow1.xoml   <pre lang="x-xml"><SequentialWorkflowActivity x:Name="Workflow1" xmlns:ns0="clr-namespace:CustomActivities;Assembly=CustomActivities, Version=, Culture=neutral, PublicKeyToken=null" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"> <ns0:ReadLineActivity x:Name="readLineActivity1" InputText="" /> <ns0:WriteLineActivity x:Name="writeLineActivity1" OutputText="{ActivityBind readLineActivity1,Path=InputText}" /> </SequentialWorkflowActivity> based on this workflow I pass a value for the property InputText activity readLineActivity1   Thanks a lot!

State Machine Workflow timer

Hi all,

I am wondering what the best way is to map the following scenario with a state machine workflow.

A customer books a seat online. The seat enters the "Reserved" state. The customer has up to one minute to confirm the reservation, and when he does, the state would change to "Sold".

If, however, he does not do that within that minute, the system would automatically cancel the reservation.

I am stuck on implementing the one minute timer. I would imagine that it would involve a DelayActivity, but I won't know where it fits in the workflow.

Terminating state machine workflow



I am creating a state machine workflow with 20 states.

My requirement is, irrespective of which state the workflow is in currently, when a user changes an item in the source list as "complete" , the workflow should be terminated.

What would be the best way to achieve this? Should I handle this item change event in all the 20 states? or is there a better way of achieving this?

Please advice.





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