OIRef
OIRef
OIRef
Copyright 2005, 2011 Oracle and/or its affiliates. All rights reserved. The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be errorfree. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial Computer Software--Restricted Rights (June 1987). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and we disclaim liability for any damages caused by such use of the Programs. The Programs may provide links to Web sites and access to content, products, and services from third parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites. You bear all risks associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is directly between you and the third party. Oracle is not responsible for: (a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations related to purchased products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from dealing with any third party. Oracle, JD Edwards, and PeopleSoft are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Contents
Chapter 1: Whats New in This Release Chapter 2: About Object Interfaces and the Programming Environment
Object Interfaces You Can Use to Access Siebel Objects 9
Overview of Interfaces You Use to Access Siebel Objects 9 Objects You Can Access Through a Siebel Object Interface 10 About the Siebel Java Data Bean Object Interface 12 About the Siebel COM Object Interface 12
17 20
Siebel Object Interface Methods You Can Use to Control Data and Objects
to Locate an Object 20 to Access Data from a Business Component 21 to Control the Navigation Flow of a Siebel Application 26 to Get and Display Information About the Current State 27 That Allow You to Control Debug Tracing 27
34
the Web Client Automation Server 35 the Mobile Web Client Automation Server 36 the Siebel COM Interface 38 the COM Data Server 40 the COM Data Server with Microsoft Visual Studio COM Data Control 46 the Siebel Java Data Bean 48
42
56
Contents
Customizing How Siebel CRM Continues an Operation 57 Using Tracing to Determine When an Event Occurs 59
60
100
Applet Methods 101 Applet Events 107 Application Methods 122 Application Events 177 Business Component Methods 183 Business Component Invoke Methods Business Component Events 260 Business Object Methods 275 Business Service Methods 278 Business Service Events 287 Control Methods 294 Property Set Methods 304 Miscellaneous Methods 320
250
326
Contents
Business Component Events for Browser Script 328 Business Object Methods for Browser Script 328 Business Service Methods for Browser Script 328 Business Service Events for Browser Script 329 Property Set Methods for Browser Script 330 Control Methods for Browser Script 331 Document Object Model Events You Can Use 332
Contents
Index
1
Table 1. Topic
Whats New in Siebel Object Interfaces Reference, Version 8.1, Rev A Description New topic. The siebel.conmgr.poolsize property and the Min MT Server parameter determine the total number of open connections. New topic. If you use Browser Script that calls a business service, then you must register that business service with the Siebel application. New topic. If Siebel CRM detects duplicate records when it executes the ExecuteQuery method, then the work it performs to resolve the duplicates depends on the value of the cursorMode argument. Revised topic. You can use the NextRecord method with Browser Script. Revised topic. The file that Siebel CRM creates from an external source is compressed in a Siebel proprietary format. Siebel CRM uploads and stores it in that format on the Siebel File System. Revised topic. The order in which Siebel CRM stores properties in a property set is random. The GetFirstProperty method and the GetNextProperty method might return any business service property.
Determining the Total Number of Open Connections on page 52 Registering a Business Service with a Siebel Application on page 139 How Siebel CRM Handles Duplicate Records with the ExecuteQuery Method on page 196 NextRecord Method for a Business Component on page 220 CreateFile Method for a Business Component on page 252
Additional Changes
This book has been reformatted to improve usability.
Table 2. Topic
Whats New in Siebel Object Interfaces Reference, Version 8.1 Description To enable the Mobile Web Client Automation Server, you set the EnableWebClientAutomation parameter to TRUE in the InfraUIFramework section of the Siebel application configuration (CFG) file. Added a caution not to use the ActivateField method on user interface (UI) context objects. You cannot use the same instance of a property set for both arguments of GetMultipleFieldValues. Added an example. You can use the UndoRecord method in Browser Script.
ActivateField Method for a Business Component on page 184 GetMultipleFieldValues Method for a Business Component on page 207 UndoRecord Method for a Business Component on page 248 Business Component Methods for Browser Script on page 326
This chapter describes Oracles Siebel Object Interfaces and the programming environment you use to customize them. It includes the following topics: Object Interfaces You Can Use to Access Siebel Objects on page 9 About the Siebel Programming Environment on page 17 Siebel Object Interface Methods You Can Use to Control Data and Objects on page 20
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
Table 3 lists the types of objects you can access. If a table cell includes Yes, then you can use the object type listed in the Object Type column with the Siebel object interface listed in the column header.
Table 3.
Types of Objects You Can Access Through a Siebel Object Interface Web Client Automation Server No Yes No No Yes Yes No Mobile Web Client Automation Server No Yes Yes Yes Yes Yes No COM Data Control No Yes Yes Yes Yes Yes No COM Data Server No Yes Yes Yes Yes Yes No Siebel Java Data Bean No Yes Yes Yes Yes Yes No
Object Type Applet Application Business Component Business Object Business Service Property Set Control
Siebel CRM uses other object types that this topic does not describe, including some specialized types. If this topic does not describe an object type, then it is not available through a Siebel object interface. If you reference it, then Siebel CRM might not pass it to an external DLL, such as a Microsoft Visual Basic COM DLL. For more information about the objects described in Table 3, see Configuring Siebel Business Applications.
10
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
Applets
To access an applet through an object interface, you add a script to the applet. In Siebel Tools, you right-click the applet, and then choose the Edit Server Scripts or Edit Browser Scripts menu item. It is similar to adding a script to a business component. For more information, see Using Script to Add Business Logic to a Business Component on page 76. You can use the following scripting languages on an applet: Siebel VB and Siebel eScript in a Server Script Browser JavaScript in Browser Script
If the Siebel client runs in high interactivity mode, then Siebel CRM does not run some applet events, such as WebApplet_ShowControl and WebApplet_ShowListColumn.
Business Services
A business service is an object type that contains a set of predefined methods that Oracle engineering implements in C++ code. It can also contain custom methods in Siebel script. It allows you to call C++ code or a scripted method of a business service from a script that you create. You can use a business service in the following ways: Called from a script or from an object interface. Reusable and can persist through a session. Simulate a global procedure. Provide a generic code library that you call from multiple scripts. Modify object properties. You can write a script in Siebel VB or Siebel eScript that configures a business service that modifies object properties.
To create a custom business service, you can do one of the following: Add a record in the Business Services list in Siebel Tools. Use administrative views in the Siebel client.
To use the Web Client Automation Server or Browser Script to call a business service, you must register the business service in Siebel Tools as an application user property. This technique prevents Service Not Found errors. For more information, see GetService Method for an Application on page 139. You can use the following types of business services: Repository. Defined in Siebel Tools and stored in the Siebel repository file (SRF). Run-time. Defined in the Siebel client and stored in the Siebel database.
For more information, see Integration Platform Technologies: Siebel Enterprise Application Integration.
Repository Business Services You can use the following types of repository business services:
11
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
Standard. References the class CSSService. You can script or modify a standard business service. Specialized. References a specialized C+ class. If the specialized business service is + documented, then you can script or modify it.
You cannot modify a repository business service at run time. You cannot use a run-time script to override a predefined business service.
Property Sets
A property set is a collection of properties that you can use to store data. It can include a child property set that forms a tree data structure. You use a property set to handle inputs to and outputs from a business service. For more information, see Integration Platform Technologies: Siebel Enterprise Application Integration.
For more information about: Developer resources for Java technology, see the following: http://www.oracle.com/technetwork/java/index.html Communication with an external application, see How an External Application Communicates with a Siebel Application on page 13. Operating systems and JDKs you can use, see Siebel System Requirements and Supported Platforms on Oracle Technology Network.
12
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
COM Data Control COM Data Server Web Client Automation Server Mobile Web Client Automation Server
To access a Siebel COM interface, you can use any of the following languages: JavaScript Visual Basic C++
You cannot use the Perl programming language to access a Siebel COM interface. NOTE: The programming environment you use might limit the features of the Siebel COM servers. For example, do not use Siebel VB code for the Data Server as a Windows NT service.
Figure 1.
To use COM Data Control to develop a Siebel application, you must install, configure, and make sure a Siebel Application Object Manager is running on a Siebel Server. For more information, see Siebel System Administration Guide. For information about the SISNAPI protocol, see Siebel Deployment Planning Guide.
13
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
Web Client Automation Server The Web Client Automation Server does the following: Allows an external application to call a business service and manipulate property sets. Runs as a small Siebel COM object in the Web browser in Internet Explorer version 5.0 or later. Can be used with the Siebel Web Client and the Siebel Mobile Web Client.
Figure 2 illustrates how an external application can call a business service and manipulate a property set in the Web Client Automation Server.
Figure 2.
How an External Application Interacts with the Web Client Automation Server
The Web Client Automation Server includes the following requirements: Runs only with a high interactivity client. The Siebel Web Client must be running. You must set the EnableWebClientAutomation parameter for the Application Object Manager to TRUE. This setting instructs Siebel CRM to download a small ActiveX control to the desktop and start the SiebelHTMLApplication process. It might be necessary for you to adjust ActiveX controls, plug-ins, and security settings in the browser.
NOTE: You cannot call the Web Client Automation Server directly from an active instance of a Siebel application. In the Windows Task Manager, the process that represents the Web Client Automation Server is named one of the following: siebelhtml.exe siebelhtmlapplication.exe SIEBEL~1.EXE
If the user ends the Siebel Web Client session, then Siebel CRM stops this process. For more information, see Accessing the Web Client Automation Server on page 35.
14
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
Mobile Web Client Automation Server The Mobile Web Client Automation Server accesses the server object that the Siebel application starts. If you can access this object, then you can obtain other Siebel objects and run Siebel object interface methods through those objects. Figure 3 illustrates how an external application can control a Siebel application that uses the Web Client Automation Server.
Figure 3.
How an External Application Interacts with the Mobile Web Client Automation Server
The Mobile Web Client Automation Server includes the following requirements: The Siebel Mobile Web Client must be running. The EnableWebClientAutomation parameter in the InfraUIFramework section of the Siebel application configuration (CFG) file must be set to TRUE. If you use Microsoft Visual Basic version 5.0 or later, then the sobjsrv.tlb file must reside in the same directory as the Siebel application configuration (CFG) file. If this file is not in the correct directory, then the COM Data Server does not work. A call you make to the Mobile Web Client Automation Server is out of process. If you create a DLL that runs in process with the Siebel application, then the calls made from the DLL to the Mobile Web Client Automation Server are out of process. For more information, see How Siebel CRM Uses Memory and Resources with the Mobile Web Client Automation Server on page 15.
For more information, see Accessing the Mobile Web Client Automation Server on page 36.
How Siebel CRM Uses Memory and Resources with the Mobile Web Client Automation Server Siebel CRM starts a process to run the Siebel Mobile Web Client. This process uses memory and resources that are specific to that process, which are in process. If you communicate with the Siebel Mobile Web Client while it is running, then the resources that Siebel CRM uses in this communication are separate form the memory and resources that it uses in the process that it started to run the Siebel Mobile Web Client. These separate resources are out of process.
15
About Object Interfaces and the Programming Environment Object Interfaces You Can Use to Access Siebel Objects
COM Data Server Figure 4 illustrates how an external application uses the COM Data Server without user interface objects. To connect to the Siebel database, the COM Data Server uses the same technology that the Siebel Mobile Web Client uses.
Figure 4.
The Mobile Web Client Automation Server includes the following requirements: The way you start a Siebel COM server depends on the programming tool or language you use. Because the COM Data Server runs without the Siebel client, you must use the Login method to set up your Data Server object. Because there are no current active Siebel objects, you cannot use an object interface method that returns active Siebel objects. You must use your own Siebel objects. If you use Microsoft Visual Basic version 5.0 or later, then the sobjsrv.tlb file must reside in the same directory as the Siebel application configuration (CFG) file. If this file is not in the correct directory, then the COM Data Server does not work. Do not run the Microsoft VB Debug environment while you communicate with the COM Data Server. If you use the COM Data Server, then the COM client cannot create multiple connections to the Siebel COM Server. You must restart the COM client before you can attempt another connection. Use COM Data Control instead. Calls made to the COM Data Server are in process. For more information, see How Siebel CRM Uses Memory and Resources with the Mobile Web Client Automation Server on page 15.
Note the different ways that the following servers handle DLLs: COM Data Server. A DLL that runs in the same address space as the calling program.
16
About Object Interfaces and the Programming Environment About the Siebel Programming Environment
Mobile Web Client Automation Server. An executable that runs in a dedicated address space. A DLL that a server task accesses must be capable of running in a multi-thread environment.
For more information, see Accessing the COM Data Server on page 40.
Programming Languages
To access object interface methods and object interface events, you can use the following programming languages: Siebel VB (Siebel Visual Basic). A programming language that is syntactically and semantically compatible with Microsoft Visual Basic. It includes an editor, debugger, interpreter, and compiler. It runs only on the Windows operating system. Siebel eScript. A programming language that is syntactically and semantically compatible with JavaScript. It uses the same tools that Siebel VB uses. Siebel eScript runs on the Windows and UNIX operating systems.
For more information, see Chapter 4, Using Siebel Visual Basic and Siebel eScript.
Server Script
A Server Script is a type of script that the Siebel Server interprets and runs. You can use the following scripting languages in a Server Script: Siebel VB. Because Siebel VB uses most of the same commands and standards as Microsoft Visual Basic, you can customize your Siebel application and reduce training costs. Siebel CRM supports Siebel VB only on the Microsoft Windows operating system. Siebel eScript. Because Siebel eScript uses most of the same commands and standards as JavaScript, it provides you the same advantages in an alternative language. You can use Siebel eScript on all operating systems that Siebel CRM supports.
For more information, see Chapter 4, Using Siebel Visual Basic and Siebel eScript.
Browser Script
A Browser Script is a type of script that the browser interprets and runs. It interacts with the Document Object Model and with the Siebel Object Model in the browser through the Browser Interaction Manager. You write Browser Script in JavaScript. You can script the behavior of Siebel events and the browser events that the Document Object Model makes available. The Document Object Models for Internet Explorer and Netscape Navigator are different.
17
About Object Interfaces and the Programming Environment About the Siebel Programming Environment
You can use Browser Script only with a Siebel application that runs in high interactivity mode. The only exception is if you script a control event that you use with the Browser Document Object Model. Browser Script was introduced with Siebel CRM version 7. For more information, see Document Object Model Events You Can Use on page 332. Do not use Browser Script to manipulate the location of a frame or form in Siebel CRM because this causes Siebel CRM to load a new page. Because it is a violation of preferred security practices, the result is a permission denied error. A high interactivity Siebel application can contain a standard interactivity view. For example, the Home Page view or the Dashboard view. If the Siebel application uses high interactivity or standard interactivity, then you cannot use Browser Script on an applet in these views. Instead, the Siebel application calls the WebApplet_ShowControl Server Script on the applet. For more information, see Chapter 6, Browser Script Quick Reference. For information about creating Browser Script, see Configuring Siebel Business Applications.
Script Assist was introduced in Siebel CRM version 7.8. For more information, see Using Siebel Tools.
Siebel Debugger
The Siebel Debugger is a tool that helps you detect errors that occur in the code of a Siebel programming language. It does not help you detect errors outside of the context of the code. You can configure Siebel CRM to start the Siebel Debugger automatically from a Siebel application if a run-time error occurs. You can also start the debugger from the Debug toolbar and Debug menu in Siebel Tools. For more information, see Using Siebel Tools.
18
About Object Interfaces and the Programming Environment About the Siebel Programming Environment
To start the Siebel Compiler and Run-Time Engine, you click the Compile button on the Debugger toolbar in Siebel Tools. You can also start it if you compile a project that contains an object definition that is associated with a Siebel script. The Siebel Compiler and Run-Time Engine do not include a user interface. The compiler compiles the custom code, and then returns a message that indicates success or failure.
Compilation Order The Siebel Compiler compiles Siebel VB functions and procedures in alphabetical order as they occur in the object definition. If a function or procedure calls another function or procedure that is not defined, then the compiler creates an error message that is similar to the following: function_name Is An Unknown Function To avoid this error, you can use the Declare statement to declare the function or procedure in the declarations section of the general section. Siebel eScript does not require you to declare a function before you use it. For more information, see Siebel VB Language Reference.
ST eScript Engine The ST eScript engine is available in Siebel CRM version 7.8 and later. It is the default Siebel eScript scripting engine in Siebel CRM version 8.0 and later. This engine allows you to use strongly typed objects that are compliant with the ECMAScript edition 4 specification. It also provides early and late binding. For information about: Binding, see About Early and Late Binding on page 19. The differences between the ST eScript engine and the T engine, see Siebel eScript Language Reference Using the ST engine, see Using Siebel Tools.
About Early and Late Binding Early binding occurs if you bind a specific object instance to a variable. The following code binds an object to a variable at design time. It is an example of early binding: var lo_bo = TheApplication().GetBusObject("Account"); Late binding occurs if you bind an object to a variable only at run time. The following code is an example of late binding: if (TheApplication().ActiveBusObject().Name() == "Account") var ls_bo_name = TheApplication().ActiveBusObject().Name(); This late binding code does not specify a specific object. The compiler cannot identify this object and it cannot identify that the Name method is part of the object. Siebel CRM can only bind this object to a variable at run time.
19
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
You can use this data to do the following work: Monitor the performance of a script. Identify performance bottlenecks. Compare profile data with previous script runs.
You can use the Script Profiler only with the ST eScript Engine. For more information, see Using Siebel Tools.
Siebel Object Interface Methods You Can Use to Control Data and Objects
This topic describes object interface methods you can use to control data and objects. It includes the following topics: Methods to Locate an Object on page 20 Methods to Access Data from a Business Component on page 21 Methods to Control the Navigation Flow of a Siebel Application on page 26 Methods to Get and Display Information About the Current State on page 27 Methods That Allow You to Control Debug Tracing on page 27
20
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
The active business component is the business component that the active applet references.
When a Siebel object interface locates an object, it can use or manipulate the object. To locate an object, you can use any of the following object interface methods: ActiveMode Method for an Applet on page 101 BusObject Method for an Applet on page 102 ActiveBusObject Method for an Application on page 125 ActiveViewName Method for an Application on page 127 GetBusObject Method for an Application on page 134 BusComp Method for a Control on page 295 Name Method for a Control on page 297 GetValue Method for a Property Set on page 314 TheApplication Method on page 322
To associate a new child record, you use one of the following methods: GetAssocBusComp Associate
21
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
To create a new record in the child record, you use one of the following methods: The NewRecord method in a child business component The GetMVGBusComp method and the NewRecord method
BusComp.Associate. BusComp.DeleteRecord. Because it moves the cursor to another record, this method automatically saves the record. BusComp.FirstRecord. BusComp.LastRecord. BusComp.NextRecord. BusComp.PreviousRecord.
22
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
1 2 3 4 5
GetBusComp. SetViewMode. This method is optional. You use it to change the view mode from the default value. ActivateField. ClearToQuery. SetSearchSpec or SetSearchExpr. NOTE: It is not necessary to activate a field on which a search specification and search expression is set, unless the GetFieldValue or SetFieldValue method also reference the field.
ExecuteQuery.
Example of Accessing Data from a New Business Component Instance in Siebel VB The following example accesses data from a new business component instance in Siebel VB: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Dim RetValue As Integer RetValue = ContinueOperation Select Case FieldName Case "Sales Stage" If FieldValue = "08 - Negotiation" Then ' Do not allow the sales cycle to be changed to this value ' if the decision-maker is not a contact for the Oppty. ' Decision-maker defined as anyone with rank VP and above Dim oBusObj As BusObject Dim sRowId As String Dim iViewMode As Integer sRowId = GetFieldValue("Id") iViewMode = GetViewMode Set oBusObj = TheApplication.ActiveBusObject ' Because parent-child relationship is established if ' BusComps are instantiated from the same BusObject. ' The ContactBC has all contact records for the ' current Oppty record. Set ContactBC = oBusObj.GetBusComp("Contact") With ContactBC .ClearToQuery
23
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
.SetSearchSpec "Job Title", "*VP*" .ExecuteQuery ForwardBackward If (.FirstRecord = 1) Then TheApplication.RaiseErrorText "Found a decision maker" Else RetVal = ContinueOperation End If End With Set ContactBC = Nothing Set oBusObj = Nothing End If End Select BusComp_PreSetFieldValue = RetValue End Function Example of Accessing Data from a New Business Component Instance in Siebel eScript The following example accesses data from a new business component instance in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) { var RetValue = ContinueOperation; switch (FieldName) { case "Sales Stage": if (FieldValue == "08 - Negotiation") { //Do not allow the sales cycle to be changed to this value //if the decision-maker is not a contact for the Oppty. //Decision-maker defined as anyone with rank VP and above var oBusObj; var sRowId; var iViewMode; sRowId = this.GetFieldValue("Id"); iViewMode = this.GetViewMode(); oBusObj = TheApplication().ActiveBusObject(); //Because parent-child relationship is established if //BusComps are instantiated from the same BusObject. //The ContactBC has all contact records for the //current Oppty record. ContactBC = oBusObj.GetBusComp("Contact"); with (ContactBC) { ClearToQuery(); SetSearchSpec("Job Title", "*VP*"); ExecuteQuery(ForwardBackward); if (FirstRecord()) { TheApplication().RaiseErrorText("Found a decision maker"); } else { RetVal = ContinueOperation; }
24
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
25
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
LastRecord Method for a Business Component on page 217 NewRecord Method for a Business Component on page 218 NextRecord Method for a Business Component on page 220 ParentBusComp Method for a Business Component on page 221 Pick Method for a Business Component on page 222 PreviousRecord Method for a Business Component on page 223 RefineQuery Method for a Business Component on page 224 SetFieldValue Method for a Business Component on page 227 SetFormattedFieldValue Method for a Business Component on page 228 SetMultipleFieldValues Method for a Business Component on page 230 SetNamedSearch Method for a Business Component on page 232 SetSearchExpr Method for a Business Component on page 234 SetSearchSpec Method for a Business Component on page 235 SetSortSpec Method for a Business Component on page 241 SetViewMode Method for a Business Component on page 244 UndoRecord Method for a Business Component on page 248 WriteRecord Method for a Business Component on page 249
If you access a Siebel object interface through COM Data Control, COM Data Server, or Siebel Java Data Bean, then no Siebel user interface is present. NOTE: Siebel CRM stores the properties of a Siebel object in the Siebel repository file (SRF). You cannot use an object interface method in Siebel VB to change these properties at run time. A business component is an example of a Siebel object.
26
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
To control the navigation flow, you can use any of the following object interface methods: Examples of Using the FindControl Method on page 104 GotoView Method for an Application on page 143
27
About Object Interfaces and the Programming Environment Siebel Object Interface Methods You Can Use to Control Data and Objects
28
This chapter describes how to customize Siebel object interfaces. It includes the following topics: Process of Customizing a Siebel Object Interface on page 29 Accessing a Siebel Object Interface on page 34 Customizing Object Interface Events and Extension Events on page 56 Configuring Error Handling on page 60
1 2 3 4 5
Determining the Type of Siebel Object Interface You Must Use on page 29 Setting the Connect String on page 30 Accessing a Siebel Object Interface on page 34 Customizing Object Interface Events and Extension Events on page 56 Configuring Error Handling on page 60
29
To identify the type of Siebel Object Interface you must use, examine the other columns in Table 4 in the row that you identified in Step 1.
Table 4.
Determining the Type of Siebel Object Interface You Must Use Web Client Automation Server Yes Mobile Web Client Automation Server Yes
Usage Control the Siebel client from an external application. Access Siebel business objects without using the Siebel client. Run objects on the Siebel Server. Run objects in the Siebel client in a mobile environment.
No
No
Yes
Yes
Yes
Yes No
No Yes
Yes No
No Yes
Yes No
Oracle defines a Siebel business object or a Siebel object interface at the sole discretion of Oracle. Oracle reserves the right to change the behavior, properties, and events of a Siebel business object or a Siebel object interface at any time without notice. CAUTION: Your Siebel application is a Web application or a client and server application that can meet the sales and marketing information requirements of your organization. Use caution if you customize a Siebel application or access it through a Siebel object interface. Only trained, technical professionals must perform this work. Improper use of a Siebel object interface can reduce the performance and reliability of your Siebel application. Test your customization thoroughly before you deploy it.
30
Variable Substitutions You Can Use to Log In to a Siebel Server Description Use the default value, tcpip, or leave empty. Use one of the following values: none. This value is the default value. mscrypto. You cannot use mscrypto with Siebel Java Data Bean. rsa. You can use rsa with Siebel Java Data Bean.
encryption
compression
Use one of the following values: none. zlib. This value is the default value.
host port
Use the name of the computer on which you installed the Siebel Server. Enter the number for the SCBroker port. The default value is 2321. Change this value only if you change the default value when you install the Siebel Server. For information about load-balancing with SCBroker, see Siebel Deployment Planning Guide, Siebel System Administration Guide, and Siebel Installation Guide for the operating system you are using.
31
Table 5. Variable
Variable Substitutions You Can Use to Log In to a Siebel Server Description Enter the name of the Siebel Enterprise Server. Enter the name of the Application Object Manager that the Siebel client must access. You can enter a custom server component or one of the following predefined server components: ISSObjMgr_lang SCCObjMgr_lang SSEObjMgr_lang SSVObjMgr_lang
For more information, see Siebel System Administration Guide. The format of the connect string is optional. You can enter only the transport variable and use a period (.) to separate it from siebel. For example: siebel.tcpip://host/siebel/AppObjMgr_lang If you specify any of the other variables, then you must use a period (.) as a placeholder for each variable that you do not specify. For example: siebel...zlib://myhost/siebel/SCCObjMgr_enu
Example Connect String for COM Data Control in Server Mode The following example includes a connect string for COM Data Control that operates in server mode: 'COM Data Control : SERVER Mode lstr = "host=" + """siebel://frashid/Siebel/SSEObjMgr_enu""" 'Format of the connect string is '"host=" + """siebel://host/enterprise/App. Object Mgr_lang""" lng = "lang=" + """ENU""" retval = siebDataCtl.Login(lng + lstr, "username", "password") Example Connect String for COM Data Control in Local Mode The following example includes a connect string for COM Data Control that operates in Local Mode: 'COM Data Control : LOCAL Mode lstr = "cfg=" + """C:\Siebel\8.1\Client_2\BIN\ENU\siebel.cfg,ServerDataSrc"""
32
'Format of the connect string is '"cfg=" + """Absolute path of the CFG file, DataSource""" 'Datasource = ServerDataSrc or Local or Sample lng = "lang=" + """ENU""" retval = siebDataCtl.Login(lng + lstr, "username", "password") If in Local Mode, then COM Data Control must reside on the same computer as the Siebel Mobile Web Client.
Example Connect String for COM Data Control When Using Siebel VB The following example includes a connect string for COM Data Control that uses Siebel VB. The Char(34) code indicates a double quote: ConnStr = "host =" & char(34) & "siebel://HOST/ENTERPRISE_SERVER/SCCObjMgr_enu/ SIEBEL_SERVER" + char(34) & " Lang = " & char(34) & "LANG" & char(34)
Specify the path to the file that defines the virtual host.
Connect String That Uses Load Balancing with COM Data Control A connect string that uses native Siebel load balancing with COM Data Control uses the following format: host="siebel://VirtualHost/EnterpriseServer/AppObjMgr_lang"vhosts="path to lbconfig.txt" where: lbconfig.txt is the file that identifies the virtual hosts.
For more information about the lbconfig.txt file, see Siebel System Administration Guide.
Connect String That Uses Load Balancing with Siebel Java Data Bean A connect string that uses native Siebel load balancing with Siebel Java Data Bean uses the following format:
33
host="siebel://VirtualHost/EnterpriseServer/AppObjMgr_lang" If you use Java code to connect to the Siebel Server, then Siebel CRM reads virtual host definitions from the following property in the siebel.properties file: siebel.conmgr.virtualhosts The siebel.properties file must reside in the classpath of the Java Virtual Machine. For information about using virtual hosts in the siebel.properties file, see Transports and Interfaces: Siebel Enterprise Application Integration.
Example Connect String That Uses Load Balancing The following example includes a connect string for COM Data Control that operates in server mode in an environment that uses Siebel round-robin load balancing across Siebel Servers: 'COM Data Control : Load Balancing lstr = "host=" + """siebel://VirtualServer1/Siebel/SSEObjMgr_enu""" + "vhosts=" + """m:\siebel\admin\lbconfig.txt""" lng = "lang=" + """ENU""" retval = siebDataCtl.Login(lng + lstr, "username", "password") where: VirtualServer1 matches the value in the VirtualServer parameter in the session manager rules in the lbconfig.txt file. For example: "VirtualServer1=1:SiebServA:2321;2:SiebServB:2321;" For information about the lbconfig.txt file, see Siebel System Administration Guide.
Accessing the Web Client Automation Server on page 35 Accessing the Mobile Web Client Automation Server on page 36 Accessing the Siebel COM Interface on page 38 Accessing the COM Data Server on page 40 Accessing the COM Data Server with Microsoft Visual Studio on page 42 Accessing COM Data Control on page 46
34
These topics assume you use Microsoft Visual Basic to access the interface.
2 3 4 5 6
Start Microsoft Visual Basic. Choose Standard EXE. Choose the Project menu, and then the References menu item. In the list box, choose SiebelHTML 1.0 Type Library. Add the required code. For more information, see Example of Accessing the Web Client Automation Server on page 35.
35
siebApp.RaiseErrorText "Property set creation failed." & errCode & "::" & errText End If 'Get A Siebel Service Set siebSvcs = siebApp.GetService("Workflow Process Manager") If Not siebSvcs Is Nothing Then Set siebSvcs = Nothing Else errCode = siebApp.GetLastErrCode errText = siebApp.GetLastErrText siebApp.RaiseErrorText "Could not Get Siebel Service." & errCode & "::" & errText End If Set siebApp = Nothing End If End Sub
2 3 4 5 6
Start Microsoft Visual Basic. Choose Standard EXE. Choose the Project menu, and then the References menu item. In the list box, choose Mobile Web Client Automation Server. Add the required code. For more information, see Example of Accessing the Mobile Web Client Automation Server on page 36.
36
Dim siebBusObj As SiebelBusObject Dim siebBusComp As SiebelBusComp Dim siebSvcs As SiebelService Dim siebPropSet As SiebelPropertySet Dim bool As Boolean Dim errCode As Integer Dim errText As String Dim connStr As String Dim lng As String 'Create The Siebel WebApplication Object Set siebWebApp = CreateObject("TWSiebel.SiebelWebApplication.1") If Not siebWebApp Is Nothing Then 'Create A Business Object Set siebBusObj = siebWebApp.GetBusObject("Contact") If Not siebBusObj Is Nothing Then 'Create a Business Component Set siebBusComp = siebBusObj.GetBusComp("Contact") Else errCode = siebWebApp.GetLastErrCode errText = siebWebApp.GetLastErrText siebWebApp.RaiseErrorText "Business Object Creation failed." & errCode & "::" & errText; End If 'Create A New Property Set Set siebPropSet = siebWebApp.NewPropertySet If Not siebPropSet Is Nothing Then Set siebPropSet = Nothing Else errCode = siebWebApp.GetLastErrCode errText = siebWebApp.GetLastErrText siebWebApp.RaiseErrorText "Property Set Creation failed." & errCode & "::" & errText; End If 'Get A Siebel Service Set siebSvcs = siebWebApp.GetService("Workflow Process Manager") If Not siebSvcs Is Nothing Then Set siebSvcs = Nothing Else errCode = siebWebApp.GetLastErrCode errText = siebWebApp.GetLastErrText siebWebApp.RaiseErrorText "Could not Get Siebel Service." & errCode & "::" & errText; End If
37
If Not siebBusComp Is Nothing Then Set siebBusComp = Nothing End If If Not siebBusObj Is Nothing Then Set siebBusObj = Nothing End If Set siebWebApp = Nothing End If End Sub
38
Figure 5.
39
7 8 9
In the Siebel Data BusObject Interfaces section, note the directory that contains the sobjsrv.tlb file. In the Available References window, make sure the Siebel Data BusObject Interfaces item contains a check mark, and then click OK. Add the required code. For more information, see Example of Accessing the COM Data Server on page 40.
40
ChDrive "C" ChDir "C:\Server\siebsrvr\bin" 'Create The COM Data Server Object Set siebApp = CreateObject("SiebelDataServer.ApplicationObject") If Not siebApp Is Nothing Then '''COM Data Server cfgLoc = " C:\Siebel\8.1\Server\BIN\ENU\siebel.cfg,ServerDataSrc" siebApp.LoadObjects cfgLoc, errCode If errCode = 0 Then 'Log in to the Siebel Server siebApp.Login "username", "password", errCode If errCode = 0 Then 'Creat A Business Object Set siebBusObj = siebApp.GetBusObject("Contact", errCode) If errCode = 0 Then 'Create a Business Component Set siebBusComp = siebBusObj.GetBusComp("Contact") Else errText = siebApp.GetLastErrText siebApp.RaiseErrorText("Business Object Creation failed: " & errCode & "::" & errText); End If 'Create A New Property Set Set siebPropSet = siebApp.NewPropertySet(errCode) If errCode = 0 Then Set siebPropSet = Nothing Else errText = siebApp.GetLastErrText siebApp.RaiseErrorText("Property Set Creation failed: " & errCode & "::" & errText); End If 'Get A Siebel Service Set siebSvcs = siebApp.GetService("Workflow Process Manager", errCode) If Not siebSvcs Is Nothing Then Set siebSvcs = Nothing Else errText = siebApp.GetLastErrText siebApp.RaiseErrorText("Could not Get Siebel Service: " & errCode & "::" & errText); End If If Not siebBusComp Is Nothing Then Set siebBusComp = Nothing End If If Not siebBusObj Is Nothing Then Set siebBusObj = Nothing End If Else errText = siebApp.GetLastErrText siebApp.RaiseErrorText("Login Failed: " & errCode & "::" & errText);
41
End If Else errText = siebApp.GetLastErrText siebApp.RaiseErrorText("Load Objects Failed: " & errCode & "::" & errText); End If Set siebApp = Nothing End If End Sub
a b c d 6
Make sure the Automation option contains a check mark. Make sure the ActiveX Controls does not contain a check mark. Click Next. Click Next.
Click Finish, and then click OK. The Application Wizard creates the MFC code that you use for this project, including the headers and libraries that COM automation requires. For more information about the MFC libraries, see the documentation for Microsoft MSDN Visual Studio.
42
Modify the new dialog box. Microsoft Visual C++ displays a new dialog box. To resize and change the text in this dialog box, right-click the label in the dialog box and edit the properties. Modify the dialog box so that it resembles the following illustration.
8 9
Choose the View menu, ClassWizard, and then the Automation menu item. Click Add Class, and then click From a Type Library.
10 Navigate to the SIEBSRVR_ROOT\bin folder, and then choose sobjsrv.tlb. 11 In the Confirm Classes dialog box, make sure all Siebel classes are chosen, click OK, and then
click OK again to close the Class Wizard.
43
e f
Choose Open from the File menu, and then choose the SiebelCOMDlg.cpp file. Add the following code to the OnInitDialog procedure. Add only the code that uses bold typeface: CDialog::OnInitDialog(); ... // TODO: Add extra initialization here // Start the Siebel Data Server if (!sApp.CreateDispatch(_T("SiebelDataServer.ApplicationObject))) { AfxMessageBox("Cannot start Siebel Data Server."); EndDialog(-1); // Fail } else { AfxMessageBox("Siebel Data Server initialized."); } return TRUE; // Return TRUE unless you make a control active ...
In the same file, add the following code to the OnOK procedure. To add this code correctly, do the following:
Make sure that the line that begins with sApp.LoadObjects references the location of the Siebel application configuration (CFG) file you intend to use. In the line that begins with sApp.Login, make sure you use a valid logon name and password. Add only the code that uses bold typeface. void CSiebelCOMDlg::OnOK() { short sErr; // Load configuration file // Make sure that the following line references the correct file sApp.LoadObjects(C:\Siebel\8.1\Server\BIN\ENU\siebel.cfg", &sErr); if(sErr) { AfxMessageBox("LoadObject failed."); return; } else { AfxMessageBox("CFG file loaded."); }
44
// Log in as SADMIN sApp.Login("SADMIN", "SADMIN", &sErr); if(sErr) { AfxMessageBox("Login failed."); return; } else { AfxMessageBox("Logged in to Siebel database."); } // Get Account business object LPDISPATCH lpdBo; lpdBo = sApp.GetBusObject("Account", &sErr); if(sErr) { AfxMessageBox("GetBusObject failed."); return; } else { AfxMessageBox("Account business object returned."); } SiebelBusObject Bo(lpdBo); // Get Account business component LPDISPATCH lpdBc; lpdBc = Bo.GetBusComp("Account", &sErr); if(sErr) { AfxMessageBox("GetBusComp failed."); return; } else { AfxMessageBox("Account business component returned."); } SiebelBusComp Bc(lpdBc); // Get the name of the first account if (sErr) return; Bc.ClearToQuery(&sErr); if (sErr) return; Bc.SetSearchSpe("Name", "*", &sErr); if (sErr) return; Bc.ExecuteQuery(ForwardOnly, &sErr); if (sErr) return; Bc.FirstRecord(&sErr); if (sErr) return; // Display the account name in a message box CString csAcctName; csAcctName = Bc.GetFieldValue("Name", &sErr); AfxMessageBox(csAcctName);
45
b c
Navigate to the Accounts screen, and then the All Accounts view. Verify that at least one account is visible in the Account list applet. If at least one account is not visible, then create one.
d e f
Exit the Siebel client. Open the Siebel application configuration (CFG) file you specified in the code and make sure the DataSource parameter indicates the correct Siebel database source. In Microsoft Visual C++, choose the Build menu, and then the SiebelCOM.exe menu item. If Microsoft Visual C++ displays an error or warning in the output window, then correct the error and repeat this step.
g h
Choose the Build menu, and then the Execute SiebelCOM.exe menu item. Wait for Microsoft Visual C++ to display the following message: Siebel Data Server initialized.
Click OK. The Siebel application displays the following series of messages: CFG file loaded. Logged in to Siebel database. Account business object returned. Account business component returned. The Siebel application displays the name of the first account in the All Accounts view.
46
2 3 4
Start Microsoft Visual Basic. Choose Standard EXE. Choose the Project menu, and then the References menu item. In the References dialog box, in the Available References window, make sure the Siebel Business Object Interfaces Type Library item contains a check mark.
5 6
To open the Object Browser, click OK. Determine the correct format for the object interface method. You must use the CreateObject method and the Login method. You cannot use an object interface method that returns an active Siebel object because no Siebel objects are currently active. You must use your own Siebel objects.
7 8
Verify that you can view the Siebel objects. Add the required code. For more information, see Example of Accessing COM Data Control on page 47.
Example of Using Siebel Server ASP Script to Access COM Data Control
To set off an ASP script in HTML code, you use the following format:
47
To indicate the beginning of the ASP script, you use the less than symbol and the percent symbol (<%). To indicate the end of the ASP script, you use the percent symbol and the greater than symbol (%>).
The following example code starts COM Data Control from a Siebel Server ASP script: <% Dim SiebelApplication, BO, BC, ConnStr, logstat Dim strLastName, strFirstName, errCode, errText Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1") ' Test to see if object is created If IsObject(SiebelApplication) = False then Response.Write "Unable to initiate Siebel Session. Else connStr = "host=" & Chr(34) & "siebel.tcpip.none.none://hostname:2321/ EntServer/ObjMgr" & Chr(34) & " lang=" & Chr(34) & "lang" & Chr(34) logstat = SiebelApplication.Login ConnStr, "SADMIN", "SADMIN" response.write("Login Status: " & logstat) Set BO = SiebelApplication.GetBusObject("Employee") Set BC = BO.GetBusComp("Employee") End If %>
Siebel.jar SiebelJI_lang.jar
To install the Siebel Java Data Bean interface, do one of the following:
Use the Siebel Enterprise Server Installer. Make sure the EAI Siebel Connectors option contains a check mark. For more information, see the Siebel Installation Guide for the operating system you are using. Install Siebel Tools. The Oracle Universal Installer installs the Siebel Java Data Bean interface by default when you install Siebel Tools.
3
48
To call the Login method for the object you started in Step 3, use the following code: SiebelDataBean l_sdb = new SiebelDataBean(); l_sdb.login(<parameters>); You must use the Login method. You cannot use an object interface method that returns an active Siebel object because no Siebel objects are currently active. You must use your own Siebel objects. For more information, see Step 2 on page 38.
49
} } }
For example: m_dataBean.login("Siebel://gatewayserver:2321/enterpriseServer/SCCObjMgr_enu", SADMIN, HELLO,"enu"); where: SADMIN is an employee. The TrustToken parameter is HELLO in the LDAPSecAdpt section of the Siebel application configuration (CFG) file.
Customizing the Parameters a Third-Party Application Uses to Connect Through the Siebel Java Data Bean
You can customize the parameters that a third-party application uses when it connects to a Siebel application through the Siebel Java Data Bean.
To customize the parameters a third-party application uses to connect through the Siebel Java Data Bean 1
Open the siebel.properties file. This file is located in your classpath, which is an operating system environment variable that a Java program references. The siebel.properties file can exist in any location. The CLASSPATH environment variable must include an entry for this file so that the Java Virtual Machine can find the file when it starts.
Set the properties. For more information, see Properties of the Siebel Properties File on page 51.
50
Properties of the Siebel Properties File Table 6 describes the properties of the siebel.properties file.
Table 6.
Properties of the Siebel Properties File Property siebel.conmgr.txtimeout Description The transaction timeout in milliseconds. The default value is 600000, which is 10 minutes. The maximum value is 2,147,483,647, which is approximately 25 days. The connection pool size. For more information, see Determining the Total Number of Open Connections on page 52. The transaction timeout in seconds on the Siebel client. The default value is 2700, which is 45 minutes. The maximum value is 2,147,483,647, which is approximately 68 years. The number of open session retries. The default value is 3. Sets the Java Cryptography Extension (JCE): To use JCE, set the value to 1. To not use JCE, set the value is 0.
siebel.conmgr.poolsize
siebel.conmgr.sesstimeout
siebel.conmgr.retry siebel.conmgr.jce
For more information, see Encrypting Communication Between the Java Data Bean and the Siebel Server on page 54. Siebel created code for Java EE Connector Architecture and Java Data Bean siebel.connection.string siebel.user.name siebel.user.password siebel.user.language siebel.user.encrypted siebel.jdb.classname Java System Properties file.encoding The Siebel connection string. The user name to log in to the Object Manager. The password to log in to the Object Manager. The preferred language for the user. Determines if Siebel CRM encrypts the username and password. The default Java Data Bean (JDB) classname. The character encoding on the Siebel client. For example, cp1252, utf8, unicodeBig, or cp942. NOTE: Java system properties are not Siebel properties.
Example of the Siebel Properties File The following code is an example of the siebel.properties file:
51
siebel.connection.string = siebel.tcpip.rsa.none://test.siebel.com/siebel/ sseobjmgr_enu/test siebel.user.name siebel.user.password siebel.user.language siebel.user.encrypted siebel.conmgr.txtimeout siebel.conmgr.poolsize = User1 = password = enu = false = 3600 = 5
Determining the Total Number of Open Connections The connection pool maintains a set of connections to a specific server process. The default value for the siebel.conmgr.poolsize property is 2. The maximum value is 500. The siebel.conmgr.poolsize property and the Min MT Server parameter on the object manager determine the total number of open connections. Each MT server process is a Windows process that includes a connection pool. The total number of open connections is the value in the siebel.conmgr.poolsize property multiplied by the value in the Min MT Server parameter. For example, if the siebel.conmgr.poolsize is 2, and if the Min MT Server parameter is 3, then the total number of open connections is six.
Set it for the entire Java Virtual Machine on the command line. For example: java -Dfile.encoding=ascii java_application
Set it in the environment variable. For more information, see your particular Java Virtual Machine. Set it for a particular Java component. Add the following line to the Java component:
52
CodePageValue is a Siebel value that specifies character encoding for the Java Data Bean.
Table 7 lists character encoding mappings you can use for the Java Data Bean. The Siebel Value column contains the codes you can specify in the CodePageValue variable.
Table 7.
Character Encoding Mappings You Can Use for the Java Data Bean Siebel Value 1 1252 1252 1252 1201 1200 65001 950 932 932 932 932 949 949 950 1250 1251 1253 1254 1255 1256 1257 1258 936 874
Java Value ascii cp1252 iso8859_1 iso8859-1 unicodebig unicodelittle utf8 big5 cp942 cp942c cp943 cp943c cp949 cp949c cp950 cp1250 cp1251 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 gbk ms874
53
Table 7.
Character Encoding Mappings You Can Use for the Java Data Bean Siebel Value 932 936 949 950 932 874
Encrypting Communication Between the Java Data Bean and the Siebel Server
To encrypt communication between the Siebel Java Data Bean and the Siebel Server, you can use the Rivest, Shamir and Adleman (RSA) encryption libraries. For information about platforms you can use with encryption, see Siebel System Requirements and Supported Platforms on Oracle Technology Network.
To encrypt communication between the Siebel Java Data Bean and the Siebel Server 1
Enable encryption in the Object Manager server component that you use for the communication between the Java Data Bean and the Siebel Server. For more information, see Siebel System Administration Guide.
Set the encryption parameter of the connect string in the Siebel Java Data Bean to rsa. For example: siebel.tcpip.rsa.none://gateway/enterprise/ObjMgr where:
gateway is the name of the gateway enterprise is the name of the enterprise ObjMgr is the name of the Object Manager
54
2 3 4
Modify the java.security file to specify your provider of choice. Make sure the classpath variable includes the necessary provider JAR files. Set the siebel.conmgr.jce property in the siebel.properties file to 1.
Login Errors You Might Encounter When You Use the Siebel Java Data Bean
The Siebel Java Data Bean might return a login error that is similar to the following: Siebel Exception thrown invoking login Method. Code--1. Message-Logon request 75 was abandoned after 2ms connection. Any of the following items can cause this error: An Object Manager process is down. A hardware reset is required. For example, Object Manager hardware, router, switch, and so forth. There is a problem with an operating system setting or the operating system network. There is a network failure. There is a network address translation timeout.
CAUTION: Create one instance of the Siebel Java Data Bean for each thread that must use it. If a thread obtains Siebel Java Data Bean Objects, then do not share those objects with any other thread.
55
Customizing Siebel Object Interfaces Customizing Object Interface Events and Extension Events
For more information, see the following topics: Applet Events on page 107 Application Events on page 177 Business Component Events on page 260
56
Customizing Siebel Object Interfaces Customizing Object Interface Events and Extension Events
where: ObjectReference is the variable name of the object on which Siebel CRM calls the event. EventName is the event that Siebel CRM calls.
57
Customizing Siebel Object Interfaces Customizing Object Interface Events and Extension Events
CancelOperation does not stop the code in a script that follows CancelOperation, but it does prevent Siebel CRM from running any predefined code that is associated with the method or event that is running. If you handle the method or event entirely through scripting, and if you must prevent the predefined code from executing, then the method or event must return CancelOperation. For more information, see How Siebel CRM Handles a Predefined Business Service Method on page 291.
You can also use the following alternative If statement: returnValue = ContinueOperation If condition is true call custom code End If
58
Customizing Siebel Object Interfaces Customizing Object Interface Events and Extension Events
Note that with a PreInvokeMethod event, you use the method name to determine if the script conditionally runs. For example, consider the following code in Siebel eScript: if (methodName == "PushOpportunity")
59
Add the following code in each event handler for the object: TheApplication.Trace "Event_Name fired." Make sure you add this code to each of the following items:
Each relevant event, such as insert, delete, write, business component, and so forth Each relevant preevent handler
3 4
Perform a few simple inserts, updates, and deletes. Make a note of each message as Siebel CRM displays it. Your notes will list the order in which events start on the view or for the object.
Example of Configuring Error Handling for the COM Data Server The following code is an example of error handling only for the COM Data Server: GetBusObject (BusObjectName as string, errcode as integer) -> businessObject Example of Configuring Error Handling for COM Data Control and Mobile Web Client Automation Server The following code is an example of error handling for COM Data Control and Mobile Web Client Automation Server: GetBusObject (BusObjectName as string) -> businessObject
60
Example of Configuring Error Handling for Siebel Java Data Bean The SiebelException object handles errors in Siebel Java Data Bean. You can use the getErrorCode method and getErrorMessage method with the SiebelException object. The SiebelException object is defined in the com.siebel.data.SiebelException file. This file is a class file in one of the.jar files included in any java project that must communicate with Siebel CRM. For example: ... import com.siebel.data.SiebelException; import com.siebel.data.SiebelDataBean; ... SiebelDataBean mySiebelBean=null; try { mySiebelBean = new SiebelDataBean(); mySiebelBean.login("Siebel://SOMSERVER/somsiebel/AppObjMgr/", "CCONWAY", "CCONWAY","enu"); } catch (SiebelException e){ // Exception handling code System.out.println (e.getErrorMessage ()); mySiebelBean = null; //avoid using mySiebelBean if login is unsuccessful } ... The ellipsis (...) in this code indicates code that was removed from the example in this book for brevity. For more object interface methods on the SiebelException object, see the Siebel Java Data Bean JavaDoc that Oracle Universal Installer installs when you install Siebel Tools. Note that Oracle Universal Installer installs the JavaDoc only if you install the Siebel Java Integration option. It installs a zipped file that contains the JavaDoc in the Tools_ROOT\CLASSES folder.
EnableExceptions Method The EnableExceptions method allows Siebel CRM to use native COM error handling. If the method is about to fail due to error, then Siebel CRM creates a COM exception and does not return the method. The COM host receives the control instead. Siebel CRM might display the error message, which is the default behavior for Microsoft Internet Explorer or Siebel VB. You cannot use script to change this behavior. The following code is an example of using the EnableExceptions method: EnableExceptions(enable as integer)
61
GetLastErrCode Method and GetLastErrText Method After Siebel CRM runs an object interface method, you can do the following: To determine if Siebel CRM returned an error from the previous operation, you can call the GetLastErrCode method. To return the text of the error message, you can call the GetLastErrText method.
For example: GetLastErrCode() ' returns errCode As Integer GetLastErrText() ' returns text As String
62
This chapter describes how to use Siebel Visual Basic and Siebel eScript. It includes the following topics: Overview of Using Siebel Visual Basic and Siebel eScript on page 63 Examples of Using Siebel Visual Basic and Siebel eScript on page 63 Guidelines for Using Siebel VB and Siebel eScript on page 64 Opening the Siebel Script Editor on page 72 Declaring a Variable on page 73 Calling More Than One Object Interface Method In a Script on page 75 Using Script to Add Business Logic to a Business Component on page 76 Using a MiniButton Control to Call a Custom Method on page 76 Tracing a Script on page 79
63
Validating Data
To meet the validation requirements for your business, you can use Siebel Visual Basic or Siebel eScript to create a custom code that uses validation rules before Siebel CRM records or deletes a record. You can use data validation to access the following types of data: Internal data. For example, you can write custom code that instructs Siebel CRM to verify that the revenue amount for an opportunity is greater than zero if the probability of the opportunity is greater than 20 percent. External data. For example, to verify the availability of a conference room before Siebel CRM inserts a new activity, you can write custom code that reads data from the database table of an external application.
You can use an object interface method to manipulate data to notify a Siebel programming language of an error and provide it information. This capability allows you to configure the Siebel application to handle the error and take appropriate action. Manipulating data in a Siebel programming language conforms to the same visibility rules as a predefined Siebel application. For example, if a business object is readable but not editable because of visibility rules in the predefined Siebel application, then the same is true if you access the object through a Siebel programming language. You cannot use a Siebel programming language to circumvent the visibility rules or the security constraints that a predefined Siebel application enforces.
64
Avoid Nested If Statements on page 67 Apply Multiple Object Interface Methods to a Single Object on page 67 Use a Self-Reference to Indicate the Current Object on page 69 Delete Objects You Have Created That You No Longer Require on page 70 Make Sure Function Names Are Unique on page 70 Manage the Script Buffer on page 70 Using Siebel VB and Siebel eScript Formats on page 71 Handling the Date Format in Siebel VB on page 71 Returning Run-Time Errors in Siebel VB on page 72
For introductory information about Siebel VB, see Siebel VB Language Reference.
Declaring Your Variables in Siebel VB You can use the Dim statement in the Option Explicit statement to declare a variable before you use it. To reduce the amount of memory that your code uses and to improve processing speed, it is recommended that you avoid using a Variant variable. You can declare a variable without specifying a data type. If you do not specify a data type, then Siebel VB assumes the Variant type, which requires 16 bytes and uses twice as much memory as the next smallest data type.
Table 8.
Naming Conventions for Variables in Scripts Naming Convention s i l si d Example sName iReturn lBigCount siAllowance dBudget
Data Type String Integer Long integer Single-precision number Double-precision number
65
Table 8.
Naming Conventions for Variables in Scripts Naming Convention o c Example oBusComp cAmtOwed
Table 9.
Siebel Constants Constant Name ContinueOperation CancelOperation Integer Value 1 2 256 257 0 1 2 3 0 1 2 3 5 7 8 9
Search Methods
ForwardBackward ForwardOnly
NewRecord Method
NewBefore NewAfter NewBeforeCopy (Not available with Siebel Java Data Bean) NewAfterCopy (Not available with Siebel Java Data Bean)
Siebel ViewMode Methods. For more information, see Constants You Can Use with the SetViewMode Method on page 245.
66
Each of these statements chooses from multiple alternatives according to the value of a single variable. It is recommended that you use the Select Case statement instead of a series of nested If statements. It simplifies code maintenance and improves performance. Siebel CRM evaluates the variable only once. The following is an example use of the Switch statement: switch (FieldName) { case "Status": { var sysdate = new Date(); var sysdatestring = ((sysdate.getMonth() + 1) + "/" + sysdate.getDate() + "/" + sysdate.getFullYear()+ " "+ sysdate.getHours() + ":" + sysdate.getMinutes()+":" + sysdate.getSeconds()); this.SetFieldValue("Sales Stage Date",sysdatestring); if ((FieldValue) == "Not Attempted") { if (this.GetFieldValue("Primary Revenue Amount") > 0) this.SetFieldValue("Primary Revenue Amount",0); } break; } case "Revenue": { if (newrecSw =="Y") { newrecSw = ""; this.SetFieldValue("Account Revenue",(FieldValue)); } break; } }
Example of Using the With Statement in Siebel VB The following example uses the With statement in Siebel VB: Set oBusObject = TheApplication.GetBusObject("Opportunity") Set oBusComp = oBusObject.GetBusComp("Opportunity") With oBusComp .ActivateField "Account"
67
.ClearToQuery .SetSearchSpec "Name", varname .ExecuteQuery ForwardBackward If (.FirstRecord = 1) Then sAccount = .GetFieldValue "Account" End If End With . . . Set oBusComp = Nothing Set oBusObject = Nothing The following example is not recommended. It does not use the With statement: Set oBusObject = TheApplication.GetBusObject("Opportunity") Set oBusComp = oBusObject.GetBusComp("Opportunity") oBusComp.ActivateField "Account" oBusComp.ClearToQuery oBusComp.SetSearchSpec "Name", varname oBusComp.ExecuteQuery ForwardBackward If (oBusComp.FirstRecord = 1) Then sAccount = oBusComp.GetFieldValue "Account" End If . . . Example of Using the With Statement in Siebel eScript The following example uses the With statement in Siebel eScript: var oBusObject = TheApplication().GetBusObject("Opportunity"); var oBusComp = oBusObject.GetBusComp("Opportunity"); with (oBusComp) { ActivateField("Account"); ClearToQuery(); SetSearchSpec("Name", varname); ExecuteQuery(ForwardBackward); if (FirstRecord()) { var sAccount = GetFieldValue( "Account"); } } //end with The following example is not recommended. It does not use the With statement: var oBusObject = TheApplication().GetBusObject("Opportunity"); var oBusComp = oBusObject.GetBusComp("Opportunity"); oBusComp.ActivateField("Account"); oBusComp.ClearToQuery(); oBusComp.SetSearchSpec("Name", varname); oBusComp.ExecuteQuery(ForwardBackward); if oBusComp.FirstRecord(); {
68
You can use the statement or keyword instead of referencing an active business object.
Example of Using the Me Statement The following business component event handler uses the Me statement instead of the ActiveBusComp statement: Function BusComp_PreSetFieldValue(FieldName As String, FieldValue As String) As Integer If Val(Me.GetFieldValue("Rep %")) >75 Then TheApplication.RaiseErrorText("You cannot set the Rep% to greater than 75") End If BusComp_PreSetFieldValue = ContinueOperation End Function For examples of using the Me statement, see the following topics: ParentBusComp Method for a Business Component on page 221 SetViewMode Method for a Business Component on page 244 BusComp_PreQuery Event on page 269 BusComp_PreWriteRecord Event on page 271 ActiveMode Method for an Applet on page 101
Example of Using the This Keyword The following business component event handler uses the This keyword instead of the ActiveBusComp statement: if (condition) { ... this.SetSearchSpec(...); this.ExecuteQuery(); return (CancelOperation); } else return(ContinueOperation);
69
Delete these objects in the reverse order in which the objects are created. Delete child objects before you delete parent objects.
Example of Deleting Objects in Siebel VB The following code is an example of deleting objects in Siebel VB: Set oBusObj = TheApplication.GetBusObject("Contact") Set oBusComp= oBusObj.GetBusComp("Contact")
70
In many instances, the only difference between the Siebel VB format and the Siebel eScript format is that the Siebel eScript format requires a pair of parentheses at the end. In these instances, this book only includes the Siebel VB format. To determine the Siebel eScript format, add the parentheses.
Differences Between Siebel eScript and ECMAscript ECMAscript is a programming language that developers use to script a client on the Web. JavaScript is a type of ECMAscript. Siebel eScript does not include user interface functions. You cannot use it to animate or control a Web page. It includes the following functions that are not part of ECMAscript: SELib Clib
You can use these functions to interact with the operating and file systems, and for performing input and output file operations. These objects include functions that are similar to functions that the C programming language uses. For more information, see Siebel eScript Language Reference. ECMAscript does not require you to declare a variable. It declares a variable implicitly as soon as you use it.
Use the DateSerial function convert the value of the date field to a date variable.
71
Perform the required date arithmetic. For example, you can use the following Siebel VB code: Dim strDate as String, varDate as Variant strDate = oBC.GetFieldValue("Date Field") varDate =DateSerial(Val(Mid(strDate,7,4)),Val(Left(strDate,2)),_ Val(Mid(strDate,4,2)))
Predefined Siebel VB method. You can use some combination of Err, ErrText, and Error. Custom Siebel VB method. If you access a Siebel object interface through Component Object Model (COM) or ActiveX, then to view the text of the error message use the following code: If errCode <> 0 Then ErrText = GetLastErrText TheApplication.RaiseErrorText ErrText Exit Sub End If
NOTE: The GetLastErrText method is only available if you use an interface that is external to Siebel Tools. You can use it in Microsoft VB but not in Siebel VB. Object interface methods use numeric error codes in a range of 4000 to 4999. For more information about error-handling and error codes, see Siebel VB Language Reference.
In the Object List Editor, locate and then right-click the object you must modify. For example, in the Applets list, locate and then right-click Contact List Applet.
In the Scripting Language dialog box, choose one of the following menu items:
72
In the Scripting Language dialog box, choose Visual Basic or eScript, and then click OK.
Declaring a Variable
This topic describes how to declare a variable.
In the script editing window, use one of the following statements in your custom script:
In Siebel VB, use the Dim statement. In Siebel eScript, use the Var statement.
Example of Declaring a Local Variable in Siebel VB The following example declares a local variable in Siebel VB: Sub WebApplet_Load Dim localStr As String End Sub Example of Declaring a Local Variable in Siebel eScript The following example declares a local variable in Siebel eScript: function WebApplet_Load () { var localStr; }
73
2 3
In the navigation tree of the script editing window, expand the general tree, and then click declarations. In the script editing window, use one of the following statements in your custom script:
In Siebel VB, use the Dim statement. In Siebel eScript, use the Var statement.
The following example declares a module variable in Siebel VB: (general) (declarations) Dim ContactId as String
Use the Global statement to declare the variable. The following example includes the Global statement in Siebel eScript: TheApplication().gVar = "some value";
Repeat Step 1 and Step 2 for each object that must access the value of the global variable.
Do Not Use a Global Variable to Reference a Siebel Object Do not use a global variable to reference a Siebel object, such as a business component or business object. If you must reference a Siebel object, then set the global variable to Nothing when you no longer require the object, or in the Application_Close event.
74
If you do not set the variable to Nothing, then a memory problem might occur. Siebel CRM cannot release from memory the object that the global variable references until the variable no longer references the object. If you must create a global variable for a business component, then make sure a global variable for the business object exists. For more information, see Application_Close Event on page 177.
Example of Calling More Than One Object Interface Method in Siebel eScript
The following example is in Siebel eScript: var iReturn; switch (methodName) { case "PushOpportunity": //your custom code iReturn = CancelOperation; break; case "Stage3": //your custom code
75
2 3 4 5 6 7
In the navigation tree of the Siebel Script Editor, choose an event in the BusComp Tree. In the Siebel Script Editor window, write your script. Choose the Debug menu, and then the Check Syntax menu item. The Check Syntax menu item is available only for Server Script. Save the changes. Choose the Tools menu, and then the Compile Selected Objects menu item. Choose the Debug menu, and then the Start menu item.
a b c d 3
76
Choose the View menu, and then the Options menu item. In the Development Tools Options dialog box, click the Object Explorer tab. Expand the Applet tree, and then make sure the Applet User Prop object type contains a check mark. Click Ok.
4 5 6
In the Applets list, locate the applet you must modify. In the Object Explorer, expand the Applet tree, and then click Control. In the Controls list, add a new control using values from the following table. Property Name Caption HTML Type Method Invoked Value ButtonTest Test MiniButton MyTest
7 8 9
In the Applets list, right-click the applet and then choose the Edit Web Layout menu item. In the Controls/Columns window, change the template mode to Edit List. Drag and then drop the ButtonTest control from the Controls/Columns window to an appropriate location on the canvas of the Web Layout Editor.
10 Choose the File menu, and then the Save menu item. 11 Close the Web Layout Editor. 12 Enable the button: a b
In the Object Explorer, click Applet User Prop. In the Applet User Props list, create a new user property using values from the following table. Property Name Value CanInvokeMethod: MyTest For more information about the CanInvokeMethod applet user property, see Siebel Developers Reference. Value TRUE
As an alternative, you can use script to enable the button. For more information, see Using Script to Enable a MiniButton on page 78.
13 In the Applets list, right-click the applet, and then choose Edit Browser Scripts. 14 In the BrowserApplet window, add the following script:
function Applet_PreInvokeMethod (name, inputPropSet) { switch (name) { case "MyTest": theApplication().SWEAlert("Browser Script!");
77
15 Close the BrowserApplet window. 16 In the Applets list, right-click the applet, and then choose Compile Selected Objects. 17 In the Object Compiler window, click Compile. 18 Start the Siebel client, and then navigate to the Accounts screen. 19 Click Test.
This is the button you created in Step 6.
20 Make sure the Siebel client displays an alert box that includes the following message:
Browser Script!
78
} return(ContinueOperation); }
Tracing a Script
As part of debugging a script you can run a trace on allocations, events, and SQL commands. You can start tracing for a user account, such as your development team. The Siebel Server sends trace information to a log file. For information about: Configuring server components, see Siebel Applications Administration Guide Logging events, see Siebel System Monitoring and Diagnostics Guide File tracing, see Trace Method for an Application on page 171
NOTE: To enable logging for the local object manager, you can set the SIEBEL_LOG_EVENT environment variable to a value of 2 through 5. For more information, see Siebel Applications Administration Guide.
To trace a script 1 2 3
In the Siebel client, navigate to the Administration - Server Configuration screen, and then the Servers view. In the Components list, choose a component to log. In the Events list, locate the Object Manager Extension Language Log event. If this record does not exist, then you cannot use the component you chose in Step 2 for logging.
4 5
a b c d
Click the Parameters tab. In the Component Parameters list, click Menu, and then choose the Columns Displayed menu item. Move the Parameter Alias and Subsystem columns to the Selected Columns window, and then click Save. In the Component Parameters list, click Query.
79
Enter the following values, and then click Go. Field Parameter Alias Subsystem Value Trace* Object Manager
Set one or more tracing parameters using values from the following table. Information to Trace Allocations Events SQL Commands Users Parameter Alias TraceAlloc TraceEvents TraceSql TraceUser
Settings for Current Value and Value on Restart Enter 1 to enable logging. Enter 0 to disable logging. Enter 1 to enable logging. Enter 0 to disable logging. Enter 1 to enable logging. Enter 0 to disable logging. Enter a list of user names. Use a comma to separate each user name. For example: sadmin,mmasters. Do not use spaces. You cannot enter more than 20 characters in this parameter. CAUTION: Tracing on the Siebel Server can affect performance. If you simultaneously trace multiple users, then use caution.
To instruct Siebel CRM to immediately make changes to these parameters, enter values in the Current Value column. To instruct Siebel CRM to make changes to these parameters only after a restart, enter values in the Value on Restart column.
6 7
Test your work, and then examine the results. When you are finished logging, set the Log Level that you set in Step 4 to 0.
The following is part of an example of the trace output: 2021 2003-04-09 15:37:20 2003-04-09 16:40:52 -0700 00000022 001 001f 0001 09 SCCObjMgr_enu 47126 1680 1584 C:\sea752\siebsrvr\log\SCCObjMgr_enu_47126.log 7.5.3 [16122] ENU ObjMgrSessionInfoObjMgrLogin32003-04-09 15:37:20Login name : SADMIN ObjMgrSessionInfoObjMgrAuth32003-04-09 15:37:20Authentication name : SADMIN ObjMgrSessionInfoObjMgrLogin32003-04-09 15:37:20Session Type: Regular Session GenericLogGenericError12003-04-09 15:37:20Invocation of Applet Menu New Service::NewExpense is not allowed. GenericLogGenericError12003-04-09 15:37:20Invocation of Applet Menu New Service::NewTimeSheet is not allowed.
80
ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:38:27[User: SADMIN] EVENT, BEGIN, BusComp [Account], BusComp_Query. ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:38:27[User: SADMIN] EVENT, END, BusComp [Account], BusComp_Query. ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:38:58[User: SADMIN] EVENT, BEGIN, BusComp [Account], BusComp_NewRecord. ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:38:58[User: SADMIN] EVENT, END, BusComp [Account], BusComp_NewRecord. ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:39:08[User: SADMIN] EVENT, BEGIN, BusComp [Account], BusComp_PreSetFieldValue. ObjMgrExtLangLogObjMgrExtLangLog02003-04-09 15:39:08[User: SADMIN] EVENT, END, BusComp [Account], BusComp_PreSetFieldValue. ObjMgrSessionInfoObjMgrLogin32003-04-09 16:40:52Username: SADMIN, Login Status: Attempt, Session Id: !1.690.b816.3e94a0a0, IP Address: 172.20.94.66
81
82
This chapter describes object interface methods and events. It includes the following topics: Format of the Object Interface Method on page 83 Technologies You Can Use to Access Object Interface Methods and Events on page 85 Object Interfaces Reference on page 100
In Siebel VB, if an object interface method returns a value, then enclose these arguments in parentheses. in Siebel VB, if an object interface method does not return a value, then do not enclose these arguments in parentheses. In Siebel eScript, always enclose these arguments in parentheses.
If you use parentheses ( ) when none are required, or if you fail to use them if they are required, then Siebel CRM creates a Type Mismatch error, which includes error code 13. Siebel CRM also creates this error if you use an incorrect number of arguments. If you use the COM Data Server interface, then you must include the errCode argument as the last argument. Note how this book uses the following terms:
83
ObjectReference is an ObjectType variable name that identifies the object that calls the object interface method. If you call a method on an object in the event handler of that object, then you are not required to explicitly specify the ObjectReference. returnValue is the value that the object interface method returns. Some methods, such as GetBusComp, return a business component object. Some methods return a string or integer. Some methods do not return any value.
84
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Technologies You Can Use to Access Object Interface Methods and Events
This topic describes technologies you can use to access object interface methods and events. It includes the following topics: Technologies You Can Use to Access Object Interface Methods on page 85 Technologies You Can Use to Access Object Interface Events on page 98
The term Yes indicates an object interface that you can use with an application method.
Applet Methods
Table 10 lists the technologies you can use to access applet object interface methods. You can use an applet object interface method only with Server Script and Browser Script.
Applet Methods Server Script No Yes Yes No No Browser Script Yes Yes Yes Yes Yes
ActiveMode Method for an Applet on page 101 BusComp Method for an Applet on page 102 BusObject Method for an Applet on page 102 FindActiveXControl Method for an Applet on page 103 FindControl Method for an Applet on page 104
85
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Applet Methods Server Script Yes Yes Browser Script Yes Yes
Examples of Using the FindControl Method on page 104 Name Method for an Applet on page 106
Application Methods
Table 11 lists the technologies you can use to access application methods.
Table 11.
Application Methods Web Client Automation Server No Mobile Web Client Automation Server No COM Data Control No COM Data Server No Java Data Bean No
Method ActiveApplet Method for an Application ActiveBusComp Method for an Application ActiveBusObject Method for an Application ActiveViewName Method for an Application Attach Method for an Application CurrencyCode Method for an Application Detach Method for an Application EnableExceptions Method for an Application FindApplet Method for an Application GetBusObject Method for an Application
Server Script No
No
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
No
No
Yes
Yes
No
Yes
No
No
No
No Yes
No Yes
No No
No Yes
Yes Yes
No Yes
Yes Yes
No No
No No
No No
No Yes
Yes Yes
No No
Yes No
No Yes
Yes No
No No
No Yes
No Yes
No Yes
No Yes
86
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 11.
Application Methods Web Client Automation Server No Mobile Web Client Automation Server Yes COM Data Control Yes COM Data Server No Java Data Bean Yes
Method GetDataSource Method for an Application Called only with InvokeMethod GetLastErrCode Method for an Application GetLastErrText Method for an Application GetProfileAttr Method for an Application GetService Method for an Application GetSharedGlobal Method for an Application GotoView Method for an Application InvokeMethod Method for an Application IsViewReadOnly Method for an Application Called only with InvokeMethod Language Method for an Application Called only with InvokeMethod LoadObjects Method for an Application
Browser Script No
No
No
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes Yes
Yes No
Yes No
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
No Yes
No No
No Yes
No Yes
No Yes
No Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
87
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 11.
Application Methods Web Client Automation Server No Mobile Web Client Automation Server No COM Data Control No COM Data Server No Java Data Bean No
Method LoadUserAttributes Method for an Application Login Method for an Application LoginId Method for an Application LoginName Method for an Application Logoff Method for an Application LookupMessage Method for an Application LookupValue Method for an Application Called only with InvokeMethod Name Method for an Application NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application RaiseError Method for an Application RaiseErrorText Method for an Application
Browser Script No
No No No No No
No No No No No
Yes
No
No
Yes
Yes
No
Yes
No Yes
Yes Yes
Yes Yes
No Yes
No Yes
No Yes
No Yes
Yes Yes
No No
No No
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
No No
No No
No No
No No
No No
No No
88
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 11.
Application Methods Web Client Automation Server No Mobile Web Client Automation Server Yes COM Data Control Yes COM Data Server Yes Java Data Bean Yes
Method SetPositionId Method for an Application SetPositionName Method for an Application SetProfileAttr Method for an Application SetSharedGlobal Method for an Application ShowModalDialog Method for an Application SWEAlert Method for an Application Trace Method for an Application TraceOff Method for an Application TraceOn Method for an Application
Browser Script No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
No
No
No
No
Yes No No No
No No No No
89
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 12.
Business Component Methods Mobile Web Client Automation Server Yes Yes Yes Yes Yes COM Data Control Yes Yes Yes Yes Yes COM Data Server Yes Yes Yes Yes Yes Java Data Bean Yes Yes Yes Yes Yes
Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component BusObject Method for a Business Component ClearLOVCache Method for a Business Component Called only with InvokeMethod ClearToQuery Method for a Business Component CreateFile Method for a Business Component Called only with InvokeMethod DeactivateFields Method for a Business Component DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component ExecuteQuery2 Method for a Business Component FirstRecord Method for a Business Component FirstSelected Method for a Business Component GenerateProposal Method for a Business Component Called only with InvokeMethod
Yes Yes
No No
Yes Yes
Yes Yes
Yes Yes
Yes Yes
No No No No No No No
90
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 12.
Business Component Methods Mobile Web Client Automation Server Yes Yes Yes COM Data Control Yes Yes Yes COM Data Server Yes Yes Yes Java Data Bean Yes Yes Yes
Method GetAssocBusComp Method for a Business Component GetFieldValue Method for a Business Component GetFile Method for a Business Component Called only with InvokeMethod GetFormattedFieldValue Method for a Business Component GetLastErrCode Method for a Business Component GetLastErrText Method for a Business Component GetMultipleFieldValues Method for a Business Component GetMVGBusComp Method for a Business Component GetNamedSearch Method for a Business Component GetPicklistBusComp Method for a Business Component GetSearchExpr Method for a Business Component GetSearchSpec Method for a Business Component GetSortSpec Method for a Business Component GetUserProperty Method for a Business Component GetViewMode Method for a Business Component InvokeMethod Method for a Business Component LastRecord Method for a Business Component
Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
91
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 12.
Business Component Methods Mobile Web Client Automation Server Yes Yes Yes No Yes Yes Yes Yes COM Data Control Yes Yes Yes No Yes Yes Yes Yes COM Data Server Yes Yes Yes No Yes Yes Yes Yes Java Data Bean Yes Yes Yes No Yes Yes Yes Yes
Method Name Method for a Business Component NewRecord Method for a Business Component NextRecord Method for a Business Component NextSelected Method for a Business Component ParentBusComp Method for a Business Component Pick Method for a Business Component PreviousRecord Method for a Business Component PutFile Method for a Business Component Called only with InvokeMethod RefineQuery Method for a Business Component RefreshBusComp Method for a Business Component Called only with InvokeMethod RefreshRecord Method for a Business Component Called only with InvokeMethod Release Method for a Business Component SetAdminMode Method for a Business Component Called only with InvokeMethod SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component
Server Script Yes Yes Yes Yes Yes Yes Yes Yes
Yes Yes
No Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes
Yes
Yes
Yes
No
Yes
No Yes
No No
No Yes
No Yes
No Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
92
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 12.
Business Component Methods Mobile Web Client Automation Server Yes Yes Yes Yes Yes Yes Yes Yes Yes COM Data Control Yes Yes Yes Yes Yes Yes Yes Yes Yes COM Data Server Yes Yes Yes Yes Yes Yes Yes Yes Yes Java Data Bean Yes Yes Yes Yes Yes Yes Yes Yes Yes
Method SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component
Server Script Yes Yes Yes Yes Yes Yes Yes Yes Yes
Table 13.
Business Object Methods Mobile Web Client Automation Server Yes Yes Yes COM Data Control Yes Yes Yes COM Data Server Yes No No Java Data Bean Yes No No
Method GetBusComp Method for a Business Object GetLastErrCode Method for a Business Object GetLastErrText Method for a Business Object
93
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 13.
Business Object Methods Mobile Web Client Automation Server Yes No COM Data Control Yes No COM Data Server Yes No Java Data Bean Yes Yes
Method Name Method for a Business Object Release Method for a Business Object
Table 14.
Business Service Methods Web Client Automation Server No No Mobile Web Client Automation Server Yes Yes COM Data Control Yes Yes COM Data Server Yes Yes Java Data Bean Yes Yes
Method Business Service Methods GetNextProperty Method for a Business Service GetProperty Method for a Business Service InvokeMethod Method for a Business Service Name Method for a Business Service PropertyExists Method for a Business Service Release Method for a Business Service
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
No
No
No
Yes
94
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 14.
Business Service Methods Web Client Automation Server No Mobile Web Client Automation Server Yes COM Data Control Yes COM Data Server Yes Java Data Bean Yes
Method RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Yes
Yes
No
Yes
Yes
Yes
Yes
Control Methods
You can use the following control methods. You can use these methods only with Browser Script: Applet Method for a Control on page 294 BusComp Method for a Control on page 295 GetProperty Method for a Control on page 295 GetValue Method for a Control on page 296 Name Method for a Control on page 297 SetLabelProperty Method for a Control on page 297 SetProperty Method for a Control on page 301 SetValue Method for a Control on page 302
Table 15.
Property Set Methods Web Client Automation Server Yes Yes No Mobile Web Client Automation Server Yes Yes No COM Data Control Yes Yes No COM Data Server Yes Yes No Java Data Bean Yes Yes Yes
Method AddChild Method for a Property Set Copy Method for a Property Set GetByteValue Method for a Property Set
95
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 15.
Property Set Methods Web Client Automation Server Yes Yes Mobile Web Client Automation Server Yes Yes COM Data Control Yes Yes COM Data Server Yes Yes Java Data Bean Yes Yes
Method GetChild Method for a Property Set GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetLastErrCode Method for a Property Set GetLastErrText Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
96
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Table 15.
Property Set Methods Web Client Automation Server Yes Mobile Web Client Automation Server Yes COM Data Control Yes COM Data Server Yes Java Data Bean Yes
Method InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetByteValue Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes No
Yes No
Yes No
Yes No
Yes No
Yes No
Yes Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Miscellaneous Methods
Table 16 lists technologies you can use to access other methods that you can use. You cannot use these methods with the following technologies: Web Client Automation Server Mobile Web Client Automation Server COM Data Control
97
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
Miscellaneous Methods Server Script No No Yes Browser Script No No Yes Yes Yes No Java Data Bean
These object interface events are available in Server Script or Browser Script in Siebel Tools.
Applet Events
Table 17 lists applet events. You can use these events only with Server Script or Browser Script.
Applet Events Server Script No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Browser Script
Applet_ChangeFieldValue Event Applet_ChangeRecord Event Applet_InvokeMethod Event Applet_Load Event Applet_PreInvokeMethod Event WebApplet_InvokeMethod Event WebApplet_Load Event WebApplet_PreCanInvokeMethod Event WebApplet_PreInvokeMethod Event
98
Siebel Object Interfaces Reference Technologies You Can Use to Access Object Interface Methods and Events
WebApplet_ShowControl Event Not available in high interactivity mode. WebApplet_ShowListColumn Event Not available in high interactivity mode.
Yes
No
Application Events
Table 18 lists application events. You can use these events only with Server Script or Browser Script.
Application Events Server Script Yes Yes Yes Yes Yes Yes No Yes No Yes No No Browser Script
Application_Close Event Application_InvokeMethod Event Application_Navigate Event Application_PreInvokeMethod Event Application_PreNavigate Event Application_Start Event
Business Component Events Server Script Yes Yes Yes Yes Yes Yes Yes Yes Browser Script No No No No No No No No
BusComp_Associate Event BusComp_ChangeRecord Event BusComp_CopyRecord Event BusComp_DeleteRecord Event BusComp_InvokeMethod Event BusComp_NewRecord Event BusComp_PreAssociate Event BusComp_PreCopyRecord Event
99
Business Component Events Server Script Yes Yes Yes Yes Yes Yes Browser Script No No No No No Yes
BusComp_PreDeleteRecord Event BusComp_PreGetFieldValue Event BusComp_PreInvokeMethod Event BusComp_PreNewRecord Event BusComp_PreQuery Event BusComp_PreSetFieldValue Event Available only in high interactivity mode. Requires you to set a field property for the event that Siebel CRM immediately runs on the Siebel Server. BusComp_PreWriteRecord Event BusComp_Query Event BusComp_SetFieldValue Event BusComp_WriteRecord Event
No No No No
Business Service Events Server Script Yes Yes Yes Browser Script Yes Yes Yes
100
Business Component Methods on page 183 Business Component Invoke Methods on page 250 Business Component Events on page 260 Business Object Methods on page 275 Business Service Methods on page 278 Business Service Events on page 287 Control Methods on page 294 Property Set Methods on page 304 Miscellaneous Methods on page 320
CAUTION: Oracle might modify or delete an undocumented method without notice. Use of an undocumented method is entirely at your own risk.
A specialized applet class or a specialized business component class is a class other than the CSSFrame class or the CSSBusComp class. A custom method is a Siebel object interface method that you modify.
Applet Methods
This topic describes applet methods. It includes the following topics: ActiveMode Method for an Applet on page 101 BusComp Method for an Applet on page 102 BusObject Method for an Applet on page 102 FindActiveXControl Method for an Applet on page 103 FindControl Method for an Applet on page 104 InvokeMethod Method for an Applet on page 105 Name Method for an Applet on page 106
10 1
Examples The following example is in Browser Script: function Applet_Load () { var currMode = this.ActiveMode(); theApplication().SWEAlert("The active mode for the selected applet is: " + currMode); }
102
Examples The following example is in Browser Script: function Applet_Load () { var appletname = this.Name(); var currBO = this.BusObject(); var currBOName = currBO.Name(); theApplication().SWEAlert("The active Business Object for the " + appletname + " is: " + currBOName); } The following example is in Siebel eScript: function WebApplet_Load () { var busObj = this.BusObject(); } The following example is in Siebel VB: Sub WebApplet_Load Dim oBusObject As BusObject Set oBusObject = Me.BusObject End Sub
Format Applet.FindActiveXControl(controlName) Table 21 describes the arguments for the Browser Script format of the FindActiveXControl method.
Table 21.
Arguments for the Browser Script Format of the FindActiveXControl Method Description Literal string or string variable that contains the name of the control.
Argument controlName
Usage You can use the FindActiveXControl method to find a control on a form applet. It does not locate a list column on a list applet.
10 3
Examples The following Browser Script example interacts with a Microsoft slide ActiveX control that resides on a Siebel applet: // Get a reference to the control var SlideCtrl = FindActiveXControl("SliderControl"); // Display some of the ActiveX Control's properties theApplication().SWEAlert ("element id = " + SlideCtrl.id); theApplication().SWEAlert ("Max ticks = " + SlideCtrl.Max); SlideCtrl.SelStart = 2; // Set a control property SlideCtrl.Refresh(); // Call the control's Refresh method var myCustomCtrl = FindActiveXControl("TestControl"); myCustomCtrl.TestProperty01 = "abc"; myCustomCtrl.Style.visible = "hidden"; // Use a Style sheet property
Format Applet.FindControl(controlName) The arguments you can use with this format are the same as the arguments described in Table 21 on page 103.
Usage The FindControl method does not do the following: Locate a control in an MVG applet, pick applet, associate applet, or detail applet. In Siebel Tools, these applets do not appear in the child View Web Template Items list of the view. Locate list columns in a list applet.
Examples of Using the FindControl Method The following example is in Browser Script: function Applet_PreInvokeMethod (name, inputPropSet) { // Code to change the Font Size of the "Location" label if (name == "fontsize") { // Use FindControl() to get a reference to the control var ctl = this.FindControl("Location");
104
ctl.SetLabelProperty("FontSize", "22"); // Set the font size return ("CancelOperation"); } } To use this example, see SetLabelProperty Method for a Control on page 297.
Browser Script Format Applet.InvokeMethod(methodName, methodArgs_PropSet); Table 22 describes the arguments for the Browser Script format of the InvokeMethod method.
Table 22.
Arguments for the Browser Script Format of the InvokeMethod Method Description The name of the method. Property set that contains the method arguments.
Server Script Format Applet.InvokeMethod(methodName, methArg1, methArg2, methArgN); Table 23 describes the arguments for the Browser Script format of the InvokeMethod method.
Table 23.
Arguments for the Browser Script Format of the InvokeMethod Method Description The name of the method. One or more strings that contain arguments for the methodName argument.
Argument methodName You can use the following arguments: methArg1 methArg2 methArgN
Usage Available with Server Script and Browser Script. Note the following:
10 5
If the method that the methodName argument identifies exists in the browser, then Siebel CRM runs this method in the browser. If the method that the methodName argument identifies exists on the Siebel Server, then Siebel CRM runs this method on the Siebel Server.
Caution About Using the InvokeMethod Method You must use InvokeMethod only to call a method that this book describes.
Examples The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { //Call a Siebel SmartScript from a custom button //using the applet.InvokeMethod method //Note the InvokeSScriptFromButton is from a custom //method added to a button if (MethodName == "InvokeSScriptFromButton") { var iReturn = ContinueOperation; var sArgs = new Array(3); sArgs[0] = "Demo Opportunity Profile"; sArgs[1] = ""; sArgs[2] = ""; this.InvokeMethod("RunCallScript", sArgs); iReturn = CancelOperation; } else { iReturn = ContinueOperation; } return(iReturn); }
106
Examples The following example is in Browser Script: function Applet_Load () { //Display the name of the applet if the applet loads using the //applet.Name() method to obtain the name of the applet var appletName; appletName = this.Name(); theApplication().SWEAlert("The name of the applet is: " + appletName); } The following example is in Siebel eScript: function WebApplet_Load () { //Display the name of the applet if the applet loads using the //applet.Name() method to obtain the name of the applet var appletName; appletName = this.Name(); TheApplication().RaiseErrorText("The name of the applet is: " + appletName); } The following example is in Siebel VB: Sub WebApplet_Load ' Display the name of the applet if the applet loads using the ' applet.Name() method to obtain the name of the applet Dim appletName As String appletName = Me.Name TheApplication.RaiseErrorText "The name of the applet is: " & appletName End Sub
Applet Events
This topic describes applet events. It includes the following topics: Overview of Applet Events on page 108 Applet_ChangeFieldValue Event on page 108 Applet_ChangeRecord Event on page 109 Applet_InvokeMethod Event on page 110 Applet_Load Event on page 112 Applet_PreInvokeMethod Event on page 113 WebApplet_InvokeMethod Event on page 114
10 7
WebApplet_Load Event on page 115 WebApplet_PreCanInvokeMethod Event on page 116 WebApplet_PreInvokeMethod Event on page 117 WebApplet_ShowControl Event on page 119 WebApplet_ShowListColumn Event on page 121
For example, Applet_ChangeFieldValue. If the event includes the Applet prefix, then you can use it only on the browser. The format for an applet event that you use on the Siebel Server is WebApplet_event. where: event is the name of the event.
For example, WebApplet_InvokeMethod. If the event includes the WebApplet prefix, then you can use it only on the Siebel Server.
Applet_ChangeFieldValue Event
The Applet_ChangeFieldValue event starts if the user uses an applet to change data in a field. It does not return any information. For more information, see Applet_ChangeRecord Event on page 109.
Format Applet_ChangefieldValue(fieldname, fieldValue) Table 24 describes the arguments for the Applet_ChangeFieldValue event.
Table 24.
Arguments for the Applet_ChangeFieldValue Event Description A string that contains the name of the field that the user changed. A string that contains the value that the user changed.
108
If the user moves to a different record but does not change a value in the previous record, then the ChangeFieldValue event does not start. If the user changes the value in a field, and another dependent field, such as a calculated field, changes as a result, then the event starts once for each field whose value changes. If the user uses a pick applet or popup applet to change data in a field, then this event does not start.
Examples The following example is in Browser Script: function Applet_ChangeFieldValue (field, value) { try { switch (field) { case "Primary Revenue Committed Flag": if (value == "Y") { var thisBC = this.BusComp(); var sRev = thisBC.GetFieldValue("Primary Revenue Amount"); var sUpside = thisBC.GetFieldValue("Primary Revenue Upside Amount"); var total = sRev + sUpside; if (total < 500000) { thisBC.SetFieldValue("Primary Revenue Committed Flag", "N"); theApplication().SWEAlert("Changing the Committed Flag to NO as $500,000 in Revenue and Upside amount is required"); } } break; } } catch(e) { // error handling routine }
Applet_ChangeRecord Event
Siebel CRM calls the Applet_ChangeRecord event if the user moves to a different record or view. It does not return any information. For more information, see Applet_ChangeFieldValue Event on page 108.
10 9
Used With You use the Applet_ChangeRecord event with Browser Script. Note the following: To return the value of the field the user navigates to, use the BusComp.GetFieldValue method. To return the value of the field the user navigates away from, use the control.GetValue method.
Examples The following example is in Browser Script: function Applet_ChangeRecord () { try { var thisBC = this.BusComp(); var sFlag = thisBC.GetFieldValue("Primary Revenue Committed Flag"); if (sFlag == "Y") { theApplication().SWEAlert("This record cannot be updated because it has been committed"); } } catch(e) // error handling routine }
Applet_InvokeMethod Event
The Applet_InvokeMethod event can start if any of the following items occur: A call to applet.InvokeMethod occurs A call to a specialized method occurs A user chooses a menu item in a menu that the user defines
For more information, see About Specialized and Custom Methods on page 101. This method does not return any information.
110
Table 25.
Arguments for the Applet_InvokeMethod Event Description The name of the method that Siebel CRM calls. A property set that identifies arguments that Siebel CRM sends to the event.
Usage This method sends information you specify in the inputPropSet argument to the PreInvokeMethod event. You can use the Applet_InvokeMethod event to display or hide controls, or to set a search specification. To access a business component from this event handler, do the following: Use this.BusComp. Do not use TheApplication.ActiveBusComp.
Examples Some methods can create, modify, or delete records. These actions might call an event at the applet or business component level. If you require Siebel CRM to perform a specific action before or after the method run, then you can use these events. The following example includes custom code in the PreInvokeMethod event and the InvokeMethod applet event. For more information, see Applet_PreInvokeMethod Event on page 113. To set the fields, this code sets and resets the flag and uses the NewRecord server event: function Applet_PreInvokeMethod (name, inputPropSet) { if (name == "Quote") { // Add code that Siebel CRM must run BEFORE the special method // Set flag to "1" theApplication().SetProfileAttr("flag","1"); } return ("ContinueOperation"); }
function Applet_InvokeMethod (name, inputPropSet) { if (name == "Quote") { // Add code that Siebel CRM must run AFTER the special method
11 1
function BusComp_NewRecord () { if (theApplication().GetProfileAttr("flag")== "1" ) { this.SetFieldValue ("Field1", "Value1"); this.SetFieldValue ("Field2", "Value2"); . . . . . } }
Applet_Load Event
Siebel CRM calls the Applet_Load event after it loads an applet and displays the data for that applet. It does not return any information.
Usage To hide or manipulate controls or to set properties on an ActiveX Control in a form applet, you can use the Applet_Load event. You can manipulate the following types of controls: CheckBox ComboBox TextBox TextArea Label
NOTE: If you must display a dialog box, then do not use the SWEAlert method or the RaiseErrorText method with the Applet_Load event. This technique can cause the browser to fail if Siebel CRM has not fully rendered the Siebel application in the browser.
112
Examples You can use the following example only with code on a form applet: function Applet_Load () { // Get the control instance. var ctrl = this.FindControl("FirstName"); // Hide the control ctrl.SetProperty("Visible","false"); // Hide the label ctrl.SetLabelProperty("Visible", "hidden"); }
Applet_PreInvokeMethod Event
Siebel CRM calls the Applet_PreInvokeMethod event immediately before it calls a specialized method on an applet. The Applet_PreInvokeMethod event can start if any of the following items occur: A call to the InvokeMethod method on an applet occurs. A user chooses a custom menu item that you define in Siebel Tools.
This event returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57. For more information, see About Specialized and Custom Methods on page 101.
Format Applet_PreInvokeMethod(name, inputPropSet) The arguments you use with this format are the same as the arguments described in Table 25 on page 111.
Examples function Applet_PreInvokeMethod (name, inputPropSet) { if(name == 'NewRecord') { if(confirm("Are you sure you want to create a new record?")) return ("ContinueOperation"); else return ("CancelOperation"); return ("ContinueOperation"); } }
11 3
WebApplet_InvokeMethod Event
Siebel CRM calls the WebApplet_InvokeMethod event after a specialized method on the Web applet runs. WebApplet_InvokeMethod starts only for a predefined method. It does not start for a custom method. For more information, see About Specialized and Custom Methods on page 101. This method does not return any information.
Format WebApplet_InvokeMethod(methodName) Table 26 describes the arguments for the WebApplet_InvokeMethod event.
Table 26.
Arguments for the WebApplet_InvokeMethod Event Description String variable or literal that contains the name of the method that Siebel CRM calls.
Argument methodName
Examples The following example is in Siebel eScript: switch (MethodName) { case "NewQuery": TheApplication().SetSharedGlobal("EnableButton", "N"); break; case "ExecuteQuery": TheApplication().SetSharedGlobal("EnableButton", ""); break; case "UndoQuery": TheApplication().SetSharedGlobal("EnableButton", ""); break; } The following example is in Siebel VB: Select Case MethodName Case "NewQuery" TheApplication.SetSharedGlobal "EnableButton", "N" Case "ExecuteQuery" TheApplication.SetSharedGlobal "EnableButton", "" Case "UndoQuery" TheApplication.SetSharedGlobal "EnableButton", "" End Select Related Topics For more information, see the following topics:
114
Applet_InvokeMethod Event on page 110 Application_InvokeMethod Event on page 178 WebApplet_PreCanInvokeMethod Event on page 116
WebApplet_Load Event
Siebel CRM calls the WebApplet_Load event immediately after it loads an applet. It does not return any information.
Usage To avoid returning a null value, do not call TheApplication.ActiveBusObject from the WebApplet_Load event. Instead, use this.BusObject to obtain a reference to the current business object.
Examples The following example is in Siebel eScript: function WebApplet_Load () { try { var currBC = this.BusComp(); with (currBC) { SetViewMode(OrganizationView); ClearToQuery(); SetSearchSpec("Last Name", "A*"); ExecuteQuery(ForwardBackward); } } catch (e) { TheApplication().RaiseErrorText(e.errText); } } The following example is in Siebel VB: Sub WebApplet_Load Dim iReturn As Integer Dim currBC As BusComp
11 5
Set currBC = Me.BusComp With currBC .SetViewMode OrganizationView .ClearToQuery .SetSearchSpec "Last Name", "A*" .ExecuteQuery End With End Sub Related Topics For more information, see the following topics: Applet_InvokeMethod Event on page 110 Application_InvokeMethod Event on page 178 WebApplet_PreCanInvokeMethod Event on page 116
WebApplet_PreCanInvokeMethod Event
The WebApplet_PreCanInvokeMethod event allows a script to determine if the user possesses the authority to call the applet method. Siebel CRM calls this method in the following situations: Before it calls the PreInvokeMethod event. If the user steps to a different record. If it loads an applet. If it calls a different method from Browser Script. For example, the GetProfileAttr method or the SetProfileAttr method.
This method returns CancelOperation or ContinueOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Format WebApplet_PreCanInvokeMethod(MethodName, &CanInvoke) Table 27 describes the arguments for the WebApplet_PreCanInvokeMethod event.
Table 27.
Arguments for the WebApplet_PreCanInvokeMethod Event Description A string that contains the name of the method that Siebel CRM must run. A string that indicates if Siebel CRM call the applet method. You can use the following values: TRUE. Siebel CRM can call the applet method. FALSE. Siebel CRM cannot call the applet method.
116
Usage Using the FirstSelected business component method with the PreCanInvokeMethod event can cause unexpected behavior in a pick applet that Siebel CRM calls from the applet where this event is called. NOTE: To enable and disable a method, it can be easier to use the CanInvokeMethod applet user property at the applet level. For an example, see Using a MiniButton Control to Call a Custom Method on page 76. For information about the CanInvokeMethod user property, see Siebel Developers Reference.
Examples The following example is in Siebel eScript: function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke) { if ( MethodName == "CustomMethod" ) { CanInvoke = "TRUE"; return( CancelOperation ); } return (ContinueOperation); } The following example is in Siebel VB: Function WebApplet_PreCanInvokeMethod (MethodName As String, CanInvoke As String) As Integer Dim iReturn As Integer iReturn = ContinueOperation If MethodName = "Test" Then CanInvoke = "TRUE" iReturn = CancelOperation End If WebApplet_PreCanInvokeMethod = iReturn End Function
WebApplet_PreInvokeMethod Event
Siebel CRM calls the WebApplet_PreInvokeMethod event before it calls any of the following: A specialized method for the Web applet. A custom method that Siebel CRM calls through the oWebApplet object of the InvokeMethod method.
This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57. For more information, see About Specialized and Custom Methods on page 101.
11 7
Format WebApplet_PreInvokeMethod(methodName) The arguments you can use with this format are the same as the arguments described in Table 26 on page 114.
Examples The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { switch (MethodName) { case "CustomMethod": var applet = this; var BC = applet.BusComp(); var ConId = BC.GetFieldValue("Contact Id"); var WshShell = COMCreateObject("WScript.Shell"); WshShell.Popup("My Custom Method was called. Here is the ID " + ConId); return(CancelOperation); break; } return (ContinueOperation); } The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer Dim iReturn As Integer iReturn = ContinueOperation Select Case MethodName Case "CustomMethod" Dim oBusComp As BusComp Set oBusComp = Me.BusComp Dim WshShell As Object ConId = oBusComp.GetFieldValue("Contact Id") Set WshShell = CreateObject("WScript.Shell") WshShell.Popup("My Custom Method was called. Here is the ID " & ConId) iReturn = CancelOperation End Select WebApplet_PreInvokeMethod = iReturn End Function
118
WebApplet_ShowControl Event
The WebApplet_ShowControl event allows a script to modify the HTML that the Siebel Web Engine creates when it renders a control on a Web page in a Siebel application that runs in standard interactivity mode. You can use the WebApplet_ShowControl event only in a Siebel application that runs in standard interactivity mode. This event does not return any information.
Format WebApplet_ShowControl (controlName, property, mode, HTML) Table 28 describes the arguments for the WebApplet_ShowControl event.
Table 28.
Arguments for the WebApplet_ShowControl Event Description A string that indicates the name of the control that Siebel CRM must render. A string that indicates the value of the property attribute of the swe:control tag or the swe:this tag that starts this event. If you do not specify the property attribute for the tag, then you can leave the property argument empty.
mode
The mode of the applet that Siebel CRM displays. You can use one of the following values: Base Edit New Query Sort
HTML
The HTML that the Siebel Web Engine creates for the swe:control or swe:this tag that starts this event.
Usage of the WebApplet_ShowControl Event The HTML that the Siebel Web Engine creates depends on the following items: The control The property displayed The mode of the applet
The script can modify the value of the HTML argument. The Siebel Web Engine sends the modified value back to the Web browser.
11 9
To render the layout of an applet, Siebel CRM uses a Siebel Web Template (.swt) file. These files are HTML files that contain special variable tags that indicate where to render a control. To render the controls on the Web page, the Siebel Web Engine converts swe tags to HTML. Siebel CRM calls the WebApplet_ShowControl event for each swe tag after the Siebel Web Engine creates the HTML to render the control, but before it sends the created HTML back to the browser. This technique allows the scripts to modify this HTML before Siebel CRM displays it. To display a control, you can include swe:control variable tags in the following ways: Use the swe:control tag by itself: <swe:control id="1" property="DisplayName"/> If the control ID is mapped to an actual control in the applet, then the Siebel Web Engine renders the DisplayName property of the control at the point where you place this tag in the template file. Siebel CRM starts the event only one time after the Siebel Web Engine creates the HTML for the swe:control tag. Use the swe:control tag and the swe:this tag: <swe:control id="1"> . . . <swe:this property="DisplayName"/> . . . </swe:control> The Siebel Web Engine renders the DisplayName property of the control at the point where you place the swe:this tag in the template file. Siebel CRM uses the outer swe:control tag only to determine if the control ID is mapped to an actual control in the applet. Siebel CRM starts the event two times:
After the Siebel Web Engine creates the HTML for the swe:this tag. After the Siebel Web Engine creates the HTML for the outer swe:control tag. This work occurs after Siebel CRM converts to HTML all objects that the code references between the swe:control tag and the /swe:control tag. This conversion includes objects in the swe:this tag.
To distinguish between these two event calls, the script can examine the value of the property attribute of the tag that Siebel CRM passes as an argument to the event.
Examples This Siebel eScript script displays negative amounts in red in a read-only form:
120
function WebApplet_ShowControl (ControlName, Property, Mode, &HTML) { var BC = this.BusComp(); if( ControlName == "Amount" && Mode == "Base" && Property == "FormattedHTML") { var amount = ToNumber(BC.GetFieldValue ("Transaction Amount")); if (amount < 0) HTML = "<FONT Color=Red> " + HTML + " </FONT>"; } }
WebApplet_ShowListColumn Event
This event allows a script to modify the HTML that the Siebel Web Engine creates when it renders a list column on a Web page in a Siebel application that runs in standard interactivity mode. You can use the WebApplet_ShowListColumn event only in a Siebel application that runs in standard interactivity. This event does not return any information.
Format WebApplet_ShowListColumn (columnName, property, mode, HTML) Table 29 describes the arguments for the WebApplet_ShowListColumn event.
Table 29.
Arguments for the WebApplet_ShowListColumn Event Description A string that indicates the name of the list column that Siebel CRM must render. For more information, see Table 28 on page 119.
Usage Usage for the WebApplet_ShowListColumn event is very similar to usage for the WebApplet_ShowControl event, except Siebel CRM uses a list column ID that is mapped to a list column in an applet. For more information, see Usage of the WebApplet_ShowControl Event on page 119.
Example This Siebel VB script displays negative amounts in a list in red font color:
12 1
Sub WebApplet_ShowListColumn (ColumnName As String, Property As String, Mode As String, HTML As String) Dim amount as Double If ColumnName = "Amount" and Mode = "Base" and Property = "FormattedHTML" Then If HTML < 0 Then HTML = "<FONT Color=Red> " + HTML + " </FONT>" End If End If End Sub The following example is in Siebel eScript: function WebApplet_ShowListColumn (ColumnName, Property, Mode, &HTML) { if ((ColumnName == 'Amount') && (Mode == "Base") && (Property == "FormattedHTML")) { var val - HTML.valueOf(); if (val < 0) HTML = "<FONT Color=Red> " + HTML + " </FONT>"; } }
Application Methods
This topic describes application methods. It includes the following topics: Overview of Application Methods on page 123 ActiveApplet Method for an Application on page 124 ActiveBusComp Method for an Application on page 125 ActiveBusObject Method for an Application on page 125 ActiveViewName Method for an Application on page 127 Attach Method for an Application on page 128 CurrencyCode Method for an Application on page 131 Detach Method for an Application on page 131 EnableExceptions Method for an Application on page 132 FindApplet Method for an Application on page 134 GetBusObject Method for an Application on page 134 GetDataSource Method for an Application on page 136 GetLastErrCode Method for an Application on page 136 GetLastErrText Method for an Application on page 137 GetProfileAttr Method for an Application on page 138
122
GetService Method for an Application on page 139 GetSharedGlobal Method for an Application on page 141 GotoView Method for an Application on page 143 InvokeMethod Method for an Application on page 145 IsViewReadOnly Method for an Application on page 146 Language Method for an Application on page 148 LoadObjects Method for an Application on page 148 Login Method for an Application on page 150 LoginId Method for an Application on page 153 LoginName Method for an Application on page 153 Logoff Method for an Application on page 154 LookupMessage Method for an Application on page 154 LookupValue Method for an Application on page 155 Name Method for an Application on page 156 NewPropertySet Method for an Application on page 157 PositionId Method for an Application on page 159 PositionName Method for an Application on page 159 RaiseError Method for an Application on page 160 RaiseErrorText Method for an Application on page 162 SetPositionId Method for an Application on page 163 SetPositionName Method for an Application on page 164 SetProfileAttr Method for an Application on page 164 SetSharedGlobal Method for an Application on page 167 ShowModalDialog Method for an Application on page 167 SWEAlert Method for an Application on page 170 Trace Method for an Application on page 171 TraceOff Method for an Application on page 173 TraceOn Method for an Application on page 174
12 3
TheApplication(), if called from Siebel eScript that resides in the Siebel repository file (SRF) theApplication(), if called from Browser Script that resides in the Siebel repository file (SRF)
Note the following: If an application method applies to only one scripting language, then the Syntax definition in the method includes one of these methods. If a method applies to an external interface or to more than one scripting language, then it must use more than one format. In this situation, the Syntax definition includes Application, which results in the following:
If you use Siebel VB, Siebel eScript, or Browser Script, then Siebel CRM substitutes the applicable statement for Application If you use an external interface, then Siebel CRM substitutes the name of an application instance for Application
Some examples in this chapter include an Application method that uses an external interface. These examples use SiebelApplication as the application instance. The examples assume that the script starts an instance of the Siebel application. This situation is true even if the example does not include the code that starts this instance.
Usage Use this method to determine which applet Siebel CRM currently displays. This applet typically includes a blue border to indicate that it is active.
Examples function Applet_PreInvokeMethod (name, inputPropSet) { switch (name) { case "Drilldown": var activeapplet = theApplication().ActiveApplet(); var activeappletname = activeapplet.Name(); theApplication().SWEAlert("Here is the applet we are drilling down from " + activeappletname);
124
Usage for the ActiveBusObject Method Do not use the ActiveBusObject method in an event handler that any of the following technologies can start: COM Data Server COM Data Control Siebel Java Data Bean
12 5
Used With Browser Script, Mobile Web Client Automation Server, Server Script
Example in Browser Script The following example is in Browser Script: function Applet_Load () { var oBusObj; oBusObj = theApplication().ActiveBusObject(); theApplication().SWEAlert("The active business object is " + oBusObj.Name() + ".") } Example of Using the ActiveBusObject Method to Call from a Custom Button on a Child Applet The following examples include script that runs on the Siebel Server that Siebel CRM can call from a custom button on a child applet in a view. This script does the following work:
1 2
Determines if the Contact business object is active. If it is active, then Siebel CRM returns the email address of the currently active parent Contact record. Uses the contact email address to call the custom SendEmail function.
Because objects that script references are currently active in the Siebel client, Siebel CRM does not delete these objects at the end of the script. The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { if (MethodName == "Send Email") { var oBO = TheApplication().ActiveBusObject(); if (oBO.Name() == "Contact") { var oBC = oBO.GetBusComp("Contact"); var sEmail = oBC.GetFieldValue("Email Address"); SendMail(sEmail); sEmail =""; } return (CancelOperation); } return (ContinueOperation); } The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer Dim iRtn As Integer iRtn = ContinueOperation
126
If MethodName = "Send Email" Then Dim oBO As BusObject Set oBO = TheApplication.ActiveBusObject() If oBO.Name() = "Contact" Then Dim oBC As BusComp Dim sEmail As String Set oBC = oBO.GetBusComp("Contact") sEmail = oBC.GetFieldValue("Email Address") SendEmail(sEmail) sEmail ="" End If iRtn = CancelOperation End If WebApplet_PreInvokeMethod = iRtn End Function
Usage Usage for the ActiveViewName method is very similar to usage for the ActiveViewName method. For more information, see Usage for the ActiveBusObject Method on page 125.
Used With Browser Script, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) { switch(FieldName) { case "Name":
12 7
case "Location": case "Account Status": case "Alias": case "City": case "Country": case "Currency Code": case "Current Volume": case "DUNS Number": case "Expertise": case "Freight Terms": case "Freight Terms Info": case "Home Page": case "Industry": case "Location": case "Main Phone Number": case "Main Fax Number": case "Sales Rep": var sActiveViewName = TheApplication().ActiveViewName(); if (sActiveViewName == "All Accounts across Organizations") { TheApplication().RaiseErrorText("You cannot update the " + FieldName + " on the " + sActiveViewName + " View"); } break; } return (ContinueOperation); }
Format Application.Attach(sessionString) Table 30 describes the arguments for the Attach method.
Table 30.
Arguments for the Attach Method Description A string that contains the Siebel Session Id. This argument is typically the output of the Detach method.
Argument sessionString
128
1 2 3 4 5
Start an instance of COM Data Control. Log in to a Siebel Server. Detach the instance. Determine the session string. Start another instance of COM Data Control. The script does not log in again. Instead, it uses the session string to access the existing session. This technique reuses the connection that the first instance created.
The following example uses COM Data Control and is written in native Visual Basic: Dim Dim Dim Dim Dim Dim SiebelApplication_first As SiebelDataControl SiebelApplication_second As SiebelDataControl errCode As Integer sessionString As String attachResult As Boolean errText As String
' Instantiate the first instance Set SiebelApplication_first = CreateObject("SiebelDataControl.SiebelDataControl.1") ' Login to Siebel SiebelApplication_first.Login "host=""Siebel.tcpip.none.none://virtual ip:port/ enterprise/object manager""", "user id", "password" errCode = SiebelApplication_first.GetLastErrCode If errCode <> 0 Then errText = SiebelApplication_first.GetLastErrText MsgBox errText Exit Sub End If ' Detach this instance from Siebel and get session id sessionString = SiebelApplication_first.Detach MsgBox "The session string is: " & sessionString ' Instantiate the second instance Set SiebelApplication_second = CreateObject("SiebelDataControl.SiebelDataControl.1") ' Attach the existing session to this instance attachResult = SiebelApplication_second.Attach(sessionString) If (attachResult = True) Then MsgBox "Session attached!" Else MsgBox "Session attach failed" End If
12 9
SiebelApplication_second.LogOff Set SiebelApplication_second = Nothing Set SiebelApplication_first = Nothing The following example uses the Siebel Java Data Bean: import com.siebel.data.*; import com.siebel.data.SiebelException; public class JDBAttachDetachDemo { private SiebelDataBean m_dataBean_first = null; private SiebelDataBean m_dataBean_second = null; public static void main(String[] args) { JDBAttachDetachDemo demo = new JDBAttachDetachDemo(); } public JDBAttachDetachDemo() { try { // Instantiate the Siebel Java Data Bean m_dataBean_first = new SiebelDataBean(); // Login to the Siebel Servers m_dataBean_first.login("siebel.tcpip.none.none://virtualip:2320/ enterprise/object manager name","user id","password"); System.out.println("Logged in to the Siebel Server "); //Get the Detach Handle String detachHandle = m_dataBean_first.detach(); System.out.println("The session id is: " + detachHandle); // Instantiate another Siebel Java Data Bean SiebelDataBean m_dataBean_second = new SiebelDataBean(); // Do Attach System.out.println("Attaching in to the Siebel Server "); m_dataBean_second.attach(detachHandle); System.out.println("Attach Done "); // Logoff m_dataBean_second.logoff(); } catch (SiebelException e) { System.out.println(e.getErrorMessage()); } } }
130
Used With Browser Script, COM Data Control, COM Data Server, Web Client Automation Server, and Server Script
Examples The following example is in Siebel eScript: function WebApplet_Load () { var currencycode; currencycode = TheApplication().CurrencyCode(); var WshShell = COMCreateObject("WScript.Shell"); WshShell.Popup(currencycode); }
Usage Use the string that the Detach method returns only with the Attach method.
Examples For a Siebel Java Data Bean example and a native VB example that uses COM Data Control, see Attach Method for an Application on page 128.
13 1
Format Application.EnableExceptions(bEnable) Table 31 describes the arguments for the EnableExceptions method.
Table 31.
Arguments for the EnableExceptions Method Description You can one of the following values: TRUE FALSE
Argument bEnable
Usage Setting the argument to TRUE enables native error handling. This allows Siebel CRM to intercept and display the exception ID and description. Native COM error handling is disabled by default.
Used With COM Data Control, Mobile Web Client Automation Server
Example of Using the EnableExceptions Method with Siebel ActiveX Data Control The native Visual Basic script in this example does the following work: Uses the Siebel ActiveX Data Control to connect to the Siebel application and to create an instance of a business object. Prompts the user to use or not use the native error handling. If the user answers yes, and if the script encounters an error, then it issues the error immediately. If the user answers no, then the script suppresses errors. You can detect errors only with the GetLastErrCode method. The following code is an example of using the EnableExceptions method with Siebel ActiveX Data Control: Dim SiebelApplication As SiebelDataControl Dim errCode As Integer Dim wrongBO As SiebelBusObject Dim nativeHandle As String Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1")
132
' Login to Siebel SiebelApplication_first.Login "host=""Siebel.tcpip.none.none://virtual ip:port/ enterprise/object manager""", "user id", "password" nativeHandle = InputBox("Use native error handling?", "", "Yes") If nativeHandle = "Yes" Then SiebelApplication.EnableExceptions (True) Else SiebelApplication.EnableExceptions (False) End If Set wrongBO = SiebelApplication.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a nonexisting Business Object errCode = SiebelApplication.GetLastErrCode() If errCode <> 0 Then 'if native error handle is disabled, this block detects it ErrText = SiebelApplication.GetLastErrText MsgBox ErrText Exit Sub End If Example of Using the EnableExceptions Method with Siebel Mobile Automation Server The script in this example performs the same work that is described in Example of Using the EnableExceptions Method with Siebel ActiveX Data Control on page 132, except it uses the Siebel Mobile Automation Server: Dim SiebelApp As SiebelWebApplication Dim errCode As Integer Dim wrongBO As SiebelBusObject Set SiebelApp = CreateObject("TWSiebel.SiebelWebApplication.1") Dim nativeHandle As String nativeHandle = InputBox("Use native error handle?", "", "Yes") If nativeHandle = "Yes" Then SiebelApp.EnableExceptions (True) Else SiebelApp.EnableExceptions (False) End If Set wrongBO = SiebelApp.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a nonexisting Business Object errCode = SiebelApp.GetLastErrCode() If errCode <> 0 Then 'if native error handle is disabled, this block detects it ErrText = SiebelApp.GetLastErrText MsgBox ErrText Exit Sub End If
13 3
Format theApplication().FindApplet(appletName) Table 32 describes the arguments for the FindApplet method.
Table 32.
Arguments for the FindApplet Method Description String variable or literal that contains the name of an applet.
Argument appletName
Usage The only applets available are applets that are visible in the active view.
Examples The following example is in Browser Script: function Applet_ChangeFieldValue (field, value) { if (theApplication().ActiveViewName() == "Account List View") { var newapplet = theApplication().FindApplet("Account Entry Applet"); var entryappletcontrol = newapplet.FindControl("Name"); var entryappletvalue = entryappletcontrol.GetValue(); theApplication().SWEAlert(entryappletvalue); } }
Format Application.GetBusObject(busObjectName)
134
Table 33.
Arguments for the GetBusObject Method Description String variable or literal that contains the name of the business object.
Argument busObjectName
Usage To delete the business object instance after it is no longer needed, you can set the business object to Nothing.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The examples in this topic create a new instance of the Account business object and returns the name of the instance of the Account business object. The following example is in Siebel eScript: var oBusObject = TheApplication().GetBusObject("Account"); var oBusComp = oBusObject.GetBusComp("Account");
13 5
private SiebelDataBean m_dataBean = null; private SiebelBusObject m_busObject = null; m_busObject = m_dataBean.getBusObject("Opportunity"); The following example is in Siebel eScript: var oBO = TheApplication().GetBusObject(this.BusObject.Name); The following example is in Siebel VB: Dim oBO as BusObject Dim oBC as BusComp Set oBO = TheApplication.GetBusObject(Me.BusObject.Name)
Used With To use this method, you can use an Application.InvokeMethod call with the following interfaces: COM Data Control Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following Siebel eScript code detects the data source and displays the name of the data source in a dialog box: var dataSrc = TheApplication().InvokeMethod("GetDataSource"); TheApplication().RaiseErrorText(dataSrc); The following example is in Siebel VB: Dim dataSrc As String dataSrc = TheApplication.InvokeMethod("GetDataSource") TheApplication.RaiseErrorText(dataSrc)
136
Usage for the GetLastErrCode Method After you run an object interface method, you can call the GetLastErrCode method to determine if Siebel CRM returned an error from the previous operation. You can use the GetLastErrText method to return the text of the error message. Each call to a method resets the run status. For more information, see GetLastErrText Method for an Application on page 137.
Used With COM Data Control, Mobile Web Client Automation Server, Web Client Automation Server
Examples The following example is for COM Data Control: errcode = SiebelApplication.GetLastErrCode If errcode <> 0 Then ErrText = SiebelApplication.GetLastErrText MsgBox ErrText Exit Sub End If
Usage for the GetLastErrText Method The text that the GetLastErrText method returns includes a Siebel error code that you can use to investigate the error. For more information, see GetLastErrCode Method for an Application on page 136. For more information about a specific error, see My Oracle Support.
Used With COM Data Control, COM Data Server, Mobile Web Client Automation Server, Web Client Automation Server
13 7
Examples The following example is for COM Data Control: errcode = SiebelApplication.GetLastErrCode If errcode <> 0 Then ErrText = SiebelApplication.GetLastErrText MsgBox ErrText Exit Sub End If
Format Application.GetProfileAttr(name) Table 34 describes the arguments for the GetProfileAttr method.
Table 34.
Arguments for the GetProfileAttr Method Description A string that indicates the name of the attribute.
Argument name
Usage For more information, see Using System Fields with the SetProfileAttr Method on page 165.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Browser Script: var myprofile = theApplication().GetProfileAttr("Hobby"); The following example is in Siebel eScript: var myprofile = TheApplication().GetProfileAttr("Hobby"); The following example is in Siebel VB: Dim myprofile As String myprofile = TheApplication.GetProfileAttr("Hobby")
138
Format Application.GetService(serviceName) Table 35 describes the arguments for the GetService method.
Table 35.
Arguments for the GetService Method Description The name of the business service to start.
Argument serviceName
Usage The GetService method searches through the predefined services that are stored in the Siebel repository file (SRF). If it does not find the business service that you specify in the serviceName argument, then it searches the business services defined in the run-time Business Services table. Siebel CRM normally deletes a business service from memory as soon as it clears all references to this business service. The act of setting the business service to another value usually clears these references. If you set the Cache property on the business service to TRUE, then Siebel CRM keeps this business service in memory as long as the Siebel application is running.
Registering a Business Service with a Siebel Application Starting with Siebel CRM version 8, if you use the Web Client Automation Server or Browser Script to call a business service, then you must register that business service with the Siebel application. You must do this to prevent a Service Not Found error. It is not necessary to specify this business service in the CFG file. This requirement does not apply to Server Script.
13 9
In the Application User Props list, create new application user properties using values from the following table. Name ClientBusinessService0 ClientBusinessService1 Value XML Converter My Business Service
You must enter the ClientBusinessService records sequentially, starting with ClientBusinessService0 and incrementing by 1 for each new ClientBusinessService user property you add.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following examples start a new instance of a business service named Workflow Process Manager. The following example is in Browser Script: function Applet_PreInvokeMethod (name, inputPropSet) { if (name == "MyCustomMethod") { var oBS; var inpPS; var outPS; inpPS = theApplication().NewPropertySet(); outPS = theApplication().NewPropertySet(); oBS = theApplication().GetService("Workflow Process Manager"); outPS = oBS.InvokeMethod("RunProcess", inpPS); inpPS = null; outPS = null; return ("CancelOperation"); } else { return ("ContinueOperation"); } } The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { if (MethodName == "MyCustomMethod") { var oBS; var inpPS;
140
var outPS; inpPS = TheApplication().NewPropertySet(); outPS = TheApplication().NewPropertySet(); oBS = TheApplication().GetService("Workflow Process Manager"); oBS.InvokeMethod("RunProcess", inpPS, outPS); inpPS = null; outPS = null; oBS = null; return (CancelOperation); } else { return (ContinueOperation); } } The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer If MethodName = "MyCustomMethod" Then Dim oBS As Service Dim inpPS As PropertySet Dim outPS As PropertySet Set inpPS = TheApplication.NewPropertySet Set outPS = TheApplication.NewPropertySet Set oBS = TheApplication.GetService("Workflow Process Manager") oBS.InvokeMethod "RunProcess", inpPS, outPS Set inpPS = Nothing Set outPS = Nothing Set oBS = Nothing WebApplet_PreInvokeMethod = CancelOperation Else WebApplet_PreInvokeMethod = ContinueOperation End If End Function
Format Application.GetSharedGlobal(varName)
14 1
Table 36.
Arguments for the GetSharedGlobal Method Description String literal or variable that contains the name of the global variable.
Argument varName
Usage Consider the following code: GetSharedGlobal("varName") This code returns the string that the following code sets: SetSharedGlobal "varName", "stringValue".
Used With COM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script
Example of Using the GetSharedGlobal Method To get the myGlobalVar global variable, the examples in this topic call the GetSharedGlobal method in the BusComp_WriteRecord event. This global variable is set through the SetSharedGlobal method in the Application_Start event. For more information, see SetSharedGlobal Method for an Application on page 167. The following example is for the Component Object Model (COM): Dim sReturn as String oleVar = SiebelApplication.GetSharedGlobal("myGlobalVar", errCode) SiebelApplication.SetSharedGlobal "myGlobalVar", " helloworld", errCode The following example is in Siebel eScript: function Application_Start (CommandLine) { TheApplication().SetSharedGlobal("myGlobalVar", "helloworld"); } function BusComp_WriteRecord () { var myVar; myVar = TheApplication().GetSharedGlobal("myGlobalVar"); } The following example is in Siebel VB: Sub Application_Start (CommandLine As String) TheApplication.SetSharedGlobal "myGlobalVar", "helloworld" End Sub
142
1 2 3 4 5
Deactivates any business object, business component, applet, or control that is active. Activates a view. Creates an instance of the business object that the view references. This business object instance becomes the active business object. Activates the primary applet of the view and the business component that this applet references. Activates the first tab sequence control of the primary applet.
Format Application.GotoView(ViewName[, BusinessObjectName]) Table 37 describes the arguments for the GotoView method.
Table 37.
Arguments for the GotoView Method Description The name of the view that the Siebel application must display. Optional. The business object that Siebel CRM uses to display the view. You cannot specify the current active business object. If you do not provide this argument, or if you specify Nothing in this argument, then Siebel CRM activates a new business object in the normal way.
Usage If an instance of the business object does not exist, then you must set the value for the BusinessObjectName argument to Nothing. You cannot use the GotoView method in the following events: Application_Navigate Application_PreNavigate Application_Start Navigate PreNavigate WebApplet_Load
14 3
The following Siebel VB script uses GotoView to programmatically navigate to the Opportunity List view: TheApplication.GotoView "Opportunity List View", Nothing If your Siebel application already started an instance of an Opportunity object with the object reference of objOppty, then the following usage in Siebel VB is acceptable: TheApplication.GotoView "Opportunity List View", objOppty If you use the GotoView method in a Siebel VB or Siebel eScript script, then Siebel CRM runs the method last. This situation is true regardless of where you use this method in the script. If script on a control uses the GotoView method, then do not set the Show Popup property on this control to TRUE. If you set the Show Popup to TRUE in this situation, then Siebel CRM opens the view in a new browser window. Because you cannot use a Multiple Document Interface (MDI) with the Siebel client, you cannot use this configuration.
Examples The following examples use the GoToView method with and without the optional business object parameter. The following example is in Siebel eScript: function BusComp_WriteRecord () { var leadQuality; var actName; var actBO; var actBC; //Get the lead quality for this opportunity leadQuality = this.GetFieldValue("Quality"); if(leadQuality == "1-Excellent") { //If it //go to actName actBO = actBC = is a excellent lead, the account for this opportunity = this.GetFieldValue("Account"); TheApplication().GetBusObject("Account"); actBO.GetBusComp("Account");
144
TheApplication().GotoView("All Account List View",actBO); } else { TheApplication().GotoView("Opportunity Detail - Activities View"); } actBC = null; actBO = null; } The following example is in Siebel VB: Sub BusComp_WriteRecord Dim Dim Dim Dim leadQuality As String actName As String actBO As BusObject actBC As BusComp
'Get the lead quality For this opportunity leadQuality = Me.GetFieldValue("Quality") If (leadQuality = "1-Excellent") Then 'If it is an excellent lead 'go to the account For this opportunity actName = Me.GetFieldValue("Account") Set actBO = TheApplication.GetBusObject("Account") Set actBC = actBO.GetBusComp("Account") With actBC .SetViewMode AllView .ClearToQuery .SetSearchSpec "Name", actName .ExecuteQuery End With TheApplication.GotoView "All Account List View",actBO Else TheApplication.GotoView "Opportunity Detail - Activities View" End If Set actBC = Nothing Set actBO = Nothing End Sub
14 5
For more information, see About Specialized and Custom Methods on page 101.
Browser Script Format theApplication().InvokeMethod(methodName, methArg1, methArg2, methArgN); Table 38 describes the arguments for the InvokeMethod method.
Table 38.
Arguments for the InvokeMethod Method Description The name of the method. One or more strings that contain arguments for the methodName argument.
Argument methodName You can use the following arguments: methArg1 methArg2 methArgN
Server Script Format Application.InvokeMethod(methodName, methArg1, methArg2, methArgN); The arguments you can use with this format are the same as the arguments described in Table 38 on page 146.
Usage The InvokeMethod method allows you to call a method on an application object that is made available directly through the Siebel application interface. For more information, see Caution About Using the InvokeMethod Method on page 106 and LoadObjects Method for an Application on page 148.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For an example, see Examples of Using the FindControl Method on page 104.
146
If this method does not return TRUE or FALSE, then an error occurred. If this method does not return TRUE or FALSE, then your script must provide a handler.
Format Application.InvokeMethod("IsViewReadOnly",viewName) Table 39 describes the arguments for the IsViewReadOnly method.
Table 39.
Arguments for the IsViewReadOnly Method Description The name of a view. You can include the name of this view in double quotes or in a variable that contains the name of the view.
Argument viewName
Usage You can set a view as read-only for a particular responsibility in the Responsibility Administration view. You can use the IsViewReadOnly method to determine if a view is read-only for the current responsibility before you attempt to edit a field. Siebel CRM does not automatically set a button to read-only when that button resides in a view that is read-only. You can use the IsViewReadOnly method to set a button to read-only in a view where IsViewReadOnly returns TRUE.
Used With To use this method, you can use an Application.InvokeMethod call with the following interfaces: Browser Script COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following example for Siebel eScript determines if the active view is read only: function ShowViewROStatus() { var sActive = TheApplication().ActiveViewName(); if (TheApplication().InvokeMethod("IsViewReadOnly",sActive) == "TRUE")
14 7
TheApplication().RaiseErrorText(sActive + "is read only."); else TheApplication().RaiseErrorText(sActive + "is not read only."); }
Used With To use this method, you can use an Application.InvokeMethod call with Server Script.
Examples The following example uses Siebel VB: Dim curLang As String curLang = TheApplication.InvokeMethod("Language") The following example uses Siebel eScript: var curLang; curLang = TheApplication().InvokeMethod("Language");
Format Application.LoadObjects(absoluteCFGfileName)
148
Table 40.
Arguments for the LoadObjects Method Description The path and name of the Siebel application configuration (CFG) file to open. For example: C:\Siebel\8.1\Server\BIN\ENU As an option, to identify the data source you can append the CFG file string with the data source, separated by a comma. For example: C:\Siebel\8.1\Server\BIN\ENU\siebel.cfg,ServerDataSrc If you do not specify the data source, then the LoadObjects method assumes the data source is local.
Argument absoluteCFGfileName
Usage Prior to calling the LoadObjects method, you must change the current directory to the Siebel\bin directory. If you use the COM Data Server, then the COM client cannot create multiple connections to the COM Server. For example, a second attempt to call the LoadObjects method causes an error message that is similar to the following: The object definition manager has already been initialized. You must restart the COM client before you can make another successful connection. Use COM Data Control instead.
Examples The following example uses COM Data Server: Private Sub LoadConfig_Click() Dim errCode As Integer LoadConfig.Enabled = False SiebelApplication.LoadObjects "C:\Siebel\8.1\Client_2\BIN\ENU\uagent.cfg", _ errCode If errCode = 0 Then ConfigOK = 1 End If Status.Text = SiebelApplication.GetLastErrText End Sub
14 9
Format LoadUserAttributes(row_id) Table 41 describes the arguments for the LoadUserAttributes method.
Table 41.
Arguments for the LoadUserAttributes Method Description The row ID of the user whose profile Siebel CRM must load.
Argument row_id
Usage To access the user profile, you can use the You profile from personalization rules, with the following exception: if the row ID is the row ID of the current user, then Siebel CRM loads the profile to the Me profile. If you call this function with no argument, then it unloads the loaded user profile. For information about user profiles, see Siebel Personalization Administration Guide.
Examples The following Siebel VB example loads a user profile to the session. The function is made available on the Siebel application object: Function LoadUserProfile As Integer TheApplication.InvokeMethod ("LoadUserAttributes","0-10N07") End Function The following Siebel VB example unloads the loaded user profile: Function LoadUserProfile As Integer TheApplication.InvokeMethod ("LoadUserAttributes", "") End Function
1 2
Log in to the COM Data Server, COM Data Control, or Siebel Java Data Bean. Access Siebel objects.
150
The Login method allows the end user to call the Siebel application without being prompted for a login and password. The Login method determines the privileges granted, and the role and responsibility of the end user for that session. This method returns a string that contains the error code.
Format Application.Login([connectString,] username, password) Table 42 describes the arguments for the Login method.
Table 42.
Arguments for the Login Method Description Connect string that uses a token. Username for the login. User password for the login.
Usage Verify that the Siebel\bin directory is the current directory. To access Data Control, you must do the following work: Make sure the default Data Source references the Siebel database that you must access. For more information, see Setting the Connect String on page 30. In the Siebel application configuration (CFG) file, make sure the EnableOLEAutomation parameter is TRUE.
Used With COM Data Control, COM Data Server, Mobile Web Client Automation Server, Siebel Java Data Bean
Examples The connect string for COM Data Control uses a token. For example: host = "Siebel://my_computer/SIEBEL/objsrvr/my_computer" lang = "ENU" Because most languages use quotes to enclose a text string, you must use quotes in parentheses. For example: To use COM Data Control in Visual Basic: m_dataBean.login("siebel.tcpip.none.none://gateway:gatewayport/ enterpriseserver/SCCObjMgr", "username", "password"); To use COM Data Control in C++: Login("host=\"siebel://my_computer/SIEBEL/objsvr/my_computer\" lang = \"ENU\"","user","password");
15 1
The following example logs in to the Siebel Server and determines if errors exist: Call SiebelAppControl.Login("host=""siebel://gtwy/enterprise/ObjMgr""", "SADMIN", "SADMIN") //Check for errors If SiebelAppControl.GetLastErrCode <> 0 Then frmMain.txtStatus.Text = SiebelAppControl.GetLasErrText Else frmMain.txtStatus.Text = "Connected successfully..." End If The following is a Siebel Java Data Bean example that logs in to a Siebel Server and then logs off: import com.siebel.data.*; import com.siebel.data.SiebelException; public class JDBLoginLogoffDemo { private SiebelDataBean m_dataBean = null; public static void main(String[] args) { JDBLoginLogoffDemo demo = new JDBLoginLogoffDemo(); } public JDBLoginLogoffDemo() { try { // instantiate the Siebel Java Data Bean m_dataBean = new SiebelDataBean(); // login to the Siebel Servers m_dataBean.login("siebel.tcpip.none.none://gateway:port/enterprise/ object manager","userid","password"); System.out.println("Logged in to the Siebel Server "); //perform function code //release the business object // logoff m_dataBean.logoff(); System.out.println("Logged off the Siebel Server "); } catch (SiebelException e) { System.out.println(e.getErrorMessage()); } } }
152
Usage The login ID is the value of the ROW_ID column in the user login record in the S_USER table. You can use the login ID as a search specification.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples In this Siebel VB example in the BusComp_PreSetFieldValue event, the LoginId method determines if the user possesses the rights to modify a record: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Select Case FieldName Case "Account Status" if Me.GetFieldValue("Created By") <> _ TheApplication.LoginId then TheApplication.RaiseErrorText("You cannot change Account Status " & _ "because you did not create the record.") end if End Select BusComp_PreSetFieldValue = ContinueOperation End Function
15 3
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For examples, see ExecuteQuery Method for a Business Component on page 194 and TheApplication Method on page 322.
Usage For clients that include a user interface, the Logoff method removes every window except for the topmost window. Logoff also removes every object, except for the topmost object, on the Siebel client and Siebel Server. If you remove the main object, then Siebel CRM automatically calls the Logoff method.
Used With COM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server
154
Table 43.
Arguments for the LookupMessage Method Description Name of the Message Category object that is the parent of the Key value. You can define this value in Siebel Tools. Name of the Message object whose text contains the value that Siebel CRM must format. You can define this value in Siebel Tools. If the error message contains a substitution argument, such as %1, then Siebel CRM uses these optional arguments to format the error message.
Examples The following Siebel eScript example returns the following text: Enter Account Title before stepping off. To test this code in the User Defined Errors message category, create a new record with the following text: Enter %1 before stepping off. Siebel CRM uses the Account Title parameter to substitute the %1 variable: var sVal = TheApplication().LookupMessage("User Defined Errors", "Test", "Account Title");
15 5
You can use this method to obtain the translation of the untranslated value in the LOV to the language that is currently active. The LookupValue method returns a string that contains the display value from the VAL column for the row. If it does not find the display value, then it returns the language independent code as the value.
Format val = Application.InvokeMethod("LookupValue", type, lang_ind_cd) Table 44 describes the arguments for the LookupValue method.
Table 44.
Arguments for the LookupValue Method Description The type that is specified in the List of Values administration view. Value for the language independent code that is specified in the List of Values administration view.
Used With To use the LookupValue method, you can use an Application.InvokeMethod call with the following interfaces: COM Data Control Siebel Java Data Bean Mobile Web Client Automation Server Server Script
156
Usage You can use the NewPropertySet method to create input and output arguments for a business service. NOTE: If you use the NewPropertySet method on an existing PropertySet object, then old references to this PropertySet are lost. If you reuse a PropertySet, then use the Reset method on this PropertySet.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples This example creates a new property set. It uses Browser Script: function Applet_PreInvokeMethod (name, inputPropSet) { if (name == "MyCustomMethod") { var oBS; var inpPS; var outPS; inpPS = theApplication().NewPropertySet(); outPS = theApplication().NewPropertySet(); oBS = theApplication().GetService("New Value Business Service"); outPS = oBS.InvokeMethod("New Value Method", inpPS); inpPS = null; outPS = null; oBS = null; return ("CancelOperation"); } else { return ("ContinueOperation"); } } The following example is for the Component Object Model (COM):
15 7
Set inpPS = SiebelApplication.NewPropertySet(errCode) Set outPS = SiebelApplication.NewPropertySet(errCode) Set oBS = SiebelApplication.GetService("New Value Business Service", errCode) oBS.InvokeMethod "New Value Method", inpPS, outPS, errCode Set inpPS = Nothing Set outPS = Nothing Set oBS = Nothing The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { if (MethodName == "MyCustomMethod") { var oBS; var inpPS; var outPS; inpPS = TheApplication().NewPropertySet(); outPS = TheApplication().NewPropertySet(); oBS = TheApplication().GetService("New Value Business Service"); oBS.InvokeMethod("New Value Method", inpPS, outPS); inpPS = null; outPS = null; oBS = null; return (CancelOperation); } else { return (ContinueOperation); } } The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer If MethodName = "MyCustomMethod" Then Dim oBS As Service Dim inpPS As PropertySet Dim outPS As PropertySet Set inpPS = TheApplication.NewPropertySet Set outPS = TheApplication.NewPropertySet Set oBS = TheApplication.GetService("New Value Business Service") oBS.InvokeMethod "New Value Method", inpPS, outPS Set inpPS = Nothing Set outPS = Nothing Set oBS = Nothing WebApplet_PreInvokeMethod = CancelOperation
158
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB example determines the position of a user who is attempting to change the sales stage. If the position does not allow this change, then this code prevents the change: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Dim sPosName As String sMsgText As String Select Case FieldName Case "Sales Stage" If FieldValue = "Approved" Then ' Do not allow the sales cycle to be changed to
15 9
' this value if the User is not a manager or VP. sPosName = TheApplication.PositionName If NOT ((sPosName="Manager") OR (sPosName="VP"))Then TheApplication.RaiseErrorText("Only a Manager or Vice President can approve a Pipeline Item. Please notify your Manager that you _ want to have this Pipeline Item approved.") End If BusComp_PreSetFieldValue = ContinueOperation End Select End Function
Format Application.RaiseError(key, [arg1], [arg2],...., [argN]) The arguments you can use in this format are the same as the arguments that are described in Table 43 on page 155 except the RaiseError Method does not include a category argument.
Usage for the RaiseError Method The RaiseError method causes Siebel CRM to terminate the script and send a notification to the browser. Therefore, you are not required to use CancelOperation after you use the RaiseError method. For more information, see Caution About Using the Cancel Operation Event Handler on page 57. The RaiseError method and the RaiseErrorText method create a Server Script exception. If you use error handling in your script, then the error handling can suppress RaiseError and RaiseErrorText functionality. If you use On Error Goto error handling in Siebel VB, and if you use the RaiseError method or the result from the RaiseErrorText method, then Siebel CRM transfers the script run to the error handler. If you use On Error Resume Next error handling, then Siebel CRM suppresses the RaiseError method and the RaiseErrorText method. CAUTION: Be careful if you use RaiseError because it cancels operations. For example, if you use it in the BusComp_PreWriteRecord event, then the user or code cannot step off the current record until Siebel CRM addresses the condition that causes the call to the RaiseError method.
160
Examples In the following Siebel eScript example, the RaiseError method results in Siebel CRM raising a scripting exception and transferring control to the Catch statement. To display the error message, you must use the Throw statement: function BusComp_PreDeleteRecord () { try { var status = this.GetFieldValue("Account Status"); if (status == "Gold") { TheApplication().RaiseError(user defined error name); } else { return (ContinueOperation); } } catch (e) { throw e; } } In the following Siebel eScript example, if the user deletes an opportunity that includes the Pipeline revenue class, then Siebel CRM sends an error message: function BusComp_PreDeleteRecord () { try { var revClass = this.GetFieldValue("Primary Revenue Class"); if (revClass == "1-Pipeline") { TheApplication().RaiseError("user-defined test error1", "PreDelete", "RaiseError Method" ); } else { return (ContinueOperation); } } catch (e) { throw e; } } Siebel CRM sends the following error message: This user-defined test error is used in PreDelete, as an example for RaiseError Method
16 1
Note the following key: user-defined test error1 This key is predefined as the following: This user-defined test error is used in %1, as an example for %2. When the script runs, Siebel CRM does the following: Substitutes PreDelete for %1 Substitutes Raise Error Method for %2
Format Application.RaiseErrorText(value, [arg1], [arg2],...., [argN]) Table 45 describes the arguments for the RaiseErrorText method.
Table 45.
Arguments for the RaiseErrorText Method Description The error text message. If the error message contains a substitution argument, such as %1, then Siebel CRM uses these optional arguments to format the error message.
Usage Usage for the RaiseErrorText method is very similar to usage for the RaiseError method. For more information, see Usage for the RaiseError Method on page 160.
Examples In the following Siebel eScript example, the RaiseErrorText method causes Siebel CRM to raise a scripting exception and then transfer control to the Catch statement. To display the error message, you must use the Throw statement.
162
function BusComp_PreDeleteRecord () { try { var status = this.GetFieldValue("Account Status"); if (status == "Gold") { TheApplication().RaiseErrorText("Unable to delete Gold Account"); } else { return (ContinueOperation); } } catch (e) { throw e; } } In the following Siebel eScript example, if the user deletes an opportunity that includes Pipeline as the revenue class, then Siebel CRM sends an error: function BusComp_PreDeleteRecord () { try { var revClass = this.GetFieldValue("Primary Revenue Class"); if (revClass == "1-Pipeline") { TheApplication().RaiseErrorText("Exception occurred in %1. Unable to delete Opportunity with %2 revenue class.", "PreDeleteRecord", revClass); } else { return (ContinueOperation); } } catch (e) { throw e; } }
Format Application.SetPositionId(positionId)
16 3
Table 46.
Arguments for the SetPositionId Method Description A string that contains the Position Id.
Argument positionId
Usage The positionId argument must contain the Position Id that is associated with the user who is currently logged in to the Siebel application.
Used With COM Data Server, COM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Format Application.SetPositionName(positionName) Table 47 describes the arguments for the SetPositionName method.
Table 47.
Arguments for the SetPositionName Method Description A string that contains the name of the position.
Argument positionName
Usage The positionName argument must contain the Position name that is associated with the user who is currently logged in to the Siebel application.
Used With COM Data Server, COM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
164
Format Application.SetProfileAttr(name, value) Table 48 describes the arguments for the SetProfileAttr method.
Table 48.
Arguments for the SetProfileAttr Method Description A string that contains the name of the attribute. The value of the attribute.
Usage The SetProfileAttr method sets the value of the value argument to an attribute in the user profile that the name argument contains. Siebel CRM does the following work: If this attribute already exists, then Siebel CRM updates the corresponding persistent profile attribute in the Siebel application. This value is defined in the Personalization Profile business component. If the profile attribute does not exist in the list of persistent profile attributes, then Siebel CRM creates it as a dynamic profile attribute. It does not include quotation marks at the beginning or end of the name. If you use the SetProfileAttr method in Browser Script, then Siebel CRM performs a round trip to the Siebel Server and back to the browser each time it uses this method. This processing creates a performance overhead.
For more information about user profile attributes, see Siebel Applications Administration Guide.
Using System Fields with the SetProfileAttr Method You cannot use the SetProfileAttr method with a system field. These fields are not explicitly defined in the Personalization Profile business component. You cannot use the SetProfileAttr method with the Id field because attempting to change the ROW_ID column of a table creates an error. For more information about system fields, see Configuring Siebel Business Applications. Personalization uses the GetProfileAttr method. Because system fields are not explicitly defined in the Personalization Profile business component, you cannot use this method with a system field, except for the Id field. For more information, see Siebel Personalization Administration Guide.
Used With Browser Script, COM Data Control, COM Data Server, Server Script, Siebel Java Data Bean, Mobile Web Client Automation Server
Examples The following example is in Browser Script: function Applet_PreInvokeMethod (name, inputPropSet)
16 5
{ if (name == "hobbyReq") { var hobby = theApplication().GetProfileAttr("Hobby"); if (hobby == "") { hobby = prompt("Please enter your favorite hobby"); theApplication().SetProfileAttr("Hobby", hobby); } return ("CancelOperation"); } else return ("ContinueOperation"); } This following examples exchange information between an applet Server Script and an applet Browser Script: In the applet Server Script, Siebel CRM uses the SetProfileAttr method to set a customer profile attribute named MyProAttr to Hello World. In the applet Browser Script, you can use the GetProfileAttr method to return the profile attribute.
The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) { if (MethodName == "MyCustomMethod") { TheApplication().SetProfileAttr("MyProAttr", "Hello World Siebel eScript"); return (CancelOperation); } return (ContinueOperation); } The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer If MethodName = "MyCustomMethod" Then TheApplication.SetProfileAttr "MyProAttr", "Hello World VB" WebApplet_PreInvokeMethod = CancelOperation Else WebApplet_PreInvokeMethod = ContinueOperation End If End Function
166
Format Application.SetSharedGlobal(varName, value) Table 49 describes the arguments for the SetSharedGlobal method.
Table 49.
Arguments for the SetSharedGlobal Method Description String variable or literal that contains the name of the shared global variable that Siebel CRM must set. String variable or literal that contains the value of the shared global variable.
Used With COM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script
Examples The following example is for the Component Object Model (COM): comVar = SiebelApplication.GetSharedGlobal("myVar", errCode) SiebelApplication.SetSharedGlobal "myVar", "BLAH", errCode The following example is in Siebel VB: TheApplication.SetSharedGlobal "myVar", "FOO" myVar = TheApplication.GetSharedGlobal("myVar") The remaining examples for using the SetSharedGlobal method are the same as the examples for using the GetSharedGlobal method. For more information, see Example of Using the GetSharedGlobal Method on page 142.
16 7
Table 50.
Arguments for the ShowModalDialog Method Description The URL of the document that Siebel CRM finished loading and displaying. Passes arguments to use if Siebel CRM displays the document. This argument can be a value of any type, including an array of values. For more information, see the window.dialogArguments property of the object in the Document Object Model. For example: See the window.showModalDialog property at http://developer.mozilla.org. See the showModalDialog method at http://msdn.microsoft.com.
options
String that specifies the attributes for the dialog box. For more information, see Values for the Options Argument on page 168.
Values for the Options Argument Table 51 describes values you can use for the options argument of the ShowModalDialog method. You must use a semicolon to separate these values.
Values for the Options Argument of the ShowModalDialog Method Description Sets the height of the dialog box. You must use an integer or floating-point number followed by one of the following items: An absolute units designator. For example, cm, mm, in, pt, pc, or px. A relative units designator. For em or ex. The default value is em.
dialogHeight
For consistent results, specify the dialogHeight and dialogWidth in pixels. The minimum height is 100 pixels. dialogLeft dialogTop dialogWidth Sets the left position of the dialog box relative to the upper-left corner of the desktop. Sets the top position of the dialog box relative to the upper-left corner of the desktop. Sets the width of the dialog box.
168
Values for the Options Argument of the ShowModalDialog Method Description Sets centering for the dialog box. You can use one of the following values: yes no 1 0 on off
The default value is yes. dialogHide Specifies how to hide the dialog box if the user prints or uses print preview. This option is available only if the user opens the dialog box from a trusted application. You can use the same values that you use with the center option. The default value is no. edge Specifies the edge style of the dialog box. You can use one of the following values: sunken raised
The default value is raised. help Specifies how to display the dialog box with the context-sensitive Help icon. You can use the same values that you use with the center option. The default value is yes. Specifies if the dialog box dimensions are fixed. You can use the same values that you use with the center option. The default value is no. scroll Specifies if the dialog box displays scrollbars. You can use the same values that you use with the center option. The default value is yes.
resizable
16 9
Values for the Options Argument of the ShowModalDialog Method Description Specifies how the dialog box displays a status bar. You can use the same values that you use with the center option. The default value is one of the following: yes for an untrusted dialog box no for a trusted dialog box
unadorned
Specifies how the dialog box displays the border window chrome. This feature is available only if the user opens the dialog box from a trusted application. A trusted application is an application that includes a trust certificate. You can use the same values that you use with the center option. The default value is no.
Examples This example uses Browser Script to display a dialog box that includes a URL: function Applet_Load () { var sOptions="dialogHeight: 1000px;edge:sunken;resizable;yes"; theApplication().ShowModalDialog("http://www.yahoo.com", "", sOptions) }
Format theApplication().SWEAlert(message)
Usage Use the SWEAlert method instead of alert. Note the following: If you use the SWEAlert method, then Siebel CRM does not send the parent applet to the background. If you use alert, then Siebel CRM sends pop-up applets to the background. MVGs and pick applets are examples of pop-up applets. If a browser event sends a JavaScript alert, then Siebel CRM hides the pop-up applet.
170
Examples The following Browser Script example displays a status message: function BusComp_PreSetFieldValue (fieldName, value) { if (fieldName == "Account Status") { var cVolume = this.GetFieldValue("Current Volume"); if ((value == "Inactive") && (cVolume > 0)) { theApplication().SWEAlert("Unable to inactivate an account that has a current volume greater than 0"); return ("CancelOperation"); } else return ("ContinueOperation"); } else return ("ContinueOperation"); }
Format Application.Trace(message) Table 52 describes the arguments for the Trace method.
Table 52.
Arguments for the Trace Method Description String variable or literal that contains message text that Siebel CRM appends to the trace file.
Argument message
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
17 1
Examples The following example is for COM Data Server: Private Sub TraceOn_Click() Dim ErrCode As Integer SiebelApplication.TraceOn "c:\temp\trace.txt", "allocation", _ "all", ErrCode If (ErrCode = 0) Then SiebelApplication.TraceOn "c:\temp\trace.txt", "SQL", "",ErrCode If (ErrCode = 0) Then SiebelApplication.Trace "Start of Tracing!", ErrCode End Sub The following example is in Siebel VB: Sub Button2_Click TheApplication.TraceOn "C:\temp\trace.txt", "allocation", TheApplication.TraceOn "C:\temp\trace.txt", "sql", "" TheApplication.Trace "start of tracing!" End Sub Example Trace Output The following is example output of an Allocation trace section: 03/05/98,17:27:47,START,4.0.4 [1425_P3] ENU 03/05/98,17:27:47,ALLOC,1,BusObject,Account,Basic 03/05/98,17:27:48,ALLOC,2,BusComp,Account,Basic 03/05/98,17:27:48,RELEASE,1 03/05/98,17:27:48,RELEASE,2 The following is example output of an SQL trace section: 01/22/98,21:03:49,START,4.0.2 [1416] ENU 01/22/98,21:04:02,COMMENT,Start of Tracing! 01/22/98,21:04:10,SQLSTMT,1,SELECT,"SELECT T1.ROW_ID, T1.MODIFICATION_NUM, T1.CREATED_BY, T1.LAST_UPD_BY, T1.CREATED, T1.LAST_UPD, T1.CONFLICT_ID, T1.NAME, T1.DESC_TEXT, T1.PRIV_FLG, T1.QUERY_STRING FROM DEV32.S_APP_QUERY T1 WHERE (T1.CREATED_BY = :1 OR T1.PRIV_FLG = :2) AND ((T1.NAME LIKE :3 OR T1.NAME LIKE :4 OR T1.NAME LIKE :5 OR T1.NAME LIKE :6) AND UPPER(T1.NAME) = UPPER(:7)) ORDER BY "all"
172
T1.NAME, T1.DESC_TEXT" 01/22/98,21:04:10,SQLBIND,1,1,1-6NF 01/22/98,21:04:10,SQLBIND,1,2,N 01/22/98,21:04:10,SQLBIND,1,3,ac% 01/22/98,21:04:10,SQLBIND,1,4,Ac% 01/22/98,21:04:10,SQLBIND,1,5,aC% 01/22/98,21:04:10,SQLBIND,1,6,AC% 01/22/98,21:04:10,SQLBIND,1,7,Account Related Topics For more information, see the following topics: TraceOff Method for an Application on page 173 TraceOn Method for an Application on page 174
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples This following example in Siebel VB sets the value in the Sales Stage field to the first value in the drop-down list for the field. It uses tracing to track the result: Sub BusComp_NewRecord TheApplication.TraceOn "C:\lvpick.doc", "SQL", "" Dim oBC as BusComp set oBC = me.GetPickListBusComp("Sales Stage") With oBC .SetViewMode AllView .ActivateField "Sales Stage Order" .ClearToQuery .SetSortSpec "Sales Stage Order" .ExecuteQuery ForwardOnly if .FirstRecord then .Pick end if End With
17 3
Format Application.TraceOn(filename, type, selection) Table 53 describes the arguments for the TraceOn method.
Table 53.
Arguments for the TraceOn Method Description Output filename for trace messages. If you do not use this argument, then Siebel CRM logs tracing information to the Object Manager log file. For more information, see Filename Argument of the TraceOn Method on page 174. The type of tracing to start. You can use the following values: Allocation. Traces allocations and deallocations of Siebel objects. This feature is useful if you suspect a memory leak exists in your code. SQL. Traces SQL statements that the Siebel application creates.
Argument filename
type
selection
Identifies which Siebel objects Siebel CRM must trace for the Allocation trace type. This argument is "" if the trace type is SQL: Script. Traces Siebel VB and Siebel eScript objects. OLE. Traces allocations for data server or automation server programs. All. Traces all objects that Siebel CRM creates as a result of scripting. This value does not trace Siebel objects that are defined through Siebel Tools.
Filename Argument of the TraceOn Method You can use the following values for the filename argument: $p. Substitutes the process Id for the filename. $t. Substitutes the thread Id for the file name.
For example: TheApplication().TraceOn("C:\\temp\\trace_$p_$t.txt", "Allocation", "All"); This code causes Siebel CRM to log trace files to the trace_1496_1412.txt file in the C:\temp\trace directory.
174
To make sure the filename argument is unique, you must place a separator between the $p and $t values. For example, assume you do not use a separator and the following items are true: The process id for user A is 1 and the thread id is 12. The process id for user B is 11 and the thread id is 2.
In this situation, because the file name is trace_112.txt for user A and for user B, Siebel CRM logs trace information for each user to the same file. If you add a separator between the process id and the thread id, then the file names are unique and Siebel CRM logs trace information to a separate file for each user. For example: trace_1_12.txt trace_11_2.txt
Usage To turn off tracing, you must call the TraceOff method. If you attempt to call the TraceOn method with a different filename without first calling TraceOff, then Siebel CRM writes trace information to the new trace file name. The old file remains open and is locked. You can issue multiple TraceOn statements to the same trace file. NOTE: It is recommended that you do not use the Trace method or the TraceOn method in a production environment. For more information, see Trace Method for an Application on page 171.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is for COM Data Server: Private Sub TraceOn_Click() Dim ErrCode As Integer SiebelApplication.TraceOn "c:\temp\trace.txt", "allocation", "all", ErrCode If (ErrCode = 0) Then SiebelApplication.TraceOn "c:\temp\trace.txt", "SQL", "",ErrCode If (ErrCode = 0) Then SiebelApplication.Trace "Start of Tracing!", ErrCode End Sub The following example is in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) { TheApplication().TraceOn("C:\\temp\\trace.txt", "Allocation", "All"); TheApplication().TraceOn("C:\\temp\\trace.txt", "SQL", ""); TheApplication().Trace("start tracing!");
17 5
return (ContinueOperation); } The following example is in Siebel VB: Sub Button2_Click TheApplication.TraceOn "C:\temp\trace.txt", "allocation", "all" TheApplication.TraceOn "C:\temp\trace.txt", "sql", "" TheApplication.Trace "start of tracing!" End Sub For example trace output, see Example Trace Output on page 172. The following examples use Trace, Traceoff, and TraceOn methods to create a trace file with SQL statements issues by the scripting query. The following example is in Siebel eScript: function BusComp_NewRecord () { TheApplication().TraceOn("C:\\trace_output.txt", "SQL", ""); TheApplication().Trace("Start of tracing!"); var oBC = this.GetPickListBusComp("Sales Stage"); with (oBC) { SetViewMode(AllView); ClearToQuery(); SetSortSpec("Sales Stage Order(ASCENDING)"); ExecuteQuery(ForwardOnly); if (FirstRecord()) { Pick(); } } oBC = null; TheApplication().Trace("End of tracing!"); TheApplication().TraceOff(); } The following example is in Siebel VB: Sub BusComp_NewRecord TheApplication.TraceOn "C:\trace_output.txt", "SQL", "" TheApplication.Trace "Start of tracing!" Dim oBC as BusComp Set oBC = Me.GetPickListBusComp("Sales Stage") With oBC .SetViewMode AllView .ClearToQuery .SetSortSpec "Sales Stage Order(ASCENDING)" .ExecuteQuery ForwardOnly
176
If .FirstRecord Then .Pick End If End With Set oBC = Nothing TheApplication.Trace "End of tracing!" TheApplication.TraceOff End Sub Related Topics For more information, see the following topics: Trace Method for an Application on page 171 TraceOff Method for an Application on page 173
Application Events
This topic describes application events. It includes the following topics: Application_Close Event on page 177 Application_InvokeMethod Event on page 178 Application_Navigate Event on page 178 Application_PreInvokeMethod Event on page 179 Application_PreNavigate Event on page 180 Application_Start Event on page 181
You can use these events only on the Siebel Server, except for the following events which you can use on the Siebel Server or the browser: Application_InvokeMethod Event Application_PreInvokeMethod Event
Application_Close Event
You can call the Application_Close event before the Siebel application exits. This technique allows scripts to perform cleanup, such as closing a connection to a COM server. Note the following: If Windows notifies the Siebel application that it must close, then Siebel CRM calls this event. If the process is terminated directly, then Siebel CRM does not call this event. For example, a direct termination occurs if the user clicks the close (X) icon at the top right of a window.
17 7
Used With Server Script Siebel Business Processes call this event. For more information, see Siebel Business Process Framework: Workflow Guide.
Application_InvokeMethod Event
Siebel CRM calls the Application_InvokeMethod event after a specialized method is called. This method returns TRUE if the call succeeds or FALSE if the call does not succeed. For more information, see About Specialized and Custom Methods on page 101.
Browser Script Format Application_InvokeMethod(name, inputPropSet) The arguments you use with this format are the same as the arguments described in Table 25 on page 111. This method sends the values you enter in the inputPropSet argument to the InvokeMethod event.
Server Script Format Application_InvokeMethod(methodName) The arguments you use with this format are the same as the arguments described in Table 25 on page 111 except there is no inputPropSet argument.
Related Topics For more information, see the following topics: Customizing the Outcome of an Object Interface Event on page 57 Application_PreInvokeMethod Event on page 179
Application_Navigate Event
Siebel CRM calls the Application_Navigate event after the user navigates to a view. This event does not return any information.
178
Application_PreInvokeMethod Event
Siebel CRM calls the Application_PreInvokeMethod event before one of the following items calls a specialized method: A custom applet menu that you define The InvokeMethod method
This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57. For more information about this method, see About Specialized and Custom Methods on page 101 and Customizing the Outcome of an Object Interface Event on page 57.
Browser Script Format Application_PreInvokeMethod (methodName, inputPropSet) The arguments you use with this format are the same as the arguments described in Table 25 on page 111.
Server Script Format Application_PreInvokeMethod(methodName) The arguments you use with this format are the same as the arguments described in Table 25 on page 111, except there is no inputPropSet argument.
Usage If the method you instruct Siebel CRM to call is part of an If statement, then you must set the return value for the PreInvokeMethod before the End If statement. The following code is an example of this usage: If MethodName = "ResetQuery" then Application_PreInvokeMethod = CancelOperation End If Used With Browser Script, Server Script
17 9
Examples The following example is in Siebel VB: Function Application_PreInvokeMethod (MethodName _ As String) As Integer Dim i As Integer Dim iReturn As Integer iReturn = ContinueOperation Select Case MethodName Case "LaunchWord" i = Shell("C:\Program Files\Microsoft Office\Office\WINWORD.EXE",1) iReturn = CancelOperation Case "LaunchExcel" i = Shell("C:\Program Files\Microsoft Office\Office\EXCEL.EXE",1) iReturn = CancelOperation End Select Application_PreInvokeMethod = iReturn End Function The following is the equivalent example in Siebel eScript. Note that for this script to run, the entire Clib.system statement must reside on a single line in the editor: function Application_PreInvokeMethod (MethodName) var iReturn = ContinueOperation; switch (MethodName) { case "LaunchWord": Clib.system("C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE",1); iReturn = CancelOperation; break; case "LaunchExcel": Clib.system("C:\\Program Files\\Microsoft Office\\Office\\EXCEL.EXE",1); iReturn = CancelOperation; } return (iReturn); }
Application_PreNavigate Event
Siebel CRM calls the Application_PreNavigate event before it displays the view to which the user navigates. This event returns CancelOperation or ContinueOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
180
Format Application_PreNavigate(DestViewName, DestBusObjName) Table 54 describes the arguments for the Application_PreNavigate event.
Table 54.
Arguments for the Application_PreNavigate Event Description Name of the view to which the user navigates. Business object that the destination view references.
Examples In the following Siebel eScript example, the script Identifies the current business object and sets the current contact Id as a global variable. You can use this variable to keep context: function Application_PreNavigate (DestViewName, DestBusObjName) { try { var currentView = this.ActiveViewName(); var BO = this.ActiveBusObject(); if(BO.Name() == "Contact") { var BC = BO.GetBusComp("Contact"); var id = BC.GetFieldValue("Id"); TheApplication().SetSharedGlobal("ContactId", id); } } catch (e) { this.Trace("Exception caught: "+e.toString()); } return (ContinueOperation); }
Application_Start Event
Siebel CRM calls the Application_Start event when the Siebel client starts and again when it displays the client interface for the first time. This event does not return any information. CAUTION: Do not use the RaiseErrorText method in the Application_Start event. The RaiseErrorText method does not work in the Application_Start event, and can cause the Application Object Manager to abort.
18 1
Format Application_Start(commandline) Table 55 describes the arguments for the Application_Start event.
Table 55.
Arguments for the Application_Start Event Description Text of the command line that starts the Siebel application.
Argument commandline
Siebel Business Processes call this event. For more information, see Siebel Business Process Framework: Workflow Guide.
Examples This example Siebel VB code returns the first and last name of the user who logs in to the Siebel application: Sub Dim Dim Dim Dim Dim Application_Start(CommandLine As String) oEmpBusObj as BusObject oEmpBusComp as BusComp oEmpBusComp as BusComp sLoginName as String sUserName as String
sLoginName = TheApplication.LoginName Set oEmpBusObj = TheApplication.GetBusObject("Employee") Set oEmpBusComp = oEmpBusObj.GetBusComp("Employee") With oEmpBusComp .ActivateField "First Name" .ActivateField "Last Name" .ClearToQuery .SetSearchSpec "Login Name", sLoginName .ExecuteQuery If (.FirstRecord = 1) Then sUserName = .GetFieldValue("First Name") sUserName = sUserName + " " + .GetFieldValue("Last Name") End If End With Set oEmpBusComp = Nothing Set oEmpBusObj = Nothing End Sub
182
18 3
ParentBusComp Method for a Business Component on page 221 Pick Method for a Business Component on page 222 PreviousRecord Method for a Business Component on page 223 RefineQuery Method for a Business Component on page 224 Release Method for a Business Component on page 225 SetFieldValue Method for a Business Component on page 227 SetFormattedFieldValue Method for a Business Component on page 228 SetMultipleFieldValues Method for a Business Component on page 230 SetNamedSearch Method for a Business Component on page 232 SetSearchExpr Method for a Business Component on page 234 SetSearchSpec Method for a Business Component on page 235 SetSortSpec Method for a Business Component on page 241 SetUserProperty Method for a Business Component on page 243 SetViewMode Method for a Business Component on page 244 UndoRecord Method for a Business Component on page 248 WriteRecord Method for a Business Component on page 249
The oBusComp and BusComp variables that this topic describes refer to an instance of a business component.
Format for the ActivateField Method BusComp.ActivateField(FieldName) Table 56 describes the arguments for the ActivateField method.
Table 56.
Arguments for the ActivateField Method Description String variable or literal that contains the name of the field.
Argument FieldName
184
You must enclose the FieldName argument in double quotes. The value you enter for the FieldName argument must match exactly the field name that displays in Siebel Tools, including the same case. For example: ActivateField("ActivityCreatedByName")
Usage for the ActivateField Method By default, a field is inactive except in the following situations: The field is a system field, such as Id, Created, Created By, Updated, or Updated By. The Force Active property of the field is TRUE. NOTE: If you write an event handler on a business component, then you must use the ForceActive user property on the control to make sure the field is active. For more information, see Siebel Developers Reference. The Link Specification property of the field is TRUE. The field is included in an applet, and this applet references a business component that is active. For a field in a list applet, the Show In List list column property is TRUE. Siebel CRM calls the ActivateField method on the field, and then runs the ExecuteQuery method.
Note the following: If Siebel CRM activates a field after it queries a business component, then it must requery the business component before the user can access the value in that field. If Siebel CRM does not requery the business component, then it returns a value of 0. If Siebel CRM calls the ActivateField method after it calls the ExecuteQuery method, then the ActivateField method deletes the query context.
The ActivateField method causes Siebel CRM to include the field in the SQL statement that the ExecuteQuery method starts. If Siebel CRM activates a field, and then if a statement in the GetFieldValue method or the SetFieldValue method references the file before Siebel CRM performs a statement from the ExecuteQuery method, then the activation has no effect. Because Siebel CRM does not return the activated field through a query it contains an empty value.
Avoiding a Corrupted Database If Siebel CRM does not activate a field before it performs a WriteRecord command, then it writes data to the Siebel database, but a corruption problem might occur if a mobile user synchronizes. This situation applies only to mobile users.
18 5
Using this sequence makes sure Siebel CRM writes the field correctly to the transaction log. During synchronization, it saves any changes that the mobile user makes back to the Siebel database correctly.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB. For an equivalent Siebel eScript example, see ClearToQuery Method for a Business Component on page 190: Dim oEmpBusObj As BusObject Dim oEmpBusComp As BusComp Dim sLoginName As String Set oEmpBusObj = TheApplication.ActiveBusObject Set oEmpBusComp = oEmpBusObj.GetBusComp("Employee") oEmpBusComp.SetViewMode AllView oEmpBusComp.ClearToQuery oEmpBusComp.SetSearchSpec "Login Name", sLoginName oEmpBusComp.ExecuteQuery ForwardBackward Set oEmpBusComp = Nothing Set oEmpBusObj = Nothing
Format BusComp.ActivateMultipleFields(SiebelPropertySet) Table 57 describes the arguments for the ActivateMultipleFields method.
Table 57.
Arguments for the ActivateMultipleFields Method Description Property set that identifies a collection of properties. These properties identify the fields that Siebel CRM must activate.
Argument SiebelPropertySet
186
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is for Siebel Java Data Bean: import com.siebel.data.*; ... //Create Siebel Java Data Bean. //log in to Siebel Java Data Bean ... //Create Siebel Bus Object. //Get the Bus Object from SiebelDataBean ... //Create Siebel Bus Comp siebBusComp //Get the business component using SiebelBusObject SiebelPropertySet ps = new mdata_bean.NewPropertySet(); ps.setProperty("Account Products",""); ps.setProperty("Agreement Name",""); ps.setProperty("Project Name",""); ps.setProperty("Description",""); ps.setProperty("Name",""); siebBusComp.ActivateMultipleFields(ps); ... The following Siebel eScript example queries the Contact business component and returns the First Name and Last Name of the first contact that it finds: var ContactBO = TheApplication().GetBusObject("Contact"); var ContactBC = ContactBO.GetBusComp("Contact"); with (ContactBC) { SetViewMode(AllView); var fieldsPS = TheApplication().NewPropertySet(); var valuesPS = TheApplication().NewPropertySet(); fieldsPS. SetProperty("Last Name", ""); fieldsPS.SetProperty("First Name", ""); ActivateMultipleFields(fieldsPS); ClearToQuery(); ExecuteQuery(ForwardBackward); if (FirstRecord()) { GetMultipleFieldValues(fieldsPS, valuesPS); var slName = valuesPS.GetProperty("Last Name"); var sfName = valuesPS.GetProperty("First Name"); } } Related Topics For more information, see the following topics:
18 7
SetMultipleFieldValues Method for a Business Component on page 230 GetMultipleFieldValues Method for a Business Component on page 207
Format BusComp.Associate(whereIndicator) Table 58 describes the arguments for the Associate method.
Table 58.
Arguments for the Associate Method Description You must use one of the following predefined constants: NewBefore NewAfter
Argument whereIndicator
For more information, see Use Constants to Standardize Code on page 66.
Usage To set field values on a child record that is associated with a parent record, use the context of the multi-value group business component.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following VB example updates the Opportunity Assignment Type field. The parent business component can be any business component that includes the Sales Rep multi-value group: Dim oParentBC as BusComp Dim oMvgBC as BusComp Dim oAssocBC as BusComp Set oParentBC = me.BusComp Set oMvgBC = OpBC.GetMVGBusComp("Sales Rep") Set oAssocBC = oMvgBC.GetAssocBusComp With oAssocBC .SetSearchSpec "Id", newPosId .ExecuteQuery
188
.Associate NewAfter End With oMvgBC.SetFieldValue "Opportunity Assignment Type", "NewType" oMvgBC.WriteRecord Set oAssocBC = Nothing Set oMvgBC = Nothing Set oParentBC = Nothing The following Siebel eScript example finds a contact when the Last Name is Abanilla, and then adds a new organization named CKS Software to the Organization multi-value group: var ok = 0; var ContactBO= TheApplication().GetBusObject("Contact"); var ContactBC = ContactBO.GetBusComp("Contact"); with (ContactBC) { ClearToQuery(); SetViewMode(AllView); // Searches by Last Name SetSearchSpec ("Last Name", "Abanilla"); ExecuteQuery(ForwardOnly); if (FirstRecord()) { // Instantiates Organization MVG var oMvgBC = GetMVGBusComp("Organization"); var oAssocBC = oMvgBC.GetAssocBusComp(); oAssocBC.ClearToQuery(); oAssocBC.SetSearchSpec("Name", "CKS Software"); oAssocBC.ExecuteQuery (); // Checks if the Organization was found if (oAssocBC.FirstRecord()) { // Organization was found try { oAssocBC.Associate(NewAfter); ok = 1; } catch (e) { ok = 0; TheApplication().RaiseErrorText("Error Associating new Organization"); } } // if oAssocBC.FirstRecord } // if FirstRecord oAssocBC = null; oMvgBC = null;
18 9
} // With ContactBC ContactBC = null; ContactBO = null; Related Topics For more information, see the following topics: NewRecord Method for a Business Component on page 218 FirstSelected Method for a Business Component on page 200 GetMVGBusComp Method for a Business Component on page 209
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For an example, see SetViewMode Method for a Business Component on page 244.
Usage You must use the ActivateField method to activate a field before you can use the ClearToQuery method. For more information, see ActivateField Method for a Business Component on page 184.
190
Search and sort specifications sent to a business component are cumulative. The business component retains and logically performs an AND operation for the queries that accumulate since the last time Siebel CRM performed the ClearToQuery method. This situation is true except if there is a new search specification on a field, and if that field already included a search specification. In this situation, the new search specification replaces the old search specification.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel eScript. var oEmpBusObj = TheApplication().ActiveBusObject(); var oEmpBusComp = oEmpBusObj ().GetBusComp("Employee"); var sLoginName; oEmpBusComp.ClearToQuery(); oEmpBusComp.SetSearchSpec("Login Name", sLoginName); oEmpBusComp.ExecuteQuery(ForwardBackward); oEmpBusComp = null; oEmpBusObj = null; For more examples, see the following: For Siebel VB examples, see the following topics:
Applet_PreInvokeMethod Event on page 113 ActivateField Method for a Business Component on page 184 ExecuteQuery Method for a Business Component on page 194.
For another Siebel eScript example, see GotoView Method for an Application on page 143.
19 1
Examples The following example is in Siebel eScript: function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Call_eScript") { var bo = TheApplication().GetBusObject("Opportunity"); var bc = bo.GetBusComp("Opportunity"); with (bc) { ClearToQuery(); SetSearchSpec ("Name", "A*"); ExecuteQuery(ForwardBackward); var count = CountRecords(); } // other code.. bc = null; bo = null; return (CancelOperation); } return (ContinueOperation); }
Usage You must use the ActivateField method to activate a field before you perform a query for a business component. For more information, see ActivateField Method for a Business Component on page 184. After you deactivate a field, you must query the business component again or the Siebel application fails.
192
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is for the Component Object Model (COM): Dim oBO As BusObject Dim OBC As BusComp Dim errCode Set oBO = SiebelApplication.GetBusObject("Account", errCode) Set oBC = oBO.GetBusComp("Account", errCode) oBC.ActivateField "Name", errCode oBC.ActivateField "Location", errCode oBC.ClearToQuery errCode oBC.ExecuteQuery ForwardOnly, errCode ' Manipulate the data oBC.DeactivateFields errCode Set oBC = Nothing Set oBO = Nothing The following example is in Siebel eScript: var oBC; var oBO; oBO = TheApplication().GetBusObject("Account"); oBC = oBO.GetBusComp("Account"); oBC.ActivateField("Name"); oBC.ActivateField("Location"); oBC.ClearToQuery(); oBC.ExecuteQuery(ForwardOnly); // Manipulate the data oBC.DeactivateFields(); oBC = null; oBO = null; The following example is in Siebel VB: Dim oBO As BusObject Dim oBC As BusComp Set oBO = TheApplication.GetBusObject("Account") Set oBC = oBO.GetBusComp("Account") oBC.ActivateField "Name" oBC.ActivateField "Location" oBC.ClearToQuery oBC.ExecuteQuery ForwardOnly ' Manipulate the data
19 3
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples This Siebel VB example deletes accounts with a status of Inactive: Sub DeleteInactiveAccounts() Dim objBO as BusObject Dim objBC as BusComp Set objBO = TheApplication.GetBusObject("Account") Set objBC = objBO.GetBusComp("Account") With objBC .ClearToQuery .SetSearchSpec "Status", "Inactive" .ExecuteQuery ForwardBackward Do While .FirstRecord .DeleteRecord Loop End With Set objBC = Nothing Set objBO = Nothing End Sub NOTE: Siebel CRM moves the cursor to the next record after it runs the DeleteRecord method. Do not use the NextRecord method after you use the DeleteRecord method in a loop because this configuration causes Siebel CRM to skip deleting the last record in the loop. If you use the DeleteRecord method on the last record, then the cursor points to nothing.
194
Format BusComp.ExecuteQuery ([cursorMode]) Table 59 describes the arguments for the ExecuteQuery method.
Table 59.
Arguments for the ExecuteQuery Method Description An integer. You must use one of the following constants: ForwardBackward. Siebel CRM processes records from first to last or from last to first. If you do not provide a value for the cursorMode argument, then Siebel CRM uses ForwardBackward. ForwardOnly. Siebel CRM processes records only from the first record to the last record. Siebel CRM does return to a prior record.
Argument cursorMode
For more information, see Use Constants to Standardize Code on page 66.
Usage To achieve maximum performance, use ForwardOnly. If you use ForwardOnly, make sure that your Siebel application code does not use PreviousRecord or FirstRecord to navigate backward without a requery. Do not use ForwardOnly with a UI business component unless the Siebel application code performs a requery with the cursorMode argument set to ForwardBackward. A UI business component is a type of business component that Siebel CRM is actively using in the Siebel client. You can write a script that creates a UI business component that does not reference the data the user manipulates. Because a user might scroll up and down a record set, you must use ForwardBackward.
You Must Activate Fields Before You Can Query Them Before you can query a business component, you must use the ActivateField method to activate all fields that are involved in the query. If you write an event handler on a business component, then you must use the ForceActive user property on the control to make sure the field is activate.
Reducing a Large Query Set If you use ForwardBackward, and if the query matches over 10,000 records, then the object manager returns an error message that is similar to the following: There were more rows than could be returned. Refine your query to bring back fewer rows. To reduce the number of queries, you can use a parent-child relationship between business components that the business object establishes. For example, the Opportunity business object establishes a parent-child relationship between the Opportunity business component and the Contact business component. If you instruct Siebel CRM to query the Opportunity business component, then it can read values from the corresponding records in the Contact business component without performing another query. You must instruct Siebel CRM to query the parent business component first, and then to query the child business component. If you query the child business component first, then Siebel CRM returns no records.
19 5
How Siebel CRM Handles Duplicate Records with the ExecuteQuery Method A faulty join configuration or duplicate data in joined tables might cause a business component to return duplicate records. If Siebel CRM detects duplicate records when it executes the ExecuteQuery method, then it does the following work depending on the value of the cursorMode argument: ForwardBackward. It automatically filters duplicate records to make sure each record is unique. ForwardOnly. It does not filter records. It returns all records that match the criteria, including duplicate records. If you update all records that Siebel CRM returns, then it displays an error that is similar to the following: The selected record has been modified by another user since it was retrieved. Please continue. This error can occur if the code attempts to update the duplicate of a record that it already updated.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples This Siebel VB example sets up and runs a query that locates the primary on the account team. Only the primary can change the primary address. (general) (declarations) Option Explicit Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Dim i As Integer Dim iFoundP As Integer ' 1 = found (TRUE), 0 = not found (FALSE) Dim oMVGBC as BusComp iFoundP = FALSE Select Case FieldName Case "SSA Primary Field" Set oMVGBC = me.ParentBusComp.GetMVGBusComp("Sales Rep") With oMVGBC ' this is the position BC .ActivateField "Active Login Name" .ActivateField "SSA Primary Field" .ClearToQuery .ExecuteQuery ForwardBackward i = .FirstRecord Do While i <> 0 If .GetFieldValue("SSA Primary Field") = "Y" Then iFoundP = TRUE 'mark that found a primary If .GetFieldValue("Active Login Name") <> TheApplication.LoginName Then TheApplication.RaiseErrorText"You cannot change the Primary address because you are not the Primary on the Account Team") End If
196
Exit Do Loop If iFoundP = FALSE Then .FirstRecord TheApplication.RaiseErrorText("No Primary Found - Contact an Administrator") End If End With End Select Set oMVGBC = Nothing BusComp_PreSetFieldValue = ContinueOperation End Function For other examples, see the following topics: Applet_PreInvokeMethod Event on page 113 GotoView Method for an Application on page 143 ClearToQuery Method for a Business Component on page 190:
Related Topics For more information, see the following topics: ActivateField Method for a Business Component on page 184 ClearToQuery Method for a Business Component on page 190 SetSearchSpec Method for a Business Component on page 235
19 7
Table 60 describes the ignoreMaxCursorSize argument for the ExecuteQuery2 method. For the cursorMode argument, see Table 59 on page 195.
Table 60.
Arguments for the ExecuteQuery2 Method Description You can use one of the following values: TRUE. Returns every record from a business component. This value might result in lower performance. FALSE. Returns the number of records according to the value in the MaxCursorSize argument. You can define the MaxCursorSize argument in the Siebel application configuration (CFG) file.
Argument ignoreMaxCursorSize
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
NOTE: If you issue a query on a business component, then Siebel CRM creates SQL for any child business component that is active. Calling the FirstRecord method starts the BusComp_ChangeRecord event and causes Siebel CRM to run the same SQL for the child business component again. For more information, see NextRecord Method for a Business Component on page 220.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
198
Examples To determine if an account displayed in a child applet includes a service request, the following examples use the FirstRecord method. The outcome of this query can determine if Siebel CRM must run other code for this account record. In this example, the Account List Applet is a child applet in the Contact Detail - Accounts View. The following example is in Siebel eScript: function BusComp_PreInvokeMethod (MethodName) { // 'CheckSR' method called from a custom button on 'Account List Applet - child' applet. if (MethodName == "CheckSR") { var oBO = TheApplication().ActiveBusObject(); var oBC = oBO.GetBusComp("Service Request"); var strAccntId = this.GetFieldValue("Id"); with (oBC) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Account Id", strAccntId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { // more code placed here } else { TheApplication().RaiseErrorText("No Service Requests Associated To This Account.") } } return (CancelOperation); } return (ContinueOperation); } The following example is in Siebel VB: Function BusComp_PreInvokeMethod (MethodName As String) As Integer Dim iRtn As Integer iRtn = ContinueOperation ''CheckSR' method called from a custom button On 'Account List Applet - child' Applet. If MethodName = "CheckSR" Then
19 9
Dim oBO As BusObject Dim oBC As BusComp Dim strAccntId As String Set oBO = TheApplication.ActiveBusObject Set oBC = oBO.GetBusComp("Service Request") strAccntId = me.GetFieldValue("Id") With oBC .SetViewMode AllView .ClearToQuery .SetSearchSpec "Account Id", strAccntId .ExecuteQuery ForwardOnly If .FirstRecord Then '[more code placed here] Else TheApplication.RaiseErrorText("No Service Requests Associated To This Account.") End If End With Set oBC = Nothing Set oBO = Nothing iRtn = CancelOperation End If BusComp_PreInvokeMethod = iRtn End Function
Examples The following examples use the FirstSelected method and the NextSelected method to allow you to customize multirecord deletion. If the user clicks a custom button in an applet, then Siebel CRM can call this code and it can call the Delete Selected custom method. The following example is in Siebel eScript:
200
function BusComp_PreInvokeMethod (MethodName) { if (MethodName == "Delete Selected") { with (this) { var iRecord = FirstSelected(); while (iRecord) { DeleteRecord(); iRecord = NextSelected(); } } return (CancelOperation); } return (ContinueOperation); } The following example is in Siebel VB: Function BusComp_PreInvokeMethod (MethodName As String) As Integer Dim iRtn As Integer iRtn = ContinueOperation If MethodName = "Delete Selected" Then With me Dim iRecord As Integer iRecord = .FirstSelected While iRecord .DeleteRecord iRecord = .NextSelected Wend End With iRtn = CancelOperation End If BusComp_PreInvokeMethod = iRtn End Function
20 1
Usage for the GetAssocBusComp Method It is appropriate to use the GetAssocBusComp method and the Associate method only with a manyto-many relationship that uses an intersection table. For example, account and industry. In the context of a many-to-many relationship, you can use Siebel VB to do the following: To associate a new record, add it to the child business component. To add a record, you use the GetAssocBusComp method and the Associate method. You set the GetAssocBusComp method to Nothing in Siebel VB or null in Siebel eScript. To insert a record, create a new record in the child business component. To insert a record, you use the GetMVGBusComp method and the NewRecord method.
If a many-to-many link exists, and if an association applet is defined for the child applet, then you can use the GetAssocBusComp method with the child business component of a parent-child view. You can use this technique instead of modifying the multi-value group business component.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB. It uses the GetAssocBusComp method to add a new industry to an account: Dim oAssocBC As BusComp Set oAssocBC = oMainBc.GetMVGBusComp("Industry").GetAssocBusComp With oAssocBC .ClearToQuery .SetSearchExpr "[SIC Code] = ""5734""" .ExecuteQuery ForwardOnly If .FirstRecord Then .Associate NewBefore End With Set oAssocBC = Nothing The following is the same example in Siebel eScript: //get the business Object and the business component var oAssocBC = oMainBc.GetMVGBusComp("Industry").GetAssocBusComp(); with (oAssocBC) { ClearToQuery; SetSearchExpr("[SIC Code] = '5734'"); ExecuteQuery(ForwardOnly) if (FirstRecord())
202
Associate(NewBefore); } oAssocBC = null; Related Topics For more information, see the following topics: GetMVGBusComp Method for a Business Component on page 209 GetPicklistBusComp Method for a Business Component on page 211
The GetFieldValue method uses the MM/DD/YYYY format when it returns a date field regardless of what format the local date uses. To return the date in the same format that the local date uses, you can use the GetFormattedFieldValue method. For more information, see GetFormattedFieldValue Method for a Business Component on page 204. NOTE: In Browser Script, you can use the GetFieldValue method only if the field is available in the applet and for system fields.
Format BusComp.GetFieldValue(FieldName) The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184.
Usage for the GetFieldValue Method If you require a value from a business component that is a parent of the current business component, then you must make sure the Link Specification property for that field is set to TRUE in Siebel Tools. If it is not, then the child business component cannot access the value in the parent business component. For more information, see Siebel Object Types Reference.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
20 3
Examples The following example is in Siebel VB: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Dim bcOppty As BusComp Dim boBusObj As BusObject Dim srowid As String srowid = GetFieldValue("Id") Set boBusObj = TheApplication.GetBusObject("Opportunity") Set bcOppty = boBusObj.GetBusComp("Opportunity") With bcOppty .SetViewMode SalesRepView .ActivateField "Sales Stage" .SetSearchSpec "Id", srowid .ExecuteQuery ForwardOnly End With Set bcOppty = Nothing Set boBusObj = Nothing End Function The following example is in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) var boBusObj = TheApplication().GetBusObject("Opportunity"); var bcOppty = boBusObj.GetBusComp("Opportunity"); var srowid = GetFieldValue("Id"); with (bcOppty) { SetViewMode(SalesRepView); ActivateField("Sales Stage"); SetSearchSpec("Id", srowid); ExecuteQuery(ForwardOnly); } bcOppty = null; boBusObj = null; }
204
Format BusComp.GetFormattedFieldValue(FieldName) The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184.
Usage You can use the GetFormattedFieldValue method with code that your implementation uses in multiple countries that use different formats for currency, date, or numbers.
Usage with Phone Data and Date Data The following behavior exists for phone data and date data: DTYPE_PHONE. If you use the GetFormattedFieldValue method with a field whose Type property is DTYPE_PHONE, then this method returns a formatted phone number. Example 1: phone = bc.GetFieldValue("Main Phone Number") TheApplication.Trace "The number is " & phone Result: The number is 8869629123 Example 2: phone = bc.GetFormattedFieldValue("Main Phone Number") TheApplication.Trace "The number is " & phone Result: The number is (886) 962-9123 DTYPE_DATE. If you use the GetFormattedFieldValue method with a field whose Type property is DTYPE_DATE, then the result is the same as the GetFieldValue method or the SetFieldValue method except that the GetFormattedFieldValue method returns the value in the same format as the Regional Setting.
Table 61 describes the formats that the GetFieldValue method and the SetFieldValue method use.
Table 61.
Date and Time Formats That the GetFieldValue Method and SetFieldValue Method Use Format mm/dd/yyyy hh:nn:ss mm/dd/yyyy hh:nn:ss
20 5
If you attempt to use the SetFieldValue method, and if the Regional Setting format is different, the Siebel CRM displays an error that is similar to the following: Error: The value '31-Dec-99' can not be converted to a date time value. To avoid this error, use the GetFormattedFieldValue format or the SetFormattedFieldValue method.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB example uses the GetFormattedFieldValue method and calculates the number of days between two dates: Sub Button_Click Dim DateDiff as Integer Dim oBC as BusComp Set oBC= me.BusComp x = oBC.GetFormattedFieldValue("Start Date") y = oBC.GetFormattedFieldValue("Done") dx = DateValue(x) dy = DateValue(y) DateDiff = dy - dx End Sub Related Topics For more information, see the following topics: ActivateField Method for a Business Component on page 184 GetFieldValue Method for a Business Component on page 203 SetFieldValue Method for a Business Component on page 227 SetFormattedFieldValue Method for a Business Component on page 228
Usage For more information, see Usage for the GetLastErrCode Method on page 137.
206
Used With COM Data Control, Mobile Web Client Automation Server
Usage For more information, see Usage for the GetLastErrText Method on page 137.
Used With COM Data Control, Mobile Web Client Automation Server
For more information, see SetMultipleFieldValues Method for a Business Component on page 230.
Format BusComp.GetMultipleFieldValues(fieldNamesPropSet, fieldValuesPropSet) Table 62 describes the arguments for the GetMultipleFieldValues method.
Table 62.
Arguments for the GetMultipleFieldValues Method Description A property set that identifies a collection of fields. A property set that provides values for the fields specified in the fieldNamesPropSet argument.
Usage You cannot use the same instance of a property set for the fieldNamesPropSet argument and for the fieldValuesPropSet argument.
20 7
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel eScript: try { var oPsDR_Header:PropertySet = TheApplication().NewPropertySet(); // Cannot use the same property set in GetMultipleFieldValues, must use a different // one for the values. The process will not error, but the values will not be placed // in the property set. var lPS_values:PropertySet = TheApplication().NewPropertySet(); oPsDR_Header.SetProperty("Last Name",""); oPsDR_Header.SetProperty("First Name",""); oPsDR_Header.SetProperty("Middle Name",""); var boContact = TheApplication().GetBusObject("Contact"); var bcContact = boContact.GetBusComp("Contact"); with (bcContact) { ClearToQuery(); SetViewMode(AllView); ActivateMultipleFields(oPsDR_Header); SetSearchSpec("Last Name", "Mead*"); ExecuteQuery(ForwardOnly); var isParent = FirstRecord(); do { // Use a different property set for the values. If you use the same one // for arguments you get no values back. GetMultipleFieldValues(oPsDR_Header, lPS_values); // Get the value from the output property set. TheApplication().Trace("Last Name = " + lPS_values.GetProperty("Last Name")); } while (NextRecord()); } //end with
208
Format BusComp.GetMVGBusComp(FieldName) The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184 except the GetMVGBusComp method uses the FieldName argument to identify the multi-value group business component.
Usage A multi-value group is a set of detail records attached to the current record in a business component that holds the corresponding multi-value field. After you run the GetMVGBusComp method, it is recommended that you set the multi-value group business component to one of the following: Nothing in Siebel VB Null in Siebel eScript
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example Siebel VB code uses the GetMVGBusComp method to add a new address to the Hong Kong Flower Shop account: Dim Dim Dim Set Set AccntBO as BusObject AccntBC as BusComp AddrBC as BusComp AccntBO = TheApplication.GetBusObject "Account" AccntBC = AccntBO.GetBusComp "Account"
With AccntBC .SetViewMode SalesRepView .ClearToQuery .SetSearchSpec "Name", "Hong Kong Flower Shop" .ExecuteQuery If (.FirstRecord) Then Set AddrBC = .GetMVGBusComp ("Street Address")
20 9
With AddrBC .NewRecord NewAfter .SetFieldValue "City", "Denver" .SetFieldValue "Street Address", "123 Main Street" .WriteRecord End With End If End With Set AddrBC = Nothing Set AccntBC = Nothing Set AccntBO = Nothing For more examples, see the following topics: ExecuteQuery Method for a Business Component on page 194 FirstSelected Method for a Business Component on page 200.
For more information about inserting records, see Usage for the GetAssocBusComp Method on page 202:
Format BusComp.GetNamedSearch(searchName) Table 63 describes the arguments for the GetNamedSearch method.
Table 63.
Arguments for the GetNamedSearch Method Description Name of the search specification that references the search string.
Argument searchName
Usage The search specification uses the same format that a predefined query uses.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Related Topics For more information, see the following topics: GetSearchSpec Method for a Business Component on page 213
210
Format BusComp.GetPicklistBusComp(FieldName) The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184, except the GetPicklistBusComp method uses the FieldName argument to identify the pick business component.
Usage To manipulate a picklist, you can use the name of the pick business component that the GetPicklistBusComp method returns. After you run the GetPickListBusComp method, it is recommended that you set the pick business component to one of the following: Nothing in Siebel VB Null in Siebel eScript
Picking a Record on a Constrained Picklist If Siebel CRM uses the GetPickListBusComp method or the Pick method to pick a record on a constrained picklist, then the constraint is active. The pick business component that these methods return contains only those records that fulfill the constraint.
To Pick a Value From a Picklist in Siebel VB You can pick a value from a picklist in Siebel VB.
21 1
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel eScript: if (this.GetFieldValue("City") == "San Mateo") { var oBCPick = this.GetPicklistBusComp("State"); with (oBCPick) { ClearToQuery(); SetSearchSpec("Value", "CA"); ExecuteQuery(ForwardOnly); if (FirstRecord()) Pick(); } oBCPick = null; } The following example is for Siebel Java Data Bean. It chooses a product from a picklist: Sieb_busObject = Sieb_dataBean.getBusObject("Service Request"); Sieb_busComp = Sieb_busObject.getBusComp("Service Request"); Sieb_busComp.newRecord(false); . . .
SiebelBusComp productBusComp = Sieb_busComp.getPicklistBusComp("Product"); productBusComp.clearToQuery(); productBusComp.setSearchSpec("Name", "ATM Card"); productBusComp.executeQuery(false); isRecord =productBusComp.firstRecord(); try { if (isRecord) productBusComp.pick(); Sieb_busComp.writeRecord(); } catch (SiebelException e) { System.out.println("Error in Pick " + e.getErrorMessage()); } The following example is in Siebel VB: If Me.GetFieldValue("City") = "San Mateo" Then Set oBCPick = Me.GetPicklistBusComp("State") With oBCPick .ClearToQuery .SetSearchSpec "Value", "CA" .ExecuteQuery ForwardOnly
212
If .FirstRecord Then .Pick End With Set oBCPick = Nothing End If Related Topics For more information, see the following topics: FirstSelected Method for a Business Component on page 200 GetMVGBusComp Method for a Business Component on page 209
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Related Topics For more information, see the following topics: GetNamedSearch Method for a Business Component on page 210 GetSearchSpec Method for a Business Component on page 213 SetSearchExpr Method for a Business Component on page 234
Format BusComp.GetSearchSpec(FieldName)
21 3
The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184, except the GetSearchSpec method uses the FieldName argument to identify the search specification.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Related Topics For more information, see the following topics: GetNamedSearch Method for a Business Component on page 210 GetSearchExpr Method for a Business Component on page 213 GetSortSpec Method for a Business Component on page 214 SetSearchSpec Method for a Business Component on page 235
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Related Topics For more information, see the following topics: GetSearchSpec Method for a Business Component on page 213 SetSortSpec Method for a Business Component on page 241
Format BusComp.GetUserProperty(propertyName)
214
Table 64.
Arguments for the GetUserProperty Method Description The name of the user property.
Argument propertyName
Usage for the GetUserProperty Method A user property is similar to an instance variable of a business component. You can use the GetUserProperty method to access a user property from anywhere in the code, even from another application through COM. An instance variable is a type of variable that is defined at the top level of the business component in the general declarations section. You can access an instance variable only in Siebel VB, and in the same object on which you declare the instance variable. For more information, see SetUserProperty Method for a Business Component on page 243. Siebel CRM resets the value of a user property every time you create a business component instance. NOTE: The GetUserProperty method does not interact directly with user properties that you define in Siebel Tools.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Usage The GetViewMode method returns NoneSetView mode until one of the following situations is true: Siebel CRM queries a business component. The SetViewMode method sets the view mode for the business component.
21 5
The NoneSetViewMode value indicates that no visibility rules are applied to the business component. If Siebel CRM creates a business component through a call to the GetBusComp method, then the value for that business component is NoneSetViewMode. If you require a specific view mode, then you must use the SetViewMode method to set this view mode. If you do not use the SetViewMode method, then Siebel CRM sets the view mode according to the most restrictive visibility mode that is defined for that business component. It does this the first time that it creates a business component instance.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Siebel VB Format BusComp.InvokeMethod methodName, methArg1, methArg2, methArgN Table 65 describes the arguments for the Siebel VB format of the InvokeMethod method.
Table 65.
Arguments for the Siebel VB Format of the InvokeMethod Method Description The name of the method. For information about the values you can enter for this argument, see Business Component Invoke Methods on page 250. A single string that contains arguments for the methodName argument. You can also pass this string in an array that contains the method parameters.
Argument methodName You can use the following arguments: methArg1 methArg2 methArgN
Siebel eScript Format BusComp.InvokeMethod(methodName, methArg1, methArg2, , methArgn); The arguments you can use in this format are the same as the arguments that are described in Table 23 on page 105.
216
Usage You can use the InvokeMethod method to call a method on a business component object that is not available directly through the object interface. For more information, see Caution About Using the InvokeMethod Method on page 106.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For examples of using the InvokeMethod method, see the following topics: ClearLOVCache Method for a Business Component on page 251 CreateFile Method for a Business Component on page 252 GetFile Method for a Business Component on page 255 PutFile Method for a Business Component on page 257
For more information, see FirstRecord Method for a Business Component on page 198 and NextRecord Method for a Business Component on page 220.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is for the Mobile Web Client Automation Server: Private Sub LastRecord_Click() Dim errCode As Integer Dim oBusComp as SiebelBusComp FieldValue.Text = ""
21 7
oBusComp.ClearToQuery oBusComp.ExecuteQuery ForwardBackward oBusComp.LastRecord errCode If errCode = 0 Then FieldValue.Text = oBusComp.GetFieldValue(FieldName.Text, _ errCode) End If Status.Text = SiebelApplication.GetLastErrText End Sub
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Browser Script: function BusComp_PreSetFieldValue (fieldName, value) { theApplication().SWEAlert(this.Name()); }
Format BusComp.NewRecord(whereIndicator)
218
Table 66.
Arguments for the NewRecord Method Description Predefined constant that instructs where Siebel CRM must add the new record. You can use one of the following values: NewBefore NewAfter NewBeforeCopy NewAfterCopy
Argument whereIndicator
For more information, see Use Constants to Standardize Code on page 66. If you use Siebel Java Data Bean, then you can use one of the following values: FALSE. This value is equivalent to the NewBefore constant. TRUE. This value is equivalent to the NewAfter constant.
Usage If you use the NewRecord method to add a new record, then Siebel CRM does the following:
1 2
Places the new record before or after the current record, depending on the value you enter for the WhereIndicator argument. Sets this new record as the current record.
You can use the NewRecord method to copy a record. To place the copy before the original record, you use the following command:
Object.NewRecord NewBeforeCopy
To place the copy after the original record, you use the following command:
Object.NewRecord NewAfterCopy
Performance with the NewRecord Method In some situations, using the NewRecord method in a Server Script can result in this method performing slowly. In this situation, Siebel CRM does not display an error message. It creates the record but the reply time is not optimal. This situation is due to the expected behavior of the Siebel application when it creates a new record. To position the new record in the record set, Siebel CRM obtains the cursor for the record set. This record set must include data before Siebel CRM creates the new record. In the context of a script, Siebel CRM must run a query on the business component before it calls the NewRecord method. If the script does not explicitly run the query, then Siebel CRM runs a full table query, which results in suboptimal performance. For more information, see Doc ID 477556.1 on My Oracle Support.
21 9
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB: Dim oBusObj as BusObject Dim oBC as BusComp Set oBusObj = TheApplication.ActiveBusObject Set oBC = oBusObj.GetBusComp("Action") oBC.NewRecord NewAfter oBC.SetFieldValue "Type", "To Do" oBC.SetFieldValue "Description", "Find Decision Makers" oBC.WriteRecord set oBC = Nothing set oBusObj = Nothing
1. Indicates the method successfully moved the record pointer to the next record. 0 (zero). Indicates the method did not move the record pointer because it points to the last record.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Browser Script
Examples The following example is in Siebel eScript: var isRecord; with (this) {
220
ClearToQuery(); SetSearchSpec("Name", "A*"); ExecuteQuery(ForwardBackward); isRecord = FirstRecord(); while (isRecord) { // do some record manipulation isRecord = NextRecord(); } } For a similar Siebel VB example, see FirstRecord Method for a Business Component on page 198.
Examples For examples, see FirstSelected Method for a Business Component on page 200.
Usage The ParentBusComp method allows you to write code in the child business component that can access a field value or perform actions in the parent business component. To use this method, it might be necessary to set the Link Specification property. For more information, see Usage for the GetFieldValue Method on page 203.
22 1
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB. For another example, see ExecuteQuery Method for a Business Component on page 194: Dim strParentName as String ... strParentName = Me.ParentBusComp.GetFieldValue("Name")
Usage For more information, see Picking a Record on a Constrained Picklist on page 211.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB example sorts the values in the Sales Stage field: Sub BusComp_NewRecord Dim oBC as BusComp set oBC = me.GetPickListBusComp("Sales Stage") With oBC .ClearToQuery .SetSearchSpec "Sales Stage", "2 - Qualified" .ExecuteQuery ForwardOnly if .FirstRecord then .Pick End With set oBC = Nothing End Sub
222
The following is the equivalent example in Siebel eScript: function BusComp_NewRecord () { var oBC = this.GetPickListBusComp("Sales Stage"); with (oBC) { ClearToQuery(); SetSearchSpec("Sales Stage", "2 - Qualified"); ExecuteQuery(ForwardOnly); if (FirstRecord()) Pick(); } oBC = null; }
1. Indicates the method successfully moved the record pointer to the next record. 0 (zero). Indicates the method did not move the record pointer because it points to the last record.
Usage You can use the PreviousRecord method only on a business component that Siebel CRM has queried with the CursorMode mode argument set to ForwardBackward. For more information, see ExecuteQuery Method for a Business Component on page 194.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel eScript example locates the next-to-last record in a query and then manipulates it: with (this)
22 3
{ ActivateField("Name") ClearToQuery(); SetSearchSpec("Name", "A*"); ExecuteQuery(ForwardBackward); isRecord = FirstRecord(); while (isRecord) { // do some record manipulation isRecord = NextRecord(); } // end while loop nextToLastRecord = PreviousRecord(); if (nextToLastRecord) { // do some more record manipulation that applies only to next-to-last record } // end if } // end with For more information, see ExecuteQuery Method for a Business Component on page 194. // verify that there is a penultimate record
Usage Unlike the ClearToQuery method, the RefineQuery method retains the existing query specification and allows you to add search conditions that include those fields that Siebel CRM has not set through a previous search expression. The RefineQuery method is most useful if you use it with the GetNamedSearch method. For more information, see ClearToQuery Method for a Business Component on page 190 and GetNamedSearch Method for a Business Component on page 210.
224
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB code uses RefineQuery: me.SetSearchSpec "Status", "Open" me.ClearToQuery me.ExecuteQuery me.RefineQuery me.SetSearchSpec "Substatus", "Assigned" me.ExecuteQuery
Examples The following example is for Siebel Java Data Bean: import com.siebel.data.*; { // create Siebel Java Data Bean // log in to Siebel Java Data Bean // Create Siebel Bus Object. // get the Bus Object from SiebelDataBean // Create Siebel Bus Comp siebBusComp // Get the business component using SiebelBusObject // Use the bus. Component // make sure to release the business component and its resources on the Siebel Server siebBusComp.release(); // release the resources occupied by Siebel Bus Object and Siebel Java Data Bean after their use. }
22 5
The following example logs in to a Siebel Server. It then creates an instance for each of the following items: Business object Business component Business service
It then releases each of these items in reverse order: import com.siebel.data.*; import com.siebel.data.SiebelException; public class JDBReleaseDemo { private SiebelDataBean m_dataBean = null; private SiebelBusObject m_busObject = null; private SiebelBusComp m_busComp = null; private SiebelService m_busServ = null; public static void main(String[] args) { JDBReleaseDemo demo = new JDBReleaseDemo(); } public JDBReleaseDemo() { try { // instantiate the Siebel Java Data Bean m_dataBean = new SiebelDataBean(); // login to the Siebel Servers m_dataBean.login("siebel.tcpip.none.none://gateway:port/enterprise/ object manager","userid","password"); System.out.println("Logged in to the Siebel Server "); // get the business object m_busObject = m_dataBean.getBusObject("Account"); // get the business component m_busComp = m_busObject.getBusComp("Account"); // get the business service m_busServ = m_dataBean.getService("Workflow Process Manager"); //release the business service m_busServ.release(); System.out.println("BS released "); //release the business component m_busComp.release(); System.out.println("BC released ");
226
//release the business object m_busObject.release(); System.out.println("BO released "); // logoff m_dataBean.logoff(); System.out.println("Logged off the Siebel Server "); } catch (SiebelException e) { System.out.println(e.getErrorMessage()); } } } For more information, see Logoff Method for an Application on page 154.
Format BusComp.SetFieldValue FieldName, FieldValue Table 67 describes the arguments for the SetFieldValue method.
Table 67.
Arguments for the SetFieldValue Method Description String that contains the name of the field. String that contains the value to set.
The format for the FieldName argument uses the same format that is described in Format for the ActivateField Method on page 184. The length of the FieldValue argument must not exceed the length of the field. For example, if you pass a 20 character string to a field that is defined as 16 characters in length, then Siebel CRM creates a run-time error that is similar to the following: Value too long for field 'xxxxx' (maximum size nnn). You must make sure the length of the string you pass is no longer than the length of the destination field.
22 7
Usage You can use the SetFieldValue method only on a field that is active. For more information, see ActivateField Method for a Business Component on page 184. If the Siebel application runs in standard interactivity mode, then call the WriteRecord method and write the record immediately after you use the SetFieldValue method. NOTE: You cannot use the SetFieldValue method with a calculated field. You cannot use the SetFieldValue method recursively.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB: If Val(Me.GetFieldValue("Rep %")) < 75 Then Me.SetFieldValue "Rep %", "75" Me.WriteRecord End If The following is the equivalent example in Siebel eScript: if (ToInteger(this.GetFieldValue("Rep %")) < 75) { this.SetFieldValue("Rep %", "75"); this.WriteRecord(); } The following Siebel VB example sets a field to null: oBC.SetFieldValue "FieldName", ""
Format BusComp.SetFormattedFieldValue FieldName, FieldValue The arguments you can use this format are the same as the arguments described in Table 67 on page 227.
228
Usage The SetFormattedFieldValue method is useful if you write code for a Siebel application that you deploy in multiple countries that use different currency, date, and number formats. You can use the SetFormattedFieldValue method only on a field that is active. For more information, see ActivateField Method for a Business Component on page 184.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB example is a fragment from a program that tracks the progress of an opportunity through sales stages: Function BusComp_PreWriteRecord As Integer Dim Dim Dim Dim Dim Dim OpportunityBO as BusObject, StageBC as BusComp OppStageId as String, SalesRep as String, Stage as String StagePrev As String, StageDate as String, StageDatePrev as String Dx as Double, Dy as Double, Diff as Double, DiffStr as String OppID As String, OppStageId as String, StageID As String SalesStageBO as BusObject, SalesStageBC as BusComp
Set OpportunityBO = TheApplication.GetBusObject ("Opportunity") Set SalesStageBO = TheApplication.GetBusObject ("Sales Cycle Def") Set SalesStageBC = SalesStageBO.GetBusComp("Sales Cycle Def") With SalesStageBC .SetViewMode AllView .ClearToQuery .SetSearchSpec "Sales Cycle Stage", StagePrev .ExecuteQuery ForwardOnly If (.FirstRecord) Then StageId = .GetFieldValue("Id") End With 'Instantiate stage BC Set StageBC = OpportunityBO.GetBusComp("Opportunity Stage") 'Check that we do not already have a record for the stage With StageBC .SetViewMode AllView .ClearToQuery .SetSearchSpec "Sales Stage Id", StageId .ExecuteQuery ForwardOnly 'Proceed further only if we do not already have record 'opportunity sales stage
22 9
If (.FirstRecord = 0) Then 'Create a new stage record and write it out .NewRecord NewAfter 'Record Id for future use OppStageId = .GetFieldValue("Id") .SetFieldValue "Opportunity Id", OppId .SetFieldValue "Sales Stage Id", StageId .SetFieldValue "Sales Rep", SalesRep .SetFormattedFieldValue "Entered Date", StageDatePrev .SetFormattedFieldValue "Left Date", StageDate Dx = DateValue (StageDatePrev) Dy = DateValue (StageDate) Diff = Dy - Dx DiffStr = Str(Diff) .SetFieldValue "Days In Stage", DiffStr .WriteRecord End If End With Set Set Set Set SalesStageBC = Nothing SalesStageBO = Nothing StageBC = Nothing OpportunityBO = Nothing
End Function
Format BusComp.SetMultipleFieldValues oPropertySet Table 68 describes the arguments for the SetMultipleFieldValues method.
Table 68.
Arguments for the SetMultipleFieldValues Method Description Property set that identifies a collection of properties. This argument identifies the fields to set and the value to set for each field.
Argument oPropertySet
The FieldName argument in the property set must match exactly the field name in Siebel Tools, including the correct case. In the following example, the FieldName is Name and the FieldValue is Acme:
oPropertySet.SetProperty "Name","Acme"
230
Usage You can use the SetMultipleFieldValues method only on a field that is active. NOTE: Do not use the SetMultipleFieldValues method on a field that uses a picklist.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel eScript: var bo = TheApplication().GetBusObject("Opportunity"); var bc = bo.GetBusComp("Opportunity"); var ps = TheApplication().NewPropertySet(); with (ps) { SetProperty ("Name", "Call Center Opportunity"); SetProperty ("Account", "Marriott International"); SetProperty ("Sales Stage", "2-Qualified"); } bc.ActivateMultipleFields(ps); bc.NewRecord(NewBefore); bc.SetMultipleFieldValues(ps); bc.WriteRecord; ps = null; bc = null; bo = null; The following Siebel Java Data Bean example sets multiple fields: SiebelDataBean SiebelBusObject SiebelBusComp SiebelPropertySet try { Sieb_dataBean = new SiebelDataBean(); ... Sieb_busObject = Sieb_dataBean.getBusObject("Account"); Sieb_busComp = Sieb_busObject.getBusComp("Account"); ps = Sieb_dataBean.newPropertySet(); with(ps) { setProperty("Name", "Frank Williams Inc"); setProperty("Location", "10 Main St"); setProperty("Account Status", "Active"); setProperty("Type", "Customer"); Sieb_dataBean Sieb_busObject Sieb_busComp ps = null; = null; = null; = null;
23 1
Sieb_busComp.newRecord(true); Sieb_busComp.setMultipleFieldValues(ps); Sieb_busComp.writeRecord(); } catch (SiebelException e) { system.out.println("Error : " + e.getErrorMessage()); } ps.release(); Sieb_busComp.release(); Sieb_busObject.release(); Sieb_dataBean.release(); Related Topics For more information, see the following topics: ActivateMultipleFields Method for a Business Component on page 186 GetMultipleFieldValues Method for a Business Component on page 207
Format BusComp.SetNamedSearch searchName, searchSpec Table 69 describes the arguments for the SetNamedSearch method.
Table 69.
Arguments for the SetNamedSearch Method Description String that identifies the name of the search specification. String that contains the search specification.
232
The searchSpec argument works in the same way as the argument you use after the equal sign in a predefined query. For more information, see SetSearchExpr Method for a Business Component on page 234 and SetSearchSpec Method for a Business Component on page 235.
Usage A named search specification is a type of search specification that Siebel CRM applies in conjunction with the existing search specification. It applies the named search specification every time it calls the ExecuteQuery method. For example, with a predefined query or with the search specification on a business component. You can only modify a named search specification programmatically. You cannot use the administrative interface to modify a named search specification. The ClearToQuery method does not clear the named search specification. To clear it, you must explicitly set the searchSpec argument to "". If Siebel CRM creates a new instance of a business component, then it clears the named search specification. Using the SetNamedSearch method to define a search does not create a predefined query. You specify this search only in script. To return this search specification, you can use the GetNamedSearch method. To return the values of an attribute in a user profile, Personalization uses the GetProfileAttr method.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The examples in this topic set a named search specification for a business component depending on the position of the current user. The following example is in Siebel eScript: function BusComp_PreQuery () { if (TheApplication().GetProfileAttr("Position") == "Siebel Administrator"); { this.SetNamedSearch ("Candidates", "[Status] LIKE 'Candidate'") } return (ContinueOperation); } The following example is in Siebel VB: Function BusComp_PreQuery () As Integer If TheApplication.GetProfileAttr("Position") = "Siebel Administrator" Then Me.SetNamedSearch "Candidates", "[Status] LIKE 'Candidate'" End If BusComp_PreQuery = ContinueOperation End Function
23 3
Format BusComp.SetSearchExpr searchSpec Table 70 describes the arguments for the SetSearchExpr method.
Table 70.
Arguments for the SetSearchExpr Method Description String that identifies the search specification.
Argument searchSpec
Usage You can call the SetSearchExpr method after you call the ClearToQuery method and before you call the ExecuteQuery method. It is not necessary to use the ActivateField method on a field that you specify in the SetSearchExpr method. The maximum length of a predefined query is 2000 characters. The searchSpec argument works in the same way as the argument you use after the equal sign in a predefined query. For example, consider the following predefined query: 'Account'.Search = "[Name] ~ LIKE ""A. C. Parker"" " You can use the following equivalent search specification in various interface methods: BC.SetSearchExpr "[Name] ~ LIKE ""A. C. Parker"" " In this example, Name is a field in a business component. You must enclose it in square brackets, [ ]. To create a query that includes a sort specification, use the SetSortSpec method. You cannot use the SetSearchExpr method to set a sort specification. Do not use the SetSearchExpr method and the SetSearchSpec method together. These methods are mutually exclusive. Any date you use with the SetSearchExpr method must use the MM/DD/YYYY format, regardless of the Regional control panel settings on the Siebel Server or the Siebel client.
Using the SetSearchExpr Method with a Keyword If a field value contains a search keyword, then you must use two pairs of double quotes around the field value. Example keywords include NOT, AND, or OR. For example, if the Sub-Status field includes the string Not an Issue as a field value, then you must use the following Siebel VB format to avoid an SQL error: substatus = GetFieldValue("Sub-Status") searchst = "[Value] = """ & substatus & """"" BC.SetSearchExpr searchst
234
The following Siebel VB format creates an SQL error: substatus = GetFieldValue("Sub-Status") searchst = "[Value] = " & substatus BC.SetSearchExpr searchst
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example in Siebel eScript demonstrates how to log the current search specification to a file: var var var var var Ob = TheApplication().ActiveBusObject(); BC = Ob.GetBusComp("Opportunity"); Account = "Turston Steel"; Oppty = "CAD/CAM implementation"; searchst = "[Name] = '" + Oppty + "' AND [Account] = '" + Account + "'";
TheApplication().TraceOn("c:\\temp\\trace.txt", "Allocation", "All"); TheApplication().Trace("the search expression is: " + searchst); BC.ClearToQuery(); BC.SetSearchExpr(searchst); BC.ExecuteQuery(ForwardBackward); Related Topics For more information, see the following topics: ClearToQuery Method for a Business Component on page 190 ExecuteQuery Method for a Business Component on page 194 SetSearchSpec Method for a Business Component on page 235 SetSortSpec Method for a Business Component on page 241
23 5
Table 71.
Arguments for the SetSearchSpec Method Description String that identifies the name of the field on which to set the search specification. String that contains the search specification.
Usage You must call the SetSearchSpec method before you call the ExecuteQuery method. To avoid an unexpected compound search specification on a business component, it is recommended that you call the ClearToQuery method before you call the SetSearchSpec method. It is not necessary to use the ActivateField method on a field that you reference in the SetSearchSpec method.
Making Multiple Calls to the SetSearchSpec Method If you instruct Siebel CRM to make multiple calls to the SetSearchSpec method for a business component, then it handles the multiple search specifications in the following ways: If the existing search specification is on the same field as the new search specification, then Siebel CRM replaces the existing search specification with the new search specification. For example, consider the following code: myBusComp.SetSearchSpec("Status", "<> 'Renewal'"); myBusComp.SetSearchSpec("Status", "<> 'Dropped'"); This code results in the following WHERE clause: WHERE Status <> 'Dropped' If the existing search specification is not on the same field as the new search specification, then Siebel CRM creates a search specification that is a logical AND of the existing and the new search specifications. For example: myBusComp.SetSearchSpec("Type", "<> 'Renewal'"); myBusComp.SetSearchSpec("Status", "<> 'Sold' AND [Status] <> 'Cancelled' AND [Status] <> 'Renewed'"); This code results in the following WHERE clause: WHERE Type <> 'Renewal' AND (Status<> 'Sold' AND Status <> 'Cancelled' AND Status <> 'Renewed') If the existing search specification includes one or more of the same fields as the new search specification, then Siebel CRM replaces only that part of the existing search specification that includes fields that the new search specification also includes. For example: myBusComp.SetSearchSpec("Status", "<> 'In Progress'") This code results in the following WHERE clause:
236
WHERE Type <> 'Renewal' AND Status <> 'In Progress' Siebel CRM replaces the search specification only on the Status field.
Combining Declarative and Scripted Search Specifications If you define a search specification declaratively in Siebel Tools, and if you use the SetSearchSpec method to define another search specification in script, then Siebel CRM creates a search specification that is a logical AND of the declarative search specification and the scripted search specification. For example, consider the following scripted search specification: myBusComp.SetSearchSpec("Status", "<> 'Cancelled'")
Consider the following declarative search specification: [Type] <> 'Renewal' AND [Status] <> 'Sold' When Siebel CRM creates a logical AND between these search specifications, the following WHERE clause results: WHERE Type <> 'Renewal' AND (Status <> 'Sold' AND Status <> 'Cancelled') Using Logical and Comparison Operators in a Search Specification You can use logical operators and comparison operators. Consider the following example, in Siebel VB: BC.SetSearchSpec "Status", "<> 'Closed' AND ([Owner] = LoginName () OR [Refer To] = LoginName ()) OR ([Owner] IS NULL AND [Support Group] = 'TS-AE')" Using Special Characters in a Search Specification The search specification can contain any of the following special characters: " (double quote) ' (single quote) = (equal sign) > (greater than symbol) < (less than symbol) ( (opening parenthesis) ) (closing parenthesis) [ (opening square bracket) [ (closing square bracket) , (comma) ~ (tilde)
You must enclose each of these special characters in quotes. This rule applies to operators that are part of the search expression and to the search text.
23 7
Using Quotes and Other Characters in a Search Specification If the search expression contains quotes or another special character, then you must enclose the entire search specification in double quotes. An apostrophe is an example of a special character. If the search object includes a special character, then you must double that character. For example, assume your specification must search for text that contains a single double quote: "We must In this situation, you must do the following work:
Use two double quotes before the word We: ""We must
2 3
Enclose the string you created in Step 1 with single quotes: '""We must' Enclose the entire expression in double quotes: "'""We must'"
Add the expression to the search specification: SetSearchSpec "Comments", "'""We must'"
In another example, assume your search specification must search for the following text in the Name field: Phillies Cheese Steaks In this situation, you must use the following search specification: SetSearchSpec "Name", "'Phillie''s Cheese Steaks'" Using Quotes and Other Characters in a Search Specification in Siebel eScript or Browser Script To mark a special character in Siebel eScript or Browser Script, you must use a backslash instead of a double quote. For example: To include double quotes before the word We, you must use the following format: SetSearchSpec("Comments", "\'\"We must\'") To include the string Phillies Cheese Steaks, you must use the following format: SetSearchSpec("Name", "\'Phillie\'\'s Cheese Steaks\'") For more information, see Using Quotes and Other Characters in a Search Specification on page 238.
Using a Search Specification to Search Text in a Nontext Field If any of the following situations are true, then you must use double quotes to enclose the text you use in a search specification: The search expression queries a field of any type other than a text field.
238
The search expression includes any character that is not included in the following list:
underscore (_) question mark (?) back slash (\) double quote (") single quote (') opening bracket ([) closing bracket (])
Using a Search Specification to Return All Records To return all records, use the ClearToQuery method and then the ExecuteQuery method. Do not use the SetSearchSpec method. For more information, see ClearToQuery Method for a Business Component on page 190 and ExecuteQuery Method for a Business Component on page 194.
Using a Search Specification to Search for a Null Field To search for a null field, use the following form: SetSearchSpec "Account", "is NULL" If your search specification requests an empty string, then the search returns every record. For example: SetSearchSpec "Account", "" Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following Siebel VB code searches for a contact by name, and then navigates to a view that displays this record: (general) (declarations) Option Explicit
23 9
Sub Dim Dim Dim Dim Dim Dim Dim Dim Dim
Button1_Click theCurrComp As BusComp TargetView As String TargetBusObj As String TargetBusComp As String NewBusObj As BusObject NewComp As BusComp RecId1 As String RecId2 As String RecId3 As String
TargetView = "Visible Contact List View" TargetBusObj = "Contact" TargetBusComp = "Contact" Set theCurrComp = Me.BusComp RecId1 = theCurrComp.GetFieldValue("Last Name") RecId2 = theCurrComp.GetFieldValue("First Name") RecId3 = theCurrComp.GetFieldValue("Account Id") Set NewBusObj = TheApplication.GetBusObject(TargetBusObj) Set NewComp = NewBusObj.GetBusComp(TargetBusComp) NewComp.ClearToQuery NewComp.SetSearchSpec "Last Name", RecId1 NewComp.SetSearchSpec "First Name", RecId2 NewComp.SetSearchSpec "Account Id", RecId3 NewComp.ExecuteQuery ForwardBackward TheApplication.GotoView TargetView , NewBusObj Set NewComp = Nothing Set NewBusObj = Nothing Set theCurrComp = Nothing End Sub For other Siebel VB examples, see FirstRecord Method for a Business Component on page 198, SetFormattedFieldValue Method for a Business Component on page 228, and BusComp_PreQuery Event on page 269. The following example is in Siebel eScript: var oAccntBO = TheApplication().GetBusObject("Account"); var oAccntBC = oAccntBO.GetBusComp("Account"); var oAddrBC; with (oAccntBC) { SetViewMode(SalesRepView); ClearToQuery(); SetSearchSpec("Name", "Hong Kong Flower Shop"); ExecuteQuery(ForwardBackward); if (FirstRecord())
240
oAddrBC = GetMVGBusComp("Street Address"); with (oAddrBC) { NewRecord(NewAfter); SetFieldValue("City", "Denver"); SetFieldValue("Street Address", "123 Main Street"); WriteRecord(); } } oAddrBC = null; oAccntBC = null; oAccntBO = null; For another Siebel eScript example, see ClearToQuery Method for a Business Component on page 190.
Format BusComp.SetSortSpec sortSpec Table 72 describes the arguments for the SetSortSpec method.
Table 72.
Arguments for the SetSortSpec Method Description String that contains the sort specification.
Argument sortSpec
The sortSpec argument uses the following format: "fieldName1,fieldName2,...(ASCENDING)" or "fieldName1,fieldName2,...(DESCENDING)" You must enclose the entire string in double quotes. To sort on various fields in different orders, you can use a comma to separate field names and order specifications.
Usage If you use the SetSortSpec method, then you must call it after you call the ClearToQuery method and before you call the ExecuteQuery method.
24 1
The SortSpec argument works in the same way as the equal sign in a predefined query. For example, consider the following predefined query: 'Account'.Sort = "Name(ASCENDING)" You can use the following equivalent search specification in various interface methods: BC.SetSortSpec "Name(ASCENDING)" Note that Name is the value in the Name property of the business component field. This example queries the Name field. Any date you use with the SetSortSpec method must use the MM/DD/YYYY format, regardless of the Regional control panel settings of the Siebel Server or Siebel client.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The Siebel VB example in this topic sorts the Opportunity list first by Account in reverse order, and then in alphabetical order by Site. Note that the column names in the Opportunity list applet are not the same as the names in the underlying business component. NOTE: For demonstration purposes, this example sorts in ascending and descending order. In actual practice, do not sort in two directions in a single sort specification because this type of sorting can significantly degrade performance. Function BusComp_PreQuery As Integer With Me .ActivateField("Account") .ActivateField("Account Location") .ClearToQuery .SetSortSpec "Account(DESCENDING), Account Location(ASCENDING)" .ExecuteQuery ForwardBackward End With End Function The following is the equivalent example in Siebel eScript: function BusComp_PreQuery { with (this) { ActivateField("Account"); ActivateField("Account Location"); ClearToQuery(); SetSortSpec("Account(DESCENDING), Account Location(ASCENDING)"); ExecuteQuery(ForwardBackward); } }
242
Related Topics For more information, see the following topics: GetSortSpec Method for a Business Component on page 214 SetSearchExpr Method for a Business Component on page 234 SetSearchSpec Method for a Business Component on page 235
Format BusComp.SetUserProperty propertyName, newValue Table 73 describes the arguments for the SetUserProperty method.
Table 73.
Arguments for the SetUserProperty Method Description String that identifies the name of the user property. String that contains the new value.
Usage Usage for the SetUserProperty method is similar to the usage for the GetUserProperty method. For more information, see Usage for the GetUserProperty Method on page 215.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB: Sub BusComp_SetFieldValue (FieldName As String) Select Case FieldName Case "Committed" me.SetUserProperty "Flagged", "Y" End Select End Sub The following is the equivalent example in Siebel eScript:
24 3
Format BusComp.SetViewMode mode Table 74 describes the arguments for the SetViewMode method.
Table 74.
Arguments for the SetViewMode Method Description A Siebel ViewMode constant or the corresponding integer value for the constant. For more information, see Constants You Can Use with the SetViewMode Method on page 245.
Argument mode
Siebel ViewMode constants correspond to applet visibility types. For more information about applet visibility types, see Siebel Security Guide.
244
Constants You Can Use with the SetViewMode Method Table 75 describes the constants you can use with the SetViewMode method. The Owner Type column indicates the value that must be set in the Owner Type property of the BusComp view mode object of the business component. For more information, see Use Constants to Standardize Code on page 66.
Table 75.
Constants for the SetViewMode Method Integer Value 0 Owner Type Position Description This constant does the following: Applies access control according to a single position or a sales team. Displays records according to one of the following items:
The user position. The sales team that includes the user position. The Visibility field or Visibility MVField of the business component determines the visibility.
ManagerView
Position
Displays records that the user and the users who report to the user can access. For example, the records that Siebel CRM displays in the My Teams Accounts visibility filter. If the business component that the view references uses single position access control, then this constant displays records that are associated directly with the active position of the user and with subordinate positions. If the business component that the view references uses sales team access control, then this constant displays records according to one of the following positions: The primary position for the user on a team. A subordinate position that is the primary member on a team.
If the user position does not include a subordinate position, then Siebel CRM does not display any records.
24 5
Table 75.
Constants for the SetViewMode Method Integer Value 2 Owner Type Position Description Displays records that the user can access, as determined by the Visibility Field property of the BusComp view mode object. For example, the records that Siebel CRM displays in the My Accounts visibility filter. Displays all records for which a valid owner exists. For example, the records that Siebel CRM displays in the All Accounts Across Organizations visibility filter. Displays records where a valid owner is associated with the record and the user position is associated with the organization. For example, the records that Siebel CRM displays in the All Accounts List View visibility filter. Applies access control for a single organization or for multiple organizations, as determined by the Visibility field or Visibility MVField of the BusComp view mode object of the business component.
AllView
Not applicable
OrganizationView
Position
GroupView
Not applicable
This constant does one of the following: Displays a list of the subcategories that the user can access. Displays records in the current category, depending on the current applet. If the user is at the catalog level, then Siebel CRM displays the first level categories.
246
Table 75.
Constants for the SetViewMode Method Integer Value 8 Owner Type Catalog Category Description Displays a list of records in categories across every catalog that the user can access. Siebel CRM typically uses this visibility in a product picklist and other list of products, such as a recommended product list. If the business component that the view references uses single organization access control, then this constant displays records that are associated directly with one of the following organizations: The organization that is currently active for the user. A descendent organization. This descendent organization is part of the organization hierarchy.
SubOrganizationVi ew
Organization
For example, the records that Siebel CRM displays in the All Opportunities Across My Organization visibility filter. If the business component that the view references uses multiple organization access control, then this constant displays records for the primary active organization or for the primary descendent organization.
Used With COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example is in Siebel VB. For another example, see BusComp_PreDeleteRecord Event on page 266: (general) (declarations) Option Explicit Dim oBO as BusObject Dim oBC as BusComp Set oBO = TheApplication.GetBusObject(Me.BusObject.Name) Set oBC = oBO.GetBusComp(Me.Name) With oBC .SetViewMode SalesRepView
24 7
.ClearToQuery .SetSearchSpec "Name", Me.GetFieldValue("Name") .SetSearchSpec "Id", "<> " & Me.GetFieldValue("Id") .ExecuteQuery ForwardOnly If .FirstRecord Then TheApplication.Trace"Entry for name " & Me.GetFieldValue("Name") & " exists." End If End With Set oBC = Nothing Set oBO = Nothing The following is the equivalent example in Siebel eScript: var oBO = TheApplication().GetBusObject(this.BusObject().Name()); var oBC = oBO.GetBusComp(this.Name); TheApplication().TraceOn("c:\\trace.txt","Allocation","All"); with (oBC) { SetViewMode(SalesRepView); ClearToQuery(); SetSearchSpec("Name", this.GetFieldValue("Name")); SetSearchSpec("Id", "<> " + this.GetFieldValue("Id"); ExecuteQuery(ForwardOnly); if (FirstRecord()) TheApplication().Trace("Entry for name " + this.GetFieldValue("Name") + " exists."); } TheApplication().TraceOff(); oBC = null; oBO = null;
Usage You can use the UndoRecord method in the following ways: To delete a new record. Use it after Siebel CRM calls the NewRecord method and before it saves the new record to the Siebel database.
248
To reverse changes made to field values. Use it before Siebel CRM uses the WriteRecord method to save these changes, or before the user steps off the record.
UndoRecord reverses unsaved changes to a record. If you require a fine degree of control over the changes that Siebel CRM reverses, then do the following:
For more information, see Caution About Using the Cancel Operation Event Handler on page 57 and NewRecord Method for a Business Component on page 218.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Usage After creating new records and setting values for fields, you can call the WriteRecord method to save the new record to the Siebel database.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The Siebel VB example in this topic implements the following logic: if the user sets the Sales Stage field to 02, then insert an activity: (general) (declarations) Option Explicit
24 9
Sub BusComp_SetFieldValue (FieldName As String) ' Run this code from the Opportunities Activities view. ' Opportunity is presumed to be the parent business component. Select Case FieldName Case "Sales Stage" if Me.GetFieldValue(FieldName) LIKE "02*" Then ' reference the Action business component Dim oBCact as BusComp Set oBCact = me.BusObject.GetBusComp("Action") With oBCact .NewRecord NewAfter .SetFieldValue "Type", "Event" .SetFieldValue "Description", "THRU SVB, Stage _ changed to 02" .SetFieldValue "Done", Format(Now(), _ "mm/dd/yyyy hh:mm:ss") .SetFieldValue "Status", "Done" .WriteRecord End With set oBCact = Nothing end if End Select End Sub For more examples, see GetMVGBusComp Method for a Business Component on page 209 and NewRecord Method for a Business Component on page 218
250
You can store a file in the local file system on the Siebel Server on which you run the script. You can also return this file. You can use a UNC (Universal Naming Convention) format. For example, \\server\dir\file.txt. You can use a DOS directory. For example, c:\dir\file.txt. The Siebel Server must be able to access the UNC path or mounted file system. If you use a Java client to run the Siebel Java Data Bean, then the Siebel Server must be able to access all files. You can use these methods with business components that use the CSSBCFile class. These methods do not serialize the files from the client of a third-party application or place files from the client of a third-party application in the Siebel file system.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: Browser Script COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following Siebel eScript example is for Server Script: function WebApplet_PreInvokeMethod (MethodName) {
25 1
if (MethodName == "TestMethod") { var lov_bo = TheApplication().GetBusObject("List Of Values"); var lov_bc = lov_bo.GetBusComp("List Of Values"); lov_bc.NewRecord(NewAfter); lov_bc.SetFieldValue("Type", "ACCOUNT_STATUS"); lov_bc.SetFieldValue("Name", "Hello"); lov_bc.SetFieldValue("Value", "Hello"); lov_bc.SetFieldValue("Order By", "12"); lov_bc.SetFieldValue("Translate", "Y"); lov_bc.WriteRecord(); lov_bc.InvokeMethod("ClearLOVCache"); lov_bc = null; lov_bo = null; return (CancelOperation); } return(ContinueOperation); }
252
Table 76.
Arguments for the CreateFile Method Description The fully qualified path to the source file on the Siebel Server or the Siebel client. The name of the field in the business component that contains the File Name. For example, AccntFileName in the Account Attachment business component. Applies to URLs. You can use one of the following values: Y. Use this value if the link to the file is stored as an attachment. N. Use this value if you reference the actual file.
The actual file is compressed in a Siebel proprietary format. Siebel CRM uploads and stores it in that format on the Siebel File System.
Usage Before you call the CreateFile method, call the NewRecord method to make sure Siebel CRM creates a new business component record.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following example is in Siebel VB: Dim RetValue as String Dim fileBC as BusComp 'Instantiate fileBC as the appropriate attachment business component fileBC.NewRecord NewAfter RetValue = fileBC.InvokeMethod ("CreateFile", "c:\Demo\Image.bmp", "AccntFileName", "Y") fileBC.WriteRecord The following example is in Siebel eScript: var fileBC;
25 3
// Instantiate fileBC as the appropriate attachment business component fileBC.NewRecord(NewAfter); RetValue = fileBC.InvokeMethod ("CreateFile", "C:\\Demo\\Image.bmp", "AccntFileName", "Y"); fileBC.WriteRecord(); The following example is in COM Data Control: Dim Dim Dim Dim errCode as Integer Args(2) as String RetValue as String fileBC as BusComp
'Instantiate fileBC as the appropriate attachment business component Args(0) = "C:\Demo\Image.bmp" Args(1) = "AccntFileName" Args(2) = "Y" fileBC.NewRecord NewAfter, errCode RetValue = fileBC.InvokeMethod ("CreateFile", Args, errCode) fileBC.WriteRecord
Format To specify a custom template, use the following format: BusComp.InvokeMethod("GenerateProposal", RecordExists, Replace, TemplateFile) To use the default proposal template, use the following format: BusComp.InvokeMethod("GenerateProposal", RecordExists, Replace)
254
Table 77.
Arguments for the GenerateProposal Method Description You can use one of the following values: TRUE. Siebel CRM uses the proposal that is currently chosen. FALSE. Siebel CRM creates a new record.
Argument RecordExists
Replace
You can use one of the following values: TRUE. Siebel CRM copies the template file from the template to the proposal as a draft file. FALSE. You typically set the Replace argument to FALSE.
TemplateFile
Optional. You can use one of the following values: A string that specifies the name of the template to use. If this argument receives a string, then the proposal searches for the first template record whose name contains the string passed. NULL. Uses the default template. This is default value.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: Browser Script COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
25 5
Format BusComp.InvokeMethod("GetFile", KeyFieldName) Table 78 describes the arguments for the GetFile method.
Table 78.
Arguments for the GetFile Method Description The name of the business component field that contains the file name. For example, AccntFileName in the Account Attachment business component.
Argument KeyFieldName
Usage for the GetFile Method The record pointer must point to the record you seek. If necessary, you must query for the record ID, using the NextRecord method to advance through the returned set of records until the record pointer points to the record you seek.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following example uses Siebel VB: Dim RetValue as String Dim fileBC as BusComp 'Instantiate fileBC as the appropriate attachment business component 'Query for the required attachment record RetValue = fileBC.InvokeMethod ("GetFile", "AccntFileName") The following example uses Siebel eScript: var RetValue; var fileBC; // Instantiate fileBC as the appropriate attachment business component // Query for the required attachment record var RetValue = fileBC.InvokeMethod("GetFile", "AccntFileName");
256
The following example uses COM Data Control: Dim Dim Dim Dim errCode as Integer Args as String RetValue as String fileBC as BusComp
'Instantiate fileBC as the appropriate attachment business component 'Query for the required attachment record Args = "AccntFileName" RetValue = fileBC.InvokeMethod ("GetFile", Args, errCode)
Format BusComp.InvokeMethod("PutFile", SrcFilePath, KeyFieldName) Table 79 describes the arguments for the PutFile method.
Table 79.
Arguments for the PutFile Method Description The fully qualified path to the file on the Siebel Server or the Siebel client. The name of the field in the business component that identifies the file name. For example, AccntFileName in the Account Attachment business component.
Usage Usage for the PutFile method is similar to usage for the GetFile method. For more information, see Usage for the GetFile Method on page 256. After Siebel CRM uses the PutFile method to save a file attachment, you must make sure it calls the WriteRecord method so that the updated attachment is visible in the Siebel client. For more information, see WriteRecord Method for a Business Component on page 249.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: COM Data Control COM Data Server
25 7
Siebel Java Data Bean Mobile Web Client Automation Server Server Script
Examples The following example uses Siebel VB: Dim RetValue as String Dim fileBC as BusComp 'Instantiate fileBC to the appropriate attachment business component 'Query for the attachment record to be updated RetValue = fileBC.InvokeMethod ("PutFile", "c:\Demo\Image.bmp", "AccntFileName") fileBC.WriteRecord The following example uses Siebel eScript: var RetValue; var fileBC; // Instantiate fileBC to the appropriate attachment business component // Query for the attachment record to be updated RetValue = fileBC.InvokeMethod("PutFile", "c:\\Demo\\Image.bmp", "AccntFileName"); fileBC.WriteRecord(); The following example uses COM Data Control: Dim Dim Dim Dim errCode as Integer Args(1) as String RetValue as String fileBC as BusComp
'Instantiate fileBC to the appropriate attachment business component 'Query for the attachment record to be updated Args(0) = "C:\Demo\Image.bmp" Args(1) = "AccntFileName" RetValue = fileBC.InvokeMethod ("PutFile", Args, errCode) fileBC.WriteRecord
258
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: Browser Script COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
NOTE: This method only works with a business component that uses the CSSBCBase class.
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: Browser Script COM Data Control Siebel Java Data Bean Mobile Web Client Automation Server Server Script
NOTE: This method only works with a business component that uses the CSSBCBase class.
25 9
Format BusComp.InvokeMethod("SetAdminMode", flag) Table 80 describes the arguments for the SetAdminMode method.
Table 80.
Arguments for the SetAdminMode Method Description You can use one of the following values: TRUE. Siebel CRM calls the business component in Admin mode. FALSE. Siebel CRM does not call the business component in Admin mode.
Argument flag
Used With To use this method, you can use a BusComp.InvokeMethod call with the following interfaces: COM Data Control COM Data Server Siebel Java Data Bean Mobile Web Client Automation Server Server Script
260
BusComp_PreQuery Event on page 269 BusComp_PreSetFieldValue Event on page 269 BusComp_PreWriteRecord Event on page 271 BusComp_Query Event on page 272 BusComp_SetFieldValue Event on page 273 BusComp_WriteRecord Event on page 274
You can use these events only on the Siebel Server, except for the PreSetFieldValue event, which you can use only on the browser. You can call an event from a data operation on a business component. You define these events for each business component. You can call an event before or after Siebel CRM performs the predefined behavior.
BusComp_Associate Event
If the user adds a business component record to create an association, then Siebel CRM calls the BusComp_Associate event. This method does not return any information.
Usage The usage for the BusComp_Associate event is the same as the usage for the BusComp_NewRecord event. For more information, see BusComp_NewRecord Event on page 264.
26 1
BusComp_ChangeRecord Event
If a business component record becomes the current record, then Siebel CRM calls the BusComp_ChangeRecord event. This method does not return any information.
Usage Siebel CRM runs code in the ChangeRecord event handler each time the active record changes. To allow smooth scrolling in a list applet, you must avoid lengthy operations in this event handler.
Examples The Siebel VB example in this topic uses subprograms in the declarations section of the general section to set up an audit trail for service requests. This example uses the ChangeRecord event handler to initialize the values from the service record so that Siebel CRM can compare them with current values: (general) (declarations) Option Explicit Dim OldClosedDate, OldCreated, OldOwner, OldOwnerGroup Dim OldSeverity, OldSource, OldStatus Declare Sub CreateAuditRecord Declare Sub InitializeOldValues Sub CreateAuditRecord (FieldName As String, NewValue As String, OldValue As String, ChangedText As String) Dim ActionBC As BusComp Dim CurrentBO As BusObject Dim theSRNumber Set CurrentBO = TheApplication.GetBusObject("Service Request") Set ActionBC = CurrentBO.GetBusComp("Action") theSRNumber = GetFieldValue("SR Number") With ActionBC .ActivateField "Activity SR Id" .ActivateField "Description" .ActivateField "Private" .ActivateField "Service request id" .ActivateField "Type" .NewRecord NewAfter
262
Sub InitializeOldValues OldClosedDate = GetFieldValue("Closed Date") OldOwner = GetFieldValue("Owner") OldSeverity = GetFieldValue("Severity") If GetFieldValue("Severity") <> OldSeverity Then NewValue = GetFieldValue("Severity") ChangedText = "Changed Priority from " + OldSeverity + _ " to " + NewValue CreateAuditRecord "Severity", NewValue, OldSeverity, _ ChangedText End If End Sub Sub BusComp_ChangeRecord InitializeOldValues End Sub
BusComp_CopyRecord Event
If the user copies a business component record, and if the user makes this record the active record, then Siebel CRM calls the BusComp_CopyRecord event. This method does not return any information.
Usage If a new record is created in one of the following ways, then Siebel CRM calls the BusComp_CopyRecord method instead of the BusComp_NewRecord method: Siebel CRM creates a new record through one of the following:
A user uses a copy record feature in the Siebel Client. For example, if the user chooses the Copy Record menu item from the Edit menu, or presses CTRL+B.
26 3
BusComp_DeleteRecord Event
If the user deletes a business component record, then Siebel CRM calls the BusComp_DeleteRecord event. The fields of the deleted record are no longer available. This method does not return any information.
Usage for the BusComp_DeleteRecord Event Siebel CRM does not start the BusComp_PreDeleteRecord event or the BusComp_DeleteRecord event for a child record that it deletes according to the Cascade Delete property on a link. For performance reasons, Siebel CRM performs these deletes directly in the data layer. Because Siebel CRM calls script events from the object layer, it does not run them.
BusComp_InvokeMethod Event
If Siebel CRM calls the InvokeMethod method on a business component, then it also calls the BusComp_InvokeMethod event. This method does not return any information.
Format BusComp_InvokeMethod(methodName) The arguments you can use with this format are the same as the arguments described in Table 26 on page 114.
Usage If you call a specialized method on a business component, or if you call the InvokeMethod method explicitly on a business component, then Siebel CRM calls the BusComp_InvokeMethod event. For more information, see About Specialized and Custom Methods on page 101.
BusComp_NewRecord Event
If the user creates a business component record, and if the user makes this record the active record, then Siebel CRM calls the BusComp_NewRecord event. You can use this event to set up default values for a field. This method does not return any information.
264
Usage If a new record is created in one of the following ways, then Siebel CRM calls the BusComp_CopyRecord method instead of the BusComp_NewRecord method: Siebel CRM creates a new record using one of the following formats:
A user uses a copy record feature in the Siebel client. For example, the user chooses the Copy Record menu item from the Edit menu, or presses CTRL+B.
Examples For an example, see Pick Method for a Business Component on page 222.
BusComp_PreAssociate Event
If Siebel CRM detects that the user is about to add a business component record to create an association, then it calls the BusComp_PreAssociate event before it adds the record. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Format BusComp_PreAssociate No arguments are available.The format is the same as for BusComp_PreNewRecord event. For more information, see BusComp_PreNewRecord Event on page 268.
BusComp_PreCopyRecord Event
If Siebel CRM detects that the user is about to copy a business component record, then it calls the BusComp_PreCopyRecord event before it copies the record. You can use this event to perform precopy validation. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
26 5
BusComp_PreDeleteRecord Event
If Siebel CRM detects that the user is about to delete a business component record, then it calls the BusComp_PreDeleteRecord event. You can use this event to prevent the deletion or to perform any actions before Siebel CRM deletes the record.This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Usage Usage for the BusComp_PreDeleteRecord event is the same as usage for the BusComp_DeleteRecord event. For more information, see Usage for the BusComp_DeleteRecord Event on page 264.
Examples The following Siebel VB example prevents the deletion of an account that includes associated opportunities: (general) (declarations) Option Explicit Function BusComp_PreDeleteRecord As Integer Dim oBC as BusComp Dim oBO as BusObject Dim sAcctRowId as string sAcctRowId = me.GetFieldValue("Id") set oBO = TheApplication.GetBusObject("Opportunity") set oBC = oBO.GetBusComp("Opportunity")
266
With oBC .SetViewMode AllView .ClearToQuery .SetSearchSpec "Account Id", sAcctRowId .ExecuteQuery ForwardOnly If (.FirstRecord = 1) Then RaiseErrorText("Opportunities exist for the Account - _ Delete is not allowed") End If End With BusComp_PreDeleteRecord = ContinueOperation Set oBC = Nothing Set oBO = Nothing End Function
BusComp_PreGetFieldValue Event
If a user accesses a business component field, then Siebel CRM calls the BusComp_PreGetFieldValue event. This method returns the field name and field value that exists before Siebel CRM displays the field. It also returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Format BusComp_PreGetFieldValue(FieldName, FieldValue) Table 81 describes the arguments for the BusComp_PreGetFieldValue event.
Table 81.
Arguments for the BusComp_PreGetFieldValue Event Description String that contains the name of the field that the user accessed. String that contains the value of the field that the user accessed.
Usage Siebel CRM calls the BusComp_PreGetFieldValue event in the following situations: At least one time for each user interface element that displays the value for a business component field Every time it updates the Siebel client As a result of other internal uses
Improving Performance when Calling the BusComp_PreGetFieldValue Method Siebel CRM runs any script that is attached to this event very frequently. It even calls empty scripts. These calls might cause a Siebel application appear to be unresponsive.
26 7
a b
In Siebel Tools, open a script you do not require. Delete the entire contents of the script, including the following content:
In Siebel VB, delete the Function statement and the End Function statement. In Siebel eScript, delete the function () statement and the {} function statement.
BusComp_PreInvokeMethod Event
If Siebel CRM calls a specialized method on a business component, then it calls the BusComp_PreInvokeMethod event before it calls this specialized method. The BusComp_PreInvokeMethod event returns ContinueOperation or CancelOperation. For more information, see About Specialized and Custom Methods on page 101, and Caution About Using the Cancel Operation Event Handler on page 57.
Format BusComp_PreInvokeMethod(methodName) The arguments you can use with this format are the same as the arguments described in Table 26 on page 114.
BusComp_PreNewRecord Event
If Siebel CRM detects that the user is about to create a new business component record, then it calls the BusComp_PreNewRecord event before it creates the record. You can use this event to perform preinsert validation. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
268
BusComp_PreQuery Event
Siebel CRM calls the BusComp_PreQuery event before it runs a query. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Usage To modify the search criteria or to restrict Siebel CRM from running certain queries, you can use the BusComp_PreQuery event.
Examples The following example is in Siebel VB: Function BusComp_PreQuery() As Integer Dim strPosition As String Dim strSearchSpec As String Dim intReturn As Integer intReturn = ContinueOperation strPosition = TheApplication.PositionName strSearchSpec = Me.GetSearchSpec("Owned By") If strPosition <> "System Administrator" Then if Len(strSearchSpec) = 0 or InStr(strSearchSpec, strPosition) = 0 Then Me.SetSearchSpec "Owned By", strPosition end if End if BusComp_PreQuery = intReturn End Function
BusComp_PreSetFieldValue Event
Siebel CRM calls the BusComp_PreSetFieldValue event in the following situations: After the user changes a field value in the Siebel client and then attempts to leave the field A call to the SetFieldValue method occurs, but before it performs any field-level validation
This event allows you to use custom validation before Siebel CRM applies predefined validation. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
26 9
Format BusComp_PreSetFieldValue(FieldName, FieldValue) The arguments you can use with this format are the same as the argument described in Table 24 on page 108.
Usage If your script returns CancelOperation for a field, then Siebel CRM does not enter data for that field. However, BusComp_PreSetFieldValue still starts for the other fields for which the picklist enters data. For more information, see Caution About Using the Cancel Operation Event Handler on page 57. If a user uses a picklist to enter data for multiple fields, then it starts the BusComp_PreSetFieldValue method for each field in which the user enters data. For example, in an applet that the user accesses to enter data for the Last Name, First Name, and Contact ID. In this example, Siebel CRM starts the BusComp_PreSetFieldValue method three times, one time for each field. NOTE: Siebel CRM does not call the BusComp_PreSetFieldValue event on a picklist or multivalue field.
Usage With Roundtrips Siebel CRM does the following during a roundtrip to the Siebel Server: In Browser Script, if the Immediate Post Changes property of the business component field is set to TRUE, then it calls the BusComp_PreSetFieldValue method after the round trip to the Siebel Server completes. In Server Script, it calls the BusComp_PreSetFieldValue method as the first event in the Siebel Server round trip.
NOTE: To prevent infinite recursions, if the BusComp_PreSetFieldValue event is running, then Siebel CRM does not run it again for the same business component instance, even if Siebel CRM uses it on a different field in the business component.
Examples The following Siebel VB example uses the PreSetFieldValue event to determine if a quote discount is greater than 20 percent, and to take the appropriate action if it is. For other examples of BusComp_PreSetFieldValue, see LoginId Method for an Application on page 153, and ExecuteQuery Method for a Business Component on page 194: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer code to check if a quote discount>20% if it is, notify user and cancel operation Dim value as Integer Dim msgtext as String If FieldName = "Discount" then
270
value = Val(FieldValue) If value > 20 then msgtext = "Discounts greater than 20% must be approved" RaiseError msgtext BusComp_PreSetFieldValue = CancelOperation Else BusComp_PreSetFieldValue = ContinueOperation End if End If End Function The following is the equivalent example in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) { var msgtext = "Discounts greater than 20% must be approved"; if (FieldName == "Discount") { if (FieldValue > 20) { TheApplication().RaiseErrorText(msgtext); } else { return (ContinueOperation); } } else { return (ContinueOperation); } }
BusComp_PreWriteRecord Event
Siebel CRM calls the BusComp_PreWriteRecord event before it writes a record to the Siebel database. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Usage For important caution information, see Caution for Using an Error Method with a Write Record Event on page 275. You can use this event to perform any final validation before Siebel CRM performs any predefined internal record-level validation.
27 1
Siebel CRM starts the BusComp_PreWriteRecord event only if the user modifies or inserts a field value, or if the user deletes a record. If the user deletes a record, then Siebel CRM calls the BusComp_PreWriteRecord method to delete the implied join that joins any records to the initial record.
Using a Write Record Event with a Multivalue Group If Siebel CRM associates a multivalue group record that uses a many to many relationship with the business component that calls the association, then it starts the BusComp_PreWriteRecord event and the BusComp_WriteRecord event. It starts these events even if the association does not update any fields in the multivalue group business component or in the calling business component. It runs the BusComp_PreWriteRecord event and the BusComp_WriteRecord event to acknowledge the update to the intersection table.
Examples The following example calls the BusComp_PreWriteRecord event: Function BusComp_PreWriteRecord As Integer ' This code resets the probability before the write ' if necessary if Me.GetFieldValue("Sales Stage") LIKE "07*" then ' Resets the Probability to 75 if less than 75 if Val(Me.GetFieldValue("Rep %")) < 75 then Me.SetFieldValue "Rep %", "75" end If end if BusComp_PreWriteRecord = ContinueOperation End Function
BusComp_Query Event
Siebel CRM calls the BusComp_Query event after it completes a query but before it displays the query results. This event does not return any information.
272
Examples In the following Siebel VB example, the Action business component uses a special activity type. If the user starts an account query, then this code determines if important information is available. If it is available, then Siebel CRM displays it in a message box: Sub BusComp_Query Dim oBusObj As BusObject, oCurrFinAct As BusComp, Dim oActivities as BusComp, oAppl as Applet Dim sName as String, sDescription as String On error goto leave set oBusObj = TheApplication.ActiveBusObject Set oCurrFinAct = TheApplication.ActiveBusComp If oCurrFinAct.FirstRecord <> 0 then sName = oCurrFinAct.GetFieldValue("Name") Set oActivities = oBusObj.GetBusComp("Finance _ Important Info Activity") With oActivities .ActivateField("Description") .ClearToQuery .SetSearchSpec "Account Name", sName .SetSearchSpec "Type", "Important Info" .ExecuteQuery ForwardOnly If .FirstRecord <> 0 then sDescription = .GetFieldValue("Description") TheApplication.Trace("Important Information: " + sDescription) do while .NextRecord <> 0 sDescription = .GetFieldValue("Description") TheApplication.Trace("Important Information: " + sDescription) loop End If End With End If leave: Set oCurrFinAct = Nothing set oBusObj = Nothing End Sub
BusComp_SetFieldValue Event
If Siebel CRM sends a value to a business component from the Siebel client or through a call to the SetFieldValue method, then it calls the BusComp_SetFieldValue event. It does not call this event for a predefaulted field or for a calculated field. This event does not return any information.
Format BusComp_SetFieldValue(FieldName)
27 3
The arguments you can use in this format are the same as the arguments that are described in Table 56 on page 184.
Examples In the following Siebel VB example, if Siebel CRM calls the SetFieldValue event, then it calls methods on an existing business component: Sub BusComp_SetFieldValue (FieldName As String) Dim desc As String Dim newDesc As String If FieldName = "Type" Then newDesc = [can be any valid string that contains the new description] desc = GetFieldValue("Description") SetFieldValue "Description", newDesc End If End Sub The following is the equivalent example in Siebel eScript: function BusComp_SetFieldValue (FieldName) { if (FieldName == "Type" && GetFieldValue(FieldName) == "Account") { SetFieldValue("Description", "Record is of Type 'Account'." ); } }
BusComp_WriteRecord Event
Siebel CRM starts the BusComp_WriteRecord event after it saves the record to the Siebel database. This event does not return any information.
Usage Do not use the BusComp_SetFieldValue event in a BusComp_WriteRecord event. If you must use the BusComp_SetFieldValue event, then use it in the BusComp_PreWriteRecord event. For more information, see BusComp_PreWriteRecord Event on page 271. For information about using the BusComp_WriteRecord event with a multi-value group, see Using a Write Record Event with a Multivalue Group on page 272.
274
Caution for Using an Error Method with a Write Record Event CAUTION: Be careful if you use the RaiseError method or the RaiseErrorText method in the BusComp_WriteRecord event or in the BusComp_PreWriteRecord event. For example, if you use the RaiseErrorText method in the BusComp_PreWriteRecord method, then the user or the code cannot step off the current record until the condition that causes Siebel CRM to call the RaiseErrorText method is addressed.
In this topic, the term oBusObj indicates a variable that contains a BusObject.
Format oBusObj.GetBusComp (BusCompName) Table 82 describes the arguments for the GetBusComp method.
Table 82.
Arguments for the GetBusComp Method Description String that contains the name of a business component.
Argument BusCompName
The BusCompName argument is case-sensitive. It must match the case of the name that Siebel Tools displays in the Name property of the business component.
27 5
Usage If a business component instance exists but you must create a new instance, then you can do the following:
1 2
Use the GetBusObject method to create a new business object instance. For this new business instance, use the GetBusComp method to create a new business component. These steps create a new business component instance that is different from the business component instance that already exists.
If you use a business object instance that already exists, then your configuration includes any other business components that reference that business object instance, even if you use the GetBusComp method. If you no longer require the business component instance, then use one of the following keywords: In Siebel VB, use Nothing (). In Siebel eScript or Browser Script, use null ().
NOTE: In Browser Script, the GetBusComp method can only access business component instances in the current view. In Server Script, the GetBusComp method can access every business component instance that exists in the active business object.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Server Script
Examples The following examples are in Siebel eScript: To access a business component in a UI context: var ActiveBO = TheApplication().ActiveBusObject(); var ConBC = ActiveBO.GetBusComp("Contact"); To access a business component in a nonUI context: var BO = TheApplication().GetBusObject("Account"); var ConBC = BO.GetBusComp("Contact");
276
Usage For more information, see Usage for the GetLastErrCode Method on page 137.
Used With COM Data Control, Mobile Web Client Automation Server
Usage For more information, see Usage for the GetLastErrText Method on page 137.
Used With COM Data Control, Mobile Web Client Automation Server
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For an example, see Name Method for a Business Component on page 218.
27 7
Examples The following example is for Siebel Java Data Bean: import com.siebel.data.*; { ... // create Siebel Java Data Bean SiebelDataBean Sieb_dataBean = null; Sieb_dataBean = new SiebelDataBean();
// log in to Siebel Java Data Bean ... // Create Siebel Bus Object. // get the Bus Object from SiebelDataBean SiebelBusObject busObj = null; busObj = Sieb_dataBean.getBusObject("Account");
... // Use the business Object // Release the business object resources ... busObj.release(); }
278
InvokeMethod Method for a Business Service on page 282 Name Method for a Business Service on page 283 PropertyExists Method for a Business Service on page 283 Release Method for a Business Service on page 284 RemoveProperty Method for a Business Service on page 285 SetProperty Method for a Business Service on page 286
Usage for a Method that Gets a Business Service Property The order in which Siebel CRM stores properties in a property set is random. For example, the Name property is the first property that Siebel Tools displays in the Business Services list for every business service. However, the GetFirstProperty method might return any business service property, not necessarily the Name property. To correct this situation it is recommended that you add the properties in a property set to an array, and then sort that array. To get or modify a property value, you can do the following:
1 2
Use the GetFirstProperty method or GetNextProperty method to return the name of a property. Use the name you returned in Step 1 in one of the following ways:
To return a property value, as an argument in the GetProperty method. To set a property value, as an argument in the SetProperty method.
For more information, see the following topics: GetNextProperty Method for a Business Service on page 280 GetProperty Method for a Business Service on page 281 SetProperty Method for a Business Service on page 286
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
27 9
Example of Using Methods that Return a Business Service Property The example in this topic returns the number of property sets that belong to a business service. The following example is in Siebel eScript: function countPropSets(busService) { var propSetName = busService.GetFirstProperty(); var count = 0; while(propSetName != "") { count++; propSetName = busService.GetNextProperty(); } return count; } The following example is for Siebel Java Data Bean: public int countPropSets(SiebelService busService) { int count = 0; try { String propSetName = busService.getFirstProperty(); while(propSetName != "") { count++; propSetName = busService.getNextProperty(); } } catch(SiebelException sExcept) { return 0; } return count; }
280
Usage for the GetNextProperty Method After you call the GetFirstProperty method to return the name of the first property of a business service, you can call the GetNextProperty to return the name of the next property. This next property is the next property that is defined for a business service after the first property. You can use the GetNextProperty consecutively to cycle through all the properties of a business service until no more properties exist, at which point Siebel CRM returns an empty string. Usage for the GetNextProperty is similar to usage for the GetFirstProperty method. For more information, see Usage for a Method that Gets a Business Service Property on page 279.
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples For examples, see Example of Using Methods that Return a Business Service Property on page 280.
Format oService.GetProperty(propName) Table 83 describes the arguments for the GetProperty method.
Table 83.
Arguments for the GetProperty Method Description A string that contains the name of the property that Siebel CRM returns.
Argument propName
Usage To return the value for this property you must know the name of the property. To return a property name, use the GetFirstProperty method or the GetNextProperty method. For more information, see Usage for a Method that Gets a Business Service Property on page 279.
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
28 1
Siebel eScript Format oService.InvokeMethod(methodName, InputArguments, OutputArguments) Table 84 describes the arguments for the Siebel eScript format of the InvokeMethod method.
Table 84.
Arguments for the Siebel eScript Format of the InvokeMethod Method Description A string that contains the name of the method that Siebel CRM must run. A property set that identifies the arguments that the method uses as input. A property set that identifies the arguments that the method returns as output.
Siebel VB Format oService.InvokeMethod methodName, InputArguments, OutputArguments The arguments you use in this format are the same as the arguments that are described in Table 84 on page 282.
Browser Script Format outputPropSet=Service.InvokeMethod(MethodName, inputPropSet) The arguments you use with this format are the same as the arguments described in Table 25 on page 111. NOTE: In Browser Script, you cannot use an output property set for this format.
Usage A predefined business service works in a way that is similar to how a call to a business component method works. You can call a specialized method on a business service that is not available directly through the object interface. You must use this method only with Siebel VB or Siebel eScript scripts. You must use Siebel Tools to write these scripts. You can call these scripts from an external interface. A run-time business service can include a custom method. Although the InvokeMethod function does not return a value, the properties in the OutputArguments property set might be modified. For more information, see Caution About Using the InvokeMethod Method on page 106.
282
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Related Topics For more information, see the following topics: Service_InvokeMethod Event on page 287 Service_PreInvokeMethod Event on page 289
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following example is in Browser Script: var svc = theApplication().GetService("Data Quality Manager"): theApplication().SWEAlert("The active service is " + svc.Name());
1. Indicates the property exists. 0 (zero). Indicates the property does not exist.
Format oService.PropertyExists(propName)
28 3
Table 85.
Arguments for the PropertyExists Method Description A string that contains the name of the property.
Argument propName
Usage Use the PropertyExists method in an If statement to determine if a specific property is set.
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Examples The following example logs in to a Siebel Server. It then creates a business object instance, a business component instance, and a business service instance. Next, it releases them in reverse order. import com.siebel.data.*; import com.siebel.data.SiebelException; public class JDBReleaseDemo { private SiebelDataBean m_dataBean = null; private SiebelBusObject m_busObject = null; private SiebelBusComp m_busComp = null; private SiebelService m_busServ = null; public static void main(String[] args) { JDBReleaseDemo demo = new JDBReleaseDemo(); }
284
public JDBReleaseDemo() { try { // instantiate the Siebel Java Data Bean m_dataBean = new SiebelDataBean(); // login to the Siebel Servers m_dataBean.login("siebel.tcpip.none.none://gateway:port/enterprise/ object manager","userid","password"); System.out.println("Logged in to the Siebel Server "); // get the business object m_busObject = m_dataBean.getBusObject("Account"); // get the business component m_busComp = m_busObject.getBusComp("Account"); // get the business service m_busServ = m_dataBean.getService("Workflow Process Manager"); //release the business service m_busServ.release(); System.out.println("BS released "); //release the business component m_busComp.release(); System.out.println("BC released "); //release the business object m_busObject.release(); System.out.println("BO released "); // logoff m_dataBean.logoff(); System.out.println("Logged off the Siebel Server "); } catch (SiebelException e) { System.out.println(e.getErrorMessage()); } } }
28 5
Format oService.RemoveProperty(propName) Table 86 describes the arguments for the RemoveProperty method.
Table 86.
Arguments for the RemoveProperty Method Description A string that contains the name of the property that Siebel CRM must remove.
Argument propName
Usage This method removes the property that the propName argument identifies from the business service that the oService parameter specifies. As a result, a subsequent call to the PropertyExists method for that property returns FALSE. For more information, see PropertyExists Method for a Business Service on page 283.
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Format oService.SetProperty(propName, propValue) Table 87 describes the arguments for the SetProperty method.
Table 87.
Arguments for the SetProperty Method Description A string that contains the name of the property that Siebel CRM must modify. A string that contains the value that Siebel CRM sets in the property that the propName argument identifies.
Usage You can use the SetProperty method to set the value of a property of a business service from one of the methods of this business service or from an external object. For more information, see GetProperty Method for a Business Service on page 281.
286
Used With Browser Script, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script
Service_InvokeMethod Event
Siebel CRM calls the Service_InvokeMethod event after it calls the InvokeMethod method on a business service. This event does not return any information. For more information, see Service_PreInvokeMethod Event on page 289.
Server Script Format Service_InvokeMethod(MethodName, InputArguments, OutputArguments) The arguments you can use in this format are the same as the arguments that are described in Table 84 on page 282.
Browser Script Format OutputArguments=oService.InvokeMethod(methodName, InputArguments) Table 88 describes the arguments for the Browser Script format of the Service_InvokeMethod Event
Table 88.
Arguments for the Browser Script Format of the Service_InvokeMethod Event Description A string that contains the name of the method that Siebel CRM must run. A property set that identifies the arguments that the method uses as input.
NOTE: In Browser Script, you cannot use an output property set for this format.
28 7
In Server Script. It can add properties to or change values of the properties in the property set that the OutputArguments argument identifies. In Browser Script. It cannot change, store, or update the values of the properties in the output property set.
If you call a business service method through Browser Script, then the business service that this method calls can use a browser or the Siebel Server. For high interactivity mode, Siebel CRM determines if the business service resides in the browser. If the business service does not reside in the browser, then it sends the request to the Siebel Server. NOTE: Browser Script can call a business service on the browser or the Siebel Server. Server Script can call only a business service on the Siebel Server.
Examples To handle transactions that are not approved, the following example in Siebel eScript adds custom logic to the predefined Credit Card Transaction Service business service: function Service_InvokeMethod (MethodName, Inputs, Outputs) if (Outputs.GetProperty("SiebelResponseMessage") != "Approved") { // special handling for failed transactions here }
Service_PreCanInvokeMethod Event
Siebel CRM calls the Service_PreCanInvokeMethod event before it calls the PreInvokeMethod event. This configuration allows you to determine if the user possesses the authority to call a business service method. This method returns CancelOperation or ContinueOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
288
Table 89 describes the arguments for the Server Script format of the Service_PreCanInvokeMethod event.
Table 89.
Arguments for the Server Script Format of the Service_PreCanInvokeMethod Event Description A string that contains the name of the method that Siebel CRM must run. A string that indicates if Siebel CRM can call the business service method. You can use one of the following values: TRUE. Siebel CRM can call the business service method. FALSE. Siebel CRM cannot call the business service method.
Browser Script Format Service_PreCanInvokeMethod(MethodName) The arguments you can use with this format are the same as the arguments described in Table 26 on page 114.
Service_PreInvokeMethod Event
Siebel CRM calls the Service_PreInvokeMethod event before it calls a specialized method on a business service. For more information, see About Specialized and Custom Methods on page 101 and Service_InvokeMethod Event on page 287. This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Server Script Format Service_PreInvokeMethod(MethodName, InputArguments, OutputArguments) The arguments you can use in this format are the same as the arguments that are described in Table 84 on page 282.
Browser Script Format Service_PreInvokeMethod(name, inputPropSet) The arguments you can use in this format are the same as the arguments that are described in Table 25 on page 111.
28 9
Usage with Server Script Siebel CRM uses the Server Script version of the Service_PreInvokeMethod event to perform the following work: Performing business logic Setting an output in the output property set If you use a custom business service, then returning CancelOperation
Usage with Browser Script Siebel CRM uses the Browser Script version of the Service_PreInvokeMethod event to perform the following work: Performing a user interaction, such as asking for input data. Setting an input property. Canceling a user operation. For example, prompting the user to confirm a record deletion.
NOTE: The Browser Script version is not intended to perform business logic. It does not return an output property set.
290
How Siebel CRM Handles a Predefined Business Service Method Figure 6 illustrates how Siebel CRM handles a predefined business service method.
Figure 6.
With a predefined business service method, the script can do the following:
1 2 3
Call the Business Service Method. In the Service_PreInvokeMethod event, process the Method and perform any necessary custom work before it runs the C++ code. When the C++ code runs, it sets values in the outputs that the service code defines.
29 1
If the C++ code runs successfully, then the Service_InvokeMethod event can inspect and modify the output, or perform other tasks depending on the successful completion of the C++ code. At this point, the calling function takes control of the script flow.
How Siebel CRM Handles a Custom Business Service Method Figure 7 illustrates how Siebel CRM handles a custom business service method.
Figure 7.
With a custom business service method, the script can do the following:
1 2
Call the Business Service Method. In the Service_PreInvokeMethod event, process the method and take any necessary custom actions.
292
The script must return CancelOperation, which instructs Siebel CRM to cancel the remaining operations that are associated with the event. If Siebel CRM does not cancel the remaining operations, then the flow continues to the C++ code. Because this C++ code cannot handle the custom method, it issues an error that is similar to the following error message: Unknown method name
Because Siebel CRM cancels the call to the method, it does not run the Service_InvokeMethod event.
For more information, see Caution About Using the Cancel Operation Event Handler on page 57.
Examples The following Siebel VB example sets properties in the custom Shipping Engine business service: Function Service_PreInvokeMethod (MethodName As String, Inputs As PropertySet, Outputs As PropertySet) As Integer If MethodName = "CalculateShipping" Then Dim Dim Dim Dim sShipper As String, sShipMethod As String dWeight As Double, dSize As Double, dCost As Double sZone As String, DelDate As Variant sCost As String, iReturn As Integer
iReturn = ContinueOperation sShipper = Inputs.GetProperty("Shipping Company") sShipMethod = Inputs.GetProperty("Ship Method") dWeight = Val(Inputs.GetProperty("Weight")) dSize = Val(Inputs.GetProperty("Volume")) iZone = Val(Inputs.GetProperty("Zone")) DelDate = DateValue(Now) Select Case sShipper Case "GlobalEx" Select Case sShipMethod Case "Next-Day Air" dCost = 14 + dWeight DelDate = DelDate + 1 Case "Second-Day Air" dCost = 11 + (dWeight * .54) DelDate = DelDate + 2 End Select Case "Airline" Select Case sShipMethod Case "Next-Day Air" dCost = 5 + (dWeight * .3) + (dSize * .33) + _
29 3
(Val(sZone) * .5) DelDate = DelDate + 1 Case "Second-Day Air" dCost = 4 + (dWeight * .3) + (dSize * .2) + _ (Val(sZone) * .3) DelDate = DelDate + 2 Case "Ground" dCost = 3 + (dWeight * .18) + (dSize * .1) + _ (Val(sZone) * .1) DelDate = DelDate + 2 + Int(Val(sZone) * .8) End Select End Select sCost = Format(dCost, "Currency") Outputs.SetProperty "Cost", sCost Outputs.SetProperty "Delivery Date", DelDate iReturn = CancelOperation End If Service_PreInvokeMethod = iReturn End Function
Control Methods
This topic describes control methods. It includes the following topics: Applet Method for a Control on page 294 BusComp Method for a Control on page 295 GetProperty Method for a Control on page 295 GetValue Method for a Control on page 296 Name Method for a Control on page 297 SetLabelProperty Method for a Control on page 297 SetProperty Method for a Control on page 301 SetValue Method for a Control on page 302
In this topic, the controlVar variable indicates the name of the control that causes Siebel CRM to call the method. For example, Button1_Click. NOTE: A control method does not work with an ActiveX control.
294
Usage Obtaining the name of the applet in which a control resides allows you to perform operations on the applet, not only on the control.
Examples For an example, see Name Method for a Business Component on page 218.
Usage You can use the GetProperty method with the following controls: CheckBox ComboBox
29 5
You can use the GetProperty method to get values for the following properties: Background Color Enabled FontType FontColor FontSize FontStyle Height Width Read Only Visible
For more information about these properties, see Table 91 on page 299. To return more than one property, you must use a separate statement for each property.
Examples The following example uses the GetProperty method to return values for the FontSize, Background Color, Width, and Height properties: theApplication().SWEAlert("checkbox.FontSize : " + objCheckBox.GetProperty("FontSize")); theApplication().SWEAlert("checkbox.BgColor : " + objCheckBox.GetProperty("BgColor")); theApplication().SWEAlert("checkbox.Width : " + objCheckBox.GetProperty("Width")); theApplication().SWEAlert("checkbox.Height : " + objCheckBox.GetProperty("Height"));
296
Usage For more information, see Usage for the GetValue Method and the SetValue Method on page 303.
Examples For an example, see Examples for the GetValue Method and the SetValue Method on page 303.
Examples For an example, see Name Method for a Business Component on page 218.
29 7
Table 90.
Arguments for the SetLabelProperty Method Description The name of the property that Siebel CRM must set. For a description of the values you can enter, see Properties You Can Set For a Label on page 299. The value to set for the property. For a description of the values you can enter, see Properties You Can Set For a Label on page 299.
Usage If you must set more than one property, then you must use a separate statement for each property.
Enabling the SetLabelProperty Method Siebel CRM does not enable the SetLabelProperty method by default. You must enable it in Siebel Tools before you use it in a script.
a b c d e 3 4 5 6 7 8
Choose the View menu, and then the Options menu item. Click the Object Explorer tab. Scroll down through the Object Explorer Hierarchy window until you locate the Applet tree. Expand the Applet tree, expand the Control tree, and then make sure the Control User Prop object type includes a check mark. Click OK.
In the Object Explorer, click Applet. In the Applets list, locate the applet that includes the control you must modify. In the Object Explorer, expand the Applet tree, and then click Control. In the Controls list, locate the control you must modify. In the Object Explorer, expand the Control tree, and then click Control User Prop. In the Control User Props list, add a new control user property using values from the following table. Property Name Value Value useLabelID TRUE
298
Properties You Can Set For a Label Table 91 lists the properties you can set for a label.
Properties You Can Set For a Label Value string Description Determines the background color for a label. For example: Red is #ff0000. Green is #00ff00. Blue is #0000ff.
Determines the font color for a label. For example, green is #00ff00. Determines the font type for a label. For example, Times Roman. Determines the font size for a label. For example, 12 pt. Determines the font style for a label. For example, italic. Determines the font weight for a label. You can use the following values: bold bolder lighter normal 100, 200, 300, or 400. These values are equivalent to light. 500, 600, or 700. These values are equivalent to normal. 800 or 900. These values are equivalent to bold.
The default value is normal. Height Visible Width string visible or hidden string Determines height for a label, in pixels. For example, 5. Determines if the label is visible. The default value is the value in the Siebel repository file (SRF). Determines the width for a label, in pixels. For example, 80.
Examples The following code uses the SetLabelProperty method: function Applet_PreInvokeMethod (name, inputPropSet){
29 9
switch (name) { // Example of changing the font size of the Location label case ("fontsize"): { var ctl = this.FindControl("Location"); var fSize = prompt("Specify the required label font size (numeric value only)."); ctl.SetLabelProperty("FontSize", fSize); return ("CancelOperation"); } // Example of changing the background color of the Location label case ("bgcolor"): { var ctl = this.FindControl("Location"); var bgColor = prompt("Specify th ebackground color of the label. Enter a valid six hexadecimal digit RGB value preceded by #"); ctl.SetLabelProperty("BgColor", bgColor); return ("CancelOperation"); } // Example of changing the font type of the Location label case ("fonttype"): { var ctl = this.FindControl("Location"); var fontType =prompt("Specify the font type for the label."); ctl.SetLabelProperty("FontType", fontType); return ("CancelOperation"); } // Example of changing the font color of the Location label case ("fontcolor"): { var ctl = this.FindControl("Location"); var fontColor = prompt("Specify the font color of the label. Enter a valid six hexadecimal digit RGB value preceded by #"); ctl.SetLabelProperty("FontColor", fontColor); return ("CancelOperation"); } break; } }
300
Format controlVar.SetProperty(propName, propValue) Table 92 describes the arguments for the SetProperty method.
Table 92.
Arguments for the SetProperty Method Description The name of the property that Siebel CRM must set. For a description of the values you can enter, see Properties You Can Set for a Control on page 301. The value that Siebel CRM must set for the property. For a description of the values you can enter, see Properties You Can Set for a Control on page 301.
Usage You can use the SetProperty method with the following controls: CheckBox ComboBox TextBox TextArea
If you must set more than one property, then you must use a separate statement to set each property.
Properties You Can Set for a Control Table 93 describes the properties you can set for a control.
Properties You Can Set for a Control Value TRUE or FALSE TRUE or FALSE TRUE or FALSE Description Determines if the control is active. The default value is the value in the Siebel repository file (SRF). Determines if Siebel CRM displays the control. The default value is the value in the Siebel repository file (SRF). Determines if the control is read-only. The default value is the value in the Siebel repository file (SRF).
30 1
To modify these control properties, you can use these same properties you use to modify a label. For a description of the values you can enter, see Properties You Can Set For a Label on page 299.
Using the SetProperty Method to Control Font Weight To use the SetProperty method to control font weight, you must use the FontWeight property. For example: control.SetProperty("FontWeight","600") You cannot use the FontStyle argument to control font weight. For example, the following code fails: control.SetProperty("FontStyle", "Bold") Examples The following code uses the SetProperty method: objCheckBox.SetProperty("FontColor", "#00ff00"); objCheckBox.SetProperty("FontStyle", "italic"); objCheckBox.SetProperty("FontType", "Verdana"); objCheckBox.SetProperty("FontSize", "14 pt"); objCheckBox.SetProperty("BgColor", "#00f000"); objCheckBox.SetProperty("Width", "100"); objCheckBox.SetProperty("Height", "100");
302
Table 94.
Arguments for the SetValue Method Description String that contains the value that Siebel CRM must set for the control.
Argument controlValue
Usage for the GetValue Method and the SetValue Method Note the following usage for the SetValue method: This method does not validate the format of the data. Data validation occurs when the user steps off the field or the record, or explicitly saves the record. This method can set the value for a read-only control, but Siebel CRM does not save this information when the user saves the record. The user can change the contents of a control before Siebel CRM saves control information to the business component field.
Note the following usage for the GetValue method and the SetValue method: These methods only work on form applets. These methods work only for a control that references a business component field. You cannot use these methods with a label.
Examples for the GetValue Method and the SetValue Method The following code uses the GetValue method and the SetValue method: function Applet_PreInvokeMethod (name, inputPropSet) { switch (name) { // Example of changing the value of the Abstract control to uppercase case ("SR Abstract"): { var ctlName = "Abstract"; var ctl = this.FindControl(ctlName); var ctlVal = ctl.GetValue(); ctl.SetValue(ctlVal.toUpperCase()); ctl= null; return("CancelOperation"); }
30 3
// Example of changing the value of a checkbox control case ("SR Billable"): { var ctlName = "Billable Flag"; var ctl = this.FindControl(ctlName); var ctlVal = ctl.GetValue(); if (ctlVal == "Y") ctl.SetValue("N"); // clear the box else ctl.SetValue("Y"); // check the box ctl= null; return("CancelOperation"); } // Example of changing the value of a date/time control case ("SR Commit time"): { var ctlName = "Agent Committed"; var ctl = this.FindControl(ctlName); ctl.SetValue("12/1/2001 1:09:31 AM"); // format is not validated until user saves the record ctl= null; return("CancelOperation"); } break; } }
304
GetProperty Method for a Property Set on page 313 GetPropertyCount Method for a Property Set on page 313 GetType Method for a Property Set on page 314 GetValue Method for a Property Set on page 314 InsertChildAt Method for a Property Set on page 315 PropertyExists Method for a Property Set on page 315 RemoveChild Method for a Property Set on page 316 RemoveProperty Method for a Property Set on page 317 Reset Method for a Property Set on page 317 SetByteValue Method for a Property Set on page 317 SetProperty Method for a Property Set on page 318 SetType Method for a Property Set on page 319 SetValue Method for a Property Set on page 320
In this topic, the oPropSet variable indicates the variable that contains a property set.
Format oPropSet.AddChild(childPropSet) Table 95 describes the arguments for the AddChild method.
Table 95.
Arguments for the AddChild Method Description A property set that Siebel CRM must make as a child to the property set that the oPropSet variable identifies.
Argument childObject
Usage You can use a property set to create a tree data structure. You can add any number of arbitrarily structured child properties to a property set. You can use a child property set to structure a property set in a manner that is similar to the structure that the data model uses. For example, a parent account property set can include child property sets for opportunities, contacts, activities, and so forth. In this example, you could create an independent property set named Opportunity, to which accounts, contacts, and activities can be children.
30 5
If Siebel CRM creates an instance of a property set through script, and then adds it to a parent property set, and if the parent property set is subsequently released, then Siebel CRM does not release this child instance. The reference to the child instance exists independently.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following fragment of Siebel eScript code adds child property sets to a parent property set: var var var var Account = TheApplication().NewPropertySet(); Opportunity = TheApplication().NewPropertySet(); Contact = TheApplication().NewPropertySet(); Activity = TheApplication().NewPropertySet();
Account.AddChild(Opportunity); Account.AddChild(Contact); Account.AddChild(Activity); Related Topics For more information, see the following topics: GetChild Method for a Property Set on page 308 InsertChildAt Method for a Property Set on page 315 RemoveChild Method for a Property Set on page 316
Usage The Copy method creates a copy of a property set, including any properties and child property sets. Because Siebel CRM typically passes a property set through a reference, making a copy allows you to manipulate a property set without affecting the original property set.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
306
Examples The following Siebel VB example uses a copy of a property set to store the original values of the properties, and displays the original and Pig-Latin forms of the properties: (general) (declarations) Option Explicit Function PigLatin (Name1 As String) As String Dim Name2 As String, FirstLetter As String Name2 = Right$(Name1, len(Name1) - 1) FirstLetter = Left$(Name1, 1) Name2 = UCase(Mid$(Name1, 2, 1)) & _ Right$(Name2, Len(Name2) - 1) Name2 = Name2 & LCase(FirstLetter) & "ay" PigLatin = Name2 End Function Sub ClickMe_Click() Dim Inputs As PropertySet, Outputs As PropertySet Dim message As String, propName, propVal, newPropVal set Inputs = TheApplication.NewPropertySet Inputs.SetProperty "Name", "Harold" Inputs.SetProperty "Assistant", "Kathryn" Inputs.SetProperty "Driver", "Merton" set Outputs = Inputs.Copy() propName = Outputs.GetFirstProperty() do while propName <> "" propVal = Outputs.GetProperty(propName) newPropVal = PigLatin(propVal) Outputs.SetProperty propName, newPropVal message = message & propVal & " has become " & _ newPropVal & Chr$(13) propName = Outputs.GetNextProperty() loop TheApplication.RaiseErrorText message Set message = Nothing Set Outputs = Nothing Set Inputs = Nothing End Sub
For more information, see SetByteValue Method for a Property Set on page 317.
30 7
Examples The following example uses a binary value as input and provides a binary output. The angle brackets (< >) indicate a variable: SiebelPropertySet input = new SiebelPropertySet(); SiebelPropertySet output = new SiebelPropertySet(); input.setProperty("ProcessName", "LMS3 Jason"); // XML to send String str="<?xml version=\"1.0\" encoding=\"UTF8\" ?><GetCommunicationDataInput><MemberID>20048963</MemberID></ GetCommunicationDataInput>"; // convert string to byte array byte [] bvalue = new String(str).getBytes(); input.setByteValue(bvalue); businessService.invokeMethod("RunProcess",input,output); // Use getByteValue to return the value..and pop it in a String..for example String out2 = new String (output.getByteValue()); System.out.println(out2);
Format oPropSet.GetChild(index) Table 96 describes the arguments for the GetChild method.
Table 96.
Arguments for the Arguments for the GetChild Method Description An integer that identifies the index number of the child property set that Siebel CRM must return.
Argument index
308
How Siebel CRM Handles Indexing for Child Property Sets Note how Siebel CRM handles indexing for a child property set you add, insert, or remove: If Siebel CRM creates a child property set, then it creates an index number for this child property set, starting at 0 (zero). It increments this index for each child property set it adds to a given parent property set. If you use the AddChild Property method, then Siebel CRM uses the next available index number for the child property set it adds. If you use the InsertChildAt method, then Siebel CRM inserts the new child property set at a specified index. It also increases the index by 1 for the property set that the new child displaces, and for all child property sets that occur after the displaced property set. If you use the RemoveChild method, then Siebel CRM removes the child property set you specify, and then decreases the index by 1 for all property sets that follow the removed child.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server NOTE: If you use the Web Client Automation Server, then the child object that Siebel CRM returns is a copy of the object. Siebel CRM updates any changes that occur to the object that it returns, but it does not update the originating object.
Examples The following Siebel eScript example sets the Name property of child property sets to the same value: function Test1_Click () { var Account = TheApplication().NewPropertySet(); var Opportunity = TheApplication().NewPropertySet(); var Contact = TheApplication().NewPropertySet(); var Activity = TheApplication().NewPropertySet(); var j; Account.AddChild(Opportunity); Account.AddChild(Contact); Account.AddChild(Activity); for (var i = 0; i < Account.GetChildCount(); i++) { j = Account.GetChild(i); j.SetProperty('Name', 'Allied Handbooks'); } } Related Topics For more information, see the following topics:
30 9
AddChild Method for a Property Set on page 305 InsertChildAt Method for a Property Set on page 315
Usage Th GetChildCount method returns the number of child property sets for the property set that the oPropSet variable identifies. Because the index number for child property sets start at 0, a child count of 3 indicates that there are child property sets at indexes 0, 1, and 2. NOTE: The GetChildCount method returns only the number of direct descendants. If a child property set includes children, then Siebel CRM does not include these grandchildren in the count that it provides in the return value.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples For an example, see GetChild Method for a Property Set on page 308.
Usage The usage for the GetFirstProperty method for a property set is similar to the usage for the GetFirstProperty method for a business service. For more information, see Usage for a Method that Gets a Business Service Property on page 279.
310
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following example uses the GetFirstProperty method to get the first property, and then uses the GetNextProperty method to return all subsequent properties. If the GetNextProperty method returns a null value, then Siebel CRM terminates the loop: function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var propName = ""; var propVal = ""; propName = Inputs.GetFirstProperty(); // stay in loop if the property name is not an empty string while (propName != "") { propVal = Inputs.GetProperty(propName); // if a property with the same name does not exist // add the name value pair to the output if (!Outputs.PropertyExists(propName)) { Outputs.SetProperty(propName, propVal); } propName = Inputs.GetNextProperty(); } return (CancelOperation); } Related Topics For more information, see the following topics: GetNextProperty Method for a Property Set on page 312 GetProperty Method for a Property Set on page 313
31 1
Usage For more information, see Usage for the GetLastErrCode Method on page 137.
Used With Mobile Web Client Automation Server, Web Client Automation Server
Usage For more information, see Usage for the GetLastErrText Method on page 137.
Used With Mobile Web Client Automation Server, Web Client Automation Server
Usage Usage for the GetNextProperty method for a property set is similar to the usage for the GetNextProperty method for a business service. For more information, see Usage for the GetNextProperty Method on page 281.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
312
Examples For an example, see GetFirstProperty Method for a Property Set on page 310.
Related Topics For more information, see the following topics: GetFirstProperty Method for a Property Set on page 310 GetProperty Method for a Property Set on page 313
Format oPropSet.GetProperty(propName) The arguments you can use with this format are the same as the arguments described in Table 83 on page 281.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following fragment of Siebel eScript code receives a set of input properties used with the Shipping Engine business service described in Service_PreInvokeMethod Event on page 289: var var var var sShipper = Inputs.GetProperty("Shipping Company"); dWeight = Val(Inputs.GetProperty("Weight")); dSize = Val(Inputs.GetProperty("Total Dimensions")); iZone = Val(Inputs.GetProperty("Zone"));
Related Topics For more information, see the following topics: GetFirstProperty Method for a Property Set on page 310 GetNextProperty Method for a Property Set on page 312 SetProperty Method for a Property Set on page 318
31 3
Used With Browser Script, COM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Related Topics For more information, see the following topics: GetValue Method for a Property Set on page 314 SetType Method for a Property Set on page 319
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
314
GetProperty Method for a Property Set on page 313 GetType Method for a Property Set on page 314 SetValue Method for a Property Set on page 320
Format oPropSet.InsertChildAt childObject, index Table 97 describes the arguments for the InsertChildAt method.
Table 97.
Arguments for the InsertChildAt Method Description The property set that Siebel CRM must make a child. It makes this property set a child of the property set that the oPropSet variable identifies. An integer that identifies the position at which Siebel CRM must insert the property set. The childObject argument identifies this property set.
Usage For more information, see How Siebel CRM Handles Indexing for Child Property Sets on page 309.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Format oPropSet.PropertyExists(propName) The arguments you can use with this format are the same as the arguments described in Table 85 on page 284.
31 5
Usage Because the GetProperty method returns an empty string for every nonexistent property, you can use the PropertyExists method in an If statement to determine if a specific property is set.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples For an example, see GetFirstProperty Method for a Property Set on page 310.
Format oPropSet.RemoveChild index Table 98 describes the arguments for the RemoveChild method.
Table 98.
Arguments for the RemoveChild Method Description An integer that identifies the index number of the child property set that Siebel CRM must remove.
Argument index
Usage For more information, see How Siebel CRM Handles Indexing for Child Property Sets on page 309.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples The following Siebel VB code fragment removes every child property set of a property set: Dim i As Integer for i = 0 to outputs.GetChildCount() outputs.RemoveChild(0) Next i
316
Related Topics For more information, see the following topics: AddChild Method for a Property Set on page 305 InsertChildAt Method for a Property Set on page 315
Format oPropSet.RemoveProperty propName The arguments you can use with this format are the same as the arguments described in Table 86 on page 286.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
31 7
Format oPropSet.setByteValue(value) Table 99 describes the arguments for the SetByteValue method.
Table 99.
Arguments for the SetByteValue Method Description The byte array that contains the value that Siebel CRM must set.
Argument value
Examples The following example uses a binary value as input and then provides a binary output. For more information, see GetByteValue Method for a Property Set on page 307: SiebelPropertySet input = new SiebelPropertySet(); SiebelPropertySet output = new SiebelPropertySet(); input.setProperty("ProcessName", "LMS3 Jason"); // XML to send String str="<?xml version=\"1.0\" encoding=\"UTF8\" ?><GetCommunicationDataInput><MemberID>20048963</MemberID></ GetCommunicationDataInput>"; // convert string to byte array byte [] bvalue = new String(str).getBytes(); input.setByteValue(bvalue); businessService.invokeMethod("RunProcess",input,output); // use getByteValue to return the value and put it in a String String out2 = new String (output.getByteValue()); System.out.println(out2);
Format oPropSet.SetProperty propName, propValue The arguments you can use with this format are the same as the arguments described in Table 87 on page 286.
318
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Examples This Siebel VB fragment uses the Shipping Engine business service: Dim Dim Set Set Svc As Service Inputs As PropertySet, Outputs As PropertySet Svc = TheApplication.GetService("Shipping Engine") Inputs = TheApplication.NewPropertySet() "Shipping Company", "Airline" "Weight", "12" "Total Dimensions", "48" "Shipping Method", "Second-Day Air"
Format oPropSet.SetType type Table 100 describes the arguments for the SetType method.
Table 100. Arguments for the SetType Method Argument type Description A string that contains data that Siebel CRM must store in the type attribute.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Related Topics For more information, see the following topics: GetType Method for a Property Set on page 314 SetValue Method for a Property Set on page 320
31 9
Format oPropSet.SetValue value Table 101 describes the arguments for the SetValue method.
Table 101. Arguments for the Arguments for the SetValue Method Argument value Description A string that contains data that Siebel CRM must store in the value attribute.
Used With Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server
Related Topics For more information, see the following topics: GetValue Method for a Property Set on page 314 SetProperty Method for a Property Set on page 318
Miscellaneous Methods
This topic describes other methods. It includes the following topics: GetErrorCode Method on page 320 GetErrorMessage Method on page 321 TheApplication Method on page 322
GetErrorCode Method
The GetErrorCode method returns a string that contains a numeric error code. For more information, see GetErrorMessage Method on page 321.
320
Examples The following example for the Siebel Java Data Bean returns the first record in the Account business component. If an error occurs, then the script displays the error code and error message: try { //Instantiate the Siebel Java Data Bean Sieb_dataBean = new SiebelDataBean(); String Cstr = "GatewayServer, EntServer, FINSObjMgr"; Sieb_dataBean.login(Cstr, "SADMIN", "SADMIN"); SiebelBusObject m_busObject = Sieb_dataBean.getBusObject("Account"); SiebelBusComp m_busComp = m_busObject.getBusComp("Account"); m_busComp.activateField("Name"); m_busComp.executeQuery(true); m_busComp.firstRecord(); Name = m_busComp.getFieldValue("Name"); System.out.println("Account Name : " + Name); m_busComp.release(); m_busComp = null; m_busObject.release(); m_busObject = null; Sieb_dataBean.logoff(); Sieb_dataBean = null; } catch (SiebelException e) { ErrorText = "Code: " + e.getErrorCode() + "\n" + "Description: " + e.getErrorMessage(); System.out.println("Error Occurred\n " + ErrorText); } ...
GetErrorMessage Method
The GetErrorMessage method returns a string that contains an error message. For more information, see GetErrorCode Method on page 320.
32 1
TheApplication Method
The theApplication method is a global method that returns a string that contains the name of an application object. This object is the root of objects in the Siebel Application Object hierarchy.
Usage You can use the theApplication method to determine the object reference of the Siebel application. You can then use this information to find other objects or to call a method on the application object. For example, if you use Siebel eScript to determine if you are logged in to a server database or local database, then you can use the following code: TheApplication().InvokeMethod("GetDataSource") Used With Browser Script, Server Script
Examples The following Siebel VB example returns the login name from the application object and creates the Employee business object: Dim oEmpBusObj as BusObject Dim sLoginName as String sLoginName = TheApplication.LoginName Set oEmpBusObj = TheApplication.GetBusObject("Employee") ... Set oEmpBusObj = Nothing
322
This chapter describes summary information for Browser Script. It includes the following topics: Applet Methods for Browser Script on page 323 Applet Events For Browser Script on page 324 Application Methods for Browser Script on page 325 Application Events for Browser Script on page 326 Business Component Methods for Browser Script Business Component Events for Browser Script on page 328 Business Object Methods for Browser Script on page 328 Business Service Methods for Browser Script on page 328 Business Service Events for Browser Script on page 329 Property Set Methods for Browser Script on page 330 Control Methods for Browser Script on page 331 Document Object Model Events You Can Use on page 332
Table 102. Summary of Applet Methods for Browser Script Method ActiveMode Method for an Applet BusComp Method for an Applet BusObject Method for an Applet Description Returns a string that contains the name of the current Web template mode. Returns the name of the business component that an applet references. Returns the name of the business object for the business component that an applet references. Format var oApplet; var mode = oApplet.ActiveMode(); var oApplet; var busComp = oApplet.BusComp(); var oApplet; var oBusObject = oApplet.BusObject();
32 3
Table 102. Summary of Applet Methods for Browser Script Method FindActiveXControl Method for an Applet Description Returns the name of a control that is a Document Object Model element. Returns the name of a control. Format var oApplet; var oControl; oControl = oApplet.FindActiveXControl (controlName as String); var oApplet; var oControl; oControl = oApplet.FindControl(controlName as String); var oApplet; var outPs; outPs = oApplet.InvokeMethod(MethodName as String, inputPropSet as PropertySet); var oApplet; var name = oApplet.Name();
Calls a method.
Table 103. Summary of Applet Events for Browser Script Event Applet_ChangeFieldValue Event Applet_ChangeRecord Event Applet_InvokeMethod Event Applet_Load Event Applet_PreInvokeMethod Event Description Starts if the user uses an applet to change data in a field. Starts if the user moves to a different record or view. Starts after a specialized method or after a custom method is called. Starts after Siebel CRM loads an applet and after it displays data. Siebel CRM calls this event immediately before it calls a specialized method on an applet. Format Applet_ChangeFieldValue (field, value) Applet_ChangeRecord() Applet_InvokeMethod (name, inputPropSet) Applet_Load() Applet_PreInvokeMethod (name, inputPropSet)
324
Table 104. Summary of Application Methods for Browser Script Method ActiveApplet Method for an Application ActiveBusComp Method for an Application ActiveBusObject Method for an Application ActiveViewName Method for an Application FindApplet Method for an Application GetProfileAttr Method for an Application GetService Method for an Application Description Returns the name of the active applet. Returns the name of the business component that the active applet references. Returns the name of the business object for the business component that the active applet references. Returns the name of the active view. Returns the name of an applet. Returns the name of an attribute in a user profile. Locates a business service. If this business service is not already running, then Siebel CRM starts it. Calls a method. Format var applet; applet = theApplication().ActiveApplet();
var
var viewName; viewName = theApplication().ActiveViewName(); var applet; applet = theApplication().FindApplet (appletName); var sAttr; sAttr = theApplication().GetProfileAttr(name); var svc; svc = theApplication().GetService (serviceName);
InvokeMethod Method for an Application Name Method for an Application NewPropertySet Method for an Application
var outPs; outPs = theApplication().InvokeMethod (methodName, methArg1, methArg2, methArgN); var appName; appName = theApplication().Name(); var PropSet; PropSet = theApplication().NewPropertySet();
Returns the name of the Siebel application. Creates a new property set.
32 5
Table 104. Summary of Application Methods for Browser Script Method SetProfileAttr Method for an Application ShowModalDialog Method for an Application SWEAlert Method for an Application Description Personalization uses this method to set a value for an attribute in a user profile. Allows you to display a dialog box with the cursor in the default state. Displays a modal dialog box that includes a message. Format theApplication().SetProfileAttr(name, value); theApplication().ShowModalDialog (url[, argin][, options]) theApplication().SWEAlert(message);
Table 105. Summary of Application Events for Browser Script Event Application_InvokeMethod Event Application_PreInvokeMethod Event Description Called after Siebel CRM calls a specialized method. Called after Siebel CRM calls a specialized method. Format Application_InvokeMethod (name, inputPropSet) Application_PreInvokeMethod (name, inputPropSet)
Table 106. Summary of Business Component Methods for Browser Script Method BusObject Method for a Business Component Description Returns the name of the business object that the business component references. Returns the value of a field from the current record of a business component. Format var busComp; var busObject; busObject = busComp.BusObject();
326
Table 106. Summary of Business Component Methods for Browser Script Method GetFormattedFieldValue Method for a Business Component Description Returns a field value that is in the same format that the Siebel client uses. Format var busComp; var sValue; sValue = busComp.GetFormattedFieldValue (fieldName); var busComp; var sExpr; sExpr = busComp.GetSearchExpr(); var busComp; var sSpec; sSpec = busComp.GetSearchSpec(fieldName); var busComp; var sReturn; sReturn = busComp.InvokeMethod(methodName,
GetSearchExpr Method for a Business Component GetSearchSpec Method for a Business Component
Returns the current search expression that is defined for the business component. Returns the search specification for a field.
Calls a method.
32 7
Table 107. Summary of Business Component Events for Browser Script Event BusComp_PreSetFieldValue Event Description Called if the user changes a value in the Siebel client. Format BusComp_PreSetFieldValue (fieldName, value)
Table 108. Summary of Business Object Methods for Browser Script Method GetBusComp Method for a Business Object Name Method for a Business Object Description Returns the name of a business component. Format var busObject; var busComp; busComp = busObject.GetBusComp(busCompName); Var sName; var busObject; sName = busObject.Name();
Table 109. Summary of Business Service Methods for Browser Script Method GetNextProperty Method for a Business Service GetProperty Method for a Business Service Description Returns the name of the next property of a business service. Returns the value of a property. Format var svc; var sName = svc.GetNextProperty(); var svc; var value; value = svc.GetProperty(name);
328
Table 109. Summary of Business Service Methods for Browser Script Method InvokeMethod Method for a Business Service Description Calls a method on a business service. Format var svc = TheApplication().GetService("Business Service"); var inputPropSet = TheApplication().NewPropertySet(); svc.InvokeMethod(methodName, inputPropSet); var svc; var name; name = svc.Name(); var svc; var bool; bool = svc.PropertyExists(name); var svc; svc.RemoveProperty(name); var svc; svc.SetProperty(name, value);
Name Method for a Business Service PropertyExists Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Returns the name of a business service. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service.
Table 110. Summary Business Service Events for Browser Script Method Service_InvokeMethod Event Description Called after Siebel CRM calls the InvokeMethod method on a business service. Called before Siebel CRM calls the PreInvokeMethod event. It allows you to determine if the user possesses the authority to call the business service method. Called before Siebel CRM calls a method on a business service. Format Service_InvokeMethod (methodName,input) Service_PreCanInvokeMethod (methodName)
Service_PreCanInvokeMethod Event
Service_PreInvokeMethod Event
32 9
Table 111. Summary of Property Set Methods for Browser Script Method AddChild Method for a Property Set Copy Method for a Property Set GetChild Method for a Property Set Description Adds a child property set to a property set. Returns a copy of a property set. Returns the index number of a child property set. Format var oPropSet; var iIndex; iIndex = oPropSet.AddChild(childObject); var oPropSet1; var oPropSet2; oPropSet2 = oPropSet1.Copy(); var oPropSet; var oChildPropSet; oChildPropSet = oPropSet.GetChild(index); var oPropSet; var iCount; iCount = oPropSet.GetChildCount();
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set
Returns the number of child property sets that exist for a parent property set Returns the name of the first property in a property set. Returns the name of the next property in a property set. Returns the value of a property. Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set.
var oPropSet; var sPropName; sPropName = oPropSet.GetFirstProperty(); var oPropSet; var sPropName; sPropName = oPropSet.GetNextProperty(); var oPropSet; var sValue; sValue = oPropSet.GetProperty(propName); var oPropSet; var iCount; iCount = oPropSet.GetPropertyCount();
var oPropSet; var type; type = oPropSet.GetType(); var oPropSet; var sValue; sValue = oPropSet.GetValue();
330
Table 111. Summary of Property Set Methods for Browser Script Method InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set Description Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set. Format var oPropSet; oPropSet.InsertChildAt(childObject, index); var oPropSet; var bool; bool = oPropSet.PropertyExists(propName); var oPropSet; oPropSet.RemoveChild(index); var oPropSet; oPropSet.RemoveProperty(propName); var oPropSet; oPropSet.Reset(); var oPropSet; oPropSet.SetProperty(propName, propValue); var oPropSet; oPropSet.SetType(value); var oPropSet; oPropSet.SetValue(value);
Table 112. Summary of Control Methods for Browser Script Method Applet Method for a Control BusComp Method for a Control Description Returns the name of the applet in which a control resides. Returns the name of the business component that an applet references. The control resides in this applet. Format var oControl; var oApplet; oApplet = oControl.Applet(); var oControl; var busComp; busComp = oControl.BusComp();
33 1
Table 112. Summary of Control Methods for Browser Script Method GetProperty Method for a Control GetValue Method for a Control Name Method for a Control SetProperty Method for a Control SetValue Method for a Control Description Returns the value of the property of a control. Format var oControl; var propVal; propVal = oControl.GetProperty( propName); var oControl; var sValue; sValue = oControl.GetValue(); var oControl; var sName; sName = oControl.Name(); var oControl; oControl.SetProperty(propName, propValue); var oControl; oControl.SetValue(value);
Note that scriptable events are not available for List Column and Tree controls.
Table 113. Document Object Model Events You Can Use in High Interactivity Control Button CheckBox Link List Column Mailto Siebel Control Type Native Native Native Native Native Description None Rendered as Input Type is CHECKBOX. Rendered through paired anchor tags or as INPUT TYPE is TEXT in edit mode. None Rendered as anchor tags with HREF is mailto or as INPUT TYPE is TEXT in Edit mode.
332
Table 113. Document Object Model Events You Can Use in High Interactivity Control MiniButton Password Text Siebel Control Type Native Native Native Description None Rendered as Input Type is password. Rendered as INPUT TYPE is TEXT or as SELECT if attached to a picklist. If there is a pop-up window, then Siebel CRM renders it as an edit box plus a button. Rendered as TEXTAREA. None Rendered through paired anchor tags with an HREF equal to the underlying field value or as INPUT TYPE is TEXT in edit mode.
NOTE: You cannot access a Siebel object from a Document Object Model event. Business components and applets are examples of Siebel objects. You can typically call code in the General section from anywhere in an object. However, you cannot call code written in the General section from a Document Object Model event. To associate a script with the control_OnClick event in high interactivity mode only, use the Applet_PreInvokeMethod event that is associated with the applet. For more information, see Using a MiniButton Control to Call a Custom Method on page 76.
33 3
Table 114. Document Object Model Events You Can Use in Standard Interactivity Control Button Event You can use the following events: CheckBox OnBlur (Base/Edit) OnFocus (Base/Edit) OnMouseOut (Base/Edit) OnMouseOver (Base/Edit) Siebel CRM renders a CheckBox control in the following ways: In Base mode, as a Y or N text value In Edit mode, as Input Type is CHECKBOX Description Not applicable
You can use the following events: OnBlur (Base/Edit) OnChange (Edit) OnFocus (Edit) OnMouseOut (Edit) OnMouseOver(Edit)
Link
You can use the following events: OnBlur (Base/Edit) OnClick (Base/Edit) OnFocus (Base/Edit) OnMouseOut (Base/Edit) OnMouseOver (Base/Edit)
Siebel CRM renders a Link control in the following ways: In Base mode, through paired anchor tags In Edit mode, as INPUT TYPE is TEXT
Mailto
You can use the following events: OnBlur (Base/Edit) OnChange (Edit) OnFocus (Base/Edit) OnMouseOut (Base/Edit) OnMouseOver (Base/Edit)
Siebel CRM renders a Mailto control in the following ways: In Base mode, as anchor tags with HREF is mailto In Edit mode, as INPUT TYPE is TEXT
334
Table 114. Document Object Model Events You Can Use in Standard Interactivity Control MiniButton Event You can use the following events: Password OnBlur (Base/Edit) OnClick (Base/Edit) OnFocus (Base/Edit) OnMouseOut (Base/Edit) OnMouseOver (Base/Edit) Siebel CRM renders a Password control in Edit mode as Input type is password. Description Not applicable
You can use the following events: OnBlur (Edit) OnChange (Edit) OnFocus (Edit) OnMouseOut (Edit) OnMouseOver (Edit)
Text
You can use the following events: OnBlur (Edit) OnChange (Edit) OnFocus (Edit) OnMouseOut (Edit) OnMouseOver (Edit)
Siebel CRM renders a Text control in the following ways: In base mode, as plain text, unless a popup window is associated with the control. In Edit mode, as INPUT TYPE is TEXT, unless the control is attached to a picklist. If the control is attached to a picklist, then Siebel CRM renders it as INPUT TYPE is SELECT.
TextArea
You can use the following events: OnBlur (Edit) OnChange (Edit) OnFocus (Edit) OnMouseOut (Base/Edit) OnMouseOver (Edit)
Siebel CRM renders a TEXTAREA control in the following ways: In base mode, as plain text, unless a popup window is associated with the control In Edit mode, as INPUT TYPE is TEXTAREA
URL
You can use the following events: OnBlur (Base/Edit) OnChange (Edit) OnFocus (Base/Edit) OnMouseOut (Base/Edit) OnMouseOver (Base/Edit)
Siebel CRM renders a TEXTAREA control in the following ways: In Base mode, through paired anchor tags with an HREF that is the underlying field value In Edit mode, as INPUT TYPE is TEXT
33 5
Table 114. Document Object Model Events You Can Use in Standard Interactivity Control Tree List Column Event Scriptable events are not available. Description Not applicable
336
This chapter describes summary information for Siebel VB. It includes the following topics: Applet Methods for Siebel VB on page 337 Web Applet Events for Siebel VB on page 338 Application Methods for Siebel VB on page 339 Application Events for Siebel VB on page 341 Business Component Methods for Siebel VB on page 342 Business Component Events for Siebel VB on page 346 Business Object Methods for Siebel VB Business Service Methods for Siebel VB on page 349 Business Service Events for Siebel VB on page 350 Property Set Methods for Siebel VB on page 351 Miscellaneous Methods for Siebel VB on page 352
Table 115. Summary of Applet Methods for Siebel VB Method BusComp Method for an Applet BusObject Method for an Applet InvokeMethod Method for an Applet Description Returns the name of the business component that an applet references. Returns the name of the business object for the business component that the applet references. Calls a specialized method. Format Dim oApplet as Applet Dim oBusComp as BusComp Set oBusComp = oApplet.BusComp Dim oApplet as Applet Dim oBusObject as BusObject Set oBusObject = oApplet.BusObject Dim oApplet as Applet oApplet.InvokeMethod methodName as String, methArg1, methArg2,
33 7
Table 116. Summary of Web Applet Events for Siebel VB Event WebApplet_InvokeMet hod Event WebApplet_PreCanInv okeMethod Event Description Called after Siebel CRM runs a specialized method on the Web applet. Called before Siebel CRM calls the PreInvokeMethod event, allowing you to determine if the user possesses the authority to call the applet method. Called before Siebel CRM calls a specialized method for the Web applet or before it calls a custom method through oWebApplet.Invoke Method. Called immediately after Siebel CRM loads an applet. Allows a script to modify the HTML that the Siebel Web Engine creates when it renders a control on a Web page in a Siebel application that runs in standard interactivity mode. Allows a script to modify the HTML that the Siebel Web Engine creates when it renders a list column on a Web page in a Siebel application that runs in standard interactivity mode. Format WebApplet_InvokeMethod(Meth odName as String) WebApplet_PreCanInvokeMetho d (MethodName as String, CanInvoke as String) WebApplet_PreInvokeMethod (MethodName as String) As Integer
WebApplet_Load WebApplet_ShowControl (controlName as String, property as String, mode as String, HTML as String)
338
Table 117. Summary of Application Methods for Siebel VB Method ActiveBusObject Method for an Application ActiveViewName Method for an Application CurrencyCode Method for an Application GetBusObject Method for an Application Description Returns the name of the business object of the active view. Returns the name of the active view. Returns the currency code that is associated with the division of the user position Creates a new instance of a business object. Format Dim oApplication as Application Dim oBusObject as BusObject Set oBusObject = oApplication.ActiveBusObject Dim oApplication as Application Dim sView as String sView = oApplication.ActiveViewName Dim oApplication as Application Dim sCur as String sCur = oApplication.CurrencyCode Dim oApplication as Application Dim oBusObject as BusObject set oBusObject = oApplication.GetBusObject (busobject as String) Dim oApplication as Application Dim sAttr as String SAttr = oApplication.GetProfileAttr(name as String) Dim oApplication as Application Dim oService as Service set oService = oApplication.GetService(serviceName as String) Dim oApplication as Application Dim sName as String sName = Application.GetSharedGlobal(varName as String)
Locates a business service. If this business service is not already running, then Siebel CRM starts it. Returns the shared global variables.
33 9
Table 117. Summary of Application Methods for Siebel VB Method GotoView Method for an Application Description Does the following: Deactivates any business object, business component, applet, or control that is active. Activates a view. Activates the primary applet of the view and the business component that this applet references. Activates the first tab sequence control of the primary applet Dim oApplication as Application oApplication.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim oApplication as Application Dim sID as String iID = oApplication.LoginId Dim oApplication as Application Dim sUser as String sUser = oApplication.LoginName Dim oApplication as Application Dim oPropSet as PropertySet oPropSet = oApplication.NewPropertySet Dim oApplication as Application Dim sRow as String sRow = oApplication.PositionId Dim oApplication as Application Dim sPosition as String sPosition = oApplication.PositionName Dim oApplication as Application oApplication.RaiseError keyValue as String, param1 as String, ... Format Dim oApplication as Application oApplication.GotoView viewName as String[, BusinessObjectName as BusObject]
InvokeMethod Method for an Application LoginId Method for an Application LoginName Method for an Application NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application RaiseError Method for an Application
Calls a method.
Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started the Siebel application. Creates a new property set.
Returns the name of the current user position. Returns the name of the current user position. Sends a scripting error message to the browser. To determine the error text, Siebel CRM uses a key to look up the current language. Sends a scripting error message to the browser.
340
Table 117. Summary of Application Methods for Siebel VB Method SetPositionId Method for an Application SetPositionName Method for an Application SetProfileAttr Method for an Application SetSharedGlobal Method for an Application Trace Method for an Application TraceOff Method for an Application TraceOn Method for an Application Description Sets the active position to a Position Id. Sets the active position to a position name. Sets a value for an attribute in a user profile. Sets a shared global variable. Format Dim oApplication as Application oApplication.SetPositionId posId as string Dim oApplication as Application oApplication.SetPositionName posName as string Dim oApplication as Application oApplication.SetProfileAttr name as String, value as String Dim oApplication as Application oApplication.SetSharedGlobal varName as String, value as String Dim oApplication as Application oApplication.Trace message as String Dim oApplication as Application oApplication.TraceOff Dim oApplication as Application oApplication.TraceOn filename as String, type as String, selection as String
Appends a message to the trace file. Turns off tracing. Turns on tracing.
Table 118. Summary of Application Events for Siebel VB Event Application_Close Event Application_Navigate Event Application_InvokeMe thod Event Application_PreInvoke Method Event Description Allows scripts to perform cleanup, before the Siebel application closes. Called after the user navigates to a view. Called after a specialized method is called. Called before an applet menu or the InvokeMethod method calls a specialized method. Format Application_Close
34 1
Table 118. Summary of Application Events for Siebel VB Event Application_PreNaviga te Event Application_Start Event Description Called before the Siebel application displays the view to which the user navigates. Called when the Siebel client starts and again when it displays the client interface for the first time. Format Application_PreNavigate (DestViewName As String, DestBusObjName As String) Application_Start(commandLine as String)
Table 119. Summary of Business Component Methods for Siebel VB Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component Description Activates a field. Format Dim oBusComp as BusComp oBusComp.ActivateField fieldName as String Dim oBusComp as BusComp oBusComp.ActivateMultipleFields oPropSet as PropertySet Dim oBusComp as BusComp oBusComp.Associate whereIndicator as Integer
Creates a new many-to-many relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on the business component. Deactivates the fields that are currently active from the SQL query statement of a business component.
Dim oBusComp as BusComp Dim oBusObject as BusObject Set oBusObject = oBusComp.BusObject Dim oBusComp as BusComp oBusComp.ClearToQuery
342
Table 119. Summary of Business Component Methods for Siebel VB Method DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component ExecuteQuery2 Method for a Business Component Description Removes the current record from a business component. Returns a set of business component records. Returns a set of business component records. Allows you to control the number of records Siebel CRM returns. Moves the record pointer to the first record in a business component, making that record the current record. Makes the first record of the multiple selection in a business component active. Returns the name of the association business component. Returns the value of a field from the current record of a business component. Format Dim oBusComp as BusComp oBusComp.DeleteRecord Dim oBusComp as BusComp oBusComp.ExecuteQuery cursorMode as Integer Dim oBusComp as BusComp oBusComp.ExecuteQuery2 cursorMode as Integer, ignoreMaxCursorSize as Integer Dim oBusComp as BusComp Dim iIsRecord as Integer iIsRecord = oBusComp.FirstRecord
Dim oBusComp as BusComp Dim iIsMultipleSection as Integer iIsMultipleSelection = oBusComp.FirstSelected Dim oBusComp as BusComp Dim AssocBusComp as BusComp Set AssocBusComp = oBusComp.GetAssocBusComp Dim oBusComp as BusComp Dim sValue as String sValue = oBusComp.GetFieldValue(FieldName as String) Dim oBusComp as BusComp Dim sValue as String sValue = oBusComp.GetFormattedFieldValue(F ieldName as String) Dim oBusComp as BusComp oBusComp.GetMultipleFieldValues oFields as PropertySet, oValues as PropertySet Dim oBusComp as BusComp Dim MvgBusComp as BusComp set MvgBusComp = oBusComp.GetMVGBusComp(FieldName as String)
GetAssocBusComp Method for a Business Component GetFieldValue Method for a Business Component
A field value that is in the same format that the Siebel client uses.
GetMultipleFieldValues Method for a Business Component GetMVGBusComp Method for a Business Component
Returns the multi-value group business component associated a business component field.
34 3
Table 119. Summary of Business Component Methods for Siebel VB Method GetNamedSearch Method for a Business Component Description Returns the name of a search specification. Format Dim oBusComp as BusComp Dim sValue as String sValue = oBusComp.GetNamedSearch(SearchNam e as String) Dim oBusComp as BusComp Dim pickBusComp as BusComp Set pickBusComp = oBusComp.GetPicklistBusComp(Field Name as String) Dim oBusComp as BusComp Dim sExpr as String sExpr = oBusComp.GetSearchExpr Dim oBusComp as BusComp Dim sSpec as String sSpec = oBusComp.GetSearchSpec(FieldName as String) Dim sSortSpec as String sSortSpec = GetSortSpec Dim oBusComp as BusComp Dim sValue as String sValue = oBusComp.GetUserProperty(property Name as String) Dim oBusComp as BusComp Dim iMode as Integer iMode = oBusComp.GetViewMode Dim oBusComp as BusComp oBusComp.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim oBusComp as BusComp Dim iReturn as Integer iReturn = oBusComp.LastRecord Dim oBusComp as BusComp Dim sName as String sName = oBusComp.Name Dim oBusComp as BusComp oBusComp.NewRecord whereIndicator as Integer
Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component. Returns the search specification for a field.
GetSearchExpr Method for a Business Component GetSearchSpec Method for a Business Component
GetSortSpec Method for a Business Component GetUserProperty Method for a Business Component
Returns the sort specification for a business component. Returns the value of a user property.
GetViewMode Method for a Business Component InvokeMethod Method for a Business Component
Returns the current visibility mode for a business component. Calls a method.
LastRecord Method for a Business Component Name Method for a Business Component NewRecord Method for a Business Component
Moves the record pointer to the last record in a business component. Returns the name of a business component. Adds a new record to a business component.
344
Table 119. Summary of Business Component Methods for Siebel VB Method NextRecord Method for a Business Component Description Moves the record pointer to the next record in a business component, making that record the current record. Makes the next record of the current multiple selection the active record. Returns the name of the parent business component. Format Dim oBusComp as BusComp Dim iReturn as Integer iReturn = oBusComp.NextRecord
NextSelected Method for a Business Component ParentBusComp Method for a Business Component
Dim oBusComp as BusComp Dim iReturn as Integer iReturn = oBusComp.NextSelected Dim oBusComp as BusComp Dim parentBusComp as BusComp Set parentBusComp = oBusComp.ParentBusComp Dim oBusComp as BusComp oBusComp.Pick
Places the currently chosen record in a pick business component into the appropriate fields of the parent business component. Moves the record pointer to the previous record in a business component. Refines a query. Sets a new value for a field in the current record of a business component. Sets the new value to a field for the current record of a business component. Sets new values in the fields of the current record of a business component. Sets the named search specification on a business component. Sets a search expression for a business component rather than for each field. Sets the search specification for a field.
PreviousRecord Method for a Business Component RefineQuery Method for a Business Component SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component
Dim oBusComp as BusComp Dim iReturn as Integer iReturn = oBusComp.PreviousRecord Dim oBusComp as BusComp oBusComp.RefineQuery Dim oBusComp as BusComp oBusComp.SetFieldValue FieldName as String, FieldValue as String Dim oBusComp as BusComp oBusComp.SetFormattedFieldValue FieldName as String, FieldValue as String Dim oBusComp as BusComp oBusComp.SetMultipleFieldValues oPropSet as PropertySet Dim oBusComp as BusComp oBusComp.SetNamedSearch searchName as String, searchSpec as String Dim oBusComp as BusComp oBusComp.SetSearchExpr searchSpec as String Dim oBusComp as BusComp oBusComp.SetSearchSpec fieldName as String, searchSpec as String
SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component
34 5
Table 119. Summary of Business Component Methods for Siebel VB Method SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component Description Sets the sort specification for a business component. Sets the value of a user property in a business component. Sets the visibility type for a business component. Reverses any unsaved changes that Siebel CRM has made on a record. Saves to the Siebel database any changes made to the current record. Format Dim oBusComp as BusComp oBusComp.SetSortSpec sortSpec as String Dim oBusComp as BusComp oBusComp.SetUserProperty propertyName as String, newValue as String Dim oBusComp as BusComp oBusComp.SetViewMode viewMode as Integer Dim oBusComp as BusComp oBusComp.UndoRecord Dim oBusComp as BusComp oBusComp.WriteRecord
SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component
Table 120. Summary of Business Component Events for Siebel VB Event BusComp_Associate Event Description Called if the user adds a business component record to create an association. Called if a business component record becomes the current record. Called if the user copies a business component record, and if the user makes this record the active record. Called if the user deletes a business component record. Called if Siebel CRM calls the InvokeMethod method on a business component. Format BusComp_Associate
BusComp_ChangeRecord
BusComp_CopyRecord
346
Table 120. Summary of Business Component Events for Siebel VB Event BusComp_NewRecord Event Description Called if the user creates a business component record, and if the user makes this record the active record. You can use this event to set up default values for a field. Called if Siebel CRM detects that the user is about to add a business component record to create an association. Called if Siebel CRM detects that the user is about to copy a business component record. You can use this event to perform precopy validation. Called if Siebel CRM detects that the user is about to delete a business component record. You can use this event to prevent the deletion or to perform any actions before Siebel CRM deletes the record. Called if a user accesses a business component field. Format BusComp_NewRecord
BusComp_PreAssociate Event
BusComp_PreAssociate
BusComp_PreCopyRecord Event
BusComp_PreCopyRecord
BusComp_PreDeleteRecord Event
BusComp_PreDeleteRecord
BusComp_PreGetFieldValue Event
34 7
Table 120. Summary of Business Component Events for Siebel VB Event BusComp_PreInvokeMethod Event Description Called if Siebel CRM calls a specialized method on a business component. Siebel CRM calls it before it calls this specialized method. Called if Siebel CRM detects that the user is about to create a new business component record. You can use this event to perform preinsert validation. Siebel CRM calls the BusComp_PreQuery event before it runs a query. You can use this event to modify the search criteria or to restrict Siebel CRM from running certain queries. Siebel CRM calls this event after the user changes a field value or after a call to the SetFieldValue method occurs. This event allows you to use custom validation before Siebel CRM applies predefined validation. Called before Siebel CRM writes a record to the Siebel database. Called after Siebel CRM completes a query but before it displays the query results. Called if Siebel CRM sends a value to a business component from the Siebel client or through a call to the SetFieldValue method. Called after Siebel CRM saves the record to the Siebel database. Format BusComp_PreInvokeMethod (methodName as String)
BusComp_PreNewRecord Event
BusComp_PreNewRecord
BusComp_PreQuery Event
BusComp_PreQuery
BusComp_PreSetFieldValue Event
BusComp_PreWriteRecord
BusComp_Query
BusComp_SetFieldValue Event
BusComp_WriteRecord Event
BusComp_WriteRecord
348
Table 121. Summary of Business Object Methods for Siebel VB Method GetBusComp Method for a Business Object Description Returns the name of a business component instance. Format Dim oBusObject as BusObject Dim oBusComp as BusComp set oBusComp = BusObject.GetBusComp(BusCompName as String) Dim oBusObject as BusObject Dim sName as String sName = oBusObject.Name
Table 122. Summary of Business Service Methods for Siebel VB Method GetFirstProperty Method for a Business Service GetNextProperty Method for a Business Service GetProperty Method for a Business Service Description Returns the name of the first property that is defined for a business service. Returns the name of the next property of a business service. Returns the value of a property. Format Dim oService as Service Dim sName as String sName = oService.GetFirstProperty Dim oService as Service Dim sName as String sName = oService.GetNextProperty Dim oService as Service Dim sValue as String sValue = oService.GetProperty(propName as String) Dim oService as Service oService.InvokeMethod(methodName as String, InputArguments as PropertySet, OutputArguments as PropertySet) Dim oService as Service Dim sName as String sName = oService.Name
34 9
Table 122. Summary of Business Service Methods for Siebel VB Method PropertyExists Method for a Business Service Description Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service. Format Dim oService as Service Dim iReturn as Boolean iReturn = oService.PropertyExists(propName as String) Dim oService as Service oService.RemoveProperty propName as String Dim oService as Service oService.SetProperty propName as String, propValue as String
RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Table 123. Summary of Business Service Events for Siebel VB Method Service_InvokeMethod Event Service_PreCanInvokeMetho d Event Description Siebel CRM calls this event after it calls the InvokeMethod method. Siebel CRM calls this event before it calls the PreInvokeMethod event. This configuration allows you to determine if the user possesses the authority to call the business service method. Siebel CRM calls this event before it calls a specialized method on a business service. Format Service_InvokeMethod (methodName as String) Service_PreCanInvokeMethod (methodName as String, CanInvoke As String)
Service_PreInvokeMethod Event
350
Table 124. Summary of Property Set Methods for Siebel VB Method AddChild Method for a Property Set Copy Method for a Property Set GetChild Method for a Property Set Description Adds a child property set to a property set. Returns a copy of a property set. Returns a child property set of a property set. Format Dim oPropSet as PropertySet oPropSet.AddChild childObject as PropertySet Dim oPropSet1 as PropertySet Dim oPropSet2 as PropertySet set oPropSet2 = oPropSet1.Copy Dim oPropSet as PropertySet Dim childPropSet as SiebelPropertySet set childPropSet = oPropSet.GetChild(index as Long) Dim oPropSet as PropertySet Dim iCount as Integer iCount = oPropSet.GetChildCount Dim oPropSet as PropertySet Dim sPropName as String sPropName = oPropSet.GetFirstProperty Dim oPropSet as PropertySet Dim sPropName as String sPropName = oPropSet.GetNextProperty Dim oPropSet as PropertySet Dim sPropVal as String sPropVal = oPropSet.GetProperty(propName as String) Dim oPropSet as PropertySet Dim count as Long count = oPropSet.GetPropertyCount Dim oPropSet as PropertySet Dim sTypeVal as String sTypeVal = oPropSet.GetType Dim oPropSet as PropertySet Dim sValVal as String sValVal = oPropSet.GetValue Dim oPropSet as PropertySet oPropSet.InsertChildAt childObject as SiebelPropertySet, index as Integer
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set
Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set. Returns the name of the next property in a property set. Returns the value of a property.
GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set InsertChildAt Method for a Property Set
Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set. Returns the value stored in the value attribute of a property set. Inserts a child property set in a parent property set at a specific location.
35 1
Table 124. Summary of Property Set Methods for Siebel VB Method PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set Description Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Sets a data value for the type attribute of a property set. Sets a data value for the value attribute of a property set. Format Dim oPropSet as PropertySet oPropSet.PropertyExists(propName as String) Dim oPropSet as PropertySet oPropSet.RemoveChild index as Integer Dim oPropSet as PropertySet oPropSet.RemoveProperty propName as String Dim oPropSet as PropertySet oPropSet.Reset Dim oPropSet as PropertySet oPropSet.SetProperty propName as String, propValue as String Dim oPropSet as PropertySet oPropSet.SetType value as String Dim oPropSet as PropertySet oPropSet.SetValue value as String
Table 125. Summary of Miscellaneous Methods for Siebel VB Method TheApplication Method Description Returns the name of an application object. Format TheApplication
352
This chapter describes summary information for Siebel eScript. It includes the following topics: Applet Methods for Siebel eScript on page 353 Web Applet Events for Siebel eScript on page 354 Application Methods for Siebel eScript on page 355 Application Events for Siebel eScript on page 357 Business Component Methods for Siebel eScript Business Component Events for Siebel eScript on page 362 Business Object Methods for Siebel eScript on page 364 Business Service Methods for Siebel eScript on page 365 Business Service Events for Siebel eScript on page 366 Property Set Methods for Siebel eScript Miscellaneous Methods for Siebel eScript on page 368
NOTE: The ST eScript engine is the default Siebel eScript scripting engine in Siebel CRM version 8.0 and later. For information about format differences between it and the traditional (T) engine, see Siebel eScript Language Reference.
Table 126. Summary of Applet Methods for Siebel eScript Method BusComp Method for an Applet BusObject Method for an Applet Description Returns the name of the business component that an applet references. Returns the name of the business object for the business component that an applet references. Format var applet; var myBusComp; myBusComp = applet.BusComp(); var applet; var busObject; busObject = applet.BusObject();
35 3
Table 126. Summary of Applet Methods for Siebel eScript Method InvokeMethod Method for an Applet Description Calls a specialized method. Format var applet; applet.InvokeMethod(methodName
Table 127. Summary of Web Applet Events for Siebel eScript Event WebApplet_InvokeMet hod Event WebApplet_Load Event WebApplet_PreCanInv okeMethod Event Description Siebel CRM calls this event after a specialized method on the Web applet runs. Siebel CRM calls this event immediately after it loads an applet. Called before Siebel CRM calls the PreInvokeMethod event, allowing you to determine if the user possesses the authority to call the applet method. Siebel CRM calls this event before it calls a specialized method for the Web applet or a custom method that it calls through the oWebApplet object of the InvokeMethod method. Allows a script to modify the HTML that the Siebel Web Engine creates when it renders a control on a Web page in a Siebel application that runs in standard interactivity mode. Allows a script to modify the HTML that the Siebel Web Engine creates when it renders a list column on a Web page in a Siebel application that runs in standard interactivity mode. Format WebApplet_InvokeMethod (MethodName) WebApplet_Load WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
WebApplet_PreInvokeMethod (MethodName)
WebApplet_ShowContr ol Event
354
Table 128. Summary of Application Methods for Siebel eScript Method ActiveBusObject Method for an Application ActiveViewName Method for an Application CurrencyCode Method for an Application GetBusObject Method for an Application Name Method for an Application GetService Method for an Application Description Returns the name of the business object that the active view references. Returns the name of the active view. Returns the currency code that is associated with the division of the user position. Creates a new instance of a business object. Format var busObject; busObject = TheApplication().ActiveBusObject(); var sView; sView = TheApplication().ActiveViewName(); var sCur; sCur = TheApplication().CurrencyCode(); var myBusObject; myBusObject = TheApplication().GetBusObject( BusObjectName); var name; name = TheApplication().Name(); var Service; Service = TheApplication().GetService (serviceName); var sName; sName = TheApplication().GetSharedGlobal (varName); TheApplication().GotoView( viewName[, BusinessObject]); TheApplication().InvokeMethod( methodName, methodArg1, methodArg2,..., methodArgn); var sID; sID = TheApplication().LoginId(); var sUser; sUser = TheApplication().LoginName();
Returns the name of the Siebel application. Locates a business service. If this business service is not already running, then Siebel CRM starts it. Returns the shared global variables.
GetSharedGlobal Method for an Application GotoView Method for an Application InvokeMethod Method for an Application LoginId Method for an Application LoginName Method for an Application
Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started Oracles Siebel application.
35 5
Table 128. Summary of Application Methods for Siebel eScript Method NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application RaiseError Method for an Application Description Creates a new property set. Format var oPropSet; oPropSet = TheApplication().NewPropertySet(); var sRow; sRow = TheApplication().PositionId(); var sPosition; sPosition = TheApplication().PositionName(); var keyVal; var arg1 ...; TheApplication().RaiseError(keyVal, arg1, );
Returns the position ID of the user position. Returns the name of the current user position. Sends a scripting error message to the browser. To determine the error text, Siebel CRM uses a key to look up the current language. Sends a scripting error message to the browser. Sets the active position to a position ID.
RaiseErrorText Method for an Application SetPositionId Method for an Application SetPositionName Method for an Application SetProfileAttr Method for an Application SetSharedGlobal Method for an Application Trace Method for an Application TraceOff Method for an Application TraceOn Method for an Application
var message; TheApplication().RaiseErrorText (message); var success; success = TheApplication().SetPositionId (posId); var success; success = TheApplication().SetPositionName (posName); TheApplication().SetProfileAttr (name, value); TheApplication().SetSharedGlobal (varName, value); TheApplication().Trace(message); TheApplication().TraceOff(); TheApplication().TraceOn(filename,
Personalization uses this method to set a value for an attribute in a user profile. Sets a shared global variable.
Appends a message to the trace file. Turns off tracing. Turns on tracing.
type, selection);
356
Table 129. Summary of Application Events for Siebel eScript Event Application_Close Event Application_InvokeMethod Event Application_Navigate Event Application_PreInvokeMethod Event Application_PreNavigate Event Description Called before the Siebel application exits. Called after a specialized method is called. Called after the user navigates to a view. Called before Siebel CRM calls a specialized method. Called before the Siebel application displays the view to which the user navigates. Called when the Siebel client starts. Format Application_Close() Application_InvokeMethod (methodName) Application_Navigate() Application_PreInvokeMethod (methodName) Application_PreNavigate (DestViewName, DestBusObjName)
Application_Start Event
Application_Start(commandLine)
Table 130. Summary of Business Component Methods for Siebel eScript Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Description Activates a field. Activates multiple fields. Format var myBusComp; myBusComp.ActivateField(fieldName); var myBusComp; myBusComp.ActivateMultipleFields(oPr opSet);
35 7
Table 130. Summary of Business Component Methods for Siebel eScript Method Associate Method for a Business Component Description Creates a new many-tomany relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on a business component. Deactivates the fields that are currently active from the SQL query statement of a business component. Removes the current record from a business component. Returns a set of business component records. Returns a set of business component records. Allows you to control the number of records Siebel CRM returns. Moves the record pointer to the first record in a business component, making that record the current record. Makes the first record of the multiple selection in a business component active. Returns the name of the association business component. Format var myBusComp; myBusComp.Associate(whereIndicator);
DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component ExecuteQuery2 Method for a Business Component
var myBusComp; myBusComp.DeleteRecord(); var myBusComp; myBusComp.ExecuteQuery(cursorMode); var myBusComp; myBusComp.ExecuteQuery2(cursorMode, ignoreMaxCursorSize);
var myBusComp; var bIsMultipleSelection; bIsMultipleSelection = myBusComp.FirstSelected(); var myBusComp; var AssocBusComp; AssocBusComp = myBusComp.GetAssocBusComp();
358
Table 130. Summary of Business Component Methods for Siebel eScript Method GetFieldValue Method for a Business Component Description Returns the value of a field from the current record of a business component. Returns a field value that is in the same format that the Siebel client uses. Format var myBusComp; var sValue; sValue = myBusComp.GetFieldValue(FieldName); var myBusComp; var sValue; sValue = myBusComp.GetFormattedFieldValue(Fie ldName); var myBusComp; myBusComp.GetMultipleFieldValues (oFields, oValues ); var myBusComp; var MvgBusComp; MvgBusComp= myBusComp.GetMVGBusComp(FieldName);
GetMultipleFieldValues Method for a Business Component GetMVGBusComp Method for a Business Component
Returns a value for each field specified in a property set. Returns the multi-value group business component that is associated a business component field. Returns the name of a search specification.
var myBusComp; var sValue; sValue = myBusComp.GetNamedSearch(SearchName) ; var myBusComp; var pickBusComp; pickBusComp = myBusComp.GetPicklistBusComp (FieldName); var myBusComp; var sExpr; sExpr = myBusComp.GetSearchExpr();
Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component. Returns the search specification that is defined for a business component. Returns the sort specification for a business component. Returns the value of a user property.
GetSortSpec Method for a Business Component GetUserProperty Method for a Business Component
35 9
Table 130. Summary of Business Component Methods for Siebel eScript Method GetViewMode Method for a Business Component InvokeMethod Method for a Business Component Description Returns the visibility mode for a business component. Calls a method. Format var myBusComp; var iMode; iMode = myBusComp.GetViewMode(); var myBusComp; var sReturn; sReturn = myBusComp.InvokeMethod(methodName, methodArg1, methodArg2,..., methodArgn); var myBusComp; var iReturn; iReturn = myBusComp.LastRecord(); var myBusComp; var sName; sName = myBusComp.Name(); var myBusComp; myBusComp.NewRecord(whereIndicator); var myBusComp; var bFound; bFound = myBusComp.NextRecord();
LastRecord Method for a Business Component Name Method for a Business Component NewRecord Method for a Business Component NextRecord Method for a Business Component
Moves the record pointer to the last record in a business component. Returns the name of a business component. Adds a new record to a business component. Moves the record pointer to the next record in a business component, making that record the current record. Makes the next record of the current multiple selection the active record. Returns the name of a parent business component. Places the currently chosen record in a pick business component into the appropriate fields of the parent business component. Moves the record pointer to the previous record in a business component, making that record the current record.
360
Table 130. Summary of Business Component Methods for Siebel eScript Method RefineQuery Method for a Business Component SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component Description Refines a query. Sets a new value in a field for the current record of a business component. Sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. Sets new values in the fields of the current record of a business component. Sets a named search specification on a business component. Sets a search expression for a business component. Sets the search specification for a business component. Sets the sort specification for a business component. Sets the value of a user property in a business component. Sets the visibility type for a business component. Reverses any unsaved changes made to the record. Saves to the Siebel database any changes made to the current record. Format var myBusComp; myBusComp.RefineQuery(); var myBusComp; myBusComp.SetFieldValue(FieldName, FieldValue); var myBusComp; myBusComp.SetFormattedFieldValue (FieldName, FieldValue);
SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component
var myBusComp; myBusComp.SetNamedSearch(searchName, searchSpec); var myBusComp; myBusComp.SetSearchExpr(searchSpec); var myBusComp; myBusComp.SetSearchSpec(FieldName, searchSpec); var myBusComp; myBusComp.SetSortSpec(sortSpec); var myBusComp; myBusComp.SetUserProperty (propertyName, newValue); var myBusComp; myBusComp.SetViewMode(viewMode); var myBusComp; myBusComp.UndoRecord(); var myBusComp; myBusComp.WriteRecord();
36 1
Table 131. Summary of Business Component Events for Siebel eScript Event BusComp_Associate Event Description Called if the user adds a business component record to create an association. Called if a business component record becomes the current record. Called if the user copies a business component record, and if the user makes this record the active record. Called if the user deletes a business component record. Called if Siebel CRM calls the InvokeMethod method on a business component. Called if the user creates a business component record, and if the user makes this record the active record. You can use this event to set up default values for a field. Called if Siebel CRM detects that the user is about to add a business component record to create an association. Called if Siebel CRM detects that the user is about to copy a business component record. You can use this event to perform precopy validation. Format BusComp_Associate()
BusComp_ChangeRecord Event
BusComp_ChangeRecord()
BusComp_CopyRecord Event
BusComp_CopyRecord()
BusComp_DeleteRecord Event
BusComp_DeleteRecord()
BusComp_InvokeMethod(methodName)
BusComp_NewRecord()
BusComp_PreAssociate Event
BusComp_PreAssociate()
BusComp_PreCopyRecord Event
BusComp_PreCopyRecord()
362
Table 131. Summary of Business Component Events for Siebel eScript Event BusComp_PreDeleteRecord Event Description Called if Siebel CRM detects that the user is about to delete a business component record. You can use this event to prevent the deletion or to perform any actions before Siebel CRM deletes the record. Called if a user accesses a business component field. Called if Siebel CRM calls a specialized method on a business component. Siebel CRM calls it before it calls this specialized method. Called if Siebel CRM detects that the user is about to create a new business component record. You can use this event to perform preinsert validation. Siebel CRM calls the BusComp_PreQuery event before it runs a query. You can use this event to modify the search criteria or to restrict Siebel CRM from running certain queries. Siebel CRM calls this event after the user changes a field value or after a call to the SetFieldValue method occurs. This event allows you to use custom validation before Siebel CRM applies predefined validation. Format BusComp_PreDeleteRecord()
BusComp_PreNewRecord Event
BusComp_PreNewRecord()
BusComp_PreQuery Event
BusComp_PreQuery()
BusComp_PreSetFieldValue Event
36 3
Table 131. Summary of Business Component Events for Siebel eScript Event BusComp_PreWriteRecord Event BusComp_Query Event Description Called before Siebel CRM writes a record to the Siebel database. Called after Siebel CRM completes a query but before it displays the query results. Called if Siebel CRM sends a value to a business component from the Siebel client or through a call to the SetFieldValue method. Called after Siebel CRM saves the record to the Siebel database. Format BusComp_PreWriteRecord()
BusComp_Query()
BusComp_SetFieldValue Event
BusComp_SetFieldValue(FieldName)
BusComp_WriteRecord Event
BusComp_WriteRecord()
Table 132. Summary of Business Object Methods for Siebel eScript Method GetBusComp Method for a Business Object Name Method for a Business Object Description Returns the name of a business component instance. Format var myBusObject; var myBusComp; myBusComp = myBusObject.GetBusComp(BusCompName); var myBusObject as BusObject; var sName; sName = myBusObject.Name();
364
Table 133. Summary of Business Service Methods for Siebel eScript Method GetFirstProperty Method for a Business Service GetNextProperty Method for a Business Service GetProperty Method for a Business Service Name Method for a Business Service InvokeMethod Method for a Business Service PropertyExists Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service Description Returns the name of the first property of a business service. Format var oService; var sName; sName = oService.GetFirstProperty(); var oService; var sName; sName = oService.GetNextProperty(); var oService; var sValue; sValue = oService.GetProperty(propName); var oService; var sName; sName = oService.Name(); var oService; oService.InvokeMethod(methodName, InputArguments, OutputArguments); var oService; var propExists; propExists = oService.PropertyExists( propName); var oService; oService.RemoveProperty(propName); var oService; oService.SetProperty(propName, propValue);
Returns the name of the next property of a business service. Returns the value of a property.
Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service.
36 5
Table 134. Summary of Business Service Events for Siebel eScript Method Service_InvokeMethod Event Description Siebel CRM calls this event after it calls the InvokeMethod method. Siebel CRM calls this event before it calls the PreInvokeMethod event. This configuration allows you to determine if the user possesses the authority to call the business service method. Siebel CRM calls this event before it calls a specialized method on a business service. Format Service_InvokeMethod (methodName) Service_PreCanInvokeMethod (MethodName, &CanInvoke)
Service_PreCanInvokeMethod Event
Service_PreInvokeMethod Event
Table 135. Summary of Property Set Methods for Siebel eScript Method AddChild Method for a Property Set Description Adds a child property set to a property set. Format var oPropSet; var iIndex; iIndex = oPropSet.AddChild( childObject); var oPropSet1; var oPropSet2; oPropSet2 = oPropSet1.Copy(); var oPropSet; var sPropVal; sPropVal = oPropSet.GetChild(index); var oPropSet; var iCount; iCount = oPropSet.GetChildCount();
Copy Method for a Property Set GetChild Method for a Property Set
Returns the number of child property sets that exist for a parent property set.
366
Table 135. Summary of Property Set Methods for Siebel eScript Method GetFirstProperty Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set Description Returns the name of the first property in a property set. Format var oPropSet; var sPropName; sPropName = oPropSet.GetFirstProperty(); var oPropSet; var sPropName sPropName = oPropSet.GetNextProperty(); var oPropSet; var sPropVal sPropVal = oPropSet.GetProperty(propName); var count; count = oPropSet.GetPropertyCount(); var oPropSet; var sTypeVal sTypeVal = oPropSet.GetType(value); var oPropSet; var sValVal; sValVal = oPropSet.GetValue(value); var oPropSet; oPropSet.InsertChildAt(childObject, index); Dim oService as SiebelService Dim propExists as Boolean propExists = oService.PropertyExists(propName) var oPropSet; oPropSet.RemoveChild(index); var oPropSet; oPropSet.RemoveProperty(propName); var oPropSet; oPropSet.Reset(); var oPropSet; oPropSet.SetProperty (propName, propValue);
GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set
Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set. Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set.
36 7
Table 135. Summary of Property Set Methods for Siebel eScript Method SetType Method for a Property Set SetValue Method for a Property Set Description Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set. Format var oPropSet; oPropSet.SetType(value); var oPropSet; oPropSet.SetValue(value);
Table 136. Summary of Miscellaneous Methods for Siebel eScript Method TheApplication Method Description Returns the name of the application object. Format TheApplication().Application_
method;
368
This chapter describes summary information for COM Data Server. It includes the following topics: Application Methods for COM Data Server on page 369 Business Component Methods for COM Data Server on page 372 Business Object Methods for COM Data Server on page 376 Business Service Methods for COM Data Server on page 377 Property Set Methods for COM Data Server on page 378
Table 137. Summary of Application Methods for COM Data Server Method CurrencyCode Method for an Application GetBusObject Method for an Application Description Returns the currency code that is associated with the division of the user position. Creates a new instance of a business object. Format Dim application as SiebelApplication Dim sCur as String sCur = Application.CurrencyCode(ErrCode as Integer) Dim application as SiebelApplication Dim busObject as SiebelBusObject set busObject = application.GetBusObject(busobjName as String, ErrCode as Integer) Dim application as SiebelApplication Dim sText as String sText = application.GetLastErrText(ErrCode as Integer) Dim application as SiebelApplication Dim sText as String sText = application.GetProfileAttr(Name as String)
Returns the text message for the error that Siebel CRM logged most recently.
36 9
Table 137. Summary of Application Methods for COM Data Server Method GetService Method for an Application Description Locates a business service. If this business service is not already running, then Siebel CRM starts it. Returns the shared global variables. Format Dim Application as SiebelApplication Dim Service as SiebelService set Service = Application.GetService(serviceName as String, ErrCode as Integer) Dim application as SiebelApplication Dim sName as String sName = application.GetSharedGlobal(varName as String, ErrCode as Integer) Dim application as SiebelApplication application.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim application as SiebelApplication application.LoadObjects(pathName\cfgFile Name as String, ErrCode as Integer) Dim application as SiebelApplication application.Login(userName as String, password as String, ErrCode as Integer)
InvokeMethod Method for an Application LoadObjects Method for an Application Login Method for an Application
Calls a method.
Allows an external application to log in to the COM Data Server, COM Data Control, or Siebel Java Data Bean, and to access Siebel objects. Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started the Siebel application. Creates a new property set.
Dim application as SiebelApplication Dim sID as String sID = application.LoginId(ErrCode as Integer) Dim application as SiebelApplication Dim sUser as String sUser = application.LoginName(ErrCode as Integer) Dim oApplication as SiebelApplication Dim oPropSet as SiebelPropertySet oPropSet = oApplication.NewPropertySet() Dim application as SiebelApplication Dim sRow as String sRow = application.PositionId(ErrCode as Integer) Dim application as SiebelApplication Dim sPosition as String sPosition = application.PositionName(ErrCode as Integer)
LoginName Method for an Application NewPropertySet Method for an Application PositionId Method for an Application
370
Table 137. Summary of Application Methods for COM Data Server Method SetPositionId Method for an Application Description Sets the active position to a position ID. Format Dim application as SiebelApplication Dim posId as String Dim status as Boolean status = application.SetPositionId(posId as String, ErrCode as Integer) Dim application as SiebelApplication Dim posName as String Dim status as Boolean status = application.SetPositionName(posName as String, ErrCode as Integer) Dim application as SiebelApplication application.SetProfileAttr(name as String, value as String, ErrCode as Integer) Dim application as SiebelApplication application.SetSharedGlobal(varName as String, value as String, ErrCode as Integer) Dim application as SiebelApplication application.Trace(message as String, ErrCode as Integer) Dim application as SiebelApplication application.TraceOff(ErrCode as Integer) Dim application as SiebelApplication application.TraceOn(filename as String, type as Integer, Selection as String, ErrCode as Integer)
SetProfileAttr Method for an Application SetSharedGlobal Method for an Application Trace Method for an Application TraceOff Method for an Application TraceOn Method for an Application
Personalization uses this method to set a value for an attribute in a user profile. Sets a shared global variable.
Appends a message to the trace file. Turns off tracing. Turns on tracing.
37 1
Table 138. Summary of Business Component Methods for COM Data Server Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component Description Activates a field. Format Dim busComp as SiebelBusComp busComp.ActivateField(fieldName as String, ErrCode as Integer) Dim buscomp as SiebelBusComp buscomp.ActivateMultipleFields(oPr opSet as SiebelPropertySet, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.Associate(whereIndicator as Integer, ErrCode as Integer)
Creates a new many-tomany relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on a business component. Deactivates the fields that are currently active from the SQL query statement of a business component. Removes the current record from a business component. Returns a set of business component records. Returns a set of business component records. Allows you to control the number of records Siebel CRM returns.
Dim busComp as SiebelBusComp Dim busObject as BusObject Set busObject = busComp.BusObject(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.ClearToQuery(ErrCode as Integer)
DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component ExecuteQuery2 Method for a Business Component
Dim busComp as SiebelBusComp busComp.DeleteRecord(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.ExecuteQuery(cursorMode as Boolean, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.ExecuteQuery2(cursorMode as Boolean, ignoreMaxCursorSize as Boolean, ErrCode as Integer)
372
Table 138. Summary of Business Component Methods for COM Data Server Method FirstRecord Method for a Business Component Description Moves the record pointer to the first record in a business component, making that record the current record. Makes the first record of the multiple selection in a business component active. Returns the name of the association business component. Format Dim busComp as SiebelBusComp Dim bIsRecord as Boolean bIsRecord = busComp.FirstRecord(ErrCode as Integer) Dim busComp as SiebelBusComp Dim iRecord as Integer iRecord = busComp.FirstSelected Dim busComp as SiebelBusComp Dim AssocBusComp as BusComp Set AssocBusComp = busComp.GetAssocBusComp(ErrCode as Integer) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFieldValue(FieldName as String, ErrCode as Integer) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFormattedFieldValue(Fie ldName as String, ErrCode as Integer) Dim buscomp as SiebelBusComp Dim retValue as Boolean retValue = buscomp.GetMultipleFieldValues(oPr opSetName as SiebelPropertySet, oPropSetValue as SiebelPropertySet, ErrCode as Integer) Dim busComp as SiebelBusComp Dim mVGBusComp as SiebelBusComp set mVGBusComp = busComp.GetMVGBusComp(FieldName as String, ErrCode as Integer) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetNamedSearch(SearchName as String, ErrCode as Integer)
FirstSelected Method for a Business Component GetAssocBusComp Method for a Business Component
Returns the value of a field from the current record of a business component.
Returns a field value that is in the same format that the Siebel client uses.
Returns the multi-value group business component that is associated a business component field. Returns the name of a search specification.
37 3
Table 138. Summary of Business Component Methods for COM Data Server Method GetPicklistBusComp Method for a Business Component Description Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component. Format Dim busComp as SiebelBusComp Dim pickBusComp as SiebelBusComp Set pickBusComp = busComp.GetPicklistBusComp(FieldNa me as String, ErrCode as Integer) Dim busComp as SiebelBusComp Dim sExpr as String sExpr = busComp.GetSearchExpr(ErrCode as Integer) Dim busComp as BusComp Dim sSpec as String sSpec = busComp.GetSearchSpec(FieldName as String, ErrCode as Integer) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetUserProperty(propertyNa me as String, ErrCode as Integer) Dim busComp as SiebelBusComp Dim iMode as Integer iMode = busComp.GetViewMode(ErrCode as Integer) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.LastRecord(ErrCode as Integer) Dim busComp as SiebelBusComp Dim sName as String sName = busComp.Name(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.NewRecord(whereIndicator as Integer, ErrCode as Integer) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.NextRecord(ErrCode as Integer)
NewRecord Method for a Business Component NextRecord Method for a Business Component
Adds a new record to a business component. Moves the record pointer to the next record in a business component, making that record the current record.
374
Table 138. Summary of Business Component Methods for COM Data Server Method ParentBusComp Method for a Business Component Description Returns the name of a parent business component. Format Dim busComp as SiebelBusComp Dim parentBusComp as SiebelBusComp Set parentBusComp = busComp.ParentBusComp(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.Pick(ErrCode as Integer)
Places the currently chosen record in a pick business component into the appropriate fields of the parent business component. Moves the record pointer to the previous record in a business component, making that record the current record. Refines a query.
Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.PreviousRecord(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.RefineQuery(ErrCode as Integer) Dim busComp as SiebelBusComp SetFieldValue(fieldname As String, fieldValue As string,errCode as Integer) Dim busComp as SiebelBusComp busComp.SetFormattedFieldValue(Fie ldName as String, FieldValue as String, ErrCode as Integer)
RefineQuery Method for a Business Component SetFieldValue Method for a Business Component
Sets a new value in a field for the current record of a business component.
Sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. Sets new values in the fields of the current record of a business component. Sets a named search specification on a business component. Sets a search expression for a business component. Sets the search specification for a business component.
SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component
Dim buscomp as SiebelBusComp buscomp.SetMultipleFieldValues(oPr opSet as SiebelPropertySet, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.SetNamedSearch(searchName as String, searchSpec as String, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.SetSearchExpr(searchSpec as String, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.SetSearchSpec(FieldName as String, searchSpec as String, ErrCode as Integer)
SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component
37 5
Table 138. Summary of Business Component Methods for COM Data Server Method SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component Description Sets the sort specification for a business component. Sets the value of a user property in a business component. Sets the visibility type for a business component. Reverses any unsaved changes made to the record. Saves to the Siebel database any changes made to the current record. Format Dim busComp as SiebelBusComp busComp.SetSortSpec(sortSpec as String, ErrCode as Integer) Dim busComp as SiebelBusComp busComp.SetUserProperty(propertyNa me as String, newValue as String, ErrCode as Integer) Dim buscomp as SiebelBusComp buscomp.SetViewMode(mode As Integer, errCode As Integer) Dim busComp as SiebelBusComp busComp.UndoRecord(ErrCode as Integer) Dim busComp as SiebelBusComp busComp.WriteRecord(ErrCode as Integer)
SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component
Table 139. Summary of Business Object Methods for COM Data Server Method GetBusComp Method for a Business Object Description Returns the name of a business component. Format Dim busObject as SiebelBusObject Dim busComp as SiebelBusComp set busComp = busObject.GetBusComp(BusCompName as String, ErrCode as Integer) Dim busObject as SiebelBusObject Dim sName as String sName = busObject.Name(ErrCode as Integer)
376
Table 140. Summary of Business Service Methods for COM Data Server Method GetFirstProperty Method for a Business Service Description Returns the name of the first property of a business service. Format Dim oService as SiebelService Dim sName as String sName = oService.GetFirstProperty(ErrCode as Integer) Dim oService as SiebelService Dim sName as String sName = oService.GetNextProperty(ErrCode as Integer) Dim oService as SiebelService Dim sValue as String sValue = oService.GetProperty(propName as String, ErrCode as Integer) Dim oService as SiebelService Dim sName as String sName = oService.Name Dim oService as SiebelService oService.InvokeMethod(methodName as String, InputArguments as SiebelPropertySet, OutputArguments as SiebelPropertySet, ErrCode as Integer) Dim oService as SiebelService Dim propExists as Boolean propExists = oService.PropertyExists( propName as String) Dim oService as SiebelService oService.RemoveProperty(propName as String, ErrCode as Integer) Dim oService as SiebelService oService.SetProperty(propName as String, propValue as String, ErrCode as Integer)
GetNextProperty Method for a Business Service GetProperty Method for a Business Service Name Method for a Business Service InvokeMethod Method for a Business Service
Returns the name of the next property of a business service. Returns the value of a property.
PropertyExists Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service.
37 7
Table 141. Summary of Property Set Methods for COM Data Server Method AddChild Method for a Property Set Description Adds child property sets to a property set. Format Dim oPropSet as SiebelPropertySet Dim iIndex as Integer iIndex = oPropSet.AddChild( childObject as Property Set, errCode as Integer) Dim oPropSet1 as SiebelPropertySet Dim oPropSet2 as SiebelPropertySet oPropSet2 = oPropSet1.Copy(ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim oChildPropSet as SiebelPropertySet oChildPropSet = oPropSet.GetChild( index as Integer, ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim iCount as Integer iCount = oPropSet.GetChildCount(ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetFirstProperty(ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetNextProperty(ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim sPropVal as String sPropVal = oPropSet.GetProperty(propName as String, ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim propCount as Integer propCount = oPropSet.GetPropertyCount (ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim sTypeVal as String sTypeVal = oPropSet.GetType(value as String)
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set
Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set.
GetPropertyCount Method for a Property Set GetType Method for a Property Set
Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set.
378
Table 141. Summary of Property Set Methods for COM Data Server Method GetValue Method for a Property Set Description Returns the value of the value attribute of a property set. Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Format Dim oPropSet as SiebelPropertySet Dim sValVal as String sValVal = oPropSet.GetValue(ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.InsertChildAt(childObject as String, index as Integer, ErrCode as Integer) Dim oPropSet as SiebelPropertySet Dim propExists as Boolean propExists = oPropSet.PropertyExists( propName as String, ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.RemoveChild(index as Integer, errCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.RemoveProperty(propName as String, ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.Reset(ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.SetProperty(propName as String, propValue as String, ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.SetType(value as String, ErrCode as Integer) Dim oPropSet as SiebelPropertySet oPropSet.SetValue(value as String, errCode as Integer)
InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set
SetType Method for a Property Set SetValue Method for a Property Set
Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set.
37 9
380
Table 142. Summary of Application Methods for COM Data Control Method Attach Method for an Application Description Allows an external application to reconnect to an existing Siebel session. Returns the currency code that is associated with the division of the user position. Returns a string that contains the Siebel session ID. Enables or disables native Component Object Model (COM) error handling. Creates a new instance of a business object. Format Dim application as SiebelDataControl Dim status as Boolean status = application.Attach(sessionID As String) Dim application as SiebelDataControl Dim sCur as String sCur = Application.CurrencyCode Dim application as SiebelDataControl Dim sessionId as String sessionId = application.Detach() Dim application as SiebelDataControl Dim bEnable as Boolean bEnable = true application.EnableExceptions(bEnable) Dim application as SiebelDataControl Dim busObject as SiebelBusObject set busObject = application.GetBusObject(busobjName as String)
CurrencyCode Method for an Application Detach Method for an Application EnableExceptions Method for an Application GetBusObject Method for an Application
38 1
Table 142. Summary of Application Methods for COM Data Control Method GetLastErrCode Method for an Application GetLastErrText Method for an Application GetProfileAttr Method for an Application Description Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of an attribute in a user profile. Format Dim application as SiebelDataControl Dim iErr as Integer iErr = application.GetLastErrCode Dim application as SiebelDataControl Dim sText as String sText = application.GetLastErrText Dim application as SiebelDataControl Dim sText as String sText = application.GetProfileAttr(profileAttr ibuteName as string) Dim application as SiebelDataControl Dim service as SiebelService set service = application.GetService( serviceName as String) Dim application as SiebelDataControl Dim sText as string sText = application.GetSharedGlobal(globalVari ableName as string) Dim application as SiebelDataControl Dim sReturn as String sReturn = application.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim application as SiebelDataControl Dim sErr as String sErr = application.Login(connectString as String, userName as String, password as String)
Locates a business service. If this business service is not already running, then Siebel CRM starts it. Returns the shared global variables.
Calls a method.
Allows an external application to log in to the COM Data Server, COM Data Control, or Siebel Java Data Bean, and to access Siebel objects. Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started the Siebel application. Disconnects the Siebel client from the Siebel Server.
LoginId Method for an Application LoginName Method for an Application Logoff Method for an Application
Dim application as SiebelDataControl Dim sID as String sID = application.LoginId Dim application as SiebelDataControl Dim sUser as String sUser = application.LoginName Dim SiebApp as SiebelDataControl Dim boolVal as Boolean boolVal = siebApp.LogOff
382
Table 142. Summary of Application Methods for COM Data Control Method NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application SetPositionId Method for an Application SetPositionName Method for an Application SetProfileAttr Method for an Application SetSharedGlobal Method for an Application Description Creates a new property set. Format Dim application as SiebelDataControl Dim PropSet as SiebelPropertySet PropSet = oApplication.NewPropertySet Dim application as SiebelDataControl Dim sRow as String sRow = application.PositionId Dim application as SiebelDataControl Dim sPosition as String sPosition = application.PositionName Dim application as SiebelDataControl Dim status as Boolean status = application.SetPositionId(sPosId) Dim application as SiebelDataControl Dim status as Boolean status = application.SetPositionName(sPosName) Dim application as SiebelDataControl application.SetProfileAttr(name as String, value as String) Dim SiebApp as SiebelDataControl Dim boolVal as Boolean boolVal = SiebApp.SetSharedGlobal(varName As String, value As String) Dim SiebApp as SiebelDataControl Dim boolVal as Boolean boolVal = siebApp.TraceOn(msg As String) Dim SiebApp as SiebelDataControl Dim boolVal as Boolean boolVal=siebApp.TraceOff Dim SiebApp as SiebelDataControl Dim boolVal as Boolean boolVal = siebApp.TraceOn(fileName As String, category As String, src As String)
Returns the position ID of the user position. Returns the name of the current user position. Sets the active position to a Position ID.
Personalization uses this method to set a value for an attribute in a user profile. Sets a shared global variable.
Turns on tracing.
38 3
Table 143. Summary of Business Component Methods for COM Data Control Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component Description Activates a field. Format Dim busComp as SiebelBusComp BusComp.ActivateField(fieldName as String) Dim busComp as SiebelBusComp busComp.ActivateMultipleFields(oP ropSet as SiebelPropertySet) Dim busComp as SiebelBusComp busComp.Associate(whereIndicator as Integer)
Creates a new many-to-many relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on a business component. Deactivates the fields that are currently active from the SQL query statement of a business component. Removes the current record from a business component. Returns a set of business component records. Returns a set of business component records. Allows you to control the number of records Siebel CRM returns.
DeactivateFields Method for a Business Component DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component ExecuteQuery2 Method for a Business Component
Dim busComp as SiebelBusComp busComp.DeleteRecord Dim buscomp as SiebelBusComp buscomp.ExecuteQuery(cursorMode As Integer) As Boolean Dim buscomp as SiebelBusComp buscomp.ExecuteQuery2(cursorMode As Integer,ignoreMaxCursorSize As Integer) As Boolean
384
Table 143. Summary of Business Component Methods for COM Data Control Method FirstRecord Method for a Business Component Description Moves the record pointer to the first record in a business component, making that record the current record. Returns the value of a field from the current record of a business component. Format Dim busComp as SiebelBusComp Dim bIsRecord as Boolean bIsRecord = busComp.FirstRecord
Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFieldValue(FieldName as String) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFormattedFieldValue (FieldName as String) Dim errCode As Integer Dim SiebApp as SiebelDataControl errCode=siebApp.GetLastErrCode Dim busComp as SiebelBusComp Dim sErr as String sErr = busComp.GetLastErrText Dim busComp as SiebelBusComp busComp.GetMultipleFieldValues (oFieldNames as SiebelPropertySet, oFieldValues as SiebelPropertySet) Dim busComp as SiebelBusComp Dim mVGBusComp as SiebelBusComp set mVGBusComp = busComp.GetMVGBusComp(FieldName as String) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetNamedSearch(SearchName as String) Dim busComp as SiebelBusComp Dim pickBusComp as SiebelBusComp Set pickBusComp = busComp.GetPicklistBusComp(FieldName as String) Dim busComp as SiebelBusComp Dim sExpr as String sExpr = busComp.GetSearchExpr
Returns a field value that is in the same format that the Siebel client uses.
GetLastErrCode Method for a Business Component GetLastErrText Method for an Application GetMultipleFieldValues Method for a Business Component
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns a value for each field specified in a property set.
Returns the multi-value group business component that is associated a business component field. Returns the name of a search specification.
Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component.
38 5
Table 143. Summary of Business Component Methods for COM Data Control Method GetSearchSpec Method for a Business Component Description Returns the search specification that is defined for a business component. Format Dim busComp as SiebelBusComp Dim sSpec as String sSpec = busComp.GetSearchSpec(FieldName as String) Dim buscomp as SiebelBusComp Dim retStr as String retStr = buscomp.GetUserProperty(prop As String) As String Dim busComp as SiebelBusComp Dim iMode as Integer iMode = busComp.GetViewMode Dim busComp as SiebelBusComp Dim sReturn as String sReturn = busComp.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.LastRecord Dim busComp as SiebelBusComp Dim sName as String sName = busComp.Name Dim busComp as SiebelBusComp busComp.NewRecord(whereIndicator as Integer) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.NextRecord
GetViewMode Method for a Business Component InvokeMethod Method for a Business Component
LastRecord Method for a Business Component Name Method for a Business Component NewRecord Method for a Business Component NextRecord Method for a Business Component
Moves the record pointer to the last record in a business component. Returns the name of a business component. Adds a new record to a business component. Moves the record pointer to the next record in a business component, making that record the current record. Returns the name of a parent business component.
ParentBusComp Method for a Business Component Pick Method for a Business Component
Dim busComp as SiebelBusComp Dim parentBusComp as SiebelBusComp Set parentBusComp = busComp.ParentBusComp Dim busComp as SiebelBusComp busComp.Pick
Places the currently chosen record in a pick business component into the appropriate fields of the parent business component.
386
Table 143. Summary of Business Component Methods for COM Data Control Method PreviousRecord Method for a Business Component RefineQuery Method for a Business Component SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component Description Moves the record pointer to the previous record in a business component, making that record the current record. Refines a query. Sets a new value in a field in the current record of a business component. Sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. Sets new values in the fields of the current record of a business component. Sets a named search specification on a business component. Sets a search expression for a business component. Sets the search specification for a business component. Sets the sort specification for a business component. Sets the value of a named user property. Format Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.PreviousRecord
Dim busComp as SiebelBusComp busComp.RefineQuery Dim busComp as SiebelBusComp busComp.SetFieldValue(FieldName as String, FieldValue as String) Dim busComp as SiebelBusComp busComp.SetFormattedFieldValue(Fi eldName as String, FieldValue as String)
SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component SetViewMode Method for a Business Component
Dim busComp as SiebelBusComp busComp.SetMultipleFieldValues (oPropSet as SiebelPropertySet) Dim busComp as SiebelBusComp busComp.SetNameSearch(searchName as String, searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSearchExpr(searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSearchSpec(FieldName as String, searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSortSpec(sortSpec as String) Dim buscomp as SiebelBusComp buscomp.SetUserProperty(propertyName as String, newValue as String) Dim buscomp as SiebelBusComp Dim boolVal as Boolean boolVal = buscomp.SetViewMode(mode As Integer)
38 7
Table 143. Summary of Business Component Methods for COM Data Control Method UndoRecord Method for a Business Component WriteRecord Method for a Business Component Description Reverses any unsaved changes made to the record. Saves to the Siebel database any changes made to the current record. Format Dim busComp as SiebelBusComp busComp.UndoRecord Dim busComp as SiebelBusComp busComp.WriteRecord
Table 144. Summary of Business Object Methods for COM Data Control Method GetBusComp Method for a Business Object Description Returns the name of a business component. Format Dim busObject as SiebelBusObject Dim busComp as SiebelBusComp set busComp = BusObject.GetBusComp(BusCompName as String) Dim busObject as SiebelBusObject Dim iErr as Integer iErr = busObject.GetLastErrCode Dim busObject as SiebelBusObject Dim sErr as String sErr = busObject.GetLastErrText Dim busObject as SiebelBusObject Dim sName as String sName = busObject.Name
GetLastErrCode Method for a Business Object GetLastErrText Method for a Business Object Name Method for a Business Object
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of a control.
388
Table 145. Summary of Business Service Methods for COM Data Control Method GetFirstProperty Method for a Business Service GetNextProperty Method for a Business Service GetProperty Method for a Business Service Description Returns the name of the first property of a business service. Returns the name of the next property of a business service. Returns the value of a property. Format Dim oService as SiebelService Dim sName as String sName = oService.GetFirstProperty() Dim oService as SiebelService Dim sName as String sName = oService.GetNextProperty() Dim oService as SiebelService Dim sValue as String sValue = oService.GetProperty(propName as String) Dim oService as SiebelService Dim sName as String sName = oService.Name Dim oService as SiebelService oService.InvokeMethod(methodName as String, InputArguments as SiebelPropertySet, OutputArguments as SiebelPropertySet) Dim oService as SiebelService Dim propExists as Boolean propExists = oService.PropertyExists( propName as String) Dim oService as SiebelService oService.RemoveProperty(propName as String) Dim oService as SiebelService oService.SetProperty(propName as String, propValue as String)
Name Method for a Business Service InvokeMethod Method for a Business Service
PropertyExists Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service.
38 9
Table 146. Summary of Property Set Methods for COM Data Control Method AddChild Method for a Property Set Description Adds child property sets to a property set. Format Dim oPropSet as SiebelPropertySet Dim iIndex as Integer iIndex = oPropSet.AddChild( childObject as Property Set) Dim oPropSet1 as SiebelPropertySet Dim oPropSet2 as SiebelPropertySet oPropSet2 = oPropSet1.Copy() Dim oPropSet as SiebelPropertySet Dim oPropSet1 as SiebelPropertySet oPropSet1 = oPropSet.GetChild(index as Integer) Dim oPropSet as SiebelPropertySet Dim iCount as Integer iCount = oPropSet.GetChildCount() Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetFirstProperty() Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetNextProperty() Dim oPropSet as SiebelPropertySet Dim sPropVal as String sPropVal = oPropSet.GetProperty(propName as String) Dim oPropSet as SiebelPropertySet Dim count as Long count = oPropSet.GetPropertyCount Dim oPropSet as SiebelPropertySet Dim sTypeVal as String sTypeVal = oPropSet.GetType() Dim oPropSet as SiebelPropertySet Dim sValVal as String sValVal = oPropSet.GetValue()
Copy Method for a Property Set GetChild Method for a Property Set
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set
Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set.
GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set
Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set.
390
Table 146. Summary of Property Set Methods for COM Data Control Method InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set Description Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set. Format Dim oPropSet as SiebelPropertySet oPropSet.InsertChildAt(childObject as SiebelPropertySet, index as Long) Dim oPropSet as Property Set Dim propExists as Boolean propExists = oPropSet.PropertyExists( propName as String) Dim oPropSet as SiebelPropertySet oPropSet.RemoveChild(index as Long) Dim oPropSet as SiebelPropertySet oPropSet.RemoveProperty(propName as String) Dim oPropSet as SiebelPropertySet oPropSet.Reset() Dim oPropSet as SiebelPropertySet oPropSet.SetProperty(propName as String, propValue as String) Dim oPropSet as SiebelPropertySet oPropSet.SetType(value as String) Dim oPropSet as SiebelPropertySet oPropSet.SetValue(value as String)
39 1
392
Siebel HTML Application Methods for the Web Client Automation Server
Table 147 describes a summary of Siebel HTML application methods you can use with the Web Client Automation Server. It does not include object interface methods that Siebel CRM does not call directly from an application instance. For information about methods that Siebel CRM calls with the InvokeMethod method on the application, see LoadObjects Method for an Application on page 148.
Table 147. Summary of Siebel HTML Application Methods for the Web Client Automation Server Method GetLastErrCode Method for an Application GetLastErrText Method for an Application GetService Method for an Application Description Returns the error code for the error that Siebel CRM logged most recently. Format Dim siebelApp As SiebelHTMLApplication Dim iErr as Long iErr = siebelApp.GetLastErrCode Dim siebelApp As SiebelHTMLApplication Dim sText as String sText = siebelApp.GetLastErrText Dim siebelApp As SiebelHTMLApplication Dim svc As SiebelService Set svc = siebelApp.GetService(ServiceName as String)
Returns the text message for the error that Siebel CRM logged most recently.
Locates a business service. If this business service is not already running, then Siebel CRM starts it.
39 3
Table 147. Summary of Siebel HTML Application Methods for the Web Client Automation Server Method Name Method for an Application Description Returns the name of the Siebel application. Format Dim siebelApp As SiebelHTMLApplication Dim name as String name = siebelApp.Name Dim siebelApp As SiebelHTMLApplication Dim propSet as SiebelPropertySet Set propSet = siebelApp.NewPropertySet
Table 148. Summary of Siebel Service Methods for the Web Client Automation Server Method GetNextProperty Method for a Business Service InvokeMethod Method for a Business Service Description Returns the name of the next property of a business service. Calls a method. Format Dim svc As SiebelService Dim iErr as Long iErr = svc.GetLastErrCode Dim svc As SiebelService svc.InvokeMethod(MethodName as
394
Table 149. Summary of Property Set Methods for the Web Client Automation Server Method AddChild Method for a Property Set Copy Method for a Property Set GetChild Method for a Property Set Description Adds child property sets to a property set. Returns a copy of a property set. Format Dim oPropSet as SiebelPropertySet oPropSet.AddChild(childObject as SiebelPropertySet) Dim oPropSet1 as SiebelPropertySet Dim oPropSet2 as SiebelPropertySet Set oPropSet2 = oPropSet1.Copy Dim oPropSet as SiebelPropertySet Dim oChildPropSet as SiebelPropertySet Set oChildPropSet = oPropSet.GetChild(index as Long) Dim oPropSet as SiebelPropertySet Dim iCount as Long iCount = oPropSet.GetChildCount Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetFirstProperty Dim oPropSet as SiebelPropertySet Dim iErr as Long iErr = oPropSet.GetLastErrCode Dim oPropSet as SiebelPropertySet Dim sText as String sText = oPropSet.GetLastErrText Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetNextProperty Dim oPropSet as SiebelPropertySet Dim sValue as String sValue = oPropSet.GetProperty(propName as String) Dim oPropSet as SiebelPropertySet Dim iCount as Long iCount = oPropSet.GetPropertyCount
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetLastErrCode Method for a Property Set GetLastErrText Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set
Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set.
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of the next property in a property set. Returns the value of a property.
Returns the number of properties that exist in the current level in the hierarchy.
39 5
Table 149. Summary of Property Set Methods for the Web Client Automation Server Method GetType Method for a Property Set GetValue Method for a Property Set InsertChildAt Method for a Property Set PropertyExists Method for a Property Set Description Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set. Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Format Dim oPropSet as SiebelPropertySet Dim type as String type = oPropSet.GetType Dim oPropSet as SiebelPropertySet Dim sValue as String sValue = oPropSet.GetValue Dim oPropSet as SiebelPropertySet oPropSet.InsertChildAt(childObject as SiebelPropertySet, index as Long) Dim oPropSet as SiebelPropertySet Dim bool as Boolean bool = oPropSet.PropertyExists(propName as String) Dim oPropSet as SiebelPropertySet oPropSet.RemoveChild(index as Long) Dim oPropSet as SiebelPropertySet oPropSet.RemoveProperty(propName as String) Dim oPropSet as SiebelPropertySet oPropSet.Reset Dim oPropSet as SiebelPropertySet oPropSet.SetProperty(propName as String, propValue as String) Dim oPropSet as SiebelPropertySet oPropSet.SetType(value as String) Dim oPropSet as SiebelPropertySet oPropSet.SetValue(value as String)
RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set
Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set.
396
Table 150. Summary of Application Methods for the Mobile Web Client Automation Server Method ActiveBusObject Method for an Application ActiveViewName Method for an Application CurrencyCode Method for an Application EnableExceptions Method for an Application Description Returns the name of the business object that the active view references. Returns the name of the active view. Returns the currency code that is associated with the division of the user position. Enables or disables native COM error handling. Format Dim application as SiebelWebApplication Dim busObject as SiebelBusObject Set busObject = application.ActiveBusObject Dim application as SiebelWebApplication Dim sView as String sView = application.ActiveViewName Dim application as SiebelWebApplication Dim sCur as String sCur = Application.CurrencyCode
39 7
Table 150. Summary of Application Methods for the Mobile Web Client Automation Server Method GetBusObject Method for an Application Description Creates a new instance of a business object. Format Dim application as SiebelWebApplication Dim busObject as SiebelBusObject set busObject = application.GetBusObject(busobjName as String) Dim application as SiebelWebApplication Dim iErr as Integer iErr = application.GetLastErrCode Dim application as SiebelWebApplication Dim sText as String sText = application.GetLastErrText Dim application as SiebelWebApplication Dim profValue as String profValue = application.GetProfileAttr(profName as String) Dim application as SiebelWebApplication Dim oService as SiebelService set oService = Application.GetService(serviceName as String) Dim application as SiebelWebApplication Dim name as String name = application.GetSharedGlobal (sName as String) Dim application as SiebelWebApplication application.InvokeMethod(methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim application as SiebelWebApplication Dim sErr as String sErr = application.Login(connectString as String, userName as String, password as String) Dim application as SiebelWebApplication Dim sID as string sID = application.LoginId Dim application as SiebelWebApplication Dim sUser as String sUser = application.LoginName
GetLastErrCode Method for an Application GetLastErrText Method for an Application GetProfileAttr Method for an Application
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of an attribute in a user profile.
Locates a business service. If this business service is not already running, then Siebel CRM starts it. Returns the shared global variables.
GetSharedGlobal Method for an Application InvokeMethod Method for an Application Login Method for an Application
Calls a method.
Allows external applications to log in to the Mobile Web Client Automation Server. Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started the Siebel application.
398
Table 150. Summary of Application Methods for the Mobile Web Client Automation Server Method Logoff Method for an Application NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application SetPositionId Method for an Application Description Disconnects the Siebel client from the Siebel Server. Creates a new property set. Returns the position ID of the user position. Returns the name of the current user position. Sets the active position to a Position ID. Format Dim application as SiebelWebApplication Dim status as Boolean Status = application.Logoff Dim application as SiebelWebApplication Dim propset As SiebelPropertySet set propset = application.NewPropertySet Dim application as SiebelWebApplication Dim sRow as String sRow = application.PositionId Dim application as SiebelWebApplication Dim sPosition as String sPosition = application.PositionName Dim application as SiebelWebApplication Dim posId as String Dim status as Boolean status = application.SetPositionId(posId) Dim application as SiebelWebApplication Dim posName as String Dim status as Boolean status = application.SetPositionName(posName) Dim oApplication as SiebelWebApplication Dim bool as Boolean bool = oApplication.SetProfileAttr(name as String, value as String) Dim application as SiebelWebApplication Dim bool as Boolean bool = application.SetSharedGlobal(varName as String, value as String) Dim application as SiebelWebApplication application.Trace(message as String) Dim application as SiebelWebApplication Dim bool as Boolean bool = application.TraceOff Dim application as SiebelWebApplication Dim bool as Boolean bool = application.TraceOn(filename as String, type as String, Selection as String)
Personalization uses this method to set a value for an attribute in a user profile. Sets a shared global variable.
Trace Method for an Application TraceOff Method for an Application TraceOn Method for an Application
Turns on tracing.
39 9
Business Component Methods for the Mobile Web Client Automation Server
Table 151 describes a summary of business component methods you can use with the Mobile Web Client Automation Server. It does not include object interface methods that Siebel CRM does not call directly from a business component instance. For information about methods that Siebel CRM calls with the InvokeMethod method on a business component, see Business Component Invoke Methods on page 250.
Table 151. Summary of Business Component Methods for the Mobile Web Client Automation Server Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component Description Activates a field. Format Dim busComp as SiebelBusComp BusComp.ActivateField(fieldName as String) Dim buscomp as SiebelBusComp buscomp.ActivateMultipleFields (oPropSet as SiebelPropertySet) Dim busComp as SiebelBusComp busComp.Associate(whereIndiSiebel cator as Integer)
Creates a new many-tomany relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on a business component. Deactivates the fields that are currently active from the SQL query statement of a business component. Removes the current record from a business component. Returns a set of business component records.
DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component
Dim busComp as SiebelBusComp Dim bool as Boolean bool = busComp.DeleteRecord Dim busComp as SiebelBusComp Dim bool as Boolean bool = busComp.ExecuteQuery(cursorMode as Integer)
400
Table 151. Summary of Business Component Methods for the Mobile Web Client Automation Server Method ExecuteQuery2 Method for a Business Component Description Returns a set of business component records. Allows you to control the number of records Siebel CRM returns. Format Dim busComp as SiebelBusComp Dim bool as Boolean bool = busComp.ExecuteQuery2(cursorMode as Integer, ignoreMaxCursorSize as Boolean) Dim busComp as SiebelBusComp Dim bIsRecord as Boolean bIsRecord = busComp.FirstRecord
Moves the record pointer to the first record in a business component, making that record the current record. Returns the name of the association business component. Returns the value of a field from the current record of a business component.
GetAssocBusComp Method for a Business Component GetFieldValue Method for a Business Component
Dim busComp as SiebelBusComp Dim AssocBusComp as SiebelBusComp Set AssocBusComp = busComp.GetAssocBusComp Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFieldValue(FieldName as String) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetFormattedFieldValue(Fi eldName as String) Dim buscomp as SiebelBusComp Dim iErr as Integer iErr = buscomp.GetLastErrCode Dim busComp as SiebelBusComp Dim sErr as String sErr = busComp.GetLastErrText Dim buscomp as SiebelBusComp buscomp.GetMultipleFieldValues(oP ropSet as SiebelPropertySet, PValues as SiebelPropertySet) Dim busComp as SiebelBusComp Dim mVGBusComp as SiebelBusComp set mVGBusComp = busComp.GetMVGBusComp(FieldName as String) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetNamedSearch(SearchName as String)
Returns a field value that is in the same format that the Siebel client uses.
GetLastErrCode Method for a Business Component GetLastErrText Method for a Business Component GetMultipleFieldValues Method for a Business Component GetMVGBusComp Method for a Business Component
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns a value for each field specified in a property set.
Returns the multi-value group business component that is associated a business component field. Returns the name of a search specification.
40 1
Table 151. Summary of Business Component Methods for the Mobile Web Client Automation Server Method GetPicklistBusComp Method for a Business Component Description Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component. Returns the search specification that is defined for a business component. Format Dim busComp as SiebelBusComp Dim pickBusComp as SiebelBusComp Set pickBusComp = busComp.GetPicklistBusComp(FieldN ame as String) Dim busComp as SiebelBusComp Dim sExpr as String sExpr = busComp.GetSearchExpr Dim busComp as SiebelBusComp Dim sSpec as String sSpec = busComp.GetSearchSpec(FieldName as String) Dim busComp as SiebelBusComp Dim sValue as String sValue = busComp.GetUserProperty(propertyN ame as String) Dim busComp as SiebelBusComp Dim iMode as Integer iMode = busComp.GetViewMode Dim busComp as SiebelBusComp Dim sReturn as String sReturn = busComp.InvokeMethod( methodName as String, methArg1, methArg2, methArgN as String or StringArray) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.LastRecord Dim busComp as SiebelBusComp Dim sName as String sName = busComp.Name Dim busComp as SiebelBusComp Dim bool as Boolean bool = busComp.NewRecord(whereIndicator as Integer) Dim busComp as SiebelBusComp Dim bReturn as Boolean bReturn = busComp.NextRecord
GetSearchExpr Method for a Business Component GetSearchSpec Method for a Business Component
GetViewMode Method for a Business Component InvokeMethod Method for a Business Component
LastRecord Method for a Business Component Name Method for a Business Component NewRecord Method for a Business Component
Moves the record pointer to the last record in a business component. Returns the name of a business component. Adds a new record to a business component.
Moves the record pointer to the next record in a business component, making that record the current record.
402
Table 151. Summary of Business Component Methods for the Mobile Web Client Automation Server Method ParentBusComp Method for a Business Component Description Returns the name of a parent business component. Format Dim busComp as SiebelBusComp Dim parentBusComp as SiebelBusComp Set parentBusComp = busComp.ParentBusComp Dim busComp as SiebelBusComp busComp.Pick
Places the currently chosen record in a pick business component into the appropriate fields of the parent business component. Moves the record pointer to the previous record in a business component, making that record the current record. Refines a query. Sets a new value in a field for the current record of a business component. Sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. Sets new values in the fields of the current record of a business component. Sets a named search specification on a business component. Sets the search expression for a business component. Sets the search specification for a business component. Sets the sort specification for a business component.
RefineQuery Method for a Business Component SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component
Dim busComp as SiebelBusComp busComp.RefineQuery Dim busComp as SiebelBusComp busComp.SetFieldValue(FieldName as String, FieldValue as String) Dim busComp as SiebelBusComp busComp.SetFormattedFieldValue(Fi eldName as String, FieldValue as String)
SetMultipleFieldValues Method for a Business Component SetNamedSearch Method for a Business Component SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component SetSortSpec Method for a Business Component
Dim buscomp as SiebelBusComp buscomp.SetMultipleFieldValues(oP ropSet as SiebelPropertySet) Dim busComp as SiebelBusComp busComp.SetNamedSearch(searchName as String, searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSearchExpr(searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSearchSpec(FieldName as String, searchSpec as String) Dim busComp as SiebelBusComp busComp.SetSortSpec(sortSpec as String)
40 3
Table 151. Summary of Business Component Methods for the Mobile Web Client Automation Server Method SetUserProperty Method for a Business Component SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component Description Sets the value of a user property in a business component. Sets the visibility type for a business component. Reverses any unsaved changes made to the record. Saves to the Siebel database any changes made to the current record. Format Dim busComp as SiebelBusComp busComp.SetUserProperty(propertyN ame as String, newValue as String) Dim buscomp as SiebelBusComp buscomp.SetViewMode(mode As Integer) Dim busComp as SiebelBusComp busComp.UndoRecord Dim busComp as SiebelBusComp busComp.WriteRecord
Business Object Methods for the Mobile Web Client Automation Server
Table 152 describes a summary of business object methods you can use with the Mobile Web Client Automation Server.
Table 152. Summary of Business Object Methods for the Mobile Web Client Automation Server Method GetBusComp Method for a Business Object Description Returns the name of a business component. Format Dim busObject as SiebelBusObject Dim busComp as SiebelBusComp set busComp = busObject.GetBusComp(BusCompName as String) Dim busobject as SiebelBusObject Dim iErr as Integer iErr = busobject.GetLastErrCode Dim busobject as SiebelBusObject Dim sValue as String sValue= busobject.GetLastErrText Dim busObject as SiebelBusObject Dim sName as String sName = busObject.Name
GetLastErrCode Method for a Business Object GetLastErrText Method for a Business Object Name Method for a Business Object
Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of the business object.
404
Business Service Methods for the Mobile Web Client Automation Server
Table 153 describes a summary of business service methods you can use with the Mobile Web Client Automation Server.
Table 153. Summary of Business Service Methods for the Mobile Web Client Automation Server Method GetFirstProperty Method for a Business Service GetNextProperty Method for a Business Service GetProperty Method for a Business Service InvokeMethod Method for a Business Service Description Returns the name of the first property of a business service. Returns the name of the next property of a business service. Returns the value of a property. Format Dim oService as SiebelService Dim sName as String sName = oService.GetFirstProperty Dim oService as SiebelService Dim sName as String sName = oService.GetNextProperty Dim oService as SiebelService Dim sValue as String sValue = oService.GetProperty(propName as String) Dim oService as SiebelService oService.InvokeMethod(methodName as String, InputArguments as SiebelPropertySet, OutputArguments as SiebelPropertySet) Dim oService as SiebelService Dim sName as String sName = oService.Name Dim oService as SiebelService Dim bool as Boolean bool = oService.PropertyExists(propName as String) Dim oService as SiebelService oService.RemoveProperty propName as String Dim oService as SiebelService oService.SetProperty(propName as String, propValue as String)
Calls a method.
Name Method for a Business Service PropertyExists Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service
Returns the name of a business service. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a property from a business service. Sets a value for a property of a business service.
40 5
Property Set Methods for the Mobile Web Client Automation Server
Table 154 describes a summary of the property set methods you can use with the Mobile Web Client Automation Server.
Table 154. Summary of Property Set Methods for the Mobile Web Client Automation Server Method AddChild Method for a Property Set Copy Method for a Property Set GetChild Method for a Property Set Description Adds child property sets to a property set. Returns a copy of a property set. Returns a child property set of a property set. Format Dim oPropSet as SiebelPropertyset oPropSet.AddChild(childObject as SiebelPropertySet) Dim oPropSet1 as SiebelPropertyset Dim oPropSet2 as SiebelPropertyset set oPropSet2 = oPropSet1.Copy Dim oPropSet as SiebelPropertySet Dim childPropSet as SiebelPropertySet set childPropSet = oPropSet.GetChild(index as Long) Dim oPropSet as SiebelPropertySet Dim iCount as Long iCount = oPropSet.GetChildCount
GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetLastErrCode Method for a Property Set GetLastErrText Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set
Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set. Returns the error code for the error that Siebel CRM logged most recently. Returns the text message for the error that Siebel CRM logged most recently. Returns the name of the next property in a property set. Returns the value of a property.
Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetFirstProperty Dim oPropSet as SiebelPropertySet Dim iErr as Integer iErr = oPropSet.GetLastErrCode Dim oPropSet as SiebelPropertySet Dim sValue as String sValue = oPropSet.GetLastErrText Dim oPropSet as SiebelPropertySet Dim sPropName as String sPropName = oPropSet.GetNextProperty Dim oPropSet as SiebelPropertySet Dim sPropVal as String sPropVal = oPropSet.GetProperty(propName as String) Dim oPropSet as SiebelPropertySet Dim lCount as Long lCount = oPropSet.GetPropertyCount
Returns the number of properties that exist in the current level in the hierarchy.
406
Table 154. Summary of Property Set Methods for the Mobile Web Client Automation Server Method GetType Method for a Property Set GetValue Method for a Property Set InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set Description Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set. Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets a value in the property of a property set. Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set. Format Dim oPropSet as SiebelPropertySet Dim sTypeVal as String sTypeVal = oPropSet.GetType Dim oPropSet as SiebelPropertySet Dim sValVal as String sValVal = oPropSet.GetValue Dim oPropSet as SiebelPropertySet oPropSet.InsertChildAt(childObject as SiebelPropertySet, index as Long) Dim oPropSet as SiebelPropertySet Dim bool as Boolean bool = oPropSet.PropertyExists(propName as String) Dim oPropSet as SiebelPropertySet oPropSet.RemoveChild(index as Long) Dim oPropSet as SiebelPropertySet oPropSet.RemoveProperty(propName as String) Dim oPropSet as SiebelPropertySet oPropSet.Reset Dim oPropSet as SiebelPropertySet oPropSet.SetProperty(propName as String, propValue as String) Dim oPropSet as SiebelPropertySet oPropSet.SetType(value as String) Dim oPropSet as SiebelPropertySet oPropSet.SetValue(value as String)
40 7
408
For more information about Siebel Java Data Bean, see the Javadoc files, which are contained in a file named Siebel_JavaDoc.jar. This file is typically located in the \siebsrvr\CLASSES directory.
Table 155. Summary of Data Bean Methods for Siebel Java Data Bean Method Attach Method for an Application CurrencyCode Method for an Application Detach Method for an Application GetBusObject Method for an Application GetProfileAttr Method for an Application Description Allows an external application to reconnect to an existing Siebel session. Returns the currency code that is associated with the division of the user position. Returns a string that contains the Siebel session ID. Creates a new instance of a business object. Returns the name of an attribute in a user profile. Format boolean attach(String sessionID) throws SiebelException String currencyCode()
String detach() throws SiebelException SiebelBusObject getBusObject(String boName) throws SiebelException String getProfileAttr(String attrName) throws SiebelException
40 9
Table 155. Summary of Data Bean Methods for Siebel Java Data Bean Method GetService Method for an Application Description Locates a business service. If this business service is not already running, then Siebel CRM starts it. Calls a method. Format SiebelService getService(string serviceName) throws SiebelException
String invokeMethod(String name, String[] args) throws SiebelException boolean login(String connString, String userName, String passWord) throws SiebelException
Allows an external application to log in to the COM Data Server, COM Data Control, or Siebel Java Data Bean, and to access Siebel objects. Returns the login ID of the user who started the Siebel application. Returns the login name of the user who started the Siebel application. Disconnects the Siebel client from the Siebel Server. Creates a new property set.
LoginId Method for an Application LoginName Method for an Application Logoff Method for an Application NewPropertySet Method for an Application PositionId Method for an Application PositionName Method for an Application SetPositionId Method for an Application SetPositionName Method for an Application SetProfileAttr Method for an Application Trace Method for an Application
String loginId()
String loginName()
Returns the position ID of the user position. Returns the name of the current user position. Sets the active position to a Position ID. Sets the active position to a position name. Personalization uses this method to set a value for an attribute in a user profile. Appends a message to the trace file.
boolean setPositionId(String posId) throws SiebelException boolean setPositionName(String posName) throws SiebelException boolean setProfileAttr(String attrName,String attrValue) throws SiebelException boolean trace(String message) throws SiebelException
410
Table 155. Summary of Data Bean Methods for Siebel Java Data Bean Method TraceOff Method for an Application TraceOn Method for an Application Description Turns off tracing. Turns on tracing. Format boolean traceOff() throws SiebelException boolean traceOn(String filename, String Category, String selection)throws SiebelException
Table 156. Summary of Business Component Methods for Siebel Java Data Bean Method ActivateField Method for a Business Component ActivateMultipleFields Method for a Business Component Associate Method for a Business Component Description Activates a field. Activates multiple fields. Format boolean activateField(String fieldName) throws SiebelException boolean activateMultipleFields(SiebelProp ertySet psFields) throws SiebelException boolean associate(boolean isInsertBefore) throws SiebelException
Creates a new many-to-many relationship for the parent object through an association business component. Returns the name of the business object that the business component references. Clears the current query but does not clear sort specifications on a business component. Deactivates the fields that are currently active from the SQL query statement of a business component.
boolean deactivateFields()
41 1
Table 156. Summary of Business Component Methods for Siebel Java Data Bean Method DeleteRecord Method for a Business Component ExecuteQuery Method for a Business Component Description Removes the current record from a business component. Returns a set of business component records. Format boolean deleteRecord() throws SiebelException boolean executeQuery(boolean cursorMode) throws SiebelException NOTE: If using the ExecuteQuery method with Siebel Java Data Bean, use True for ForwardOnly and False for ForwardBackward. ExecuteQuery2 Method for a Business Component Returns a set of business component records. Allows you to control the number of records Siebel CRM returns. Moves the record pointer to the first record in a business component, making that record the current record. Returns the value of a field from the current record of a business component. Returns a field value that is in the same format that the Siebel client uses. Returns values for the fields specified in a property set. boolean executeQuery2(boolean cursorMode, boolean ignoreMaxCursorSize) throws SiebelException boolean firstRecord() throws SiebelException
GetFieldValue Method for a Business Component GetFormattedFieldValue Method for a Business Component GetMultipleFieldValues Method for a Business Component GetMVGBusComp Method for a Business Component
String getFieldValue(String fieldName) throws SiebelException String getFormattedFieldValue(String fieldName) throws SiebelException boolean getMultipleFieldValues(SiebelProp ertySet Src, SiebelPropertySet result) throws SiebelException SiebelBusComp getMVGBusComp(String fieldName) throws SiebelException
Returns the multi-value group business component that is associated a business component field. Returns the name of a search specification. Returns the name of the pick business component that is associated with a field in the current business component. Returns the current search expression that is defined for a business component.
GetNamedSearch Method for a Business Component GetPicklistBusComp Method for a Business Component GetSearchExpr Method for a Business Component
String getNamedSearch(String searchName) throws SiebelException SiebelBusComp getPicklistBusComp(String fieldName) throws SiebelException
412
Table 156. Summary of Business Component Methods for Siebel Java Data Bean Method GetSearchSpec Method for a Business Component GetUserProperty Method for a Business Component GetViewMode Method for a Business Component InvokeMethod Method for a Business Component Description Returns the search specification that is defined for a business component. Returns the value for the specified property. Returns the visibility mode for a business component. Calls a method. Format String getSearchSpec(String fieldName) throws SiebelException String getUserProperty(String property) throws SiebelException int getViewMode() String invokeMethod(String methodName, String[] methArg1, methArg2, methArgN) throws SiebelException boolean lastRecord() throws SiebelException String name() boolean newRecord(boolean isInsertBefore) throws SiebelException boolean nextRecord() throws SiebelException
LastRecord Method for a Business Component Name Method for a Business Component NewRecord Method for a Business Component NextRecord Method for a Business Component
Moves the record pointer to the last record in a business component. Returns the name of a business component. Adds a new record to a business component. Moves the record pointer to the next record in a business component, making that record the current record. Returns the name of a parent business component. Places the currently chosen record in a pick business component into the appropriate fields of the parent business component. Moves the record pointer to the previous record in a business component, making that record the current record. Refines a query.
ParentBusComp Method for a Business Component Pick Method for a Business Component
41 3
Table 156. Summary of Business Component Methods for Siebel Java Data Bean Method Release Method for a Business Component Description Releases a business component and the resources for this business component that exist on the Siebel Server. Sets a new value in a field for the current record of a business component. Sets a new value in a field in the current record of a business component. It accepts the field value in the current local format. Sets new values to the multiple fields specified in the property set for the current record of a business component. Sets a named search specification on a business component. Sets the search expression for a business component. Sets the search specification for a business component. Sets the sort specification for a business component. Sets the value of a user property in a business component. Sets the visibility type for a business component. Reverses any unsaved changes made to the record. Saves to the Siebel database any changes made to the current record. Format void release()
SetFieldValue Method for a Business Component SetFormattedFieldValue Method for a Business Component
boolean setFieldValue(String fieldName, String fieldValue) throws SiebelException boolean setFormattedFieldValue(String fieldName, String fieldValue) throws SiebelException
SetNamedSearch Method for a Business Component SetSearchExpr Method for a Business Component SetSearchSpec Method for a Business Component SetSortSpec Method for a Business Component SetUserProperty Method for a Business Component SetViewMode Method for a Business Component UndoRecord Method for a Business Component WriteRecord Method for a Business Component
boolean setNamedSearch(String searchName, String searchText) throws SiebelException boolean setSearchExpr(String searchExpr) throws SiebelException boolean setSearchSpec(String fieldName, String searchSpec) throws SiebelException boolean setSortSpec(String sortSpec) throws SiebelException boolean setUserProperty(String propName, String propVal) boolean setViewMode(int mode) throws SiebelException boolean undoRecord() throws SiebelException boolean writeRecord() throws SiebelException
414
Table 157. Summary of Business Object Methods for Siebel Java Data Bean Method GetBusComp Method for a Business Object Name Method for a Business Object Release Method for a Business Object Description Returns the name of a business component. Returns the name of the business object. Releases a business object and the resources for this business object on the Siebel Server. Format SiebelBusComp getBusComp(String busCompName) throws SiebelException String name() void release()
Table 158. Summary of Business Service Methods for Siebel Java Data Bean Method Business Service Methods GetNextProperty Method for a Business Service GetProperty Method for a Business Service InvokeMethod Method for a Business Service Description Returns the name of the first property of a business service. Returns the name of the next property of a business service. Returns the value of a property. Format String getFirstProperty() String getNextProperty()
String getProperty(String propName) throws SiebelException boolean invokeMethod(String methodName, SiebelPropertySet inputPropertySet, SiebelPropertySet outputPropertySet) throws SiebelException String Name() boolean propertyExists(String propName) throws SiebelException
Calls a method.
Name Method for a Business Service PropertyExists Method for a Business Service
Returns the name of a business service. Returns a Boolean value that indicates if the property that the argument identifies exists.
41 5
Table 158. Summary of Business Service Methods for Siebel Java Data Bean Method Release Method for a Business Service RemoveProperty Method for a Business Service SetProperty Method for a Business Service Description Releases a business service and the resources that this business service uses on the Siebel Server. Removes a property from a business service. Sets a value for a property of a business service. Format void release()
void removeProperty(String propName) throws SiebelException void setProperty(String propName, String propValue) throws SiebelException
Table 159. Summary of Property Set Methods for Siebel Java Data Bean Method AddChild Method for a Property Set Copy Method for a Property Set GetByteValue Method for a Property Set GetChild Method for a Property Set GetChildCount Method for a Property Set GetFirstProperty Method for a Property Set GetNextProperty Method for a Property Set GetProperty Method for a Property Set Description Adds child property sets to a property set. Returns a copy of a property set. Returns a byte array if a byte value is set. Returns a child property set of a property set. Returns the number of child property sets that exist for a parent property set. Returns the name of the first property in a property set. Returns the name of the next property in a property set. Returns the value of a property. Format int addChild(SiebelPropertySet propertySet) SiebelPropertySet copy(SiebelPropertySet propertySet) public byte[] getByteValue()
String getFirstProperty()
String getNextProperty()
416
Table 159. Summary of Property Set Methods for Siebel Java Data Bean Method GetPropertyCount Method for a Property Set GetType Method for a Property Set GetValue Method for a Property Set InsertChildAt Method for a Property Set PropertyExists Method for a Property Set RemoveChild Method for a Property Set RemoveProperty Method for a Property Set Reset Method for a Property Set SetByteValue Method for a Property Set SetProperty Method for a Property Set SetType Method for a Property Set SetValue Method for a Property Set Description Returns the number of properties that exist in the current level in the hierarchy. Returns the value of the type attribute of a property set. Returns the value of the value attribute of a property set. Inserts a child property set in a parent property set at a specific location. Returns a Boolean value that indicates if the property that the argument identifies exists. Removes a child property set from a parent property set. Removes a property from a property set. Removes every property and child property set from a property set. Sets the value portion of a property set. Sets a value in the property of a property set. Sets the value for the type attribute of a property set. Sets the value for the value attribute of a property set. Format int GetPropertyCount()
String getType() String getValue() boolean insertChildAt(SiebelPropertySet propertySet, int index) boolean propertyExists(String propertyName) boolean removeChild(int index)
public void setByteValue(byte[] value) boolean setProperty(String propertyName, String propertyValue) boolean setType(String type) boolean setValue(String value)
41 7
Table 160. Summary of Siebel Exception Methods for Siebel Java Data Bean Method GetErrorCode Method GetErrorMessage Method Description Returns a numeric error code. Returns an error message. Format int getErrorCode() String getErrorMessage()
418
Index
A
ActivateField business component method, about 184 ActivateMultipleFields business component method, about 186 ActiveApplet application method, about 124 ActiveBusObject application method, about 125 ActiveMode applet method, about 101 ActiveViewName application method, about returning name of active view 127 ActiveX control, about using Login method 150 AddChild property set method, about 305, 306 allocations, about using TraceOn application method to track 174 applet events Applet_ChangeFieldValue, about 108 Applet_ChangeRecord even, about 109 Applet_InvokeMethod, about 110 Applet_Load, about 112 Applet_PreInvokeMethod, about 113 object interface events, table of 98 WebApplet_InvokeMethod, about 114 WebApplet_Load applet event 115 WebApplet_Load, about 112 WebApplet_PreCanInvokeMethod, about 116 WebApplet_PreInvokeMethod, about 117 WebApplet_ShowControl 119 WebApplet_ShowListColumn, about 121 applet methods ActiveMode, about 101 BusComp, about 102 BusObject, about 102 Find control, about 104 FindActiveXControl, about 103 InvokeMethod, about 105 Name, about 106 syntax summary (Browser Script), table of 323 syntax summary (Siebel eScript), table of 353 Applet_ChangeFieldValue event, about 108 Applet_ChangeRecord event, about 109 Applet_InvokeMethod event, about 110
Applet_Load event, about 112 Applet_PreInvokeMethod event, about 113 applets ActiveApplet. about returning reference to currently active applet 124 applet methods syntax summary (Browser Script), table of 323 applet methods syntax summary (Siebel eScript), table of 353 applet methods syntax summary (Siebel VB), table of 337 events, about and list of 108 FindApplet, about returning applet identified by argument 134 object type, described 11 parent applet object, about returning for control 294 WebApplet events summary (Siebel VB), table of 338 WebApplet events summary, table of (Siebel eScript), table of 354 WebApplet events syntax summary (Browser Script), table of 324 application events Application_Close event, about 177 Application_InvokeMethod, about 178 Application_Navigate, about 178 Application_PreNavigate, about 180 Application_Start, about 181 PreInvokeMethod, about 179 syntax summary, table of (Siebel eScript) 357 table of object interface events 99 application methods ActiveApplet, about 124 ActiveBusComp, about returning business component associated with 125 ActiveBusObject, about 125 ActiveViewName, about returning name of active view 127 Attach, about 128 CurrencyCode, about 131 Detach, about 131 EnableExceptions, about 132 FindApplet, about 134 GetBusObject, about 134 GetDataSource, InvokeMethod method 136
41 9
Index B
GetLastErrCode, about 136 GetLastErrText, about 137 GetProfileAttr, about 138 GetService, about 139 GetSharedGlobal, about 141 GotoView, about 143 InvokeMethod, about 145 IsViewReadOnly, InvokeMethod method 146 Language, InvokeMethod method 148 LoadObjects, about 148 LoadUserAttributes, about using to load user profile 150 Login. about 150 LoginID, about 153 LoginName, about 153 Logoff, about 154 LookupMessage, about 154 LookupValue, InvokeMethod method 155 Name, about 156 NewPropertySet, about 157 PositionID, about 159 PositionName, about 159 RaiseError, about 160 RaiseErrorText, about 162 SetPositionID, about 163 SetPositionName, about 164 SetProfileAttr, about 164 SetSharedGlobal, about 167 syntax summary (COM data control), table 381 syntax summary (COM data server), table 369 syntax summary, table of (eScript) 355 Trace, about 171 TraceOff, about 173 TraceOn, about 174 application object type described 10 unique object type, about using to return 322 Application_Close event, about 177 Application_InvokeMethod application event, about 178 Application_Navigate application event, about 178 Application_PreNavigate application event, about 180 Application_Start application event, about 181 applications application events syntax summary (Siebel eScript), table of 357 application methods summary (Siebel VB), table of 339
application methods syntax summary (COM data control), table 381 application methods syntax summary (COM data server), table 369 application methods syntax summary (eScript), table of 355 application methods syntax summary (Siebel Mobile Web Client), table 397 events summary (Siebel VB), table of 341 methods syntax summary (Browser Script), table of 325 registering business services in Siebel Tools 139 association business component Associate, about creating many-to-many relationship 188 BusComp_Associate, about calling after record added to create association 261 GetAssocBusComp, returning association business component 201 Attach application method, about 128
B
Browser Script about 17 applet methods syntax summary, table 323 application methods syntax summary, table 325 business component methods syntax summary, table 326 business object methods syntax summary, table 328 business service events syntax summary, table 329 business service methods syntax summary, table 328 Control methods syntax summary, table 331 property set methods syntax summary, table 330 WebApplet events syntax summary, table 324 BusComp applet method, about 102 control method, about 295 ExecuteQuery, about return record using method 194 ExecuteQuery2, about returning records using method 197 object interface events, table of 99 BusComp_Associate business component event, about 261 BusComp_ChangeRecord business
420
Index B
component event, about 262 BusComp_CopyRecord business component event, about 263, 264 BusComp_DeleteRecord business component event, about 264 BusComp_InvokeMethod business component event, about 264 BusComp_NewRecord business component event, about 264 BusComp_PreAssociate business component event, about 265 BusComp_PreCopyRecord business component event, about 265 BusComp_PreDeleteRecord business component event, about 266 BusComp_PreGetFieldValue business component event, about 267 BusComp_PreInvokeMethod business component event, about 268 BusComp_PreNewRecord business component event, about 268 BusComp_PreQuery business component event, about 269 BusComp_PreSetFieldValue business component event, about 269 BusComp_PreWriteRecord business component event, about 271 BusComp_Query business component event, about 272 BusComp_SetFieldValue business component event, about 273 BusComp_WriteRecord business component event, about 274 business active application associated with 125 business component events BusComp_Associate, about 261 BusComp_ChangeRecord, about 262 BusComp_CopyRecord, about 263, 264 BusComp_DeleteRecord, about 264 BusComp_InvokeMethod, about 264 BusComp_NewRecod, about 264 BusComp_PreAssociate, about 265 BusComp_PreCopyRecord, about 265 BusComp_PreDeleteRecord, about 266 BusComp_PreGetFieldValue, about 267 BusComp_PreInvokeMethod, about 268 BusComp_PreNewRecord, about 268 BusComp_PreQuery, about 269 BusComp_PreSetFieldValue, about 269 BusComp_PreWriteRecord, about 271 BusComp_Query, about 272 BusComp_SetFieldValue, about 273 BusComp_WriteRecord, about 274
syntax summary, table of (eScript) 362 business component methods ActivateField, about 184 ActivateMultipleFields, about 186 Associate, about 188 BusObject, about 190 ClearLOVCache, InvokeMethod method 251 ClearToQuery, about 190 CreateFile, InvokeMethod method 252 DeactivateFields, about 192 DeleteRecord, about 194 ExecuteQuery, about 194 ExecuteQuery2, about 197 FirstRecord, about 198 FirstSelected, about 200 GenerateProposal, InvokeMethod method 254 GetAssocBusComp, about 201 GetFieldValue, about 203 GetFile, InvokeMethod method 255 GetFormattedFieldValue, about 204 GetLasErrCode, about 206 GetLastErrText, about 207 GetMultipleFieldValues, about 207 GetMVGBusComp, about 209 GetNamedSearch, about 210 GetPicklistBusComp, about 211 GetSearchExpr, about 213 GetSearchSpec, about 213 GetSortSpec, about 214 GetUserProperty, about 214 InvokeMethod, about 216 LastRecord, about 217 Name, about 218 NewRecord, about 218 NextRecord, about 220 NextSelected, about 221 ParentBusComp, about 221 Pick, about 222 PreviousRecord, about 223 PutFile, InvokeMethod method 257 RefineQuery, about 224 RefreshBusComp, InvokeMethod method 258 RefreshRecord, InvokeMethod method 259 Release, about 225 SetAdminMode, InvokeMethod method 259 SetFieldValue, about 227 SetFormattedFieldValue, about 228 SetMultipleFieldValues, about 230 SetNamedSearch, about 232 SetSearchExpr, about 234 SetSearchSpec, about 235 SetSortSpec, about 241
42 1
Index B
SetUserProperty, about 243 SetViewMode, about 244 syntax summary (COM data control), table 384 syntax summary (COM data server), table 372 UndoRecord, about 248 WriteRecord, about 249 business components about 21 applet, associated with 102 BusComp method, about returning for the control 295 BusComp object, logical flow of instantiating 23 business component events summary (Siebel VB), table of 346 business component events syntax summary (eScript), table of 362 business component methods syntax summary (COM data control), table 384 business component methods syntax summary (COM data server), table 372 business component methods syntax summary (eScript), table of 357 business component methods syntax summary (Siebel VB), table of 342 database, saving records to 22 GetBusComp, about returning for a business component 275 methods for accessing, list of 25 methods syntax summary (Browser Script), table of 326 methods syntax summary (Siebel Mobile Web Client), table 400 methods syntax summary, table of (eScript) 357 name property, returning 218 object type, described 10 records, adding and inserting 21 scenarios 22 SiebelBusComp methods syntax summary (Java), table of 411 business object methods GetBusComp, about 275 GetLastErrCode, about 276 GetLastErrText, about 277 Name, about 277 Release, about 277 syntax summary (COM data control), table 388 syntax summary (COM data server),
table 376 table of 93 business objects active applet, about returning for business component 125 business object methods syntax summary (COM data control), table 388 business object methods syntax summary (COM data server), table 376 business object methods syntax summary (eScript), table of 364 business object methods syntax summary (Siebel VB), table of 349 BusObject, about returning business object for applet 102 BusObject, about returning business object that contains business component 190 methods syntax summary (Browser Script), table of 328 methods syntax summary (Siebel Mobile Web Client), table 404 Name, about using to return name of business object 277 object type, described 10 business service events Service_InvokeMethod, about 287 Service_PreCanInvokeMethod, about 288 Service_PreInvokeMethod, about 289 syntax summary, table of (eScript) 366 business service methods GetFirstProperty, about 279 GetLastErrCode, about 311 GetLastErrText, about 312 GetNextProperty, about 280 GetProperty, about 281 InvokeMethod, about 282 Name, about 283 PropertyExists, about 283 Release, about 284 RemoveProperty, about 285 SetProperty, about 286 syntax summary (COM data control), table 389 syntax summary (COM data server), table 377 syntax summary, table of (eScript) 365 business service object type, described 11 business services business service events syntax summary (eScript), table of 366 business service events syntax summary (Siebel VB), table of 350 business service methods syntax summary
422
Index C
(COM data control), table 389 business service methods syntax summary (COM data server), table 377 business service methods syntax summary (eScript), table of 365 business service methods syntax summary (Siebel VB), table of 349 events syntax summary (Browser Script), table of 329 methods syntax summary (Browser Script), table of 328 methods syntax summary (Siebel Mobile Web Client), table 405 object interface events, table of 100 object interface methods, table of 94 registering in Siebel Tools 139 retrieving property names 280 SetProperty, about setting values to members of 286 SiebelService methods syntax summary (Java), table of 415 BusObject applet method, about 102 business component method, about 190
C
C++ COM Server, building in 42 COM Server, testing program 46 CanInvokeMethod applet user property, using instead of PreCanInvokeMethod applet event 77, 117 ChangeFieldValue, about 108 ChangeRecord event, about 109 child property sets, about using AddChild to add to a property set 305 ClearLOVCache business component method, about 251 ClearToQuery business component method, about 190 coding, caution, about and using Siebel Tools 63 COM Data Control about and diagram 12 starting 47 COM data control application methods syntax summary (table) 381 business component methods syntax summary (table) 384 business object methods syntax summary (table) 388
business service methods syntax summary (table) 389 installation, about 47 load balancing with 33 property set methods syntax summary (table) 390 COM Data Server about and diagram 16 building in C++ 42 C++, testing program 46 starting 16 COM data server application methods syntax summary (table) 369 business component methods syntax summary (table) 372 business object methods syntax summary (table) 376 business service methods syntax summary (table) 377 installation, about 40 interface method, about COM error handling 60 LoadObjects method, about using to start object and return reference 148 property set methods syntax summary (table) 378 COM error handling, about and methods 60 COM interfaces Siebel COM client in C++, building 42 Siebel COM client in C++, testing program 46 comparison operators, using in search expressions 237 connect string about, syntax, and example 30 leveraging load balancing with 33 Siebel Server, substitutions when logging in to (table) 31 constants, table of 66 control methods Applet method, about returning parent applet object 294 BusComp, about 295 GetProperty, about 295 GetValue, about returning control value 296 Name, about returning object name 297 SetProperty, about 297, 301 SetValue, about using to set contents of the control 302 syntax summary, table of (Browser Script), table of 331 controls FindControl, about argument specified
42 3
Index D
in 104 GetProperty, returning values of control properties 295 GetValue, returning value of control 296 object interface methods, table of 95 SetLabelProperty, setting values to control properties 297 SetProperty, setting values to control properties 301 SetValue, using to set the contents of the control 302 Copy property set method, about 306 copying records, using NewRecord method 219 CreateFile business component method, about 252 CurrencyCode application method, about 131 custom methods, calling 216 custom methods, calling with MiniButton controls 76
D
data bean. See Java Data Bean, SiebelDataBean, individual Siebel Java entries 409 data value SetProperty, about using to set value to 318 SetType, about using to set data value of type to property set 319 database, about using WriteRecord to save to database 249 DeactivateFields business component method, about 192 deallocations, using TraceOn application method to track 174 debug tracings methods, table of 27 DeleteRecord business component method, about 194 Detach application method, about 131
code 276 business service methods, about using GetLastErrCode to return most recent 311 GetErrorCode, about using with Java Data Bean to display numeric code 320 error handling See also individual Siebel object interface entries COM error handling, about and examples 60 error message tracking 61 native COM error handling, enabling and disabling 132 error messages business component methods, about using GetLastErrText 207 business object methods, about using GetLastErrText 277 business service methods, about using GetLastErrText 312 function_name Is An Unknown Function, about and correcting 19 GetErrorMessage, about using with Java Data Bean to display message 321 GetLastErrText, about returning last text error message 137 event method syntax 56 events, object interface events, table of 98 ExecuteQuery business component method, about 194 ExecuteQuery2 business component method, about 197 external applications logging in 150
F
field value, method of retuning in the current local format 204 FindActiveXControl applet method, about 103 FindApplet application method, about 134 FindControl applet method, about 104 FirstRecord business component method, about 198 FirstSelected business component method, about 200
E
EnableExceptions application method, about 132 error code application methods, about using GetLastErrCode to return last error code 136 business component methods, about using GetLastErrCode to return most recent 206 business object methods, about using GetLastErrCode to return last error
G
GenerateProposal business component method, about 254 GetAssocBusComp business component method, about 201 GetBusComp business object method,
424
Index H
about 275 GetBusObject application method, about 134 GetByteValue property set method 307 GetChild property set method, about 308 GetChildCount property set method, about 310 GetDataSource application method, about 136 GetErrorCode method, about 320 GetErrorMessage method, about using to display error messages 321 GetFieldValue business component method, about 203 GetFile business component method, about 255 GetFirstProperty business service method, about 279 property set method, about 310 GetFormattedFieldValue business component method, about 204 GetLastErrCode application method, about 136 business component method, about 206 business object method, about 276 business service method, about 311 GetLastErrText application method, about 137 business component method, about 207 business object method, about 277 business service method, about 312 note, about availability to interfaces 72 GetMultipleFieldValues business component method, about 207 GetMVGBusComp business component method, about 209 GetNamedSearch business component method, about 210 GetNextProperty business service method, about 280 property set method, about 312 GetPicklistBusComp business component method, about 211 GetProfileAttr application method, about 138 GetProperty business service method, about 281 control method, about 295 controls, about returning values of properties 295 property set method, about 313 GetPropertyCount property set method, about 313 GetSearchExpr business component method,
about 213 GetSearchSpec business component method, about 213 GetService application method, about 139 GetSharedGlobal application method, about 141 GetSortSpec business component method, about 214 GetType property set method 314 GetUserProperty business component method, about 214 GetValue control method, about 296 property set method, about 314 global state, properties and functions 27 global variables about and VB example 74 GetSharedGlobal application method, about 141 GotoView application method, about 143
H
high interactivity mode, about running Browser Script 18
I
InsertChildAt property set method, about 315 interface methods, table grouped by object interface type 85 InvokeMethod applet method, about 105 Applet_InvokeMethod, about 110 application method, about 145 application methods called 122 business component method, about 216 business component methods called 250 business service method, about 282 ClearLOVCache method called 251 CreateFile method called 252 GenerateProposal method called 254 GetDataSource method called 136 GetFile method called 255 IsViewReadOnly method called 146 Language method called 148 LookupValue method called 155 PutFile method called 257 RefreshBusComp method called 258 RefreshRecord method called 259 SetAdminMode method called 259 WebApplet_InvokeMethod, about 114 IsViewReadOnly application method, about 146
42 5
Index J
J
java Bean. See individual Siebel Java entries Java Cryptography Extension (JCE), enabling 54 Java Data Bean GetErrorCode, about using to display numeric error codes 320 GetErrorMessage, about using to display error messages 321 table of SiebelDataBean method syntax 409 JavaScript. See Siebel eScript JCE (Java Cryptography Extension), enabling 54
Mobile Web Client Automation Server, setting up to access 36 Web Client Automation Server, setting up to access 35 MiniButton controls, using to call custom methods 76 Mobile Web Client Automation Server about and diagram 15 accessing 36 installation 35, 36 Mobile Web Client Automation Server, enabling 15 module variables, about and VB example 74 MVG business component, returning 209
L
Language application method, about 148 LastRecord business component method, about 217 load balancing 33 Load event Applet_Load, about calling after applet is loaded 112 WebApplet_Load event, about calling immediately after Siebel CRM loads applet 115 LoadObjects application method, about 148 LoadUserAttributes application method, about 150 local variables, described and VB example 73 locating objects method, about and list of methods 20, 21 logical operators in search expressions 237 Login method application method, about 150 LoginId application method, about 153 LoginName application method, about 153 Logoff application method, about 154 LookupMessage application method, about 154 LookupValue application method, about 155
N
Name applet method, about 106 application method, about 156 business component method, about 218 business object method, about 277 business service method, about 283 control method, about 297 named field value, about using SetFieldValue to set new value to 227 navigation methods, object interfaces 26 NewPropertySet application method, about 157 NewRecord business component method, about 218 NextRecord business component method, about 220 NextSelected business component method, about 221
O
object interface events See also Siebel object interfaces, events applet, table of 98 application, table of 99 BusComp, table of 99 business service, table of 100 object interface methods See also Siebel object interfaces, methods applet, table of 85 application, table of 86 business component, table of 90 business object, table of 93 business service, table of 94 control, table of 95 miscellaneous methods and events, table of 97 property set, table of 95
M
methods custom methods, calling with MiniButton controls 76 table grouped by interface type 85 Microsoft Foundation Class (MFC) library. See COM Data Server Microsoft Visual Basic COM Data Control Interface, setting up to access 47 COM Data Server, setting up to access 16
426
Index P
object interfaces. See Siebel object interfaces object types applet object type, described 11 application, described 10 business component, described 10 business object, described 10 business service, described 11 property set, described 12 object, about using Name method to return object name 297 Open 76 operating currency code, returning 131
P
ParentBusComp business component method, about 221 Pick business component method GetPicklistBusComp, returns component 211 Pick method, about 222 Pick Method business component method 222 PositionId application method, about 159 PositionName application method, about 159 PreCanInvokeMethod WebApplet_PreCanInvokeMethod, about 116 PreInvokeMethod Applet_PreInvokeMethod, about 113 Application_PreInvokeMethod, about 179 WebApplet_PreInvokeMethod, about 117 PreviousRecord business component method, about 223 programming custom code, about customizing data validation 64 environment, component of 17 languages, about 17 user interface components, about customizing behavior 64 programming with Siebel Object interfaces, about 29 properties of controls GetProperty, about returning values 295 SetLabelProperty, about setting visual properties 297 SetProperty, about setting visual properties 301 property set methods AddChild, about adding child property set to 305 Copy, about returning copy of set 306
GetByteValue 307 GetChild, about returning child property of property set 308 GetChildCount, about returning child property sets attached to 310 GetFirstProperty, about returning name of first property 310 GetNextProperty, about returning next property 312 GetProperty, about returning property value when given name 313 GetPropertyCount, about returning number of properties attached to 313 GetValue, about retrieving data value 314 InsertChildAt, about inserting child property set in a parent property 315 object interface methods, table of 95 RemoveChild, about removing child property set from parent property set 316 RemoveProperty, about removing a property from property set 317 SetByteValue 317 SetProperty, about setting a data value to property 318 SetType, about setting data value of type 319 syntax summary (COM data control), table 390 syntax summary (COM data server), table 378 syntax summary table (eScript) 366 property set object type, described 12 property sets business service methods syntax summary (COM data control), table 390 business service methods syntax summary (COM data server), table 378 Copy, about returning copy of 306 GetChild, about retrieving child property set 308 GetFirstProperty, about retrieving property names 310 GetNextProperty, about retrieving property names 312 GetProperty, about retrieving property values 313 GetPropertyCount, about retrieving values of type members 313 GetType, about retrieving values of type members 314 GetValue, about retrieving value values 314 InsertChildAt, about adding child 315 methods syntax summary (Browser Script), table of 330
42 7
Index Q
methods syntax summary (eScript), table of 366 methods syntax summary (Siebel Mobile Web Client), table 406 methods syntax summary (Siebel VB), table of 351 methods syntax summary (Siebel Web client), table of 395 RemoveChild, about removing child property set 316 RemoveProperty, about removing properties of 317 Reset, about removing properties and child properties 317 SetProperty, about setting values to members of 318 SetType, about setting values to type members 319 SetValue, about setting values to value member 320 SiebelPropertySet methods syntax summary (Java), table of 416 tree data structure, for 305 PropertyExists business service method, about 283 property set method, about retuning Boolean value 315 PutFile business component method, about 257
Pick, about placing record in a picklist 222 PreviousRecord, about moving to previous record 223 UndoRecord, about using to reverse unsaved changes 248 WriteRecord, about saving database changes 249 RefineQuery business component method, about 224 RefreshBusComp business component method, about 258 RefreshRecord business component method, about 259 Release business component method, about 225 business object method, about 277 business service method, about 284 RemoveChild property set method, about 316 RemoveProperty business service method, about 285 property set method, about 317 Reset property set method, about removing properties and child property sets 317 run-time engine, calling 19
S
Script Profiler, about 20 script tracing 79 search expression GetSearchExpr, about using to return current search expression 213 SetSearchExpr, about setting on entire search expression 234 search specification Field name argument, about returning for field specified in 213 searchName, returns named search specification 210 SetNamedSearch, about setting a named search specification on the business component 232 SetSearchSpec, about setting for a particular field 235 SetSearchSpec, about setting for particular field 235 server components, logging events 79 Server Script, components 17 server, about Logoff method 154 Service_InvokeMethod business service event, about 287 Service_PreCanInvokeMethod business
Q
queries ClearToQuery, about using to clear query 190 GetSortSpec, using to get sort specification 214 RefineQuery, about using to define after a run 224 SetSortSpec, using to set sort specification 241 quotation marks, about using in search expressions 237
R
RaiseError application method, about 160 RaiseErrorText application method, about 162 records LastRecord, about using to move to 217 NewRecord, about adding a new record (row) 218 NextSelected, about using to make next record active 221
428
Index S
service event, about 288 Service_PreInvokeMethod business service event, about 289 SetAdminMode business component method, about 259 SetByteValue property set method 317 SetFieldValue business component method, about 227 SetFormattedFieldValue business component method, about 228 SetLabelProperty controls, about setting visual properties 297 SetMultipleFieldValues business component method, about 230 SetNamedSearch business component method, about 232 SetPositionID application method, about 163 SetPositionName application method, about 164 SetProfileAttr application method, about 164 SetProperty business service method, about setting 286 controls, about setting visual properties 301 property set method, about setting data value to 318 SetSearchExpr business component method, about 234 SetSearchSpec business component method, about 235 SetSharedGlobal application method, about 167 SetSortSpec business component method, about 241 SetType property set method, about 319 SetUserProperty business component method, about 243 SetValue control, about using to set contents of 302 property set, about setting data value to 320 SetViewMode business component method, about 244 ShowModalDialog application method, about 167 Siebel business components, about events and list of 261 Siebel COM interfaces accessing 38 COM Data Control interfaces, about and diagram 12 COM Data Server, about and diagram 16 COM error handling 60 Mobile Web Client Automation Server, about
and diagram 15 Web Client Automation Server, about and diagram 14 Siebel Compiler compiler/interpreter described 18 order considerations and error message 19 Siebel compiler invoking 19 Siebel constants table 66 Siebel eScript about 17 applet methods, syntax summary (table) 353 application events syntax summary, table of 357 application methods syntax summary, table of 355 business component events syntax summary, table of 362 business component methods syntax summary, table of 357 business object methods syntax summary, table of 364 business service events syntax summary, table of 366 business service methods syntax summary, table of 365 format conventions 84 property set methods syntax summary, table of 366 Siebel VB, differences between 71 ST eScript engine 19 theApplication, method syntax summary, table of 368 this object reference, about using and example 69 WebApplet event summary, table of 354 with shortcut, about and example 67 Siebel eScript language, about 17 Siebel extension events applet events, about and list of 108 events occur, determining when 59 method syntax 56 program flow, process affected by script 57 Siebel business component events, about and list of 261 Siebel Java Bean character encoding (table) 52 data Bean, about installation 47, 48 Java Data Bean and Siebel Server, encrypting communication between 54 SiebelBusComp methods syntax summary, table of 411 SiebelDataBean methods syntax summary,
42 9
Index S
table of 409 SiebelExceptions methods syntax summary, table of 418 SiebelPropetySet methods syntax summary, table of 416 SiebelService methods syntax summary, table of 415 Siebel Java interfaces multiple threads, using with 55 object, about using to access 12 Siebel Mobile Web Client application methods syntax summary, table of 397 business component methods syntax summary, table of 400 business object methods syntax summary, table of 404 business service methods syntax summary, table of 405 property set methods syntax summary, table of 406 Siebel object interfaces See also error handling about 29 COM Data Control, starting 47 COM Data Server, starting 16 component of Siebel programming environment described 17 Java Data Bean 12 Siebel COM interfaces, accessing method 12 Siebel Java interfaces 12 Siebel methods and events, about accessing from scripts 17 usage evaluation matrix, table 29 Siebel object interfaces, events See also individual Siebel object interface entries applet events, about and list of 108 events occur, determining when 59 method syntax 56 program flow, process affected by script 57 Siebel business component events, about and list of 261 Siebel object interfaces, formats format 83 Siebel object interfaces, getting started See also individual Siebel object interface entries COM Data Control, accessing and screen example 47 connect string, about, syntax, and example 30 connect string, substitutions when logging in to a Siebel Server (table) 31
Mobile Web Client Automation Server, accessing 36 Siebel COM interfaces, accessing 38 Siebel object interfaces, methods See also individual Siebel object interface entries business components, accessing 21 examples 84 global state properties and functions 27 list of 20 locating objects, about and list of methods 20, 21 navigation methods 26 user interaction, about and methods 27 Siebel programming constants, table of 66 custom code, about customizing data validation 64 environment, components of 17 user interface components, about customizing behavior 64 Siebel script debug tracing methods, table of 27 global variables, about and VB example 74 local variables. about and VB example 73 module variables, about and VB example 74 Siebel Script Editor about 18 Script Assist 18 Siebel Server Java Data Bean and Siebel Server, encrypting between 54 Siebel session ID, about returning string containing Id 131 Siebel VB about 17 applet methods syntax summary, table of 337 application events summary, table of 341 application methods syntax summary, table of 339 business component methods syntax summary, table of 342 business components events summary, table of 346 business object methods syntax summary, table of 349 business service events syntax summary, table of 350 business service methods syntax summary, table of 349 components of 17 date variables, about working with 71 format conventions 84
430
Index T
getting started 71 Me object reference, about using and example 69 naming conventions, using standardized 65 objects, deleting and example 70 picklist, picking a value from 211 property set methods syntax summary, table of 351 run-time errors, about trapping 72 Select Case, making effective use of 67 Siebel eScript, differences between 71 theApplication method, syntax summary 352 variables, declaring 65 WebApplet events, summary (table) 338 With shortcut, using and example 67 Siebel VB language, about 17 Siebel Web client property set methods syntax summary, table of 395 Siebel Service methods syntax summary, table of 394 SiebelHTMLApplication methods syntax summary, table of 393 SiebelBusComp methods syntax summary (Java), table of 411 SiebelDataBean methods syntax summary (Java), table of 409 SiebelException methods syntax summary (Java), table of 418 SiebelHTMLApplication methods syntax summary, table of 393 SiebelPropertySet methods syntax summary (Java), table of 416 SiebelService methods syntax summary (Java), table of 415 syntax summary (Siebel Web client), table of 394 sort specification getting 214 setting 241 special characters, using in search expressions 237 specialized methods, calling 216 ST eScript engine about 19 Script Profiler 20
Trace application method, about 171 TraceOff application method about 173 debug tracing, about 27 TraceOn application method about 174 debug tracing, about 27 tracing scripts 79 tree data structure, creating using property sets 305
U
UndoRecord business component method, about 248 user interaction, object interface methods 27 user interface control object type 12 user property value GetUserProperty, about using to return value 214 SetUserProperty, about using to set the value of named business user property 243
V
Validating 64 value, returning value of control 296 visibility type SetViewMode, about setting for business component 244
W
Web Client Automation Server about and diagram 14 installation, about 35 Web Client Automation Server, enabling 14 WebApplet events summary, table of (Siebel eScript) 354 syntax summary, table of (Browser Script) 324 WebApplet_InvokeMethod event, about 112 WebApplet_Load event, about 115 WebApplet_PreCanInvokeMethod event, about 116 WebApplet_PreInvokeMethod event, about 117 WebApplet_ShowControl event, about 119 WebApplet_ShowListColumn event, about 121 WriteRecord business component method, about 249
T
theApplication method object type, about using to return 322 syntax summary (eScript), table of 368 syntax summary (Siebel VB) 352
43 1
Index W
432