Create a case management app
To start developing your case management app using the Case Management framework, you start by creating a few modules that support the definition of your main case.
Follow this guide to create the basis of your case management app, with the following modules:
-
The user interface (UI) module which contains the screens of your app needed for end users to interact with the cases. Follow the optional step in this guide to create a simple version of this module so you can test your app.
-
A core services (CS) module which contains the case business entity, the case definition and the case status definitions for a case. Each core services modules can only include one case definition.
-
The workflow (WF) module which contains the BPT processes associated with case definitions.
Prerequisites
Before you proceed, make sure that you installed the latest version of the Case Management framework in your environment.
Overview
Step 1. Create the app and a core services module
Step 2. Create the business entity and the case definition
Step 3. Associate the business entity with case
Step 4. Create the initial case status
Step 5. Create bootstrapping action
Step 6. Create the workflow module
Optional step. Test your Reactive Web app setup
Step 1. Create your app and the core services module
Start by creating your app and adding the core services module. The core services module is where you build the business logic and the corresponding public actions, and the configuration mechanisms for the case definition that you need while developing your apps with the Case Management framework.
Let's create an app, then create a core services module for your case, and finally create the business entity for your case. Follow these steps:
-
In Service Studio, create a new app.
Create a Reactive Web app or a Traditional Web app. The last optional step of this guide only works for Reactive Web apps.
-
Create a Service module and name it
<business-entity-name>_CS
.Replace <business-entity-name> with a name that represents the business entity that will be associated with the case definition of your app. For example, if you are creating a support ticketing app, use
Ticket
as the <case-entity-name> since your cases represent support tickets. -
In <business-entity>_CS, open Manage Dependencies, and add the following dependencies:
-
From the CM_Case_CS producer, add the Case entity.
-
From the CaseConfigurations_API producer, add the SetupCaseManagementApplication action.
-
From the CaseServices_API producer, add the Case_Initialize action.
-
From the CM_CaseDefinition_CS producer, add the PurgeType static entity.
-
-
In the Data tab, create a new Entity for the business data of the cases, and set the name and add relevant attributes. For example, name the new entity
Ticket
, and add aDescription
text attribute. -
Set the Public property of the entity to Yes.
-
Set the Data Type of the Id attribute to Case Identifier.
-
Right-click the entity, select Edit Entity, and in the Advanced tab select Expose Process Events.
Step 2. Create the case definition
Next, let's create a static entity to keep the case definition and then create a record for the first case definition of your app. Follow these steps:
-
In the Data tab of <business-entity>_CS, create a Static Entity, and name it
CaseDefinitionConfiguration
. -
Set the Public property to Yes.
-
Rename the Id attribute to
CaseDefinitionId
, and the Data Type as Text. -
Rename the Label attribute as
Name
. -
Add a new attribute named
Description
, with the Data Type set as Text. -
Add a new attribute named
HasAccessControl
, with the Data Type set as Boolean. -
Add a new attribute named
PurgeTypeId
, with the Data Type set as PurgeTypeId. -
Add a new attribute named
DaysToPurgeCase
, with the Data Type set as Integer. -
Add a new attribute named
DaysToPurgeProcess
, with the Data Type set as Integer. -
Delete Order and Is_Active attributes.
-
To configure the case definition, add a Record to the CaseDefinitionConfiguration static entity. Name the record
CaseDefinition
. -
Generate a GUID and paste that GUID into the value field of the CaseDefinitionId attribute of the CaseDefinition record.
A Globally Unique IDentifier, or GUID, is used as a unique identifier to ensure integrity across environments.
You can use an online GUID generator to create a GUID for each record.Check the RFC 4122 for more information on GUIDs and their format.
-
Set the Name and Description attributes of the CaseDefinition record.
Step 3. Associate business entity with case
In this step you add an action to the core services module that associates the business entity with the case definition. Follow these steps:
-
In the Logic tab of <business-entity>_CS, create a Server Action, and name it
<business-entity-name>_Create
, where <business-entity-name> is the name of the entity created in Step 1. This action is used to encapsulate the logic to initialize the case. -
Set the Public property of the action to Yes.
-
Add an Input Parameter and name it
<business-entity-name>
. Ensure the data type of the parameter is set as <business-entity-name>. -
In the action flow of <business-entity-name>_Create, add a Case_Initialize action between the Start and End.
-
Set CaseDefinitionId of the Case_Initialize action as
TextToIdentifier(Entities.CaseDefinitionConfiguration.CaseDefinition)
. -
Add an Assign after the Case_Initialize action, and set the
<business-entity-name>.Id
(the identifier of the input parameter) asCase_Initialize.CaseId
(the output of Case_Initialize). -
Add a Create<business-entity-name> action after the assign, and set the Source as the input parameter.
Step 4. Create the initial case status
In this step you create the initial case status of the case definition. Follow these steps:
-
In the Data tab of <business-entity>_CS, create a Static Entity, and name it
CaseStatusConfiguration
. -
Set the Public property to Yes.
-
Rename the Id attribute to
CaseStatusId
, and the Data Type as Text. -
Rename the Label attribute as
Name
. -
Add a new Text attribute named
Alias
. -
Add a new Boolean attribute named
IsInitial
. -
Rename the Is_Active attribute to
IsActive
. -
Add a Record to the CaseStatusConfiguration static entity.
-
Name the record
<initial-state>
, where <initial-state> represents the initial state of a case in your app, for exampleSubmitted
. -
Set IsInitial as True.
-
Generate a GUID and paste that GUID into the value field of the CaseStatusId attribute of the <initial-state> record.
A Globally Unique IDentifier, or GUID, is used as a unique identifier to ensure integrity across environments.
You can use an online GUID generator to create a GUID for each record.Check the RFC 4122 for more information on GUIDs.
Step 5. Create bootstrapping action
In this step you create an action that bootstraps the case definition and case status definition every time you publish the core services module. Follow these steps:
-
In the Processes tab of <business-entity>_CS, add a Timer and name it
Bootstrap_CaseConfiguration
. -
Set the Schedule property of the timer as When Published.
-
In the Action property of the new timer, select New Server Action.
-
Drag the CaseDefinitionConfiguration static entity to the new action flow to add an Aggregate that fetches all records in CaseDefinitionConfiguration.
-
Drag the CaseStatusConfigurations static entity to the action flow after the previous aggregate to add an Aggregate that fetches all records in CaseStatusConfigurations.
-
In the action, create a new Local Variable, name it SetupData, and set the Data Type as SetupData.
-
Add an Assign after the aggregate that fetches all the CaseStatusConfigurations, and add the following assignments:
- Set SetupData.BusinessEntityEspaceId as
GetOwnerEspaceIdentifier()
. - Set SetupData.CaseDefinition as
GetCaseDefinitionConfigurations.List.Current
and complete the mapping with the data from the aggregate:- Set CaseDefinitionId as
TextToIdentifier(GetCaseDefinitionConfigurations.List.Current.CaseDefinitionConfiguration.CaseDefinitionId)
. - Set Name as
CaseDefinitionConfiguration.Name
. - Set Description as
CaseDefinitionConfiguration.Description
. - Set HasAccessControl as
CaseDefinitionConfiguration.HasAccessControl
. - Set PurgeTypeId as
CaseDefinitionConfiguration.PurgeTypeId
. - Set DaysToPurgeCase as
CaseDefinitionConfiguration.DaysToPurgeCase
. - Set DaysToPurgeProcessas
CaseDefinitionConfiguration.DaysToPurgeProcessas
.
- Set CaseDefinitionId as
- Set SetupData.CaseStatusList as
GetCaseStatusConfigurations.List
and complete the mapping with the data from the aggregate:- Set CaseStatusId as
TextToIdentifier(CaseStatusConfiguration.CaseStatusId)
. - Set Name as
CaseStatusConfiguration.Name
. - Set Alias as
CaseStatusConfiguration.Alias
. - Set IsInitial as
CaseStatusConfiguration.IsInitial
. - Set IsActive as
CaseStatusConfiguration.IsActive
.
- Set CaseStatusId as
- Set SetupData.BusinessEntityEspaceId as
-
Add a SetupCaseManagementApplication action after the Assign.
-
Set SetupData of the SetupCaseManagementApplication as the local variable
SetupData
. -
Publish the module by selecting 1-Click Publish.
Step 6. Create a module for the workflow
In this step you create the workflow module, where you can later build the processes for case definitions using BPT.
Follow these steps:
-
In app details, create a Blank module and name it
<app-name>_WF
. -
In the <app-name>_WF module, open Manage Dependencies, add the following dependencies:
-
From the <business-entity>_CS producer, add the business entity you created in Step 1.
-
From the CaseServices_API producer, add the Case_AssociateProcess action.
-
-
In the Process tab, create a new Process.
-
Set the Launch On property to the Create<business-entity-name> entity action, where <business-entity-name> is the name of the business entity created in Step 1.
-
In the elements tree, right-click the process and select Add Callback Action > On Process Start.
-
In the On Process Start action, add the Case_AssociateProcess action between the Start and End.
-
Set the following properties of the Case_AssociateProcess action:
-
Set CaseId as
<business-entity-name>Id
, where <business-entity-name> is the name of the business entity you created in Step 1. -
Set ProcessId as
ProcessId
.
-
-
Publish the module by selecting 1-Click Publish.
If you created a Reactive Web App you can check out the next optional step to learn how to create the UI module and test the setup of your case management app.
Otherwise you can check out the next steps on developing your case management app.
Optional step. Test your Reactive Web app setup
The following steps are for Reactive Web Apps only.
Let's make sure the setup of your case management app is complete by adding a UI module that you can use to test your app.
Follow these steps:
-
Create a Reactive Web App module and name it
<app-name>_UI
. -
Open Manage Dependencies and add <business-entity-name>_Create and <business-entity-name> entity from <business-entity>_CS producer. Where <business-entity-name> is the name of the business entity you created in step 1.
-
In the Interface tab, add a new empty screen to the Main Flow.
-
Add a local variable with <business-entity-name> data type.
-
Set your screen as Anonymous, in the Roles properties.
-
Add a Form to your screen.
-
Drag your local variable into the form widget.
-
Define a new action for the OnClick event of the generated button.
-
Add a <business-entity-name>_Create action after the OnClick event flow.
-
Set the <business-entity-name>_Create action input as the local variable created in step 4.
-
Publish the module by selecting 1-Click Publish.
-
Open the app in your browser by selecting Open in browser.
-
In your app, fill in the form and submit it.
-
Access the Service Center for your environment by going back to Service Studio and selecting Module Management in Service Center.
-
In Monitoring > Processes, find your process. Verify that it ran and is now closed.
Next steps
After completing the steps in this topic you are ready to continue developing your case management app. The typical next steps include the following:
-
In the core services module, define all the cases status for the case definition.
-
In the workflow module, create the processes that support your cases using BPT while making sure you associate the processes with cases.
-
In the UI module, create the screens that let your end users interact with cases and check the list of activities associated with their cases.
-
Add other case management features provided by Case Management framework to your app.