Exercise: Workflow Tasks and Inboxes

Workflow is the combination of the automation of Infinity features and end user interaction. This exercise deals with user input often required within a workflow.

In the following exercise, we will gain experience working with two new concepts: Workflow Tasks and Workflow Inboxes. For more information on tasks and inboxes, see Workflow Tasks and Inboxes.

Instructions

Step 1 -  Add the WorkflowInboxSpec to the catalog project.

Make sure the Blackbaud.CustomFx.MajorGivingWorkflow.Catalog project is open within Visual Studio 2008

Step 2 -  Complete the WorkflowInboxSpec.

Using the XML below as a guide, complete the WorkflowInboxSpec.

<WorkflowInboxSpec
	xmlns="bb_appfx_workflow_inbox"
	xmlns:common="bb_appfx_commontypes"
	ID="cdc6e2ea-0bf9-42a2-b6f1-d4dae5a4398a" 
	Name="Director of Special Giving Inbox (Custom)"
	Description="Infinity SDK Customization.  
Used by workflows that involve the approval of large or other special gifts. 
  See Major Giving (Custom) Workflow."
  Author="Technical Training">
</WorkflowInboxSpec> 

Step 3 -   Save and load the spec.

Step 4 -  Configure the inbox.

Step 5 -   Add the necessary roles/application users to the workflow inbox.

In this step, we will add the appropriate application user to the inbox.

Go ahead and add yourself to the inbox.

Step 6 -  Use a DefineTask workflow activity to send a task to the workflow inbox.

Step 7 -  Add a DefineTask workflow activity to send a task to the workflow inbox

At this point, your business activity should look similar to this:

Step 8 -  Add a WaitForTaskCompletion workflow activity.

There are always two steps involved with Workflow Tasks – define the task and then assign and wait for it to be completed. So the next step in our sequence is to assign and wait for the task to be completed. The WaitForTaskCompletion activity is used for the second step.

Note: The WaitForTaskCompletion activity has an InArgument property that accepts the WorkflowTaskData variable we named taskData in the DefineTask step. It also allows specifying a duration of type TimeSpan to wait before timing out via the timeOutDuration InArgument. The cancelled and timedOut properties are boolean OutArguments that you can use to make a decision based on whether the task was cancelled or if the timeout expired prior to the task being cancelled or completed. When the workflow executes and reaches the WaitForTaskCompletion activity the workflow will pause until the task is completed. Under the hood the Workflow Service will save the current state of the workflow to the database and unload the in-memory footprint of the workflow definition and classes. In other words the workflow will go idle, persist, and unload. Since we did not specify a timeout the workflow will pause indefinitely until somebody marks the task completed in the application.

The property sheet for the WaitforTaskCompletion should look like this:

At this point, your business activity should look similar to this:

Step 9 -  Add the WorkflowTaskViewForm feature as a workflow activity.

After the task is completed, we need to provide the workflow with the name of the person who completed the task. In other words, we need the name of the person who performs the part of the Director of Special Giving.

Fortunately, there is a view data form called Workflow Task View Form that is part of the out-of-the-box Workflow Task page. You can view this page if you have tasks associated with a workflow instance. We utilize this view data form within our flowchart as a workflow activity and obtain the name of the person who completed the workflow task.

Step 10 -  Save, build, and test the workflow.