+ All Categories
Home > Documents > Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 |...

Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 |...

Date post: 15-Apr-2020
Category:
Upload: others
View: 14 times
Download: 0 times
Share this document with a friend
52
Transcript
Page 1: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first
Page 2: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

1 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

Develop a first business process application with Bonita BPM 6 by Raphaël Allègre, Product Manager, Bonitasoft

 

TABLE OF CONTENTS

1.  Introduction ........................................................................................................................................ 3 2.  The BPM Suite ................................................................................................................................... 3 

2.1.  Bonita BPM Studio: the development environment ..................................................................... 3 2.2.  Bonita BPM Engine and Bonita BPM Portal: the production environment .................................... 4 2.3.  Application development cycle ................................................................................................... 6 

3.  Phase I: Application Scope Definition (requirements analysis) ............................................................ 7 3.1.  Business requirements .............................................................................................................. 8 3.2.  Application scope ...................................................................................................................... 8 

4.  Phase II: Process model design .......................................................................................................... 9 4.1.  Happy path ................................................................................................................................ 9 4.2.  Human vs Service task ............................................................................................................ 10 4.3.  Pool, lanes & actors ................................................................................................................. 10 4.4.  Alternative endings .................................................................................................................. 12 

4.4.1.  If the request is refused by the manager .......................................................................... 12 4.4.2.  If the request is refused by the HR officer ........................................................................ 12 

4.5.  Extended process model .......................................................................................................... 13 4.5.1.  Request approved by the manager & the HR officer ......................................................... 14 

4.6.  User management & task assignation ...................................................................................... 14 5.  Phase III: Data Management ............................................................................................................. 17 

5.1.  Business data .......................................................................................................................... 17 5.1.1.  Employee object .............................................................................................................. 18 5.1.2.  Leave request object ....................................................................................................... 18 

5.2.  Process data ............................................................................................................................ 19 5.3.  Connection to other Information Systems ................................................................................. 20 

5.3.1.  Concept of connectors in Bonita BPM 6.0 ........................................................................ 20 5.3.2.  Configuring the Bonita email connector to send notifications ........................................... 21 

Page 3: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 2 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

5.3.3.  Configuring the database connector to store the submitted leave request ........................ 27 5.3.4.  Configuring the database connector to get the leave request information ......................... 31 5.3.5.  Configuring the database connector to update the employee’s remaining leave days ....... 33 5.3.6.  Configuring the Bonita connector to publish events on a Google calendar ........................ 34 

6.  Phase IV: Web user interface design ................................................................................................. 36 6.1.  Leave request submission form ............................................................................................... 36 

6.1.1.  Employee information section .......................................................................................... 36 6.1.2.  Leave request submission section ................................................................................... 39 6.1.3.  Data initialization and consistency ................................................................................... 39 6.1.4.  Data insertion into the external database ......................................................................... 41 6.1.5.  Leave request unicity constraint ...................................................................................... 42 6.1.6.  Manager validation form .................................................................................................. 42 6.1.7.  HR validation form ........................................................................................................... 42 

7.  Phase V: application testing ............................................................................................................. 43 7.1.  Happy path testing: the leave request is approved ................................................................... 43 

7.1.1.  The employee requests a leave ....................................................................................... 43 7.1.2.  The manager reviews leave requests ............................................................................... 44 7.1.3.  HR officer reviews approved requests .............................................................................. 45 7.1.4.  The employee is notified .................................................................................................. 46 7.1.5.  Google Calendar event publication ................................................................................... 47 7.1.6.  Update of the remaining leave days ................................................................................. 47 

7.2.  Alternative path testing: the leave request is refused by the manager ...................................... 47 8.  Next steps ........................................................................................................................................ 49 9.  Further reading ................................................................................................................................ 50 

 

   

Page 4: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

3 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

1. Introduction Whether  you  are  wondering  how  BPMN  can  significantly  improve  the  efficiency  of  your  daily 

operations  or  whether  you  are  wondering  how  to  turn  an  existing  process  into  an  optimized 

dynamic application, this paper addresses these challenges through a concrete business example: 

the modeling  and  the  automation  of  an  employee  leave management  procedure. We  have  put 

ourselves  in  the  shoes  of  a  project  team  engaged  in  the  development  of  its  first  BPMN 

implementation. 

The  example  application  is  developed with  Bonita  BPM  6  Teamwork  Subscription  Edition.  This 

paper also gives some pointers to develop it with Bonita BPM 6 Community Edition. 

Through  the  use of BPMN  2.0  graphical  elements, we will  explain how  to design  an  executable 

business process model readily understandable by all business stakeholders. 

The paper  covers  the entire application  life  cycle  such as  the  requirements analysis,  the process 

modeling, the design of the web user interfaces and finally the acceptance testing and deployment.  

For each phase, the reader  is guided with  illustrations or scripts extracted  from the solution. The 

main  development  choices  are  explained  and  best  practices  in  terms  of  design  or  performance 

optimization are suggested. 

The  resulting  application  is  a  live prototype  that  can be  tested by  all  the  stakeholders.  You  can 

install  Bonita  BPM  and  follow  the  example  given, making modifications  and  customizations  as 

noted,  to  create  your  own  first  business  process  application with  Bonita  BPM.  Suggestions  for 

further action (next steps) are given at the end of the paper. 

2. The BPM Suite

2.1. Bonita BPM Studio: the development environment Bonita  BPM  Studio  is  a  graphical  environment  for  creating  a  business  process  application.  It 

contains  two  principle  design  tools:  the whiteboard,  for  drawing  the  process  flow  diagram  and 

defining the detail of steps, transitions, decision points and other process elements; and the form 

builder, which  is used to create forms used  in process web applications. Bonita BPM Studio  is the 

process development environment for both the business analyst and the application developer. 

You  can  install  Bonita  BPM  Studio  on  a  development  system,  then  create  and  test  processes 

without needing to deploy a production environment. Bonita BPM Studio contains an embedded, 

locally  deployed  version  of  the  Bonita  BPM  Engine,  suitable  for  testing  a  process  that  is  in 

