Lab 5 - Completing process details

Lab Goal

To complete the details of rewards process for submitting employee rewards and processing by HR department

Process details

  • The process we designed is incomplete, we need configuration, task group assignments, variables, etc.
  • In this lab we will walk through the process to:
    • assign process variables for mapping our domain model
    • configure and assign the user task to a group
    • configure specific tasks (Log and Email)
    • become familiar with the process designer along the way

Process properties

  • We will be submitting an Employee when starting our process
  • Two other variables are needed; name & outcome
  • Let's open the properties editor for our process
    • hover on top right pencil icon in designer
    • click to open Diagram properties pane on the right

Process properties

  • The properties pane for our process opens in right pane
  • Click on Process Data at the bottom to open editor

Add process variable

  • Next click on plus icon '+' to define a new process variable

Add process variable

  • Add first process variable
    • Name: employee
    • Data Type: Employee [com.redhat.demo.hr.rewards]

Add process variable

  • Add final two process variables
    • Name: outcome
    • Data Type: Boolean
    • Name: name
    • Data Type: String

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Approve reward details

  • Click on Approve Reward node
  • Properties for node appears in right pane editor
  • Expand menus and you'll see Assignments section at bottom

Approve reward data

  • Click pencil icon next to Assignments to open pop-up
  • This is Approve Reward Data I/O editor
  • Click on +Add next to Data Inputs and Assignments

Approve reward data input

  • Within a process step we'll map global variables to local variables
  • On exit we'll map data out from local to global process variables
  • Create local input variable by filling in Name: employee_in
  • Assign data type from drop down, Data Type: Employee
  • Assign the source for this local variable, Source: employee

Approve reward data output

  • Now let's create data mapping back out to global process variables
  • Create Data Output and Assignment:
    • Name: approval
    • Data Type: Boolean
    • Target: outcome
  • Click on Save, note Assignments: 1 data input and 1 data output

Approve reward task name

  • Now assign a real task name, Task Name: Approve_Reward
  • A user task needs to have group assigned that can claim the task
  • Let's look at how we can create a manager group and assign for task processing

Approve reward assignment

  • Click on Add button under Groups
  • Click on New and create manager group
  • Click on check mark to save the new group

Approve reward entry action

  • On entering this node, possible to take small actions
  • We'll use it to map data model value to a process variable
  • At bottom of propterties pane, locate Script field

Approve reward entry action

  • Using the java setting, copy Employee.name to name process variable:
    • kcontext.setVariable("name", employee.getName());

Approve reward exit action

  • We'll add some debug log information on exit of this node
  • At bottom of propterties pane, locate Script field

Approve reward exit action

  • Using the java setting, log the status of reward approval:
    • System.out.println("PROCESS DEBUG: Exit Approve Reward - reward approval set to: " + kcontext.getVariable("approval") + ".");

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Log details

  • Click on Log node
  • hover on top right pencil icon in designer
  • click to open Diagram properties pane on the right
  • Properties for node appears in right pane editor
  • Expand Implementation/Execution section
  • Let's log a message using java code

Log details

  • Add logging code in two stages; we log employee reward and log the value of the rewards decision:
    • System.out.println("LOG: Reward for employee " + kcontext.getVariable("name") + " transaction logged.");
    • System.out.println("LOG: Initial reward decision is: " + kcontext.getVariable("outcome"));

Log details

  • Now check if the outcome value is not set
  • If reward was rejected, outcome is NULL, so set to false here
  • Finally we log the value of the reward approval decision
    • if ( kcontext.getVariable("outcome") == null ) { kcontext.setVariable("outcome", false); }
    • System.out.println("LOG: Final reward decision is: " + kcontext.getVariable("outcome"));

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Rejected flow details

  • We need to determine path to take from the gateway
  • This is done by clicking on the top sequence flow (selecting)
  • click on pencil icon to open Diagram properties pane
  • Set the property Name: rejected

Rejected flow details

  • Expand Implementation/Execution section
  • Use the Condition radio button to activate menus for variable checking
  • Select Process Variable outcome and Condition Is false:
  • This path in the process is only taken if the outcome variable is set to false

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Rejected flow details

  • Now to configure the accepted path through the gateway
  • This is done by clicking on the bottom sequence flow (selecting)
  • click on pencil icon to open Diagram properties pane
  • Set the property Name: accepted

Rejected flow details

  • Expand Implementation/Execution section
  • Use the Condition radio button to activate menus for variable checking
  • Select Process Variable outcome and Condition Is true:
  • This path in the process is only taken if the outcome variable is set to true

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Note rejected details

  • Open properties for Note personnel file rejected
  • Expand Implementation/Execution section
  • Use the Script field to log note to personnel file
    • System.out.println("Note for the personnel file of " + kcontext.getVariable("name") + ", award rejected.");
  • This is actually just writing to the log file

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Note accepted details

  • Open properties for Note personnel file accepted
  • Expand Implementation/Execution section
  • Use the Script field to log note to personnel file
    • System.out.println("Note for the personnel file of " + kcontext.getVariable("name") + ", award accepted.");
  • This is actually just writing to the log file

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Email rejected details

  • Select node and open properties for Email
  • Expand Data Assignments section
  • Note the 4 data inputs and click on pencil icon to view
  • The [Body, From, Subject, To] input fields need Sources

Email rejected details

Fill in the following for each source field by selecting Constant from drop down menu:
  • Body: We are happy to inform you that your reward submission was rejected, best of luck next time!
  • From: hr@company.com
  • Subject: Your reward was rejected!
  • To: #{name}@company.com

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Email accepted details

  • Select node and open properties for Email
  • Expand Data Assignments section
  • Note the 4 data inputs and click on pencil icon to view
  • The [Body, From, Subject, To] input fields need Sources

Email accepted details

Fill in the following for each source field by selecting Constant from drop down menu:
  • Body: We are happy to inform you that your reward submission was approved and will soon be deposited to your bank account!
  • From: hr@company.com
  • Subject: Your reward was approved!
  • To: #{name}@company.com

Save the process

  • Be sure to regularly SAVE your work, located left top of designer
  • You can (and should!) comment your work, so click on that link
  • Add a comment and click on Save button
  • After saving, should see a green bar showing save succeeded

Process validation alerts

  • When you save a process you see green pop-up boxes (if all goes well) with validation successes.
  • Pull up the bottom Alerts log and verify no errors
  • (Clear the messages with button on the right)

Rewards process project

(next up, creating process and task forms...)
  • Click on rewards project (use bread crumb menu at the top) and view the domain model assets:
Eric D. Schabell
Portfolio Architect Director
@ericschabell
http://schabell.org
Other Red Hat Process Automation Manager Workshops

Red Hat Process Automation Manager Articles

Red Hat Process Automation Manager Demos

Process Automation Manager

Up next...

Lab 6 - Creating process and task forms