Create a Workflow Using VS 2010 with an initiation Form and Process the Data in a SP list.
1. Create a Customer List in a SharePoint Site, with required columns.
2. Create a new VS project File, New, New Project, Select C#, SharePoint, 2010, Sequential Workflow and Give the Project name as Mohan_WFSample1.
3. Click on Ok, Enter the Url Http://Madan:8181( Give your site URL). Select Deploy as a farm solution, Click on next, Enter the Workflow name (CustomerWF), Select List Workflow click on next.
4. The library or list to associate your workflow with = select your list/library (ex:- Customer).
5. The history list to display … = Workflow history
6. The task list to display … = Tasks.
7. Click on next.
8. Select a User Manually starts the work flow?
9. Now click on Finish.
v In the solution explorer, with in project select Workflow1, right click on it , in the properties window click on Add, New item, Select Workflow Initiation Form, click Add.
v Add the following code to the main content placeholder
<br />
<br />
<br />
<asp:CheckBox ID="Checkbox" runat="server" Text="Fast Track Customer" />
v Now open the WorkflowInitiationForm.aspx.cs
1. In the GetInitiationData method replace returnstring.Empty; with the following code.
v Open the view Designer of Workflow1.cs. From the Toolbox, add a Code activity, after the onWorkflowActivated1 activity.
v Double click on codeActivity1 to generate an Execute Code event in code behind. Add the following code to the codeActivity1_ExecuteCode method. Set a Breakpoint in the method.
If (workflowProperties.InitiationData == "True")
{
System.Diagnostics.Debug.WriteLine("This is a fast track customer");
}
v Press F5 to deploy and debug the new workflow
v Navigate to the Customer list and create a new item in the list
v Click on the edit dropdown for the item and select Workflows, Execute
No comments:
Post a Comment