Skip to content

Creating An IfElse Business Rule

An IfElse activity allows you to create rules based on conditions. The IfElse activities go from left to right, so the first condition is in Branch 1. If that condition is true, the business rule will fire down that branch. If Branch 1 is false, the business rule will move on to Branch 2 and fire down that branch. You can add as many branches to the IfElse activity as desired. The activity will keep moving across from branch to branch until a condition is met.

You can select any activity for the IfElse statements just as you would in any other business rule.

  1. Click the Current Record/Grid View button Grid View
    Icon, or press Ctrl+G to change to Current Record View.

    The workflow will appear, along with a list of possible activities.

  2. Add a new record.

  3. Complete the following fields:

    • Start Type: Select the start type from the list:
      • After Update: Starts the business rule after the database has been updated.
      • Batch: Creates a batched workflow that runs on a schedule.
      • Before Update: Starts the business rule before the database is updated.
    • Workflow Name: Name the business rule.
    • Active: Select this check box to make the business rule active.
    • Wait for Execution: If this box is checked, you will have to wait for the results of the business rule to return before proceeding. If this box is not checked, the workflow will run prior to the completion of the business rule's execution.
  4. Click and drag the IfElse activity from the Activity Pane into the Workflow Editor.

    An IfElse diagram will appear in the Workflow Editor: If Else Business Rule Activity

  5. Configure Branch 1 of the IfElse activity.

    1. Configure ifElseBranch1 in the Activity Configuration snap-in.

      Caution: Configuring each IfElse branch is crucial to proper functionality of your business rule. You must tell each IfElse branch what condition to look for and where.

      • DataSet: When a session is saved in JustWare, all datasets are sent to the Web service. Consequently, when creating a business rule, it is necessary to define which data set you want the business rule to search through. Choose from the following options:
        • Original Data: Select to search the data in its original state (before it was updated).
        • Inserted Data: Select to search data that was just inserted into the session.
        • Updated Data: Select to search data that was just updated. This is different from Inserted Data in that nothing new has been added; data has simply been updated in the snap-in.
        • Deleted Data: Select to search data that was just deleted in the session.
        • Proposed Data: Select to search data that is being submitted in the session.
      • Snap-in Name: Specify the name of the snap-in that the business rule will search through to determine a condition.
      • Select String: A line of code that you use to define the condition the business rule is checking for. It usually defines a specific field in a snap-in that the business rule should search in. The Select String is crucial for an IfElse business rule to fire properly. It must be written correctly or the business rule will fail. More information on writing Select String statements can also be found at the Microsoft Developers Center at http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx.
      • Name: The default name for the activity auto-populates this field. To rename the activity, type a name with no spaces.
      • Description: Type a description for the activity.
      • Active: Select this check box to activate the specified activity. If this check box is cleared, the rest of the business rule will still run; only this activity will be disabled.
    2. Configure both the trigger and the result in Branch 1 in the Activity Configuration snap-in.

    3. Configure Branch 2 of the IfElse activity.
    4. Configure ifElseBranch2 in the Activity Configuration snap-in. Click for details.

      • DataSet: When a session is saved in JustWare, all datasets are sent to the Web service. Consequently, when creating a business rule, it is necessary to define which data set you want the business rule to search through. Choose from the following options:
        • Original Data: Select to search the data in its original state (before it was updated).
        • Inserted Data: Select to search data that was just inserted into the session.
        • Updated Data: Select to search data that was just updated. This is different from Inserted Data in that nothing new has been added; data has simply been updated in the snap-in.
        • Deleted Data: Select to search data that was just deleted in the session.
        • Proposed Data: Select to search data that is being submitted in the session.
      • Snap-in Name: Specify the name of the snap-in that the business rule will search through to determine a condition.
      • Select String: A line of code that you use to define the condition the business rule is checking for. It usually defines a specific field in a snap-in that the business rule should search in. The Select String is crucial for an IfElse business rule to fire properly. It must be written correctly or the business rule will fail. More information on writing Select String statements can also be found at the Microsoft Developers Center at http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx.
      • Name: The default name for the activity auto-populates this field. To rename the activity, type a name with no spaces.
      • Description: Type a description for the activity.
      • Active: Select this check box to activate the specified activity. If this check box is cleared, the rest of the business rule will still run; only this activity will be disabled.
    5. Configure both the trigger and the result in Branch 2 in the Activity Configuration snap-in.

    6. Configure any remaining branches in your IfElse activity.

    Note: On the last branch of your IfElse activity, you can either configure the IfElseBranch condition or you can leave it blank. If you configure the condition, it will be tested. If you leave the condition blank, then the branch will be treated as an "else," and the activities in the branch will occur.

  6. Configure the business rule for either Non-batched Workflows or Batched Workflows:

    Workflow Type Description
    Non-batched Workflows To run the business rule when a snap-in is modified, select desired parameters in the Non-batched Workflows snap-in. See Non-batched Workflows Snap-in for more information.
    Batched Workflows To automatically run the business rule on a schedule, select desired parameters in the Batched Workflows snap-in. See Batched Workflows Snap-in for more information.
  7. Indicate the agencies that this workflow will be executed for in the Execute For The Following Agencies snap-in. By default, all the agencies are selected.

  8. Save the Session. (Click Save button or Ctrl+S)

Related Topics