Finishing 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
Defining process input properties (data)
We will be submitting an
Employee
when starting our process along
with two other variables;
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
Open process data in diagram editor
The properties pane for our process opens in right pane by click on
Process Data
at the bottom to open editor:
Add new process variable
Next click on plus icon '+' to define a new process variable:
Add employee process variable
Add first variable, the employee process variable:
- Name:
employee
- Data Type:
Employee [com.redhat.demo.hr.rewards]
Add two final process variables
Add final two process variables:
- Name:
outcome
- Data Type:
Boolean
- Name:
name
- Data Type:
String
Saving your work
- 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 task details
Click on Approve Reward
node. Properties for node appears in right
pane editor, expand the menus and you'll see Assignments
section
at bottom:
Approve Reward task 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 - map Employee to employee_in
Within our tasks we'll map global variables to local variables and on exit
from a task we'll map data back 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 - map approval to outcome
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 - assign a 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 - assign to manager group
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:
- Click on
Add
button under Groups
- Click on
New
and create manager
group
- Click on check mark to save the new group
Approve Reward - assign on entry action
Upon entering this task node, it's possible to take small actions. We'll use it
to map data model value to a process variable. At bottom of properties pane,
locate the Script
field:
Approve Reward - on-entry assign name variable
Using the
java
setting, copy Employee.name to name process variable:
kcontext.setVariable("name", employee.getName());
Approve Reward - assign on exit action
We'll add some debug log information on exit of this node. At bottom of properties
pane, locate Script
field:
Approve Reward - on-exit assign log status
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") + ".");
Saving your work
- 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 - setup task to log a message
This task node is to log a message:
- 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 - logging name and decision details
Add logging code in two stages, first we log the employee being rewarded and second we
log the final reward 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 - logging outcome if not set?
Now what if the value of
outcome
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"));
Saving your work
- 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 flow - set name rejected
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
Process flow - set condition details
We want this path taken if the
outcome
variable is set to false, so
start by:
- Expanding the
Implementation/Execution
section
- Use the
Condition
radio button to activate menus for variable checking
- Select Process Variable
outcome
and Condition Is false
Saving your work
- 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 flow - set name accepted
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:
accepted
Process flow - set condition details
We want this path taken if the
outcome
variable is set to true, so
start by:
- Expanding the
Implementation/Execution
section
- Use the
Condition
radio button to activate menus for variable checking
- Select Process Variable
outcome
and Condition Is true
Saving your work
- 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 Personnel File Rejected - sending note
We want to note the path taken by our process instance in the logs:
- 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.");
Saving your work
- 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 Personnel File Accepted - sending note
We want to note the path taken by our process instance in the logs:
- Open properties for
Note personnel file accpeted
- 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.");
Saving your work
- 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 - data inputs
Select node and open properties for
Email rejected
to add data inputs:
- 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 - create mail template
Fill in 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
Saving your work
- 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 - data inputs
Select node and open properties for
Email accepted
to add data inputs:
- 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 - create mail template
Fill in 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
Saving your work
- 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 finished - validation alerts (gone!)
When you save a process you see green pop-up boxes (if all goes well) with validation
successful. Pull up the bottom Alerts
pane with error log and verify there
are no more errors.
(Note: Clear
and refresh the messages with button on the right)
Returning to Asset view
Finally, we return to Asset view by clicking on rewards
project
in bread crumb menu at top. (Returning to Asset view can be done at any time).
Other Red Hat Process Automation Manager Workshops
Red Hat Process Automation Manager Articles
Red Hat Process Automation Manager Demos: