Exercise: Use a View Form to Retrieve Data in a Workflow
The purpose of the exercise is to continue practicing bringing Infinity features into the workflow and assigning the result of a view data form into a strongly typed variable. We will then leverage this variable within our workflow using an additional FlowDecision Activity.
At this point within our workflow, we know when we have a large vs. a small gift. If it's a large gift, the workflow automatically marks the revenue transaction as "Do Not Acknowledge." Our next step is to determine whether or not the constituent who provided the payment is a major giving prospect. If the donor is already a major giving prospect, we will simply exit the workflow. If the donor is not already a major giving prospect, then will continue the workflow.
For more information, see Add Features to an Infinity System Role.
Instructions
Step 1 - Locate the Feature using “Go To”
The Constituent page's expression view data form contains a wealth of information pertaining to a constituent including true/false values for each of the built in constituencies such as donor, major giving prospect, board member, volunteer, etc.
-
Navigate to the Constituent page.
-
Place the shell into Design Mode.
-
Click the Go to page button.
-
Click the link beside Expression data form in the summary section of the metadata page.
-
On the Fields tab, review the fields available on the expression view form. Note the ISPROSPECT field ID. We can use this to make a decision within our workflow about whether the constituent is a major giving prospect.
Step 2 - Permission the feature.
-
Click the Assign permissions action on the left side of the metadata page for the expression view form.
-
Grant permission for the feature to the "Workflow System Role for Training Exercise" system role.
Step 3 - Bring the feature into the development environment.
Within Visual Studio, select Tools\Add System Role Activities to add the activity to the toolbox.
Step 4 - Place the feature on to the Workflow Designer (MajorGiving.xamlx).
-
Open the flowchart within your MajorGiving.xamlx workflow designer.
-
Drag a Sequence Activity onto the workflow designer below the Do Not Acknowledge BusinessActivity. We will not use a business activity for this step since it is implementation detail that is of no real interest to the end user. In other words, we do not want this step to appear within the Activity Status tab on the Workflow Instance page.
-
Provide the following value for the DisplayName property for the Sequence Activity:
Property Name
Value
DisplayName
Get Constituent Expression View Form Data
-
Double-click the Sequence Activity to view its contents.
-
Drag the Constituent Page Expression View Form (Load) activity inside of the Sequence Activity.
Step 5 - Create a variable to hold the value of the data form's Result outArgument.
In the next step we will create a variable to hold the values retrieved by the view data form. To get the appropriate variable type, we can view the API tab on the metadata page:
As you can see from the figure above, the ConstituentPageExpressionViewFormData data class can be found within the Blackbaud.AppFx.Constituent.Catalog.WebApiClient.ViewForms.Constituent namespace within the Blackbaud.AppFx.Constituent.Catalog.WebApiClient.dll client-side web API assembly.
-
Open the Variables button/tab at the bottom of the workflow designer within Visual Studio 2010.
-
Add a new variable named resultConstituentPageExpressionViewFormData. The variable data type is "Blackbaud.AppFx.Constituent.Catalog.WebApiClient.ViewForms.Constituent.ConstituentPageExpressionViewFormData."
-
Scope the variable to the Major Giving Service. See below for the completed variable within the workflow designer.
Step 6 - Provide the properties for the ConstituentPageExpressionViewFormData activity.
Property Name |
Value |
---|---|
DisplayName |
ConstituentPageExpressionViewFormLoad |
RecordId |
inputformfieldConstituentID.ToString |
Result |
resultConstituentPageExpressionViewFormData |
Step 7 - Review the references to the Workflow Assemblies.
View the properties for the Visual Studio 2010 project. Select the References tab.
When we added the Constituent Page Expression View Form activity to Visual Studio, behind the scenes the following references were set to our project:
The workflow activity, ConstituentPageExpressionViewFormLoad, is defined within the Blackbaud.AppFx.Constituent.Catalog.Activities assembly.
The class that defines the data returned by the activity, ConstituentPageExpressionViewFormData, is defined within the Blackbaud.AppFx.Constituent.Catalog.WebApiClient.dll client-side web API assembly.
These assemblies should ultimately be deployed to the Blackbaud workflow service application on the Blackbaud workflow server such as c:\inetpub\wwwroot\bbwf\bin\.
Step 8 - Connect the Sequence Activity to the flowchart.
Connect the new sequence activity to the Do Not Acknowledge business activity. Your flowchart should now look like this:
Step 9 - Add a new FlowDecision activity
Now that we have our constituent data from the expression view form loaded into the variable: resultConstituentPageExpressionViewFormData, we can leverage the variable within the condition of a new FlowDecision activity. The resultConstituentPageExpressionViewFormData variable contains the values for the form fields on the expression view data form including Boolean values for each of the system defined constituencies, such as major giving prospect.
-
Within the Flowchart tab of the Toolbox, drag a FlowDecision workflow activity onto the Flowchart activity.
-
Connect the FlowDecision activity to the sequence activity that we created in the previous steps.
-
Right-click the FlowDecision and view its properties and add the following properties:
Property Name
Value
Condition
CBool(resultConstituentPageExpressionViewFormData.ISPROSPECT.Value = True)
FalseLabel
False
TrueLabel
True
Step 10 - Add activities for each outcome of the FlowDecision.
Our next order of business is to add two business activities to the flowchart, one for each of the possible outcomes of the FlowDecision. We will connect the true outcome to a new BusinessActivity that contains a Sequence Activity that in turn contains a new LogMessage Activity. The LogMessage Activity logs the fact that the donor is already a prospect to the database. Next, we connect the false outcome to a BusinessActivity which eventually sends an approval task to the Director of Special Giving. The business activity that sends an approval task is a little more involved, so we will save the implementation details for a later exercise. In the meantime, the false outcome business activity just contains a log message stating that the donor is not a major giving prospect.
-
Add two BusinessActivity activities, one for the "true" outcome and one for the "false" outcome.
-
Connect each BusinessActivity to the appropriate outcome.
-
Add the following properties for the "true" business activity:
Property Name
Value
DisplayName
Donor is Already a Prospect
Description
Donor is already a major giving prospect
DetailLevel
High
-
Add the following properties for the "false" business activity:
Property Name
Value
DisplayName
Send Approval Task to Dir of Special Giving Inbox
Description
Send Approval Task to Dir of Special Giving Inbox and Waiting for Approval
DetailLevel
High
Your flowchart should look similar to this:
Step 11 - Add Sequence and LogMessage activities for the "true" business activity.
-
Double-click the "true" BusinessActivity named Donor is Already a Prospect.
-
Add a Sequence Activity within the BusinessActivity.
-
Add a LogMessage Activity within the Sequence Activity.
-
Add the following properties to the LogMessage Activity:
Property Name
Value
DisplayName
Donor is Already a Prospect
Message
"Constituent is already a prospect. No approval task sent to Dir. of Special Giving."
MessageType
InfoMessage
Your business activity should look similar to this:
Step 12 - Repeat the previous step for the "false" business activity.
-
Double-click the "false" BusinessActivity named Send Approval Task to Dir of Special Giving Inbox.
-
Add a Sequence Activity within the BusinessActivity.
-
Add a LogMessage Activity within the Sequence Activity.
-
Add the following properties to the LogMessage Activity:
Property Name
Value
DisplayName
Donor is Not Already a Prospect
Message
"Constituent is not already a prospect. Soon we will send a task to the Director of Special Giving."
MessageType
InfoMessage
Your business activity should look similar to this: