One of the greate feature I found in the SharePoint is the Powerfull engine for developing the Workflows by visual studio 2010. some of the greate feature I love to capture in my blog, which help me out in future to remember whenever I need any one of them. The most immense topic is corelation properties.
I used Co-releatoin property in the BizTalk Server 2006, Still I quite impress with this Microsoft methodology to integrate different line of business. In sp 2010 again I am using the co-relation property in one of my workflow.
You can consider a correlation token as a unique identifier that enables mapping between the objects in a workflow and the environment that is hosting the Windows Workflow Foundation (WF) workflow runtime.
Useful Link : http://msdn.microsoft.com/en-us/library/ms475438.aspx
Whenver you create a sequential workflow project in Visual Studio 2010 for SharePoint , it will prompt to ask name several times, which may confusion with which will be the workflow name.
There are actually three names that are used when creating workflows in Visual Studio 2010.
The first is the name of the project item,
second the name of the workflow itself—as defined in the Elements.xml file under the workflow project item folder
third is the name of the association.
(1) Create a new Project in Vs2010, Select SharePoint Template form left pane and Choose Sequential WorkFlow item from right pane.
(2) Deployed it as a Farm Solution because it is a site workflow.
(3) Choose a site workflow.
(4) Check History list to capture the history log of the workflow, And Task to Create Task in our workflow. Click Finish.
(5) Simple WorkFlow project has been created. Our First event on this WorkFlow is OnWorkFlowInitiated event.
Create a TaskToken as MyToken and Define the Task Id by Click on the Properties and also create an new GUID for our Task.
(7) Now Create new Task Properties.
(8) Generating Method Invoking Event to provide description and title for the task. We can also provide more detail regarding the Task but now we just put title and description, and mentioned new Guid for this Task.
(9) Drag a OnTeskChange event, and put name as WhenMyTaskChange.On the Properties set the Corelation Token as of TaskToken, so that both will be use a same uniuque corelation Id and set as MyTask_Id.
(10) Drag the Code Executer (Code Activity) on the design , and set the methodinvoking on which we are updating a content of our list. we can do anything with list, add update delete list , content type etc. Previously in BiZtalk server 2006 it CodeActivity was not there for this we used to add the classlibrary for data manipulation.
(11) Choose site workflow
(12) Waiting for task to change, workflow status is Inprogress.
(13) Change the Content of Task to Change so that it will resume the workflow.