Chapter 5. MortgageApprovalProcess business process in Business Central

A business process is a diagram that describes the order in which a series of steps must be executed using a flow chart. A business process consists of a collection of nodes that are linked to each other using connections. Each of the nodes represents one step in the overall process while the connections specify how to transition from one node to the other.

The sample Mortgage_Process contains the following predefined MortgageApprovalProcess business process.

sampleBP

5.1. Delete the existing MortgageApprovalProcess process application

For this tutorial, delete the existing MortgageApprovalProcess business process and recreate it to gain a better understanding of creating a business process. Creating a new business process using the same name ensures that the sample project deploys and tests without error.

Procedure

  1. In Business Central, go to MenuDesignProjectsMortgage_Process.
  2. Input MortgageApprovalProcess.bpmn in to the project’s asset search box and click MortgageApprovalProcess.
  3. Select Delete from the toolbar, and click Delete to confirm that you want to delete this asset.

5.2. Creating a new MortgageApprovalProcess business process application

The following procedures guide you through the creation of tasks, connections, and gateways that make up the MortgageApprovalProcess business process.

Red Hat Process Automation Manager contains a predefined selection of node types to simplify business process creation. The predefined node panel is located on the left side of the diagram editor.

node panel

5.2.1. Creating the initial mortgage business process

The mortgage validation business process determines whether a mortgage application contains all required data. If the specified data requirements are met, the application proceeds on to the mortgage calculation business process.

Procedure

  1. In Business Central, go to MenuDesignProjectsMortgage_Process.
  2. Click Add AssetBusiness Process.
  3. Enter the following values:

    • Business Process: MortgageApprovalProcess
    • Package: Select com.myspace.mortgage_app

      The Package specifies the location inside the existing project where the asset will be created. In this example, it is created in com/myspace/mortgage_app.

  4. Click Ok. The diagram editor opens.
  5. In the upper-right corner, click the Diagram properties diagram properties icon.
  6. Scroll down and expand Process Data and click btn plus in the Process Variables section.
  7. Enter the following values:

    • Name: application
    • Data Type: Application [com.myspace.mortgage_app]

5.2.2. Creating outgoing connections and exclusive gateways

This section shows you how to create outgoing connections, exclusive gateways, and business rule tasks. Use exclusive gateways to make decisions and react to events based on the available data.

Procedure

  1. Create an outgoing connection from the start event to an exclusive gateway:

    1. On the canvas, click the start event node and click the Create Parallel icon.

      create parallel
    2. Hover over the config icon icon of the parallel and click the Convert into Exclusive icon.

      exclusive gateway
  2. Create an outgoing connection from the exclusive gateway to a business rule task:

    1. On the canvas, click the exclusive gateway and click the Create Task icon.

      create task
    2. Hover over the config icon icon of the task and click the Convert into Business Rule icon.

      bus rule task
  3. Configure the business rule task:

    1. Click the business rules task.
    2. If the Diagram properties panel is not open, in the upper-right corner click the Diagram properties diagram properties icon.
    3. In the Diagram properties panel, enter Validation in the Name field.
    4. Expand Implementation/Execution and from the Rule Flow Group list select validation.
    5. In the On Exit Action field, enter the following Java expression:

      System.out.println(application.getProperty());
    6. Expand Data Assignments and click btn assign next to Assignments.
    7. In the Validation Data I/O window, click Add and create the following assignments:

      val data io
    8. Click Save.
  4. In the diagram editor, to save the changes made to the business process, click Save and click Save again to confirm your changes.

5.2.3. Defining the validation data

This section shows you how to define the validation data that determines whether the application data is correct, contains an error, or has missing information.

Procedure

  1. Create an outgoing connection from the Validation task to an exclusive gateway:

    1. Click the Validation task and click the Create Parallel icon.
    2. Hover over the config icon icon of the parallel and click the Convert into Exclusive icon.

      exclusive gateway
  2. Create an outgoing connection from the exclusive gateway to a new business rule task:

    1. Click the exclusive gateway and click the Create Task icon.
    2. Hover over the config icon icon of the task and click the Convert into Business Rule icon.

      new br task
    3. If the Diagram properties panel is not open, in the upper-right corner click the Diagram properties diagram properties icon.
    4. In the Diagram properties panel, enter Retract Validation in the Name field.
    5. Expand Implementation/Execution and enter error in the Rule Flow Group field.
  3. Configure the connection between the exclusive gateway and the business rule task:

    1. Click the connection.

      created connection
    2. If the Diagram properties panel is not open, in the upper-right corner click the Diagram properties diagram properties icon.
    3. In the Diagram properties panel, enter Invalid in the Name field.
    4. Expand Implementation/Execution and select Expression in the Condition Expression section.
    5. From the list, select drools and enter ValidationErrorDO() in the Condition Expression field.
  4. Create an outgoing connection from the Retract Validation task to a new user task:

    1. Click the Retract Validation task and click the Create Task icon.
    2. Hover over the config icon icon of the task and click the Convert into User icon.

      user task
    3. If the Diagram properties panel is not open, in the upper-right corner click the Diagram properties diagram properties icon.
    4. In the Diagram properties panel, enter Correct Data in the Name field.
    5. Expand Implementation/Execution and enter the following values:

      • Task Name: CorrectData
      • Groups: broker
    6. Click btn assign next to Assignments.
    7. In the Correct Data Data I/O window, click Add and create the following assignments:

      correct data io
    8. Click Save.
  5. Connect the Correct Data back to the first exclusive gateway. Your workflow should look similar to the following diagram:

    workflow1

