Chapter 27. 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 27.1. orderhardware business process case definition
Prerequisites
- You have created a new case in Business Central. For more information, see Chapter 25, Creating a new IT_Orders case project.
- You have created the data objects. For more information, see Chapter 26, 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 sub-processes, subcases, and business rules used in the case.
- In the upper-right corner, click the Properties icon.
Scroll down and expand Case Management, click in the Case File Variables section, and enter the following:
Figure 27.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 Properties icon.
Scroll down and expand Case Management, click in the Case Roles section, and enter the following:
Figure 27.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.
27.1. Creating the Place order sub-process
Create the Place order
sub-process, 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 27, Designing the case definition.
Prerequisites
- You have created a new case in Business Central. For more information, see Chapter 25, Creating a new IT_Orders case project.
- You have created the data objects. For more information, see Chapter 26, 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 Properties icon.
Scroll down, expand Process Data, click in the Process Variables section, and enter the following values under Process Variables:
Table 27.1. Process variables Name Data Type CaseID
String
Requestor
String
_hwSpec
org.jbm.doc
ordered_
Boolean
info_
String
caseFile_hwSpec
org.jbm.doc
caseFile-ordered
Boolean
caseFile-orderinf
String
Figure 27.4. Completed process variables
- 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 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 data inputs and outputs in the Place order Data I/O dialog box:
Table 27.2. Data inputs and assignements Name Data Type Source _hwSpec
org.jbpm.document
caseFile_hwSpec
orderNumber
String
CaseId
Requestor
String
Requestor
Table 27.3. Data outputs and assignements Name Data Type Target ordered_
Boolean
caseFile_ordered
info_
String
CaseFile_orderInfo
For the first input assignment, select Custom for the Data Type and input
org.jbpm.document.Document
.- Click OK.
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.
You can open the sub-process in a new editor in Business Central by clicking the Place order task in the main process and then clicking the Open Sub-process task icon.
27.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:- Expand Tasks in the Object Library and drag a user task onto the canvas and convert the new task to a user task.
- Click the new user task and click the Properties icon in the upper-right corner.
-
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 OK.
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 click the Properties icon in the upper-right corner.
-
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 OK.
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 sub-process:From the Object Library, expand sub-processes, 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 sub-process.
- Click the new sub task and click the Properties icon in the upper-right corner.
-
Input
Place order
in the Name field. Expand Data Assignments and click in the Assignments field and add the following:
- Click OK.
- Click the connection from the Data-based Exclusive (XOR) gateway to the sub-process 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 click the Properties icon in the upper-right corner.
-
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 OK.
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 27.5. Manager approval business process