Exercise: Build a TaskSpec

You can create functional areas, tasks, and data lists with two methods:

  1. Configure the feature through Shell Design.

  2. Use the Infinity SDK to edit the appropriate XML spec within Visual Studio.

We will now create a TaskSpec to open our Food Item Add Data Form that we created previously. This exercise assumes you created the food item tables from Lab: Build the Food Bank Tables and that you created the Food Item Add Data Form from Exercise: Build a Food Item Add Data Form Spec.

Here is a link to the Food Bank Source Code.

Step 1 -  Add the new Task Spec item into the Blackbaud.CustomFx.FoodBank.Catalog project.

Right-click the project within the Solution Explorer, and select Add\New Item… from the popup menu. Select Blackbaud AppFx Catalog as the category on the Add New Item dialog window, and select Task Spec as the template. Enter FoodItem.Add.Task.XML as the XML file name for the task.

File Name: FoodItem.Add.Task.XML

Step 2 -   Enter the appropriate attributes for the TaskSpec element.

  • Name: Add a Food Item

  • Description: Add a Food Item

  • Author: Technical Training

  • FunctionalAreaID: <Enter the value of the ID attribute of the FunctionalAreaSpec>

  • Sequence: 10

A TaskSpec essentially contains a reference to its functional area via the FunctionalAreaID attribute. The value points to the ID of the FunctionalAreaSpec. This organizes the task within the appropriate functional area. To set the value of the FunctionalAreaID attribute, open the Functional Area Spec you just created, copy the GUID from the ID attribute to the clipboard, and paste the GUID as the value to the FunctionalAreaID attribute.

Step 3 -   Enter the DataFormID attribute for the ShowAddDataForm element.

Below the TaskSpec element, add a new ShowAddDataForm element. This lets Infinity know that when a user clicks this task, it should open an Add Data Form. The ShowAddDataForm element needs a reference to a data form's DataFormInstanceID as the value for the DataFormID attribute. Remember, for data forms, we reference the DataFormInstanceID and not the ID of the data form. Our Add Data Form does not need any context to add a new food item row to the database. A food item stands alone in the database with no foreign key dependencies to other tables. When you finish, your TaskSpec should look like this:

<TaskSpec
    XMLns="bb_appfx_task"
    XMLns:common="bb_appfx_commontypes" 
    ID="c6f7f80e-3371-4611-a2d4-e56ec746edbd"
    Name="Add a Food Item"
    Description="Add a Food Item."
    Author="Technical Training"
    FunctionalAreaID="2b32333c-5cd7-4e54-a3d3-a41b382cdfa9"
    Sequence="10"
    >

<!-- indicate what this task should do (navigate to a page, show a form, etc. -->
    <common:ShowAddDataForm DataFormID="b911e219-42f2-4b64-9f02-d9e2ff899799"/>
</TaskSpec>

Here is a link to the Food Bank Source Code.