Академический Документы
Профессиональный Документы
Культура Документы
3
Siebel Scripting Training
• Architecture
• Server Script
• Browser Script
• Flow of Execution
• Business Services
• Implementation Considerations and Best Practices
• Testing and Debugging
• Appendix
4
<Insert Picture Here>
5
What is Siebel Scripting?
6
Siebel Scripting Capabilities
7
Siebel 7 Scripting
8
<Insert Picture Here>
Architecture
9
Architecture
Client Side
Web Server
SWE
Siebel
Database
10
Architecture
11
Architecture
Language Platform
eScript Windows
Unix
Javascript MS Internet Explorer 5.5+
Mozilla Firefox (for SI mode
apps only)
12
Architecture
• eScript and Siebel Visual Basic
13
Architecture
• Events
• Custom scripts implemented on objects in the Siebel repository can be triggered by various
events
• Triggering events can occur when a user performs an action such as creating a new record,
clicking an applet button or the user navigating to a new view.
• Methods
• In addition to supporting the placement of custom scripts on objects, they also support a range
of standard methods that can be programmatically invoked from custom script.
• For example it is possible to programmatically search for records in the database, perform
updates to the current record from a custom script or programmatically invoke a business
service.
14
Architecture
15
Architecture
• In addition to implementing custom script on objects within the Siebel repository to modify the standard
application behaviour to meet a customers requirement. A customer may also want to access Siebel data
from a external application.
• It is possible to access Siebel data from an external MS Windows application written in either VB or C++
using the COM Data Server activex object.
• See Siebel Object Interfaces Reference > COM Data Server Quick Reference
• It is possible to access Siebel data from an external java application use the Java Data bean
• See Siebel Object Interfaces Reference > Java Data Bean Quick Reference
16
Architecture
• In some cases a customer may have a bespoke desktop application that they want to interact together with a current session
of the Siebel application that might be running on the same PC.
• This is possible using the functionality provided by the automation server components which allows an application written in
VB or C++ to programmatically interact with the current Siebel session running on the same PC.
• There are two versions of the automation server depending on whether the Siebel application will be run using the mobile
web client or web client.
• Siebel Object Interfaces Reference > Mobile Web Client Automation Server Quick Reference
• Siebel Object Interfaces Reference > Siebel Web Client Automation Server Quick Reference
17
<Insert Picture Here>
Server Scripting
18
Server Scripting
19
Server Scripting
20
Server Scripting
21
Server Scripting
• When invoking the server script editor for the first time you will be asked which language that you want to
use for the current repository object.
• Use checkbox to set default language to be used for all objects. This can also be set default language in
Tools > View > Options > Scripting dialog. This setting is stored in tools.cfg file not in the Siebel repository.
22
Server Scripting
• Application
• Business Components
• Applets
23
Server Scripting – Application object
• In Siebel 7.8 the Application object has the following scripting
events in which you can place custom server scripts:
• Application_Start
• Application_Close
• Application_PreInvokeMethod
• Application_InvokeMethod
• Application_PreNavigate
• Application_Navigate
24
Server Scripting – BusComp object
• In Siebel 7.8 the Business Component object has the following scripting events in which you
can place custom server scripts:
• BusComp_PreNewRecord BusComp_PreQuery
• BusComp_NewRecord BusComp_Query
• BusComp_PreCopyRecord BusComp_PreInvokeMethod
• BusComp_CopyRecord BusComp_InvokeMethod
• BusComp_PreDeleteRecord BusComp_DeleteMethod
• BusComp_ChangeRecord BusComp_PreAssociateRecord
• BusComp_PreWriteRecord BusComp_AssociateRecord
• BusComp_WriteRecord
• BusComp_PreSetFieldValue
• BusComp_SetFieldValue
• BusComp_PreGetFieldValue
25
Server Scripting – Applet object
• In siebel 7.8 the Applet object has the following scripting
events in which you can place custom server scripts:
• WebApplet_PreInvokeMethod
• WebApplet_InvokeMethod
• WebApplet_PreCanInvokeMethod
• WebApplet_Load
• WebApplet_ShowControl
• WebApplet_ShowListControl
26
Server Scripting - eScript Engines
7.0.x : T Engine
7.5.x : T Engine
7.7.x : T Engine 7.7.2.3 ST Engine
27
Benefits of ST Scripting Engine:
• Improved scalability:
Lower footprint per user for CPU and memory use
• New functionality:
Added support for ECMAScript Edition 4 compliant strong
typing. Using strongly typed objects results in more functional scripts
and faster performance.
28
Enabling ST Script Engine in > 7.7.2.3
[Siebel]
RepositoryFile = siebel.srf
ApplicationName = Siebel Tools
ApplicationTitle = Siebel Tools
ApplicationSplashText = Tools
Vertical =
ComponentName = Siebel Tools Client
DataSource = Local
EnableCLIScripting = TRUE
…
29
Enabling ST Script Engine in > 7.8.2
30
Server Scripting – Tools Options
T Script Engine ST Script Engine
31
Enable Method Listing / Enable Auto Complete
32
Enable Warnings / Deduce Types
33
ST Scripting Engine References
• Bookshelf:
• Using Siebel Tools > Siebel Script Editors > About the ST
eScript Engine
• SupportWeb:
• Technical Note 610: Scripting Enhancements in Siebel Fix
Pack 7.7.2.3
34
v8 Enhancements to ST Scripting Engine
35
v8 Enhancements – ‘Enable Favorites’
• Most frequently accessed objects exposed in the Script
Assist window appear at the top
• Favourites appear in italic type
• Session based
• Unused favourites eventually drop back down list
36
<Insert Picture Here>
Browser Scripting
37
What is Browser Script?
38
The Document Object Model (DOM)
39
Supported Events for Browser scripting
• HI mode:
• Applet_PreInvokeMethod
• Applet_InvokeMethod
• Applet_ChangeRecord
• Applet_ChangeFieldValue
• Applet_Load
• BusComp_PreSetFieldValue
• Service_PreInvokeMethod
• Service_InvokeMethod
• Service_PreCanInvokeMethod
40
Supported Events for Browser scripting
• SI mode:
• Form Applet Control and List Applet List Column controls
• onmouseover
• onmouseout
• onblur
• onfocus
• onclick
41
Supported DOM Events for HI Mode
Bookshelf 7.8 > Siebel Object Interfaces Reference > Browser Scripting > Supported DOM Events for High Interactivity Mode > Table 67
42
Supported DOM Events for HI Mode (cont’d)
43
Supported DOM Events for SI Mode
44
Supported DOM Events for SI Mode (cont’d)
Bookshelf 7.8 > Siebel Object Interfaces Reference > Browser Scripting > Supported DOM Events for Standard Interactivity Mode > Table 68
45
Generating Browser Scripts
• If Browser script compilation folder is set in Tools, those written against the compiled objects will be generated.
• View > Options > Scripting
46
Generating Browser Scripts (cont’d)
47
Generating Browser Scripts (cont’d)
• Web Clients:
C:\ses78\SIEBSRVR\BIN\genbscript.exe
C:\ses78\SIEBSRVR\BIN\ENU\uagent.cfg
C:\ses75\SIEBSRVR\WEBMASTER
48
Generating Browser Scripts (cont’d)
• Bookshelf (7.8):
• Configuring Siebel eBusiness Applications > Overview of
Configuring Siebel Applications > About Scripting and Object
Interfaces > Generating Browser Scripts
• SupportWeb:
• Alert 365: Browser Script Generation in Siebel 7.x and 8.x
• Alert 466: Genbscript must be run after Distribution of SRF
Upgrade kit to Mobile Web Client for Version 7.0.3 and
higher.
49
<Insert Picture Here>
Flow of Execution
50
Scripting flow Control
• Important to understand:
• The way in which events are called.
• What is possible in different environments (HI vs SI)
• How to communicate between application layers
51
Scripting Flow Diagram
52
Enabling a Custom Button on an Applet
53
Enabling a Custom Button on an Applet (cont’d)
WebApplet_PreCanInvokeMethod
54
Enabling a Custom Button on an Applet (cont’d)
55
Enabling a Custom Button on an Applet (cont’d)
56
Enabling a Custom Button on an Applet (cont’d)
Button Press
“ContinueOperation”
Applet_PreInvokeMethod WebApplet_PreInvokeMethod
CancelOperation
ContinueOperation
ContinueOperation
BusComp_PreInvokeMethod
No Server Side
WebApplet_InvokeMethod
processing if
handled on
browser side Applet_InvokeMethod
Server
Browser DONE
57
Scripting flow Control
58
<Insert Picture Here>
Business Services
59
What are Business Services?
• Reusable, independent objects that encapsulate and simplify the
use of some set of functionality.
• Objects that operate, or act upon, other objects to achieve a
particular goal.
• Are not specifically tied to data or tables within the Siebel data
model.
• Can simplify the task of moving data and converting data
formats between the Siebel application and external
applications.
• They can be assessed either directly by way of Workflows
(Business Processes), or by way of script written against
object(s) within the Repository.
• General business services are based on the class ‘CSSService’,
although exceptions for specialised cases also exist.
60
Types of Business Services
61
Types of Business Services - Custom
• In Siebel Tools:
• Created at design time in Siebel Tools using Siebel VB or
Siebel eScript.
• Have to be compiled into SRF before testing possible.
• Stored in the repository and automatically migrated to new
repository during the upgrade processes.
62
Invoking a BS from Browser Script
Invoke Method
“ContinueOperation”
Service_PreInvokeMethod Service_PreInvokeMethod
Continue Operation
CancelOperation
Default Service
Processing
“CancelOperation”
Service_InvokeMethod
No Server Side
processing if
Server handled on
Service_InvokeMethod
Browser browser side
DONE
63
Invoking a Custom BS from Browser Script
64
Invoking a Custom BS from Server Script
65
Syntax for invoking BS
• Browser
var psInput = theApplication().NewPropertySet();
var oService = theApplication().GetService(“xxx”);
var psOutput = oService.InvokeMethod(“xxx”, psInput);
• Server
var psInput = TheApplication().NewPropertySet();
var psOutput = TheApplication().NewPropertySet();
var oService = TheApplication().GetService(“xxx”);
oService.InvokeMethod(“xxx”, psInput, psOutput);
66
<Insert Picture Here>
Implementation
Considerations and Best
Practices
67
Best Practices - General
• Siebel Scripting provides a powerful and flexible way to
customize your Siebel applications. However, adding
scripting to Siebel applications increases the overall
complexity of application maintenance and upgrades,
thereby increasing the total cost of ownership.
• Poorly designed and implemented eScript or Siebel VB can
directly and negatively impact the performance,
scalability, and system stability of your Siebel application
implementation.
Primary references:
68
Best Practices - General
• Before resorting to using scripting you should always consider if there
is a configuration based method of achieving the requirement. This is
because a scripting solution may not be most effective or give best
performance.
See:
69
Best Practices – Exception Handling
• Implement exception handling code to handle unexpected errors in
a controlled way and also perform “clean up” actions.
try
{ // code that should be executed goes here
}
catch (e)
{ // error handling code goes here for example…
TheApplication().RaiseErrorText(e.toString());
}
finally
{ // clean up code that will be executed even if error occurs goes here
}
70
<Insert Picture Here>
71
Debugging Options - Server
• Tools Debugger - use of Breakpoints, and debug toolbar to step through code.
• Log file
• Web Client - Set tracing on Object Manager
• Dedicated Web Client - Set ‘SIEBEL_LOG_EVENTS’ System Environment Variable to 4 or 5
72
Debugging Options – Browser
• theApplication().SWEAlert();
• FileSystemObject
var fso = new ActiveXObject(“Scripting.FileSystemObject”);
var a = fso.CreateTextFile(“c:\\debug.txt”, true);
// var a = fso.OpenTextFile(“c:\\debug.txt”, 8, false);
a.WriteLine(“Output to debug file…...”);
a.Close();
73
v8 Enhancements - Debugging with
ST Scripting Engine
74
v8 Enhancements – ‘Fix And Go’
• Allows changing a script in a local Tools Debugging session and directly
testing changes on the Siebel Developer Web Client without having to
recompile SRF
75
<Insert Picture Here>
APPENDIX A
Server Side Scriptable Object Events
(See also Bookshelf > Siebel Object Interfaces Reference Guide)
76
Application Object
77
Server Scripting – Application object
Application_Start event
• The Start event is called when the client starts and again when
the user interface is first displayed.
• You can place code that you want to run when the users
application session is started in this event, for example to
initialize profile attributes or start a business process.
78
Server Scripting – Application object
Application_Close event
79
Server Scripting – Application object
Application_PreInvokeMethod event
80
Server Scripting – Application object
Application_InvokeMethod event
81
Server Scripting – Application object
Application_PreNavigate
• The arguments DestViewName and DestBusObjName are passed to the event. This
identifies the name of the view to which the user is navigating and the business
object of the destination view.
• This event can be used for validation and determining if the user should be allowed
to navigate to the view. Return CancelOperation if the navigation should not
proceed, else return ContinueOperation for the navigation to be allowed.
82
Server Scripting – Application object
Application_Navigate
83
Business Component
Object
84
Server Scripting – Buscomp object
Buscomp_PreNewRecord
• The event will be triggered by the user performing action in the user
interface to create a new record in an applet. It can also be triggered
as result of custom code creating a new record in the buscomp.
85
Server Scripting – Buscomp object
Buscomp_NewRecord
• The NewRecord event is called after a new row has been created in
the business component, initialized due to configurations and made
active.
• The event may be used to set up default values for fields. For
example place code in this event to programmatically populate certain
fields in the buscomp based on complex calculation.
• This event is not triggered if the new record has been created as the
result of a copy operation either in the user interface or from custom
script. The Buscomp_Copy event will be triggered instead.
86
Server Scripting – Buscomp object
Buscomp_PreCopyRecord
87
Server Scripting – Buscomp object
Buscomp_CopyRecord
• through any UI copy record mechanism (Edit > Copy Record; CTRL+B)
88
Server Scripting – Buscomp object
Buscomp_PreDeleteRecord
• This event may be used to perform validation checking to evaluate if the deletion
should proceed.
• In this event you can evaluate the current value of fields within the record to be
deleted using this.GetFieldValue(fieldname)
89
Server Scripting – Buscomp object
Buscomp_DeleteRecord
• The current context is a different row (the Fields of the just-deleted row are
no longer available).
• When a user reads and deletes an existing record or creates and then undoes
the new record, this invokes the DeleteRecord method and will results in the
execution of any scripts on the PreDeleteRecord and DeleteRecord events.
90
Server Scripting – Buscomp object
Buscomp_PreWriteRecord
• The PreWriteRecord event is called before a new or updated row is written to the
database.
• In this event you perform any final validation necessary before the actual save
occurs. Return CancelOperation if you do not want the record to be written to
the database, otherwise return ContinueOperation to allow the database to be
updated.
• The PreWriteRecord event triggers only if a field value was modified or inserted,
or when a record is deleted. When a record is deleted, PreWriteRecord is called
to delete the implied join records to the initial record.
91
Server Scripting – Buscomp object
Buscomp_PreWriteRecord
Notes:
92
Server Scripting – Buscomp object
Buscomp_WriteRecord
93
Server Scripting – Buscomp object
Buscomp_PreSetFieldValue
• To trigger this event as soon as user enters a value into a field set the
field’s property ImmediatePostChanges = “True” else the event will be
triggered for all fields when the record is written.
94
Server Scripting – Buscomp object
Buscomp_SetFieldValue
95
Server Scripting – Buscomp object
Buscomp_PreGetFieldValue
• You can use this event to implement fields that are based on a
complex calculation that needs to be implemented in code.
• Populate the argument FieldValue using your custom code with the
desired value and return CancelOperation from the event.
Note: in eScript the & preceeding the FieldValue argument name indicates that the parameter is being
passed to the event method by reference (and not value)
96
Server Scripting – Buscomp object
Buscomp_PreQuery
97
Server Scripting – Buscomp object
Buscomp_Query
98
Server Scripting – Buscomp object
Buscomp_PreInvokeMethod
• Custom methods at buscomp level usual refer to field values within the current
records context:
for example this.GetFieldValue(“fieldname”)
99
Server Scripting – Buscomp object
Buscomp_ChangeRecord
100
Server Scripting – Buscomp object
Buscomp_PreAssociate
101
Server Scripting – Buscomp object
Buscomp_Associate
102
Applet Object
103
Server Scripting – Applet object
WebApplet_PreInvokeMethod
• The PreInvokeMethod event is called before a specialized method for the applet is invoked or a user-defined method is
invoked through from code using the InvokeMethod applet method.
• Argument methodName is a string variable containing the name of the method being invoked.
• To implement a custom method for the applet place custom code in this event. Return CancelOperation at the end of the
custom methods implementation.
• Return CancelOperation in this event to prevent a specialized method to be executed. Return ContinueOperation in this
event to allow standard or specialized methods to proceed.
104
Server Scripting – Applet object
WebApplet_InvokeMethod
105
Server Scripting – Applet object
WebApplet_PreCanInvokeMethod
106
Server Scripting – Applet object
WebApplet_PreCanInvokeMethod
• Example (eScript)
return (ContinueOperation);
}
107
Server Scripting – Applet object
WebApplet_Load
108
Server Scripting – Applet object
WebApplet_ShowControl
109
Server Scripting – Applet object
WebApplet_ShowControl
110
Server Scripting – Applet object
WebApplet_ShowControl
• Example
111
Server Scripting – Applet object
WebApplet_ShowListColumn
112
Server Scripting – Applet object
WebApplet_ShowControl
113
Server Scripting – Applet object
WebApplet_ShowListColumn
• Example
114