development. 

Page 5: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 4 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 1. Bonita BPM Studio 

Bonita  BPM  Studio  is  also  the  tool  for  preparing  a  completed  process  for  deployment,  and  for 

configuring the organization information required for a process. 

2.2. Bonita BPM Engine and Bonita BPM Portal: the production environment

The Bonita BPM Engine  is  the process execution engine of Bonita BPM.  It  is  invisible  to process users. 

The Bonita BPM Portal is the part of Bonita BPM that is visible to process users, who use it to view tasks and take actions. The Portal is also the tool used by the process administrator to deploy and manage a process. 

When  a  process  is  ready  for  production,  prepare  the  production  environment  by  installing  the 

Bonita BPM software, pre‐requisites and dependencies, and configuring the system. Then you can 

deploy a process that has been exported from Bonita BPM Studio. 

Page 6: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

5 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 2. Bonita BPM Portal, displayed on a web browser and on a mobile device 

 

Figure 3. Schematic of service‐based, extensible Bonita BPM Engine 

 

Page 7: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 6 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

2.3. Application development cycle Application development is based on an iterative and collaborative approach.  

We  begin  by  analyzing  the  business  requirements  and  defining  the  scope  of  the  application,  or 

more specifically, the deliverables of the first iteration.  

 

Figure 4. The 5 phases of application development project life cycle 

In each of the 5 phases of the project lifecycle, the business‐oriented or end‐user oriented people 

will collaborate as much as possible with the technical people to optimize the chances of a quick 

adoption of  the developed application. The  typical project  stakeholders are  the business analyst, 

the developer, the end user and the testers. The role of the business analyst can often be played by 

the business user (SMEs), the person who drives the needs for the process. 

This paper will now follow the phases of the development lifecycle:  

Application scope definition (requirements analysis) 

Process model design 

Data management (and connection to other Information Systems) 

Web user interface (UI) design 

Testing / Live demo 

Page 8: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

7 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

3. Phase I: Application Scope Definition (requirements analysis)

All  organizations  have  to  manage  internal  administrative  tasks,  such  as  the  employee  leave 

procedure, for example. In this paper, we will explain how to build an application with Bonita BPM 

to manage such a process. 

Let’s  look  at  some  common  problems with  this  process.  If  we  analyze  the  details  of  different 

practices,  we  can  see  that  in  many  cases  the  process  is  not  well  managed.  The  two  main 

consequences of inefficiency or poor management are time wasted on non‐strategic activities and 

dissatisfaction among the workforce. Here are some examples of common problems that  impact 

the organization. 

Example  Consequence  Cause 

The officer has to review paper‐

based requests and enter the 

data manually in the system. 

Time consuming 

Workforce dissatisfaction 

Error prone 

Multiple recapture of 

information 

The HR officer is giving incorrect 

information because his source is 

not up to date. 

Workforce dissatisfaction 

Error correction needed 

Multiple unsynchronized 

systems 

Employees don’t have access to 

their up to date remaining paid‐

vacation days. 

Time consuming 

Workforce dissatisfaction 

Unavailability of 

information 

The approval status is waiting 

since several weeks because the 

manager has still not processed 

the request. 

Time consuming 

Employee dissatisfaction 

Approval process not 

optimized 

The officer has to review paper‐

based requests and enter the 

data manually in the system. 

Time consuming 

Workforce dissatisfaction 

Error prone 

Multiple recapture of 

information 

 

Note  that depending on  the  type of organization and what  type of  laws apply, different  types of 

leave exist  such as  sick  time, paid and unpaid vacation  time, personal  time off, etc. The  type of 

leave is usually linked to the payroll system.  

   

Page 9: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 8 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

3.1. Business requirements Keeping  in mind  the  primary  business  objective  of  improving  process  efficiency  and  increasing 

employee satisfaction, here are the requirements that the first  iteration of our application should 

address: 

1. Provide a centralized solution to manage employee leave request 

2. Provide a solution appropriate for the 3 distinct user profiles: requestor, manager and HR 

officer 

3. Eliminate paper timesheets  

4. Eliminate error‐prone manual processes 

5. Automate  the  existing  process  from  request  submission  to  request  information 

documentation/archival 

6. Share information across the company 

7. Notify employees when key decisions are made 

3.2. Application scope

Business Requirements  Solution 

Centralized solution to manage employee leave 

request 

Build an executable model to orchestrate the 

business process; build a business process 

application, with a web‐based interface, to 

interact with end users. 

Adapt the solution to the 3 distinct user profiles: 

requestor, manager and HR officer 

Include the 3 personas during the design of 

the process model and address their 

requirements at an early stage. 

Eliminate paper timesheets and other error‐

prone manual processes 

Design web forms within the process model in 

order to manage data entries. Implement 

automatic data validation rules to ensure data 

integrity. Use connectors to push data to 

external IT systems. In our example, the leave 

request as well as all the approval steps will be 

managed through a web form. 

Automate the approval process 

Use BPMN 2.0 graphical elements to model 

the approval process relevant to your 

organization. In our example, the process 

model will automatically route an employee’s 

leave request to the employee’s manager first 

and then to the HR officer. 

Page 10: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

9 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

Notify employees when decision are made 

Include the appropriate notification scheme in 

the process model. In this example, we will 

use connectors to automatically generate 

notifications. 

4. Phase II: Process model design The purpose of this phase is to design the business process model. It usually starts by analyzing the 

existing process within the organization. The business analyst or the person who drives the needs 

for the process is usually the one creating and refining the model. The process needs to address the 

specific business case and the previously listed business requirements. 

4.1. Happy path One of the best practices of process modeling is to start with the design of the “happy path”1. The 

idea is to simplify the model of your process in order to visualize the activities and the flow from its 

beginning to its end. 

 

Figure 5. “Happy path” modeling 

Figure 5 corresponds to the “happy path” for the  leave process. The first graphical element  is the 

start  event  “Submit  request”.  The  process will  be  actually  started  at  the  submission  of  a  leave 

request web  form. Once  the process  is started,  the  flow  is  then automatically  routed  to  the  first 

task called “Manager checks request”. This human task means the employee’s manager will check 

the  employee’s  request  through  a  web  form  and  decide  whether  or  not  to  approve  it.  If  the 

employee’s manager approves the request, the flow  is then routed to the second task called “HR 

checks request”. At this second level of approval, the HR officer has to verify whether the request is 

legitimate or not.  If  the HR officer approves  the  request,  it  is  then  routed  to a  third  service  task 

called  “Notify  of  approval”.  Once  the  email  notification  has  been  automatically  sent  to  the 

employee, the flow  is automatically routed to  last task of the process: “Google calendar update”. 

This  service  task will  publish  the  approved  leave  dates  to  a  shared  Google  calendar. Once  the 

calendar publication has been completed, the flow is routed to the terminate end event that stops 

the entire process.  

 1 Best practice #1: start process modeling by representing the “happy path” in its simplest version. The purpose is to represent the main activities from the start event to the end event without including the alternative paths.  

Page 11: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 10 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

4.2. Human vs Service task A human task is an activity to be performed by a user as opposed to a service task to be executed 

by  the  system.  In Bonita BPM,  a human  task  is  an  activity  that  is exposed  to  the end user. The 

developer can design web forms and manipulate data interactively with the process. Human tasks 

and their associated web forms are displayed in the Bonita BPM Portal task list view. 

4.3. Pool, lanes & actors Once  we  have  designed  the  “happy  path”,  we  can  now  illustrate  the  3  different  functional 

responsibilities we have  in our business process.  Figure 6  shows  the pool,  “Leave Process”,  that 

represents the process. The pool is sub‐divided into 3 lanes, each representing a participant in the 

process. The  first  lane,  “Employee”  includes  the element  (start event)  related  to  the employee’s 

request.  The second lane, “Employee manager”, corresponds to the employee’s manager role. The 

third  lane,  “HR  officer”,  refers  to  the  human  resource  officer  responsibilities.  Thus,  the  lanes 

visually represent roles or organizational units that perform activities. 

 

Figure 6. Leave process with three lanes representing groups with process responsibilities 

In Bonita BPM, to assign a human task to a particular group of users means defining an actor for the 

task and associating this actor to the desired group of users.  

An actor defines the potential pool of performers for an activity. Actors are resolved at runtime to 

determine who is eligible to perform a task. In our case, we have created 2 actors, “Employee” and 

“HR officer” (see Figure 6). The employee actor is set as the initiator of the process. This means that 

the leave process can only be started by a user who is mapped to the “Employee” actor. 

Page 12: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

11 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 7. Create actors and set process initiator  

Note that we haven’t created an actor with the employee’s manager responsibility.  The end user is 

defined  from derives  from  the employee actor  through  the use of an actor  filter called “Initiator 

manager” that returns the manager of the initiator of the process. 

 

Figure 8. Assign actor actor filter for “employee’s manager” 

   

Page 13: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 12 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

4.4. Alternative endings Once we have defined the “happy path” with the appropriate lanes and actors, we can now design 

the alternative branches of our process. 

4.4.1. If the request is refused by the manager

The  first  task  intended  to  the manager  is  the  review  of  the  subordinate’s  leave  request.  The 

manager  can either approve or  refuse  the  request. Each of  these options  represents a different 

path on the diagram. The exclusive gateway, “Approved by manager?,” routes the flow in the only 

branch that matches the condition. In case of request refusal, the flow is routed to the service task 

“Notification of manager refusal,” that will handle the email notification. The process ends once the 

notification of refusal has been transmitted.   

 

Figure 9. Alternative path if request is refused by manager 

Note  that we positioned  the  service  task  “Notification of manager  refusal” within  the employee 

lane because we considered that it was more readable this way since the notification is intended to 

the employee. Nevertheless, a  service  task  is not  concerned by  the actor  concept  since  it  is not 

performed by a user but by  the  system, other options are also possible  such as put  it  inside  the 

manager lane or creating a new “system” lane for it. 

4.4.2. If the request is refused by the HR officer

When an employee’s request has been approved by the manager, it is automatically routed to the 

HR officer for review. The HR officer can either reject or approve the request. To manage these 2 

cases, we  added  another  exclusive  gateway:  “Approved  by HR?”  In  case  of  refusal,  the  flow  is 

Page 14: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

13 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

routed  to  the  service  task  “Notification  of HR  refusal”  that will  automatically  handle  the  email 

notification. The process ends when the notification of refusal has been transmitted.   

 

Figure 10. Alternative path if request is refused by HR officer 

4.5. Extended process model The  figure  below  now  illustrates  the  comprehensive  process  model  from  the  leave  request 

submission (start event) to the 3 potential endings (terminate end event): “refused by manager”, 

refused by HR” and “request approved”. 

Page 15: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 14 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 11. Process with 3 possible paths 

4.5.1. Request approved by the manager & the HR officer

When  the  HR  officer  validates  the  employee’s  request,  the  flow  is  routed  to  the  service  task 

“Google  calendar  update”.  This  task  automatically  creates  a Google  calendar  event with  all  the 

employee leave details. This calendar  is shared with all the employees within the company. When 

this step has been completed, the flow is split into two branches (through a parallel gateway): one 

to handle the email notification to the employee and the other to handle the update of the number 

of leave days remaining after the approved request. Notice that the parallel gateway receiving the 

flows from the two service tasks will merge them again once the two are performed. This behavior 

ensures  that  process  can’t  end  without  having  completed  the  “DB  update”  and  the  email 

notification to the employee. 

4.6. User management & task assignation The end users of the business process application are managed through an internal directory called 

organization. An organization is composed of groups, roles, memberships and users.  

The  term  actor  is  strictly  a  name  that  generally  corresponds  to  functional  responsibilities.  The 

assignment of an actual user to a task can be performed when actors are mapped with the users 

from  the active organization. Actor mapping  is done via  the process  configuration. The process 

configuration can be changed after deployment of the application. This means that it is possible to 

