BPA Scripts
17 - 2
BPA
17 - 3
Script
Plug-In
Service
UI-Oriented Scripts
BPA scripts help users work through business processes
They typically ask users to enter information and then
invoke a server-based service to update the database
For example, you can develop BPA scripts to help users:
17 - 4
17
Invoking BPA Scripts
17 - 6
Favorite
Scripts
Script
17 - 7
User
Favorite
Scripts
Script
17 - 8
Version 2 Implications
With the advent of version 2, the need to use the BPA menu to invoke
scripts is greatly reduced
This is because version 2 allows designers to place HL's and icons
that execute BPA scripts in more easily accessible places on the UI:
A menu item can invoke a BPA script (you just did this)
A context menu item can invoke a BPA script
An entry in the Favorite Links dashboard zone can invoke a BPA script
A hyperlink in an explorer zone can invoke a BPA script
A zone header can contain a hyperlink that invokes a BPA script
Buttons on display-only UI maps can invoke BPA scripts
Context sensitive zones can contains buttons and hyperlinks to invoke
BPA scripts
Selecting a To Do entry can kick off a BPA script
Etc.
17 - 9
17
The BPA Area
The action bar contains buttons that allow you to update the
database and navigate to transactions
These 4 elements
Area
appear onDisplay
every
page
17 - 11
17 - 12
17
UI Map
Service
Script
Script
(BPA)
Data Area
17 - 14
BO
Standalone
Business
Service
Remember, UI
maps have
schemas just like
everything else that
appears below
Script
(BPA)
Data Area
Taxpayer
Spouse
Depend1
Depend2
17 - 15
BO
BO: Human
BO: Human
BO: Human
BO: Human
<name mapField=ENTITY_NAME>
<row mapChild=CI_PER_NAME">
<PRIM_NAME_SW is="Y"/>
<NAME_TYPE_FLG default="Primary"/>
</row>
</name>
<email mapField=EMAILID"/>
<socialSecurityNumber mapField="PER_ID_NBR">
<row mapChild=CI_PER_ID">
<ID_TYPE_CD is="SSN"/>
</row>
<socialSecurityNumber/>
<homePhone mapField="PHONE" >
<row mapChild="CI_PER_PHONE">
<PHONE_TYPE_CD is="HOME" />
</row>
</homePhone>
Same Thing
You could achieve the same thing by referencing a single
service script whose schema is configured accordingly
And this is, by far, the preferred approach as a single service call
from the client to the server is always better than 4 service calls
Family Service Script Schema
Script
(BPA)
Data Area
<Taxpayer type=group>
<includeBO name=Human"/>
<Taxpayer/>
Service
Script
<Spouse type=group>
<includeBO name=Human"/>
<Spouse/>
<Depend1 type=group>
<includeBO name=Human"/>
<Depend1/>
17 - 16
<Depend2 type=group>
<includeBO name=Human"/>
<Depend2/>
17
Script
Step
Step Type
Control the UI
Structured programming techniques
17 - 18
Valid Values:
Move data
Conditional branch
Label
Go to a step
Edit data
Invoke business object
Invoke business service
Invoke service script
Terminate
Prompt user
Input data
Set focus to a field
Mathematical operation
Invoke function
Invoke map
Height
Navigate to a page
Press a button
Display text
Perform script
Transfer control
Transfer control
Perform script
Invoke map
Navigate to a page
You can also use Xpath, but you are limited to the XPath 1.0 language
as most browsers have not adopted 2.0 yet
Height Steps
Height steps allow you to change the height
of the BPA area to be larger or smaller than
the standard size
You can also specify a height of 0 to hide
the BPA area
Most of our scripts don't use the BPA area
and therefore the first step is frequently a
Height of zero
Remember, if you want to display data
during debugging, set the Height to
something other than zero (15% is a
standard height)
Or just leave out the height step (but then you'd
have to add it before "production")
17 - 20
Script
Step
Height Unit
Valid Values:
Pixels
Percentage
17 - 21
Step
Navigation
Option
17 - 22
17 - 23
17 - 24
Perform Steps
A Perform step would better be defined as an Include step
Perform steps are used to execute script steps that are
defined in a separate script (which we refer to in common
parlance as a "subscript")
You'd move steps into a "subscript" just because its a
good programming technique to not repeat the same logic
in multiple scripts
No one can force you to be a good programmer though
17 - 25
Transfer Steps
A Transfer step stops execution of the current script and
starts execution of another script
Again, you use this to consolidate common logic
And again, no one can force you to be a good programmer
17 - 26
17
The nice side effect of this is that, while most MO's require a new BPA
script to add, change and delete their BO's, the script is trivial
What takes the work is the development of the UI maps to capture data
We will only be able to explain how this was achieved after the future
chapter is behind us
If you're interested in "reading ahead", have a look at the BPA script
used to add an approval profile and notice how virtually everything in
it is dynamic
We'll now move on to describing the structure of the UI maps that are
invoked by these trivial BPA scripts
17 - 28
17
Scripts and UI Maps
17 - 30
An Example
Clicking the icon causes a
BPA script to execute
17 - 31
UI Map
Schema
HTML
<includeBO name=C1-ConsProg"/>
<tr>
<td oraLabel="conservationProgram/description"></td>
<td><input type="text"
oraField="conservationProgram/description" />
</td>
</tr>
<tr>
<td oraLabel="conservationProgram/generalInfo/startDate"></td>
Notice in this example
<td><input type="text"
that weve just included
oraField="conservationProgram/generalInfo/startDate" />
the schema of a BO (so if
</td>
you change this BO, you
</tr>
17 - 33
17 - 34
17
17 - 36
Base-Package Patterns
The BPA area is rarely, if ever, used as it looks odd having
a UI map in the BPA area
Pop-ups are used when:
You want the user to confirm the action (e.g., if the user wants to
delete something, we will frequently pop-up a map asking them to
confirm the deletion)
You need a small amount of additional information to complete the
action (e.g., if the user wants to reject an adjustment, we would
pop-up a map asking them for the rejection reason)
17 - 37
17
17 - 39
Enforcing Consistency
We ship a sample style sheet so your HTML can inherit the
look and feel from a single spot
We also ship a library of JavaScript functions to handle
things like monetary formatting, date formatting,
defaulting, etc.
You can add your own functions if you want
You can choose to ignore our functions; the choice is yours
17 - 40
HTML Sources
The UI map tips contain many HTML examples
Recall that the UI map transaction has a dashboard zone
that can generate sample HTML for display only and input
maps using the map's schema
There are many base-package and demo BPA scripts and
UI maps with interesting examples
17 - 41
17 - 42
17
User Interface (UI) Maps
Drop Downs
17 - 44
17 - 45
See the map used to add / update a Rebate Definition to see how
users can upload data from a CSV (useful for mass uploads)
See the map used to display the Sample and Submit results to see
how user can see a list of the results from an explorer zone in a UI
map
17 - 46
17
Updating The Database
17 - 48
Displaying Errors
In most sample scripts, if an error is returned, we return to the step
that invokes the map
This causes the map to be redisplayed with the error message shown in
red
This is the base-package standard
If you want to show the error in a pop-up, you can; just navigate to a
step that invokes another pop-up
17 - 49
17 - 50
17
User /
Favorite
Link
Navigation
Option
Transaction
Script
Script
(BPA)
17
Menu Line
Menu Item
Transaction
17 - 54
Script
Script
(BPA)
Navigation
Option
Menu Item
Transaction
17 - 55
Script
Context
Script
(BPA)
17
17 - 57
17 - 58
17
Access Rights
Plug-In
17 - 60
Application
Service
BPA and
Service
This is optional
Valid actions
aren't used for
this type of
security check
17 - 61
17
17 - 63
Review Questions
17 - 64
17
Eligibility Rules
Outdated Concept
Eligibility rules were used prior to version 2
With the advent of V2 (and the ability to put BPA scripts on
menus, favorites, explorer hyperlinks, explorer zone
header hyperlinks, context sensitive zones, etc.) the need
to use the BPA menu and the eligible scripts zones to
invoke scripts has been reduced
Because eligibility rules are only used on the BPA menu
and the eligible scripts zone, this section is therefore not
as relevant as it used to be
If you're running short of time, skip this section as it's
sophisticated and will rarely be used in base-package
development
17 - 66
17 - 67
For example, you can indicate a script is only eligible if the user is part of the
CSR user group AND the current accounts customer class is residential
i.e., a user can execute a favorite script even if its not eligible
i.e., only eligible scripts matching the users search criteria appear in the
bottom half of the script menu (if theyve turn on the switch on the BPA
menu)
17 - 68
17 - 69
Valid Values:
Always Eligible
Never Eligible
Based on Criteria Group
Script
17 - 70
17 - 71
Script
Criteria
Group
Eligibility
Criteria
Customers credit rating is > 700 and amount of debt older than 60
days is between $50 and $500, OR
Credit rating is > 800 and the amount of debt older than 60 days is
Eligibility Group 1
between $50 and $1,000
Eligible for the script if the criteria indicate the group is
TRUE
17 - 72
Script Group 2
Eligible for the script if the criteria indicate the group is
TRUE
Eligibility Criteria
When an eligibility criterion is executed, the system
17 - 73
Valid Values:
Person
Account
Premise
Valid Values:
Call an algorithm
Characteristic
This is only used if you need
to retrieve a value from
someplace else in the
system (other than a
characteristic)
Valid Values:
<
<=
=
>=
>
<>
Between
In
Call an algorithm
17 - 74
Script
How to retrieve
comparison
value
Value
Retrieval
Algorithm
How to
compare
Comparison
Algorithm
Criteria
Group
Eligibility
Criteria
What happens
if the criteria is
true
What happens
if the criteria is
false
What happens
if the criteria is
indeterminate
17 - 75
Script
Valid values:
Eligible
Ineligible
Check Next Group
If Group Is
True
Valid values:
Eligible
Ineligible
Check Next Group
If Group Is
False
Criteria
Group
Eligibility
Criteria
17
17 - 77
Script
How to retrieve
comparison
value
Value
Retrieval
Algorithm
Criteria
Group
Eligibility
Criteria
Script
How to
compare
Must be a senior
Must have been a customer for less than
Comparison
a year
Algorithm
17 - 78
Criteria
Group
Eligibility
Criteria
17 - 79