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

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

How to Run a Routine When the Workflow Starts up

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :SharePoint
I have developed a workflow that is working just fine.  I am attempting to modify it so that variables are reinitialized with none-default values when the workflow is being loaded.  I created a new routine that I want to run when the workflow starts up.  This routine does the reinitializing of variables based on condidtions.  My initial intention was to place the routine within the same routine that calls InitializeComponents() (see code fragment below).  But this produces a build error.  Looks like InitializeComponents() is the only routine allowed in this procedure.  Where can I place mystartuproutine() so that it is executed when the workflow starts? Thanks for your feedback. using statement1; using statement2; using statement3; namespace MyNameSpace { public sealed partial class MyWorkflow : StateMachineWorkflowActivity { public MyWorkflow () { InitializeComponent(); mystartuproutine(); //placement here causes build error. Removal causes successful build. } routine1 { //code here } routine2 { //code here } mystartuproutine { //code here } } }

View Complete Post

More Related Resource Links

workflow starts before files are saved?


I have a sharepoint designer workflow associated with a document lib. The workflow is triggered when a new item is created or modified. The workflow will update attributes of the item.

The problem comes that for small files, the workflow works. For bigger file (even 0.5 mb), either the workflow failed to update the item or the file was saved as 0 byte.

Any recommendations?

Custom Workflow starts 2 times


I created simple workflow with Sharepoint Designer 2010 for a custom list.

Workflow sends email notification to user, who created current item. I set it to start workflow automatically when item is created.

The problem is that this wf starts 2 times and sends 2 emails. Where could be the problem?

Workflow that starts at certain hour - how to set trigger?


There is some list with DateTime column. Then I have "Expiration" column, which would be calculated and shows 'Yes', when it's in 30days period till today (eg. today is 17112010, when dateTime is 16102010, than Expiration shows 'No', when dateTime is 10112010 then Expiration shows 'Yes'). I can manange to create such column.

The problem is with Workflow. I'd like to create such one, that would starts everyday eg. at 03:00AM and check the column Expiration - if there is 'Yes', then it does something, it's not important. The thing is, how to make it run everyday? In MS Designer there are only three triggers: when edit, when create and manually.

Is it possible to prevent a user from seeing the tasks generated by the workflow he starts?


Hi All,

When a user starts a workflow, there will be tasks generated in a task list. Is it possible to prevent this user from visiting the task list? I remove the user's permission from that task list and the user can not see the it at first. But when he starts the workflow, the task list becomes availble to the user.

I checked the permission setting of that task list and found a note saying "Some items of this list may have unique permissions which are not controlled from this page". That's why these tasks become available to the user.

The reason for what I'm trying to do is that I don't want the users to know what's going on in detail. The workflow will send the user a email when there is any outcome.

Is it possible to do that? Thanks!


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.

Workflow Services: Visual Design of Workflows with WCF and WF 4


The .NET Framework 4 makes it easier than ever to implement WCF services using WF. We'll demonstrate just how easy it is by modeling a long-running, durable and instrumented workflow based on a real-world business case without having to write any code.

Leon Welicki

MSDN Magazine May 2010

Workflow Essentials: Collaborative Workflow Improvements in SharePoint 2010


In this article, the author covers the new features in SharePoint 2010 geared for workflow developers and then walks the reader through a couple of new user scenarios.

Paul Andrew

MSDN Magazine November 2009

Foundations: Workflow Services for Local Communication


This month's column describes how to use WCF for communication between a workflow and a host application in Windows Workflow Foundation 3. This knowledge should help developers with their efforts using WF3 and prepare them for WF4, where WCF is the only abstraction over queues (referred to as "bookmarks" in WF4) that ships with the framework.

Matthew Milner

MSDN Magazine November 2009

Foundations: Windows Workflow Design Patterns


Design patterns provide a common, repeatable approach to solving software development tasks, and many different patterns can describe how to accomplish a certain goal in code. When developers begin working with Windows Workflow Foundation (WF), they often ask about how to accomplish common tasks with the technology. This month's column discusses several design patterns used in WF.

Matthew Milner

MSDN Magazine August 2009

ASP.NET Workflow: Web Apps That Support Long-Running Operations


Integrating workflow into ASP.NET applications means communicating with activities via a workflow queue and hosting the runtime in the global application class. We'll show you how.

Michael Kennedy

MSDN Magazine January 2009

Real-World WF: Best Practices For Windows Workflow Foundation Apps


The heart of Windows Workflow Foundation is its declarative programming model. Here are some best practices to consider when using WF to realize software solutions in the real world.

Josh Lane

MSDN Magazine December 2008

Foundations: Workflow Tips and Tricks


Matt Milner addresses reader requests for information about safely sharing a persistence database across applications and using lesser-known parts of the framework such as ChannelManagerService.

Matt Milner

MSDN Magazine August 2008

Foundations: Loading Workflow Models in WF


When building workflows, you must consider the developer experience, available tools, long-term maintenance, and future versioning.

Matt Milner

MSDN Magazine May 2008

Foundations: Workflow Services


With the NET Framework 3.5, Windows Workflow Foundation can now truly be integrated with Windows Communication Foundation. This column describes how the integration works and how to make use of it effectively.

Matt Milner

MSDN Magazine Launch 2008

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

Foundations: Workflow Communications


Matt Milner introduces the Windows Workflow Foundation (WF) communication architecture and covers sending data out of a workflow and submitting data to running workflow instances.

Matt Milner

MSDN Magazine September 2007

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