dynamically modify the task assignment rules independently from the process design.  

In our example, we mapped the actor, “Employee”, to the role “member” of the organization. This 

means  that all users with  the  role  “member” will be able  to  start an  instance of  the application 

“Leave Process”. Since the role “member” is the default role in our organization, it means each user 

will be able to submit a leave request. The second actor, “HR officer” is mapped to the group “HR”. 

All users belonging to the group “HR” will be eligible to perform the human task called “HR officer 

checks request”. 

Page 16: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

15 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 12. Actor mapping definition: actor “Employee” mapped  to  the  role “member” and actor “HR officer” mapped to the group “HR” 

To create users, create an organization via the submenu Manage… of the menu Organization. For 

this  example,  we  have  created  an  organization  called  “BonitaSoft  S.A.”  This  organization  is 

composed of different groups, roles and users. The membership is the assignation of a group and a 

role to a user. 

Page 17: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 16 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 13. Creation of the organization “BonitaSoft S.A.” from the menu Organization>Manage… 

To make your organization “active”, you need to publish it. Only one organization at a time can be 

active during execution. 

   

Page 18: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

17 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

5. Phase III: Data Management The  purpose  of  this  phase  is  to  determine  the  data  needed  to  build  the  business  process 

application.  First we need to distinguish business data and process data. 

 

Figure 14. “business” and “process” data in Bonita BPM 

5.1. Business data Business data represent the information that the process application interacts with (read, write and 

update) and which may exist outside of the process. Business data may be shared or used by other 

applications  within  the  organization.  Business  data  are  also  very  often  useful  for  reporting 

purposes.  Best  practice  is  to manage  Business  data  in  an  external  database.  In  our  case,  the 

business data correspond to the employee information and the leave request. 

   

Page 19: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 18 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

5.1.1. Employee object

The employee information will be summarized by the following attributes.  

Variable  Type  Description 

Employee ID*  Integer  Unique employee identifier  

First name*  Text  Employee’s fist name 

Last name*  Text  Employee’s last name 

Email*  Text  Employee’s email 

Manager*  Text  Employee’s manager 

Available annual leaves  Numeric  Remaining days for annual 

leave types 

Available sick leaves  Numeric  Remaining days for sick 

leave types 

 

Bonita BPM 6.0 offers a  simple directory  called organization  in order  to manage  the users. The 

organization is composed of groups, roles, memberships and users (see. part User management & 

task assignation). All the fields marked with a star already exist  in the Bonita organization (Bonita 

BPM  Engine). We will  then only  store  in  the  external DB, data not marked with  a  star plus  the 

Employee ID. 

5.1.2. Leave request object

The employee  leave request gathers the  information about the  leave. The  leave request will then 

be stored as a table in an external database. Here is the leave request table definition: 

Variable  Type  Description 

Employee ID  Integer  Unique employee identifier  

Start date  Date  Date of the first day of leave 

End date  Date  Date of the last day of leave 

Return date  Date  Date of the return day in 

the company 

Number of days  Numeric  Number of days off 

Type of leave  Text  Type of leave available 

Page 20: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

19 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

according to 

company/country: annual 

leave, sick leave, unpaid 

leave, other 

Status  Text  Status of the leave request: 

submitted, approved by 

manager, refused by 

manager, refused by HR 

officer, validated 

Manager refusal comment  Text  Manager refusal 

explanation 

HR officer refusal comment  Text  HR officer refusal 

explanation 

 

5.2. Process data Process data represent the  information that the executable model needs to route the flow to the 

right  tasks.  In  this example,  it  includes  the approval or  refusal of  the employee's  request by  the 

manager and the HR officer.  

Variable  Type  Description 

Approval  Boolean  Boolean variable that 

indicates the approval (true) 

or the refusal (false) of the 

employee leave request, 

either by the manager or 

the HR officer. 

 

   

Page 21: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 20 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

5.3. Connection to other Information Systems

5.3.1. Concept of connectors in Bonita BPM 6.0

In Bonita BPM, connectors are used  to make your process  interact with an external  IT system.  In 

our application example, we have  identified  the 3 use  cases below  that  require  the use of  such 

connectors: 

Retrieving or storing data from an external database (employee information, leave request)  

Sending email notifications whenever decisions are made 

Creating a Google Calendar event to share information with other employees 

Connectors can be triggered at the process level or at the task level. Bonita BPM 6.0 offers a list of 

pre‐built connectors as illustrated by the figure below. 

 

Figure 15. Connectors in Bonita BPM 

In our example, we will use: 

Email connectors to notify the requestor about the status of the leave request 

Database connectors to display or update employee information 

Page 22: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

21 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

Database connectors to store or update the leave request details 

Google Calendar connector to post an employee’s leave dates on a shared Google calendar 

On the process diagram, connectors are  identified by a “plug”  icon on the upper right corner of a 

task.  The  example  below  illustrates  the  use  of  the  email  connectors  on  the  two  service  tasks 

“Notification  of manager  refusal”  and  “Notification  of  HR  refusal”.  Note  that  we  can  also  use 

connectors within forms (eg. to initialize a field, on the submit button, etc.). 

In the next sections, we’ll explain how the connectors are configured. 

 

Figure 16. Connectors on tasks 

5.3.2. Configuring the Bonita email connector to send notifications

Objective

According  to  the process design, an email notification  is sent  to an employee when  the manager 

has  refused  the  request, when  the HR officer has  refused  the  request, or when  the  request has 

been approved by both the manager and the HR officer. The email notification will be sent to the 

employee who has submitted the request. Its subject and content should include the status of the 

request  (refused  or  approved),  the  comment  of  the manager,  and  the  details  about  the  leave 

request. 

Implementation

To add a connector on a task, click on the task and select the Connectors pane of the General tab. 

The  list  of  connectors  displayed  after  clicking  on  Add…  corresponds  to  all  the  pre‐built  Bonita 

connectors plus any user defined connectors you may have added. The SMTP email connector  is 

under the category Messaging. Like the other connectors, its configuration is facilitated by a step‐

