Forms

Workflow applications comprise several layers of technology that collaborate to create a composite application. When a workflow requires human interaction, it must include a layer that facilitates user input, referred to as the "presentation layer." In Workflow Studio, the primary element of this presentation layer is the form, which comes in two types: User Input and User Decision.

User Input forms allow users to enter information and submit the data back to the workflow for subsequent activities. These forms do not have "routing" capabilities, meaning they appear to any user currently running the workflow at the point in the process where the User Input form is placed.

On the other hand, User Decision forms should be used when a form needs to be routed to someone to provide information or make a decision. These forms offer routing options, create a workflow task for any "approvers" at that stage in the workflow, and send email notifications to the users when the form is routed to an approver for a decision.

Forms include components that enable users to input information into a workflow and allow you, as a workflow developer, to capture data for use throughout the workflow. Forms are designed in the Form Designer and then compiled and published to the Workflow Server. Workflow Studio generates a unique activity for compiled forms called a "Form activity." When a form is compiled into an activity, you can place the resulting activity onto the workflow's design surface, making its properties, known as "dependency properties," accessible for use throughout the workflow.

In Workflow Studio, form components comprise two category types: 

  • Primitives – allow you to place simple objects such as booleans, datetime controls, and string-based objects (i.e., fields, labels, etc.) on a form

  • RBAC components – allow you to place the properties of any component or view (e.g., First and Last names of a Person) on a form


This tutorial will guide you through the process of creating forms in Workflow Studio, including both User Input and User Decision forms, and adding multiple component types to each. We will start by creating a basic User Input form that can be used in a "Leave Request" workflow. Then, we will use this form as a basis for creating a related User Decision form, which a user can utilize to approve or deny the leave request.

The steps for this are as follows:

  1. Create a User Input form:

    1. In Workflow Studio, create a new form and choose the User Input form type.

    2. Name the form, for example, "LeaveRequestForm."

    3. Add components to the form, such as text fields for the leave request's start date, end date, and reason, as well as any other necessary fields.

  2. Configure the User Input form components:

    1. Set the properties for each component, such as labels, validation rules, and default values

    2. Bind the form components to the appropriate attributes or variables that will be used in the workflow.

  3. Create a User Decision form:

    1. In Workflow Studio, create a new form and choose the User Decision form type.

    2. Name the form, for example, "LeaveRequestApprovalForm."

    3. Add the same components as in the User Input form, as well as an additional component for the approver's decision (e.g., a dropdown list or radio buttons for "Approve" and "Deny").

  4. Configure the User Decision form components:

    1. Set the properties for each component, such as labels, validation rules, and default values.

    2. Bind the form components to the appropriate attributes or variables that will be used in the workflow.

    3. Configure the routing options and task assignment for the approver.

  5. Compile and publish the forms

Create a User Input form

  1. In the Workspace tree of Solution Explorer, right-click the Package node in which you want to create the form and select New User Interface > Form from the context menu.

     

  2. A form will appear in the workspace with some default naming.

     

  3. In the Properties pane, enter a name for the form in the Name field, and provide a title and description for the form in the Title and Description fields, respectively.

     

  4. Double-click directly on the default form tab's caption text to edit it. Change the caption from "Tab1" to "Request for Leave." After that, add primitive controls to the form, which will enable users to input information relevant to the workflow the form is intended for.

  5. Click the Add Object button from the Workflow Studio Form Designer Commands menu.

     

     

  6. In the "Add Object" window that appears, navigate to the Primitives tab. Select the DateTime and MultiLineString objects, and then click the Add button. The "DateTime" object utilizes a Calendar template, allowing users to select a date through a calendar interface. The "MultiLineString" control enables users to input multiple lines of text.

     

  7. Open the Add Object window again and add a second DateTime object to the form's Components tree.
    In the Components tree under the Other Objects node, DateTime1, DateTime2, and MultiLineString1 appear.

  8. To make it easier to identify the purpose of each primitive object you just added to the form's Component tree, double-click each object name to enable Edit mode and modify the names to something more meaningful. For instance, you can change:

    • DateTime1 to StartDate 

    • MultiLineString1 to ReasonForLeave 

    • DateTime2 to EndDate

  9. Place the components onto the form by dragging them from the Components tree and dropping them onto the form within the Form Designer.

  10. Right-click the text control and select Edit to open the Field Configuration window. Check the Is Double ColumnSpan option and click OK.

     

    As shown below, the above action allows the field to spread across the form.

     

     

Create the User Decision form

In the following example, we use the example User Input form shown above to create an Approval or User Decision form that can be linked to it in a workflow.

  1. Open the User Input form you created above, click the Common menu, and click the Save As button.

  2. In the Save As dialog that appears, name the form appropriately, saving it in the package of your choice.

  3. Right-click the Enter the text displayed in the image below section and click Delete Section.

     

    Next, we need to add a new section to the form that can bind the properties of the person initiating the request.

  4. Click the New Section button in the Workflow Studio Form Designer Commands menu to add the new section.

     

  5. Change the section's name to Initiator of the Request by double-clicking the default text.

     

     

  6. Click the Add Object button from the Workflow Studio Form Designer Command menu.

     

     

  7. IIn the "Add Object" window that appears, navigate to the Rbac Components tab. Locate and select the Person component, and then click the Add button. A dialog will appear, allowing you to drag any attributes associated with an EmpowerID Person onto the form as dependency properties.


    After clicking the "Add" button, a component named "Person1" will be added to the Components tree located on the left side of the form. The "Person1" component contains the attributes and properties related to EmpowerID Person objects.

     

  8. Double-click directly on the Person1 text to place it in Edit mode and change the object's name to Initiator. This data property represents the Person initiating the leave request.

     

  9. Expand the Initiator object node, locate the FriendlyName attribute, and drag it onto the Initiator section of the form.

     

  10. Edit the FriendlyName label, changing the text from FriendlyName to Name.

  11. From the Initiator object node in the Components tree, find the "Department", "Title", "Email", and "Telephone" attributes. Drag each attribute onto the form, arranging them to resemble the image provided below.


    Now we want to make all of the fields on the approval form read-only as we don't want the approver to have the ability to alter the original request data. In this scenario, the fields in the Request Details section of the form will receive their values from the information entered in the Request Details section of the Leave Request form by the request initiator, while the fields in the Initiator of the Request section will receive their values from the binding that occurs between the request initiator and the initiator component we just added to the form.

  12. Right-click the Start Date field and select Edit from the context menu.

     

  13. In the Field Configuration window that appears, select Read Only from the lower pane and then click OK to close the window.

     

  14. Repeat the above two steps for the rest of the objects in both sections of the form. Once completed, you should see only the object labels, as shown in the below image.

     

  15. From the Components tree, expand the Approval Decisions node and do the following to add buttons to the form that allow the approver to make a decision about the request.

    • Select Approved

    • Select Rejected

    • Select Delegated

    • Select ReturnedToSender

    • Deselect Submit

    • Deselect Canceled
      Also, make sure to choose User Decision in FormType in the form properties window.

       

  16. Save your changes and publish the form to make it available to workflows as a From activity.

Publish the forms


The forms developed above will have to be deployed to make them available to workflows. Build and deployment topics are detailed in the articles below,


 

In this article