WB835 Unit06 Script
WB835 Unit06 Script
Slide 1
Slide 2
Unit objectives
• Build a business object
• Initialize a complex object and a list
• Build a service
• Use coaches to define and implement guided user interactions
• Implement a service for an activity in a process
• Map variables between a nested service and an activity in the overlying
process
• Describe the object methods
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Slide 3
1
coaches, and if the
same data is shared
across multiple tasks,
Playback participants
can see the data move
through the different
activities
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Slide 4
Topics
• Creating a data model
• Building services
• Building coaches
• Implementing services in a process
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Slide 5
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
• Playback 1 involves demonstrating the process can move from one coach to another inside
the process.
• Business objects are used to represent business data that is relevant to the context of the
process.
• A coach is a user interface for human services.
• Services are made up of activities that are triggered in a process.
• And Data mapping is used to transfer data to and from services in the process.
Slide 6
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Until now, simple variables have been implemented to drive process flow. Process flow data is
only part of the data necessary for the process to function correctly though. Much of the process
flow data is derived from or dependent upon business data. In this Playback, the project
development team defines the business data model for the process.
Slide 7
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Business objects are used to represent the business data that is relevant in the context of your
business process. You want to create a data model that accurately reflects the business data and
its structure. Do not allow existing web pages, existing systems, coaches, web services, database
tables, or other influences to affect the development of your process business objects that belong
in your data model.
Slide 8
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
When the System Data toolkit types or the other business objects do not match the project
specifications, you can create custom business object types. In IBM Business Automation
Workflow, you can use a base business object type or define a new complex structure to create a
custom business object type. You can create rules about complex data that is nested, or
hierarchical. Data that is referenced within the text of a rule is not limited to simple object types
such as String, Integer, or Date. You can also create complicated rules with nested object
structures.
Slide 9
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
After you define the data, organize your data into different logical units. An example might be a
street address, city, and state that becomes a unit that is called address. Some organization is
obvious, but other data is more difficult to organize. Look to existing data models in your company
to help you create the object.
Slide 10
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Business objects begin with an uppercase letter. Adopt this convention to differentiate variables
from business object types. If the business object consists of more than one word, capitalize the
first letter of each word. In the example that is provided in the slide, the position variable uses the
business object type Position. Keep in mind, variables and business objects are case-sensitive.
10
Slide 11
Refactoring
• Limited refactoring support for the following cases:
▪ Business object rename in processes and services
▪ Business object attribute rename in processes and services
▪ Local variable rename in the specific process and related services
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
• Over time, applications change and business objects, their attributes, and variables might be
renamed. However, many parts of a business process might reference or have a dependency
on a business object, an attribute, or a variable. Therefore, renaming any object can produce
unexpected results.
• For instance, suppose you created an object type address that contains city, state, and postal
code elements. Later on, your company goes international and wants to specify the current
object as a US address and add other addresses that belong to other countries. If you
change the object name, anything that references the original address object throws an error,
and you must manually parse through all the objects in your process application to correct the
errors.
• Refactoring offers a one-step process to update references to the changed variable name.
When you use the combination Alt + Shift + R to rename an object, a rename window opens
and guides you through targeting all the things in the library that use the old object’s name.
• Refactoring is available to those objects referenced under the Variables tabs in the processes
and services in your Process Application.
• Unfortunately, one limitation is that any JavaScript code found in coaches are not updated.
11
Slide 12
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
When declaring lists, developers can declare any variable to be a list, or an array, of a business
object type. This statement means that instead of containing only one of the types declared
(String, Date, Integer), the business object holds many of the same business object types.
Therefore, if developers want to create a business object that contains multiple integers, they
create a private list variable of type Integer.
To create a variable list, select the Is List: checkbox, and the list object adds the (List) designator
after the variable type in the variable name.
12
Slide 13
• You must also initialize lists before you use them, by using .listOf
tw.local.yourStringList = new tw.object.listOf.String();
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
In IBM Business Automation Workflow, all complex business objects and all lists must be
initialized before they are used in a process or service. If the complex business object or list is not
initialized, the process receives runtime errors, or notices that the coach controls to which the
business objects are bound do not behave as expected.
If a business object includes nested complex business objects, then you must initialize the nested
business objects before they are used. You also initialize lists before you use them with the
method .listOf. This command works for simple and complex business object types.
13
Slide 14
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Carefully consider how variables are passed from the parent process to other processes when
using nested processes. Subprocesses and linked processes handle variables differently.
• A subprocess has access to the data of the parent process, and data mapping is not
required to pass data into or out of the subprocess. However, you can also declare private
variables within the subprocess that are not visible to the parent process.
• Linked processes require developers to create input and output variables in the nested
process and to map variables from the parent process to the linked process. The variables
must be of the same variable type when mapping. This input and output variable declaration
allows the data values to pass successfully from one process to another.
14
Slide 15
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
When a custom business object is created in a process application, that object is available for all
processes and services included in the process application. To share a custom business object
across process applications, create or store the custom object in a toolkit. Then, create a
dependency on that toolkit from the process applications that require the variable.
The Shared Object checkbox of the business object and its values must be accessible to other
instances at run time. Shared business objects apply only to a complex structure type. The data
within the shared business object is shared between business processes and tasks.
A shared business object uses database resources. The data within a shared object is persisted
to the database when the shared object is created. The business process or task is persisted to
the database when the JavaScript method save() is applied to the shared business object.
15
Slide 16
Building services
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Building services
• After modeling the business process, it is time to think about these processes as sets of
interactions.
• These interactions represent a critical piece of Business Process Management (BPM).
Instead of focusing solely on the chains of activities with their sets of inputs and outputs, think
about the protocols and agreements that are made between the users.
• Services provide a strategy for choreographing these protocols and agreements.
16
Slide 17
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Services are made up of steps that define what happens when the service activities are triggered
in a process. Each step enables the service to do a different job, from integrating with an external
data source to generating HTML forms known as coaches.
17
Slide 18
Creating services
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
You use IBM Process Designer to build reusable services that implement the activities in your
processes. Services differ from processes in that they have no lanes. The service palette is
customized with what items you can use to build the service. For example, in this Playback, you
are examining human services. A coach can be added only to a human service. For a web
service, a service modeler and palette are not required.
When creating a service, developers give them human-readable names. They use spaces
between the words so other developers can understand what this service does. Name the service
after the activity that the service does so developers can identify its function without having to
open the service.
Services use business objects and variables just as processes use business objects and
variables. Remember, these objects can be declared as private, input, or output. Private variables
are values that are seen only within the service; they are also available to any nested services.
Input variables are mapped to values that you can pass into the current service. Output variables
are mapped to values that you can pass out from this service to a parent process or service.
18
Slide 19
Building coaches
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Building Coaches
A human service presents a web form for a process participant to interact with. This web form in
IBM Business Automation Workflow is an HTML page that is called a coach. This topic covers the
fundamentals of building coaches.
During this part of the Playback, developers do not look to alter the appearance or add any extra
functions to their coaches. Developers concentrate on creating forms that can be filled out and
ensuring that data is posted back to the server. The process gathers all the necessary data from
the users in the process to complete the overall process.
19
Slide 20
Coach overview
• Coaches are the web-based user interfaces that provide process-
related data to Process Portal users and collect input from those users
• Coaches are implemented in the client-side human services, which
manage the flow from one coach to another
• Two types of user interface are available for human services:
▪ Task completion
▪ Stand-alone services (dashboard, a startable service, or a URL service)
• Coaches provide a way for team members to input business and
process data into the process in a dashboard or task completion
• Coaches provide a wizard-like approach for team members to complete
their tasks
• The coach is rendered in a browser for the business user when the
coach service (the process activity of the participant) is run
• Similar to building processes and services, developers use a
WYSIWYG interface to build coaches by dragging objects from a widget
palette onto the coach designer canvas
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
• Coaches are the user interfaces for human services. You have two types of user interfaces
for human services: task completion and stand-alone services.
• A task completion user interface implements a specific activity within a process instance. It
also has access to the details of that process instance.
• A stand-alone service can be a dashboard, a service, or a URL service. A dashboard is a
stand-alone user interface that users can run at any time. Users can access dashboards
through the Process Portal.
20
Slide 21
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
• The UI toolkit contains a set of views for designing applications that can run on multiple
device types, such as mobile and desktop devices. Each view points to a specific set of files:
o A JavaScript file that provides the behavior of the view
o Image files to represent the view on the palette and on the canvas
o And a preview JavaScript file that shows a preliminary image of the view when it is
dropped on the coach editor palette
• The view can also have other files such as CSS and LESS files for styling, localization files,
and other control-specific resource files, but these additional files are optional.
• Views are covered in more detail in the next Unit.
21
Slide 22
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
22
Slide 23
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Coaches are web-based forms or dashboards that a developer builds for business users to
complete the tasks or follow process or task performance metrics that are assigned to them at run
time. All development occurs inside a web browser, so developers have a “what you see is what
you get” or WYSIWYG view of the rendering of the coach.
Coaches are made of up of views and controls. The view provides the user interface elements
and layout for the coach through sections and controls. Each view can contain one or more
views, which creates a parent-child relationship between these views. At run time, the parent view
is rendered as a <div> tag that contains a nested <div> tag for each child view. Each view also
has a binding function to use data values from a business object, CSS code to control its visual
layout, and JavaScript to define its behavior.
23
Slide 24
Panels
• Views contain a group of views or controls, or both (other views).
• Views that are panels contain a group of panels or controls or both.
• Panels control the layout of your controls after they are rendered in the
browser.
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Panels are views that contain a group of other panels or controls or both. Panels control the
layout of your controls after they are rendered in the browser. The controls are made of HTML div
and span sections. To add a panel, select Layout in the Building blocks section and drag the
Panel to a spot on the canvas. When the mouse cursor turns to a green plus (+) sign, you can
drop the panel. Gold highlights of other objects on the canvas highlight where the object can be
placed. A tabs control is also used to group similar sections. All the panels can be nested within
each other.
24
Slide 25
Controls
Controls are Views that include buttons and other standard HTML objects.
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Alternatively, you can click the plus sign (+) in a grid to add Controls or objects to the canvas.
Controls are Views that include buttons, check boxes, input boxes, date/time pickers, select
controls, and other standard HTML objects. Although the standard objects cover most of a
developer’s needs, IBM Business Automation Workflow allows developers to customize the
controls. Controls are customized by using a custom HTML block on the coach designer that
includes JavaScript, CSS, or custom HTML elements. When the controls are laid out, it is easy to
copy and paste them into a view to share with other coaches across your process application or
other installations.
25
Slide 26
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Views, whether sections or controls, contain settings for use in the coach. The property settings
are separated into five categories:
• General: This section describes the common properties of the object, such as the control ID,
and the behavior, such as binding and label visibility
• Positioning: Sets the padding, margins, height, width, and overflow of the objects on the
canvas
• Configuration: Allows developers to modify the configuration attributes of an object
• Events: Define logic to be called based on events such as on load, on change, on focus, and
on blur.
• Visibility: Sets the visibility of the object through a variable value, a rule, or a script
• The HTML Attributes section allows developers to add classes and attributes to the HTML
objects that are rendered in the browser
26
Slide 27
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
• A quick and easy way to add controls to a coach is to drag the variable directly to the coach
canvas. IBM BAW binds the variable to an appropriate control such as an input box for a
string variable.
• Before you can do this, you first need to define the simple and complex variables for the
service.
• You add variables in the same manner as adding views. A developer can drag the individual
elements of a complex variable or the entire variable.
• If the output of the coach controls the process flow, add the process flow variables necessary
to control the process directly on the coach. They look like input boxes when running the
coach, and when doing a Playback, developers enter the process flow data into that input box
to control the gateways.
27
Slide 28
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
When designing a client-side human service, you can layout the interactions using a flow
diagram. The editor leverages the same BPMN elements as used in process modeling for
convenience sake.
Following the logic of the diagram displayed on the slide, you can see the first thing completed is
a service task that retrieves department names. If an error occurs in that service, the user is
presented the Show Error Message coach. If the service is successful, the Hiring Form coach is
next displayed.
When the Hiring Form is submitted, a script task labeled Map Vars is executed.
Buttons allow the form to post the data back to the server from the client. On the slide, the
sequence flows for the buttons include the Submit button and the Retry button for when there is
an error.
This slide represents the completed Hiring Request client-side human service.
28
Slide 29
Size Resolution
Small 640 pixels or less
• The controls can respond dynamically Medium 641 - 1024 pixels
to three different screen sizes.
Large More than 1024 pixels
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
29
Slide 30
Implementing services in a
process
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
30
Slide 31
Implementing services
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
When developers first add an activity to a lane in a process, it has default functions. To specify
what happens when an activity is triggered at run time, you must attach a service. Services are
attached in the Implementation section of the Properties tab of an activity. Services can be run
from the process, from a coach, or from other services.
31
Slide 32
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
All Services share the same business objects and instantiate business objects using variables.
You must set the input and output mapping for each activity in the process. If you are using a
linked process, you will also need to map variables between the parent process and the linked
process.
32
Slide 33
Data mapping
• Data mapping is used to pass the values of variables between an activity
(task) in a process and a service.
• When you attach a service to an activity, the Data Mapping section must be
populated with the input and output variables of that service.
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Data mapping is used to pass the values of variables between an activity in a process and a
service. When you attach a service to an activity, the Data Mapping section must be populated
with the input and output variables of that service. The Data Mapping section is used to map the
input and output variables of the service to variables in the process so that runtime variable
values can be passed to and from the service.
If data is not showing up on a coach when it should be, many times it is a data mapping issue.
33
Slide 34
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Mapping input and output data is applicable only if the client-side human service is used within a
process. If the client-side human service is used for a dashboard, data mapping is not
necessary.\
If the variables defined in the process use the same names as those contained in the activity, you
can use the auto-mapping feature.
34
Slide 35
tw.local.myString.toLowerCase();
Namespace Object Method
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
All objects in IBM Business Automation Workflow have methods that are associated with them. If
you are familiar with object-oriented programming, then you are familiar with using methods on
objects. To access the object methods, you must first use the object namespace followed by the
object, and the method you would like to access.
JavaScript methods corresponding to the object type are available with the standard syntax.
For example, the JavaScript method toLowerCase can be called on an object of type String. In
this example, the results of the call are used to convert the value of tw.local.myString variable to
all lowercase.
35
Slide 36
Unit summary
• Build a business object
• Initialize a complex object and a list
• Build a service
• Use coaches to define and implement guided user interactions
• Implement a service for an activity in a process
• Map variables between a nested service and an activity in the overlying
process
• Describe the object methods
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
36
Slide 37
Review questions
1. True or false:
Capitalize the first letter of business objects. Use a camel case data
type for a variable when creating an instance of the object (for
example, employeeId).
2. Coaches are made up of what two types of components?
3. How do you define what should occur in order for a participant to
complete an activity?
A. Services
B. Gateways
C. Lanes
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
Notes:
Write your answers here:
•
37
Slide 38
Review answers
1. True. This naming convention makes it easier to identify whether a
business object is the object type or an instance of the object.
2. Sections and controls. Sections control the layout of your controls
after they are rendered in the browser. Controls include buttons,
check boxes, input boxes, date time pickers, select controls, and
other standard HTML objects.
3. A. Services define what happens when users try to complete their
activity or when the system must run an activity in a process.
Services are attached to an activity from the Implementation section
in the Properties view.
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2020
38
Slide 39
Exercise: Playback 1:
Business data, services, and
coaches
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2019
39
Slide 40
Exercise introduction
• Determine and organize data when provided with a written
process
• Add business objects and object types
• Create a client-side human service
• Add variables and business objects to a process application
• Create and configure a coach to obtain process participant
input
• Model a coach by using the concept of grids
• Add coach controls to control process flow
• Create a client-side human service and coach for the General
Manager review activity
• Implement an activity by attaching a service and mapping data
Playback 1: Business data, services, and coaches © Copyright IBM Corporation 2019
40
41