by‐step configuration wizard. Here are the detailed configuration steps. 

First step

In the first step, define the name, the description, the triggering event and the error management 

option for your connector. For the Select event option, select Finish which means the connector will 

be  executed  at  the  end  of  the  service  task.  This  gives  us  the  opportunity  to  execute  another 

connector at the beginning of the task  in order to retrieve the business data (eg. start date,  leave 

type, etc.) required for the email content definition. 

Page 23: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 22 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 17. First step to define the email connector 

We  selected  the  option,  “Put  in  failed  state.”  This  offers  the  Bonita  BPM  Portal  administrator 

responsible for the application case management the possibility to detect the error, correct it and 

replay the task. 

Second step

Define  the  SMTP  server  connection 

information.  It  is  recommended  to  use 

parameters  for  the  technical  settings  of 

the connector configuration2.  

 

 

 2 Best practice #2: use of parameters for technical settings.  Indeed, parameters are part of the process configuration and they can be directly modified in production from Bonita Portal without having to redeploy the application. 

In Community Edition,  as parameters are not available, you can use 

process data with type ‘Constant’. 

Page 24: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

23 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 18. Second step to define the email connector 

Third step

In this third step, define the sender and recipient email addresses. In this example, we used a  parameter  for  the  sender  address  (eg.  no‐[email protected]).  The  recipient  email address needs  to be dynamically evaluated and should correspond  to  the employee who requested the  leave. To do this, open the expression editor and select script. Here  is the Groovy script used to return the required email address: 

Page 25: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 24 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 19. Third step to define the email connector 

 

Note that this script uses a provided Groovy function from the Bonita category. 

Fourth step

Define the object, the content and the attachment(s) if applicable. In our case, both the object and 

the content are dynamic. 

Return 

BonitaUsers.getUserProfessionalContactInfo(apiAccessor,BonitaUsers.getProcessInstanceI

nitiator(apiAccessor,processInstanceId).getId()).getEmail(); 

Page 26: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

25 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 20. Fourth step to define the email connector 

Here is the script definition used for the object called “Title”: 

 

Where  managerFirstName  and  managerLastName  are  two  transient  variables  defined  at  the service task level (“Notification of manager refusal”). Indeed, the rich text editor provided with the email connector allows  inserting process variables but no Groovy script. This  is why we used two transient variables defined at the task level. 

 

Figure 21. Definition of transient variables 

 

 

return  managerFirstName+"  "+managerLastName+"has  refused  your  leave  request 

submitted on:"+leave_request_creation_date;

Page 27: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 26 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Here are the scripts used to initialize these two transient variables:  

 

 

Here is the email content definition for our email connector: 

 

Figure 22. Definition of email content 

The rich text editor offered to define the email content supports the insertion of process variables 

(“F1  or  Ctrl  space”).  In  our  example,  the  process  variables  used  (requestorFirstName, 

managerRefusalComment, dayOfLeave, etc) are transient variables that have been initialized at the 

beginning of the task by a database connector set on Enter. All the business related information is 

stored in our external database, so we need to use a database connector to retrieve it. 

Here is an example of the generated email: 

return 

BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor,processInstanceId).getFirstN

ame(); 

return 

BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor,processInstanceId).getLastNa

me(); 

Page 28: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

27 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 23. Email message with variables 

5.3.3. Configuring the database connector to store the submitted leave request

Objective

Although it is not visible in the process design, the employee leave request form will be part of the 

start  event  (See  section  36).  This  means  that  submitting  a  leave  request  will  start  a  process 

instance. The objective of the database connector in our case is to store all the information entered 

in the form while the leave request submission. 

Implementation

To add a connector on the form displayed at the start of the process, open the form by clicking on 

the pool and selecting the Application tab. 

 

Figure 24. Add a form to start the process 

 

Page 29: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 28 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

In Community Edition,  as form connectors are not available, the connector at the pool level can be used. 

You can then open the form (Leave_request). When the form is opened, click on the Submit button 

or the form itself and select the Connectors tab in order to add the connector. 

 

Figure 25. Add a connector to the form 

 

Here  are  the  detailed  configuration 

steps. 

First step

Set the name and the description of the connector. 

 

Figure 26. Create a database connector 

Second step

Choose between 2 options to define the SQL query. The graphical builder offers a graphical mode 

to build the query. It requires you to first configure the access to your database. The other option is 

Page 30: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

29 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

to use the text editor to write the query. The Groovy script editor is also part of this second option. 

In this case, we use the text editor in order to have access to the Groovy editor.    

 

Figure 27. Choose connector editor 

Third step

Define the settings to access the external 

database.  As  a  good  practice,  we  use 

parameters  so  that  it  can  be  changed 

later  without  having  to  redeploy  the 

application if its configuration changes.  

 

 

 

In Community Edition,  as parameters are not available, you can use 

process data with type ‘Constant’. 

Page 31: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 30 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 28. Configure database access 

Fourth step

Define the SQL query either with a basic text editor or with the Groovy script editor. In this case we 

have defined a Groovy script named insert  leave. Here  is an example of script we use to store the 

leave request in the database. 

 

Figure 29. Configure database query 

Page 32: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

31 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Note that we added some entries in the Bonita BPM Studio logs to display the SQL query. 

5.3.4. Configuring the database connector to get the leave request information

Objective

The  objective  here  is  to  use  a  database  connector  to  retrieve  the  employee  leave  request 

information required to for the human task “Manager checks request.” The best practice to manage 

business  data  required  for  a  form  is  to  create  a  custom  transient  data  type  (Java  object)  and 

initialize  it  with  a  single  database  connector.  This  way,  you  will  avoid  impacting  the  form 

performance with too many connectors in the forms. Also, using a transient data at the form level 

will avoid storing business data in the Bonita BPM Engine database. 

 

Figure 30. Manager checks request task 

To  create a new data  type, go  to Development>Data  types>New data  type… When your  custom 

data  type  is  defined,  you  can  create  it  as  a  JAR.  To  create  the  transient  data  derived  from  the 

custom Java object, click on the human task and select Application>Pageflow>Transient Data. 

import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.logging.Logger; Date request_date = new Date(); String status = "submitted"; DateFormat mySimpleDateFormat = new SimpleDateFormat("YYYY‐MM‐dd HH:mm:ss"); Logger logger=Logger.getLogger("org.bonitasoft"); 

 String mySQL="INSERT INTO leave_request (start_date, end_date, return_date, number_days, type_of_leave, bonita_id, submission_date, status) VALUES ('"+mySimpleDateFormat.format(field_dayOfLeave)+"', '"+mySimpleDateFormat.format(field_Date1)+"', '"+mySimpleDateFormat.format(field_dayOfReturn)+"', "+field_numberOfDays+", '"+field_leave_Type+"',"+loggedUserId+", '"+mySimpleDateFormat.format(request_date)+"', '"+status+"')"; logger.severe(mySQL); 

return mySQL; 

Page 33: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 32 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 31. Add new data type as transient data 

In  this  example,  we  have  created  the 

transient  java  object  named 

“employeeRequest” and  it  is  initialized by 

the database connector named “get  leave 

request  data.”  Since  most  of  the 

configuration  steps  are  similar  to  the 

previously  presented  database  connector, 

we are only presenting here the steps that 

are different.  

SQL query definition

Here is the script we defined to select the submitted leave request information: 

 

Note  that  the  primary  key  (unicity  constraint)  is  defined  by  the  two  columns  “bonita_id”  and 

“start_date.”  Our  assumption  is  that  the  same  employee  cannot  submit more  than  one  leave 

request with the same start date. 

Connector output operations

In  this  last  step, we  need  to  use  the  connector  output  (resultset)  and map  it  to  the  transient 

variable “employeeRequest”  

import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.logging.Logger; Logger logger=Logger.getLogger("org.bonitasoft"); DateFormat mySimpleDateFormat = new SimpleDateFormat("YYYY‐MM‐dd HH:mm:ss"); String mySQL="SELECT end_date, return_date, number_days, type_of_leave FROM leave_request WHERE bonita_id = "+BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId()+ " AND start_date= '"+mySimpleDateFormat.format(leave_request_start_date)+"'"; logger.severe(mySQL); return mySQL; 

In Community Edition,  as Java Data Type creation is not available, you can create the Java objects externally and import 

the jar file into Bonita BPM Studio. Also, as connectors to initialize form transient data are not available, define a task transient data instead and a task connector to initialize. 

Page 34: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

33 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 32. Connector output configuration 

Here is the script we used to define the mapping. 

 

 

5.3.5. Configuring the database connector to update the employee’s remaining leave days

Objective

The objective  is to use a connector to update the employee’s remaining  leave days right after the 

approval of  the HR officer. As  shown on  the process diagram,  this operation  is managed by  the 

service task “database update.”  

 

Figure 33. Leave request database update task 

import org.bonitasoft.employeeleaverequest.LeaveRequest;import java.util.Date; resultset.next(); LeaveRequest employeeRequest = new LeaveRequest(); Date endDate = new Date(resultset.getDate("end_date").getTime()); Date returnEnd = new Date(resultset.getDate("return_date").getTime()); employeeRequest.setEndDate(endDate); employeeRequest.setReturnDate(returnEnd); employeeRequest.setLeaveType(resultset.getString("type_of_leave")); employeeRequest.setNumberDays(resultset.getInt("number_days")); return employeeRequest; 

Page 35: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 34 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

SQL query definition

Here is the script used to update the employee’s remaining leave days: 

 

Note  that  in  this example, each employee has  fixed number of annual  leave and  sick  leave each 

year. Each approved annual leave or sick request is then subtracted from the number of leave days 

available. 

5.3.6. Configuring the Bonita connector to publish events on a Google calendar

Objective

The purpose of this connector is to publish the leave request dates (start & end) on a shared Google 

calendar.  

Google calendar connector configuration

Set the email account, the password, and the URL to the target calendar. 

 

Figure 34. Google calendar connector configuration wizard: step I 

Then define the event: title, content, start time and end time.  

if(typeLeave == "Annual leave"){return "UPDATE public.employee SET available_paid_leave = available_paid_leave ‐ "+numberDays+" WHERE bonita_id = "+BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId(); } else if(typeLeave == "Sick leave"){ return "UPDATE public.employee SET available_sick_leave = available_sick_leave ‐ "+numberDays+" WHERE bonita_id ="+BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId(); } 

Page 36: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

35 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 35. Google calendar connector configuration wizard: step II 

Here are the scripts used for the event start and end: 

    

leave_request_start_date.format("yyyy‐MM‐dd'T'HH:mm:ss'+02:00'");endDate.format("yyyy‐MM‐dd'T'HH:mm:ss'+02:00'"); 

Page 37: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 36 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

6. Phase IV: Web user interface design With Bonita BPM Studio, you can create web forms which are displayed to the end users when they 

perform their assigned tasks. These web forms can be created on human tasks. A form can also be 

added at  the pool  level. The submission of a pool‐level  form  triggers  the creation of  the process 

instance. In our process model, we have designed 3 web forms: 

The “leave_request” form to be used by all employees, and which gathers all the required 

information to submit a leave request. 

The  “manager_validation”  form  to be used by  the managers  to  view  the  leave  requests 

submitted by their subordinates, and to approve or refuse them. 

The  “hr_validation”  form  to  be  used  by  the  HR  officers  to  review  the  leave  requests 

submitted by the employees and approved by their managers. 

6.1. Leave request submission form This form is created at the pool level. As you can see on the image below, the form “leave_request” 

has been added to the pool by selecting it and clicking on Application tab and then Pageflow.  

 

Figure 36. Add an instantiation form to the process pool 

The  design  of  the  form  is  done  using  the  form  builder.  The  form  area  is  structured with  a  grid 

system  composed of  rows  and  columns. A palette  of drag‐and‐drop widgets  is  available  for  the 

design  of  the  form  fields.  In  this  case,  the  form  should  include  a  section  with  the  employee 

information and another section related to the leave request submission. 

6.1.1. Employee information section

Page 38: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

37 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

For  this section  the purpose  is  to display 

the  employee’s  first  name,  last  name, 

email and manager. Since this section will 

also  be  displayed  in  the  manager 

validation  form  and  the  HR  officer 

validation form, it is recommended to use 

a group widget  in order  to be able  to reuse  it. A group widget and  its content can be saved as a 

template  (Forms>Save Widget  as  a  template…).  It  is  also  good practice3  to use  a  group widget, 

because  the  data  initialization  can  be  done  with  only  one  Groovy  script.  This  improves  form 

performance.  

 

Figure 37. Using the form builder to create a form 

As you can see in the figure above, we positioned the four required widgets (first name, last name, 

email and manager)  in a group widget. The  initialization of  these 4 widgets  is done at  the group 

widget  level by clicking on  it and going to the Data pane of the General tab. Here  is the script we 

used for the initialization: 

 3 Best practice #3: it is recommended to use the Group widget to group several widgets that share the same theme. The feature “save widget as a template…” offers the capability of reusing the widget template in other forms. Using a group widget also allows global data initialization at the group level using a java Map object. 

In Community Edition,  as group widgets are not available, the forms 

can be designed without them. 

Page 39: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 38 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

We also added a “message” type widget above the group widget to display the “employee information” section. We tuned the appearance of the widgets using the Appearance tab and then Field. Here is an example of customization (text size, color and position) we have applied for the “message” widget. 

 

 

Figure 38. Define the appearance of a field 

For each widget, configure how its data is handled by clicking on the widget and going to the Data 

pane of the General tab. 

 

import org.bonitasoft.engine.identity.User;import org.bonitasoft.engine.identity.ContactData; Map<String, Object> result = new HashMap<String, Object>();  User user = BonitaUsers.getUser(apiAccessor, loggedUserId); ContactData UserContact = BonitaUsers.getUserProfessionalContactInfo(apiAccessor,loggedUserId);  long managerId = user.getManagerUserId(); User manager = BonitaUsers.getUser(apiAccessor, managerId);  result.put("firstname", user.getFirstName()); result.put("lastname", user.getLastName()); result.put("manager", manager.getUserName()); result.put("email", UserContact.getEmail()); return result; 

Page 40: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

39 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

6.1.2. Leave request submission section

In this section of the form, we want to display the fields required to submit a leave request.  In our 

example, we used: 

a dropdown list widget for “Type of leave” 

a text field widget to display “Available days” 

three date widgets for “Start date”, “End date” and “Return date”  

a text field widget to enter “Number of days” 

a text area widget to enter a “Comment” 

a “Submit” button to submit the request 

 

Figure 39. Design request form 

6.1.3. Data initialization and consistency

We  initialized the “Type of  leave”  list with a Java  list variable defined with 4 values: annual  leave, 

sick leave, non‐paid leave and other. By default, the selected value is set to “annual leave.” The text 

field  “Available  days”  informs  the 

employee  about  his  remaining  paid 

leaves  so  that  he  can  take  it  into 

account  as  he  is  creating  a  new  leave 

request.  The  information  is  pulled  out 

from  the  business  database  using  a 

connector4. Since the remaining leaves value to be displayed depends on the type of leave selected 

by the employee  (annual or sick  leave) we used the Contingency feature. As shown on the  image 

here,  the  text  field “Available days”  is contingent on  the  field “Type of  leave”. The Groovy script 

 4 Best practice #4: use of transient form data initialized by connectors to manage data required in a form. 

In Community Edition,  as contingency is not available, you can 

implement it with JavaScript and external APIs. 

Page 41: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 40 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

expression “not display” hides the widget when the type of leave selected is either “Unpaid leave” 

or “Other”.  

 

Figure 40. Example of a hidden contingent widget 

Here is the condition we used: 

 

When the type of  leave  is changed to sick  leave for example, the update value expression returns 

the appropriate remaining leave days for the concerned employee. Here is the SQL query we used 

for the connector getting the remaining leave days: 

 

To ensure data consistency regarding the date widgets, we used the Validators feature at the form 

level. For example, to ensure that the start date is prior to the end date and to the return date: 

return ("Annual leave".equals(field_leave_Type) || "Sick 

leave".equals(field_leave_Type)); 

if (field_leave_Type.equalsIgnoreCase("annual leave")) {  return "SELECT available_paid_leave FROM employee WHERE bonita_id ="+loggedUserId; } else { 

return "SELECT available_sick_leave FROM employee WHERE bonita_id ="+loggedUserId; 

Page 42: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

41 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 41. Add a validator to the field 

Here is the Groovy expression (date validation) used for the field Parameter.  

 

6.1.4. Data insertion into the external database

The data  related  to  the  leave  request  section of  the  form  are  inserted  in our  external business 

database at the submission of the form. We added a connector positioned on the Submit button. 

 

Figure 42. Add a connector to execute on the submit button 

Please refer to the section (27 – 

Fourth step) for the leave request 

data insertion explanations. 

return field_dayOfLeave.before(field_Date1)&&field_Date1.before(field_dayOfReturn);

In Community Edition,  as form connectors are not available, you can 

implement this with either task or pool connector.

Page 43: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 42 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

6.1.5. Leave request unicity constraint

For the leave request table, we defined a primary key based on the start date and employee ID. In 

order to ensure that this constraint is not violated, we can use a form validator that will prevent an 

employee  from submitting an  invalid  leave  request. Another possible option would have been  to 

throw an error when the database connector fails, and catch the error with a Catch Error boundary 

event in order to route the flow another task. 

6.1.6. Manager validation form

In addition to the fields already used for the leave request submission form, the form displayed to 

the managers includes an additional section called “manager validation,” composed of: 

a radio button to set the “Status” of the employee’s request 

a text area field to set the “Refusal comment” in case of refusal 

 

Figure 43. Text area widget “refusal comment” configuration 

The text area widget “Refusal comment” is displayed only when the manager decide to refuse the 

request. To implement this, we used the Contingency feature with the following condition: 

 

6.1.7. HR validation form

The  form designed  for  the HR officers  is almost  identical  to  the one  for  the managers. When we 

added this form, we used the option “Duplicate a form from the  list below”  in order to reuse the 

existing manager validation form. 

return field_Radio_buttons1.equalsIgnoreCase("refuse");

Page 44: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

43 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

7. Phase V: application testing In this chapter we present the final application to the end users, specifically these three identified personas: 

the employee requesting a leave (Raphael) 

the manager reviewing the request (Charles) 

the HR officer reviewing approved requests (Stephanie) 

7.1. Happy path testing: the leave request is approved

7.1.1. The employee requests a leave

After logging into the Bonita BPM Portal, the employee can submit a leave request by starting the 

leave management application  from  the Apps menu. This will open  the  leave  request submission 

form  as  presented  in  the  previous  chapter.  The  field  “Available  days”  informs  the  employee 

Raphael  that  he  has  25  annual  leave  days  remaining.  The  submission  of  this  form  will  then 

automatically create a new task for the employee’s manager, Charles. In our example, Charles will 

get a new task in his inbox. 

 

Figure 44. Leave request form 

If  the  employee  selects  incorrect  dates  for  leave,  the  designed  form  validator  (see  Data 

initialization and consistency) warns him and blocks the data submission. Here  is the result of the 

validation. 

Page 45: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 44 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 45. Warning appears if leave dates are incorrectly entered 

7.1.2. The manager reviews leave requests

After  logging  into  the Bonita BPM Portal,  the manager  can  check  the  task  list and  sees all  leave 

requests waiting for approval. In our example, Charles has a new item in his task list named “Leave 

request from Raphael.”  

 

Figure 46. Manager’s task list 

When the manager opens the task, the leave request submitted by a team member appears. In our 

example, Charles gets  the  leave  request  submitted by Raphael at  the previous  stage  (start date: 

09/26/2013). 

Page 46: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

45 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 47. Manager approval form 

7.1.3. HR officer reviews approved requests

After  logging  into  the Bonita BPM Portal,  the HR officer can check  the  task  list and views all  the 

leave requests that have been approved by managers and waiting for HR approval. In our example, 

Stephanie,  the HR officer, has  a new  item  in her  task  list named  “Leave  request  from Raphael” 

which has been approved by his manager. The HR officer can open the task, review the request and 

approve or refuse it.  

Page 47: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 46 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 48. HR Review Form 

When a  leave  request has been approved,  the process  flow adds 2 additional  service  tasks. One 

handles  the  email  notification  of  approval,  and  the  other manages  the  Google  calendar  event 

publication.   

7.1.4. The employee is notified

Since  the  HR  officer  approved  the  request,  the  process  application  then  gets  all  the  required 

information from the business database and uses  it to automatically send an email notification to 

the employee who has requested the leave. Here is the email notification received by Raphael.  

 

Figure 49. Email notification send to employee 

Page 48: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

47 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

7.1.5. Google Calendar event publication

Based  on  the  approved  leave  request  information,  the  process  automatically  publishes  the 

corresponding Google agenda event to share the leave information with the rest of the team.  

 

Figure 50. Update to Google calendar 

7.1.6. Update of the remaining leave days

If  the  employee  tries  to  request  a  second  leave  right  after  the  approval  of  the  one  previously 

approved, he will then see that his number of available days has been updated. In the screenshot 

below,  the employee Raphael has now 23 available annual  leave days  compared  to 25 when he 

submitted his first request. 

 

Figure 51. Number of available leave days has been updated 

7.2. Alternative path testing: the leave request is refused by the manager

The manager reviewing a leave request from his subordinate can decide to refuse it. If the manager 

selects  “refuse”,  the  text  box  “Refusal  comment”  is  automatically  added  and  an  explanation  is 

requested.   

Page 49: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 48 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

 

Figure 52. Manager refuses leave request 

The refusal of the  leave request automatically routes the flow to the service task  in charge of the 

email  notification.  The  employee,  Raphael,  receives  the  email  notification  bellow  including  the 

explanation of his manager Charles. 

Page 50: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

49 | www.bonitasoft.com    © 2013 Bonitasoft 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION 

 

Figure 53. Employee notification in case of refusal 

8. Next steps For the next project iteration, we can envisage the following extension points:  

When  the employee applies  for a  leave,  show  the details of all upcoming  leaves  so  that 

he/she is better informed on how many leaves he has already requested.

When  the manager approves  leave,  show him/her details of who else on  the  team  is on 

leave during the same period, to avoid having everyone on the team on leave at the same 

time.

Show  employee  leave  reporting  at  a  team/function/business  unit  level  for  capacity  and 

project planning.

Add  the ability  to export  and  import  leave  request  information  through  connection  to  a 

payroll system.

Support cancellation of leaves by employees.

 

For more  information about  leave management process applications,  see  the Process  Library on 

www.bonitasoft.com. 

   

Page 51: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

© 2013 Bonitasoft     www.bonitasoft.com  | 50 

DEVELOP A FIRST BUSINESS PROCESS APPLICATION   

9. Further reading

 

Best Practices  for Getting Started with BPM 

 

Speaking to the C‐Suite about BPM 

 

Understanding  Business Process Automation 

 

More information available at www.bonitasoft.com. 

 

Page 52: Bonitasoft - Techhosteddocs.ittoolbox.com/Develop A First Process Application_251013 (1).pdf · 1 | © 2013 Bonitasoft DEVELOP A FIRST BUSINESS PROCESS APPLICATION Develop a first

 

51 | www.bonitasoft.com    © 2013 Bonitasoft 

 

 

HEADQUARTERS GRENOBLE, FRANCE 32, rue Gustave Eiffel 

38000 Grenoble 

EMEA, ASIA & LATIN AMERICA PARIS, FRANCE 73‐77, rue de Sèvres 

92100 Boulogne‐Billancourt 

NORTH AMERICA SAN FRANCISCO, USA 51 Federal St. Suite 305 

San Francisco, CA94107 

 


Recommended