Chapter 4. Designing the case definition
You design cases using the process designer in Business Central. Case design is the basis of case management and sets the specific goals and tasks for each case. The case flow can be modified dynamically during run time by adding dynamic tasks or processes. In this procedure, you will create this same case definition to familiarize yourself with the case definition design process.
The IT_Orders sample project in Business Central includes the following orderhardware business process case definition.
Figure 4.1. orderhardware business process case definition
Prerequisites
- You have created a new case in Business Central. For more information, see Chapter 2, Creating a new IT_Orders case project.
- You have created the data objects. For more information, see Chapter 3, Data objects.
Procedure
- In Business Central, go to Menu → Design → Projects and click IT_Orders_New.
- Click Add Asset → Case Definition.
In the Create new Case definition window, add the following required information:
-
Case Definition: Input
orderhardware
. This is usually the subject of the case or project that is being case managed. - Package: Select com.myspace.it_orders_new to specify the location that the case file is created in.
-
Case Definition: Input
- Click Ok to open the process designer.
Define values for the case file variables that are accessible to the subprocesses, subcases, and business rules used in the case.
- In the upper-right corner, click the Diagram properties icon.
Scroll down and expand Case Management, click in the Case File Variables section, and enter the following:
Figure 4.2. orderhardware case file variables
NoteThe following case file variables are custom data types:
- hwSpec: org.jbpm.document.Document (type in this value)
- survey: Survey [com.myspace.it_orders_new] (select this value)
- Click Save.
Define the roles involved in the case.
- In the upper-right corner, click the Diagram properties icon.
Scroll down and expand Case Management, click in the Case Roles section, and enter the following:
Figure 4.3. orderhardware case roles
-
owner
: The employee who is making the hardware order request. The role cardinality is set to1
, which means that only one person or group can be assigned to this role. -
manager
: The employee’s manager; the person who will approve or deny the requested hardware. The role cardinality is set to1
, which means that only one person or group can be assigned to this role. -
supplier
: The available suppliers of IT hardware in the system. The role cardinality is set to2
, which means that more than one supplier can be assigned to this role.
-
- Click Save.
4.1. Creating the Place order subprocess
Create the Place order subprocess, which is a separate business process that is carried out by the supplier. This is a reusable process that occurs during the course of case execution as described in Chapter 4, Designing the case definition.
Prerequisites
- You have created a new case in Business Central. For more information, see Chapter 2, Creating a new IT_Orders case project.
- You have created the data objects. For more information, see Chapter 3, Data objects.
Procedure
- In Business Central, go to Menu → Design → Projects → IT_Orders_New.
- From the project menu, click Add Asset → Business Process.
In the Create new Business Process wizard, enter the following values:
-
Business Process:
place-order
-
Package: Select
com.myspace.it_orders_new
-
Business Process:
- Click Ok. The diagram editor opens.
- Click an empty space in the canvas, and in the upper-right corner, click the Diagram properties icon.
Scroll down and expand Process Data and click in the Process Variables section and enter the following:
- Click Save.
Drag a start event onto the canvas and create an outgoing connection from the start event to a task and convert the new task to a user task.
-
Click the user task and in the Diagram properties panel, input
Place order
in the Name field. -
Expand Implementation/Execution, click Add below the Groups menu, click Select → New, and input
supplier
. Click in the Assignments field and add the following:
For the first input assignment, select Custom for the Data Type and input
org.jbpm.document.Document
.- Click Save.
Select the Skippable check box and enter the following text in the Description field:
Approved order #{CaseId} to be placed
Create an outgoing connection from the Place order user task and connect it to an end event.
- Click Save to confirm your changes.
4.2. Creating the Manager approval business process
The manager approval process determines whether or not the order will be placed or rejected.
Procedure
- In Business Central, go to Menu → Design → Projects → IT_Orders_New → orderhardware Business Processes.
Create and configure the prepare hardware spec user task:
- Drag a start event onto the canvas and create an outgoing connection from the start event to a task and convert the new task to a user task.
- Click the new user task and in the upper-right corner click the Properties icon.
-
Input
Prepare hardware spec
in the Name field. -
Expand Implementation/Execution, click Add below the Groups menu, click Select → New, and input
supplier
. -
Input
PrepareHardwareSpec
in the Task Name field. Select the Skippable check box and enter the following text in the Description field:
Prepare hardware specification for #{initiator} (order number #{CaseId})
Click in the Assignments field and add the following:
- Click Save.
Create and configure the manager approval user task:
- Click the Prepare hardware spec user task and create a new user task.
- Click the new user task and in the upper-right corner click the Properties icon.
-
Click the user task and in the Properties panel input
Manager approval
in the Name field. -
Expand Implementation/Execution, click Add below the Actors menu, click Select → New, and input
manager
. -
Input
ManagerApproval
in the Task Name field. Click in the Assignments field and add the following:
- Click Save.
Select the Skippable check box and enter the following text in the Description field:
Approval request for new hardware for #{initiator} (order number #{CaseId})
Enter the following Java expression in the On Exit Action field:
kcontext.setVariable("caseFile_managerDecision", approved);
- Click Save.
Click the Manager approval user task and create a Data-based Exclusive (XOR) gateway.
Create and configure the place order reusable subprocess:
From the Object Library, expand Subprocesses, click Reusable, and drag the new element to the canvas on the right side of the Data-based Exclusive (XOR) gateway.
Connect the Data-based Exclusive (XOR) gateway to the subprocess.
- Click the new sub task and in the upper-right corner click the Properties icon.
-
Input
Place order
in the Name field. Expand Data Assignments and click in the Assignments field and add the following:
- Click the connection from the Data-based Exclusive (XOR) gateway to the subprocess and click the Properties icon.
Expand Implementation/Execution, select Condition, and set the following condition expressions.
- Click the Place order user task and create an end event.
Create and configure the order rejected user task:
- Click the Data-based Exclusive (XOR) gateway and create a new user task.
Drag the new task to align it below the Place order task.
- Click the new user task and in the upper-right corner click the Properties icon.
-
Input
Order rejected
in the Name field. -
Expand Implementation/Execution and input
OrderRejected
in the Task Name field. -
Click Add below the Actors menu, click Select → New, and input
owner
. Click in the Assignments field and add the following:
- Click Save.
Select the Skippable check box and enter the following text in the Description field:
Order #{CaseId} has been rejected by manager
- Click the Order rejected user task and create an end event.
- Click Save.
- Click the connection from the Data-based Exclusive (XOR) gateway to the Order rejected user task and click the Properties icon.
Expand Implementation/Execution, select Condition, and set the following condition expressions.
Click Save.
Figure 4.4. Manager approval business process