Chapter 15. Business processes 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

15.1. Creating the business process

The following procedures guide you through the creation of tasks, connections, and gateways that make up the MortgageApprovalProcess 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 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]

15.1.1. 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.

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

Procedure

  1. Drag a start event node onto the canvas.
  2. 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
  3. 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.
    2. Hover over the config icon icon of the task and click the Convert into Business Rule icon.

      bus rule task
  4. Configure the business rule task:

    1. Click the business rules task.
    2. If the Properties panel is not open, in the upper-right corner click the Properties diagram properties icon.
    3. In the Properties panel, enter Validation in the Name field.
    4. Expand Implementation/Execution, select New from the Rule Flow Group menu, and input 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:

      • Data Inputs and Assignements

        • Name: application
        • Data Type: Application [com.myspace.mortgage_app]
        • Source: application
      • Data Outputs and Assignements

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

          Figure 15.1. Validation Data I/O assignments

          Screen capture of the Validation Data I/O assignments
  5. Click OK in the Validation Data I/O window.
  6. Above the canvas, click Save to confirm your changes.

15.1.2. 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. Drag the new task below the exclusive gateway as shown below.
    3. Hover over the config icon icon of the task and click the Convert into Business Rule icon.

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

    1. Click the connection.

      created connection
    2. If the Properties panel is not open, in the upper-right corner click the Properties diagram properties icon.
    3. In the 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.

      languagedropdown
  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. Drag the new task below the Validation task as shown below.
    3. Hover over the config icon icon of the task and click the Convert into User icon.

      user task
    4. Click on the new user task and in the Properties panel, enter Correct Data in the Name field.
    5. Expand Implementation/Execution and enter CorrectData in the Task Name field.
    6. Select New from the Groups menu, and input broker.
    7. Click btn assign next to Assignments.
    8. In the Correct Data Data I/O window, click Add and create the following assignments:

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

        • Data Outputs and Assignements
      • Name: application
      • Data Type: Application [com.myspace.mortgage_app]
      • Target: application

        Figure 15.2. Correct Data Data I/O assignments

        Screen capture of the Correct Data Data I/O assignments
    9. Click OK in the Correct Data Data I/O window.
    10. Above the canvas, click Save to confirm your changes.
  5. Click on the Correct Data user task, then click the Create sequence Flow icon and drag it back to the first exclusive gateway. Your workflow should look similar to the following diagram:

    workflow1

15.1.3. Calculating the mortgage

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

Procedure

  1. Return to the second exclusive gateway and create an outgoing connection to a new business rule task.
  2. Click the created connection and in the Properties panel, input Valid in the Name field.

    1. Expand Implementation/Execution and select Expression in the Condition Expression section.
    2. From the list, select drools and enter not ValidationErrorDO() in the Condition Expression field.
  3. Click the new business rule task and in the Properties panel, input Mortgage Calculation in the Name field.

    validconnection
    1. Expand Implementation/Execution, select New from the Rule Flow Group menu, and input mortgagecalculation.
  4. Expand Data Assignments and click btn assign next to Assignments.
  5. In the Mortgage Calculation Data I/O window, click Add to create the following assignments and click Save.

    Figure 15.3. Mortgage Calculation Data I/O assignments

    screen capture of the Mortgage Calculation Data I/O assignments
  6. Click OK in the Mortgage Calculation Data I/O window.
  7. 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: inlimit
    • Data Type: Boolean
  8. Create an outgoing connection from the Mortgage Calculation task to a new user task.
  9. Click the user task, enter Qualify in the Name field.
  10. Expand Implementation/Execution and enter Qualify in the Task Name field.
  11. Select New from the Groups menu, and input approver.
  12. Click btn assign next to Assignments. In the Qualify Data I/O window, click Add to create the following assignments:

    Figure 15.4. Qualify Data I/O assignments

    Screen capture of the Qualify Data I/O assignments
  13. Click OK in the Qualify Data I/O window.
  14. Above the canvas, click Save to confirm your changes.
  15. Click on the Qualify user task, click on the Create parallel menu icon, and convert it to an exclusive gateway.
  16. Drag the new exclusive gateway below the Qualify user task.
  17. Create an outgoing connection from the exclusive gateway and connect it to a new user task.
  18. Click the connection and input In Limit in the Name field of the Properties panel.
  19. Expand Implementation/Execution and select Condition in the Condition Expression section.
  20. Select inlimit from the Process Variable drop-down menu and select Is true from the Condition drop-down menu.

    inlimit true
  21. Click the user task, enter Final Approval in the Name field.
  22. Expand Implementation/Execution and enter FinalApproval in the Task Name field.
  23. Select New from the Groups menu, and input manager.
  24. Click btn assign next to Assignments. In the Final Approval Data I/O window, click Add to create the following assignments:

    Figure 15.5. Final Approval Data I/O assignments

    Screen capture of the Final Approval Data I/O assignments
  25. Click OK in the Final Approval Data I/O window.
  26. Above the canvas, click Save to confirm your changes.

15.1.4. 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. Click on the Final Approval user task and select Create End from the user task quick menu.
  2. Move the end event below the Final Approval user task.

    create end
  3. 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
  4. Click the connection and input Not in Limit in the Name field of the Properties panel.
  5. Expand Implementation/Execution and select Condition in the Condition Expression section.
  6. Select inlimit from the Process Variable drop-down menu and select Is false from the Condition drop-down menu.
  7. 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
  8. Click the new user task and in the Properties panel, input Increase Down Payment in the Name field.
  9. Expand Implementation/Execution and enter IncreaseDownPayment in the Task Name field.
  10. Select New from the Groups menu, and input broker.
  11. Click btn assign next to Assignments. In the Increase Down Payment Data I/O window, click Add to create the following assignments:

    Figure 15.6. Increase Down Payment Data I/O assignments

    Screen capture of the Increase Down Payment Data I/O assignments
  12. Click OK in the Increase Down Payment Data I/O window.
  13. Above the canvas, click Save to confirm your changes.
  14. Click on the Increase Down Payment user task, click on the Create parallel menu icon, and convert it to an exclusive gateway.
  15. Drag the new exclusive gateway below the Increase Down Payment user task.
  16. Create an outgoing connection from the exclusive gateway to an end event.
  17. Click the connection and input Down payment not increased in the Name field of the Properties panel.
  18. Expand Implementation/Execution and select Expresssion in the Condition Expression section.
  19. Input return !incdownpayment; and select java from the drop-down menu.
  20. Create an outgoing connection from the exclusive gateway and connect it to the first exclusive gateway.
  21. Click the connection and input Down payment increased in the Name field of the Properties panel.
  22. Expand Implementation/Execution and select Expresssion in the Condition Expression section.
  23. Input return incdownpayment; and select java from the drop-down menu.
  24. Above the canvas, click Save to confirm your changes and save the entire business process.

Figure 15.7. Final version of the business process

Screen capture of the Final version of the business process