5.2.4. Calculating the mortgage

The mortgage calculation business process determines the applicant’s mortgage borrowing limit.

Procedure

  1. Return to the second exclusive gateway. Create an outgoing connection to a business rule task.

    second gateway
  2. Click the created connection and in the Diagram properties panel, input Valid in the Name field.
  3. Expand Implementation/Execution, select Expression in the Condition Expression section, and enter not ValidationErrorDO() in the drools expression field.
  4. Click the created business rule task and in the Diagram properties panel, input Mortgage Calculation in the Name field.
  5. Expand Implementation/Execution and select mortgagecalculation from the Rule Flow Group drop-down menu.
  6. Expand Data Assignments and click btn assign next to Assignments.
  7. In the Mortgage Calculation Data I/O window, click Add to create the following assignments and click Save.

    mortgage calc assignments
  8. Click an empty space on the canvas, scroll down, expand Process Data, and click btn plus next to Process Variables. Enter the following values:

    new proc var
    • Name: inlimit
    • Date Type: Boolean
  9. Create an outgoing connection from the Mortgage Calculation task to a user task.

    qualify task
  10. Click the user task, enter Qualify in the Name field, expand Implementation/Execution, and enter the following values:

    • Task Name: Qualify
    • Groups: approver
    • Click btn assign next to Assignments. In the Qualify Data I/O window, click Add to create the following assignments:

      qualify io
  11. Click Save. Above the canvas, click Save, and Save, to confirm your changes.
  12. Create an outgoing connection from the Qualify task to an exclusive gateway.

    1. Click the GATEWAYS icon in the node panel.
    2. Click Exclusive and drag it to the right of the Qualify task.
  13. Create an outgoing connection from the exclusive gateway and connect it to a user task.
  14. Click the connection and input in Limit in the Name field of the Diagram properties panel.
  15. Expand Implementation/Execution and select Condition in the Condition Expression section.
  16. Select inlimit from the Process Variable drop-down menu and select Is true from the Condition drop-down menu.

    inlimit true
  17. Click the user task, enter Final Approval in the Name field, expand Implementation/Execution, and enter the following values:

    • Task Name: FinalApproval
    • Groups: manager
  18. Click btn assign next to Assignments. In the Final Approval Data I/O window, click Add to create the following assignments:

    approval io
  19. Click Save. Above the canvas, click Save, and Save, to confirm your changes.

5.2.5. Increasing the down payment

The increasing the down payment business process checks to see if the applicant qualifies for the loan by increasing their down payment. The final result is either the final loan approval, or loan denial based on the applicant’s inability to increase the down payment.

Procedure

  1. Create an outgoing connection from the Final Approval user task and connect it to an end event.

    create end
  2. Return to the exclusive gateway that connects with the Final Approval user task. Create a second outgoing connection and connect it to a new user task.

    new task
  3. Click the connection and input Not in Limit in the Name field of the Diagram properties panel.
  4. Expand Implementation/Execution and select Condition in the Condition Expression section.
  5. Select inlimit from the Process Variable drop-down menu and select Is false from the Condition drop-down menu.
  6. Click an empty space on the canvas, scroll down, expand Process Data, and click btn plus next to Process Variables. Enter the following values:

    • Name: incdownpayment
    • Data Type: Boolean

      proc var new
  7. Click the new user task and in the Diagram properties panel, input Increase Down Payment in the Name field.
  8. Expand Implementation/Execution and enter the following values:

    • Task Name: IncreaseDownPayment
    • Groups: broker
    • Click btn assign next to Assignments. In the Increase Down Payment Data I/O window, click Add to create the following assignments:

      increase down io
  9. Click Save. Above the canvas, click Save, and Save, to confirm your changes.
  10. Create an outgoing connection from the Increase Down Payment user task to an exclusive gateway.
  11. Create an outgoing connection from the exclusive gateway to an end event.
  12. Click the connection and input Down payment not increased in the Name field of the Diagram properties panel.
  13. Expand Implementation/Execution and select Condition in the Condition Expression section.
  14. Select incdownpayment from the Process Variable drop-down menu and select Is false from the Condition drop-down menu.
  15. Create an outgoing connection from the exclusive gateway and connect it to the first exclusive gateway.
  16. Click the connection and input Down payment increased in the Name field of the Diagram properties panel.
  17. Expand Implementation/Execution and select Condition in the Condition Expression section.
  18. Select incdownpayment from the Process Variable drop-down menu and select Is true from the Condition drop-down menu.
  19. Click Save, and Save, to confirm your changes.

Figure 5.1. Final version of the business process

finalBP