Bookshelf Home | Contents | Index | PDF |
Siebel Object Interfaces Reference > Siebel Object Interfaces Reference > Object Interfaces Reference > Application MethodsThis topic describes application methods. It includes the following topics:
Overview of Application MethodsAn application method is a predefined methods that return the current Siebel application object instance:
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. ActiveApplet Method for an ApplicationThe ActiveApplet method returns a reference to the applet that Siebel CRM displays. FormattheApplication().ActiveApplet(); UsageUse this method to identify the applet that Siebel CRM currently displays. This applet typically includes a blue border to indicate that it is active. Used WithExamplesfunction Applet_PreInvokeMethod (name, inputPropSet) ActiveBusComp Method for an ApplicationThe ActiveBusComp method returns the name of the business component that the active applet references. FormattheApplication().ActiveBusComp(); Used WithExamplesfunction Applet_Load () ActiveBusObject Method for an ApplicationThe ActiveBusObject method returns the name of the business object that the active view references. FormatUsage for the ActiveBusObject MethodDo not use the ActiveBusObject method in an event handler that any of the following technologies can start: Used WithBrowser Script, Mobile Web Client Automation Server, Server Script Example in Browser ScriptThe following example is in Browser Script: function Applet_Load () Example of Using the ActiveBusObject Method to Call from a Custom Button on a Child AppletThe 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:
Objects that the script references are currently active in the Siebel client, so 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 (oBO.Name() == "Contact") sEmail =""; The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer Dim iRtn As Integer If MethodName = "Send Email" Then Dim oBO As BusObject If oBO.Name() = "Contact" Then Dim oBC As BusComp Set oBC = oBO.GetBusComp("Contact") sEmail = oBC.GetFieldValue("Email Address") WebApplet_PreInvokeMethod = iRtn ActiveViewName Method for an ApplicationThe ActiveViewName method returns the name of the active view. FormatUsageUsage for the ActiveViewName method is very similar to usage for the ActiveViewName method. For more information, see Usage for the ActiveBusObject Method. Used WithBrowser Script, Mobile Web Client Automation Server, Server Script ExamplesThe following example is in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) Attach Method for an ApplicationThe Attach method allows an external application to reconnect to an existing Siebel session. It returns a Boolean value that indicates if Siebel CRM successfully ran the method. FormatApplication.Attach(sessionString) Table 30 describes the arguments for the Attach method.
Used WithCOM Data Control, Siebel Java Data Bean ExamplesThe examples in this topic do the following work:
The following example uses COM Data Control and is written in native Visual Basic: Dim SiebelApplication_first As SiebelDataControl ' Instantiate the first instance ' Login to Siebel errCode = SiebelApplication_first.GetLastErrCode ' Detach this instance from Siebel and get session id ' Instantiate the second instance ' Attach the existing session to this instance SiebelApplication_second.LogOff The following example uses the Siebel Java Data Bean: import com.siebel.data.*; public class JDBAttachDetachDemo public static void main(String[] args) public JDBAttachDetachDemo() // Login to the Siebel Servers System.out.println("Logged in to the Siebel Server "); //Get the Detach Handle // Instantiate another Siebel Java Data Bean // Do Attach // Logoff catch (SiebelException e) CurrencyCode Method for an ApplicationThe CurrencyCode method returns the currency code that is associated with the division of the user position. For example, USD for U.S. dollars, EUR for the euro, or JPY for the Japanese yen. FormatUsed WithBrowser Script, COM Data Control, COM Data Server, Web Client Automation Server, and Server Script ExamplesThe following example is in Siebel eScript: function WebApplet_Load () Detach Method for an ApplicationThe Detach method returns a string that contains the Siebel session Id. FormatUsageUse the string that the Detach method returns only with the Attach method. Used WithCOM Data Control, Siebel Java Data Bean ExamplesFor a Siebel Java Data Bean example and a native VB example that uses COM Data Control, see Attach Method for an Application. EnableExceptions Method for an ApplicationThe EnableExceptions method enables or disables native Component Object Model (COM) error handling. This method does not return any information. FormatApplication.EnableExceptions(bEnable) Table 31 describes the arguments for the EnableExceptions method. UsageSetting 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 WithCOM Data Control, Mobile Web Client Automation Server Example of Using the EnableExceptions Method with Siebel ActiveX Data ControlThe native Visual Basic script in this example does the following work:
The following code is an example of using the EnableExceptions method with Siebel ActiveX Data Control: Dim SiebelApplication As SiebelDataControl Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1") 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 Set wrongBO = SiebelApplication.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a nonexisting Business Object errCode = SiebelApplication.GetLastErrCode() Example of Using the EnableExceptions Method with Siebel Mobile Automation ServerThe script in this example performs the same work that is described in Example of Using the EnableExceptions Method with Siebel ActiveX Data Control, except it uses the Siebel Mobile Automation Server: Dim SiebelApp As SiebelWebApplication Set SiebelApp = CreateObject("TWSiebel.SiebelWebApplication.1") Dim nativeHandle As String If nativeHandle = "Yes" Then Set wrongBO = SiebelApp.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a nonexisting Business Object errCode = SiebelApp.GetLastErrCode() FindApplet Method for an ApplicationThe FindApplet method returns the name of an applet. FormattheApplication().FindApplet(appletName) Table 32 describes the arguments for the FindApplet method.
UsageThe only applets available are applets that are visible in the active view. Used WithExamplesThe following example is in Browser Script: function Applet_ChangeFieldValue (field, value) GetBusObject Method for an ApplicationThe GetBusObject method creates a new instance of a business object. It returns the name of this new business object instance. FormatApplication.GetBusObject(busObjectName) Table 33 describes the arguments for the GetBusObject method.
UsageTo delete the business object instance after it is no longer needed, you can set the business object to Nothing. Used WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThe 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"); oBusComp = null; The following example is in Siebel VB: Dim AccntBO as BusObject Set AccntBO = Nothing Examples of Using the GetBusObject Method to Refer to the Business Object That Is Currently ActiveThe name of the business object instance that Siebel CRM returns might vary depending on the location where it calls the code, such as a Web applet event. The examples in this topic are useful if you must refer to the business object instance that is currently active. The following example is for Siebel Java Data Bean: private SiebelDataBean m_dataBean = null; 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 GetDataSource Method for an ApplicationThe GetDataSource method returns the name of the data source that Siebel CRM defines in the DataSource server parameter for the session. The default value is ServerDataSrc. FormatdataSrc = Application.InvokeMethod("GetDataSource") Used WithTo use this method, you can use an Application.InvokeMethod call with the following interfaces: ExamplesThe 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"); The following example is in Siebel VB: Dim dataSrc As String GetLastErrCode Method for an ApplicationThe GetLastErrCode method returns the error code for the error that Siebel CRM logged most recently. This code is a short integer. 0 (zero) indicates no error. FormatUsage for the GetLastErrCode MethodAfter 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. Used WithCOM Data Control, Mobile Web Client Automation Server, Web Client Automation Server ExamplesThe following example is for COM Data Control: errcode = SiebelApplication.GetLastErrCode GetLastErrText Method for an ApplicationThe GetLastErrText method returns a string that contains the text message for the error that Siebel CRM logged most recently. FormatUsage for the GetLastErrText MethodThe 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. For more information about a specific error, see My Oracle Support. Used WithCOM Data Control, COM Data Server, Mobile Web Client Automation Server, Web Client Automation Server ExamplesThe following example is for COM Data Control: errcode = SiebelApplication.GetLastErrCode GetProfileAttr Method for an ApplicationThe GetProfileAttr method returns the name of an attribute in a user profile. For more information, see SetProfileAttr Method for an Application. FormatApplication.GetProfileAttr(name) Table 34 describes the arguments for the GetProfileAttr method. UsageFor more information, see Using System Fields with the SetProfileAttr Method. Used WithBrowser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThe 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 GetService Method for an ApplicationThe GetService method locates a business service. If this business service is not already running, then Siebel CRM starts it. This method returns the name of the business service. FormatApplication.GetService(serviceName) Table 35 describes the arguments for the GetService method. UsageThe 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 ApplicationStarting 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. To register a business service with a Siebel application
Used WithBrowser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server ExamplesThe 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) The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer GetSharedGlobal Method for an ApplicationThe GetSharedGlobal method returns the shared global variables. A shared variable is a type of variable that any script in the user session can access. It is shared among all scripts. A shared global variable is unique to the user and the user session. A global variable for a given user is not visible to any other user. A global variable is visible only to the current user and user session. You can access the global variable from any event. FormatApplication.GetSharedGlobal(varName) Table 36 describes the arguments for the GetSharedGlobal method.
UsageThis code returns the string that the following code sets:
Used WithCOM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script Example of Using the GetSharedGlobal MethodTo 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. The following example is for the Component Object Model (COM): Dim sReturn as String The following example is in Siebel eScript: function Application_Start (CommandLine) function BusComp_WriteRecord () The following example is in Siebel VB: Sub Application_Start (CommandLine As String) Sub BusComp_WriteRecord GotoView Method for an ApplicationThe GotoView method does the following work:
This method does not return any information. FormatApplication.GotoView(ViewName[, BusinessObjectName]) Table 37 describes the arguments for the GotoView method. UsageIf 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: The following Siebel VB script uses GotoView to programmatically navigate to the Opportunity List view:
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:
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. You cannot use a Multiple Document Interface (MDI) with the Siebel client, so you cannot use this configuration. Used WithExamplesThe following examples use the GoToView method with and without the optional business object parameter. The following example is in Siebel eScript: function BusComp_WriteRecord () //Get the lead quality for this opportunity //If it is a excellent lead, with (actBC) TheApplication().GotoView("All Account List View",actBO); } The following example is in Siebel VB: Dim leadQuality As String 'Get the lead quality For this opportunity 'If it is an excellent lead With actBC TheApplication.GotoView "All Account List View",actBO Else Set actBC = Nothing InvokeMethod Method for an ApplicationThe InvokeMethod method calls a method. It returns the following values:
For more information, see About Specialized and Custom Methods. Browser Script FormattheApplication().InvokeMethod(methodName, methArg1, methArg2, methArgN); Table 38 describes the arguments for the InvokeMethod method.
Server Script FormatApplication.InvokeMethod(methodName, methArg1, methArg2, methArgN); The arguments you can use with this format are the same as the arguments described in Table 38. UsageThe 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 and LoadObjects Method for an Application. Used WithBrowser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesFor an example, see Examples of Using the FindControl Method. IsViewReadOnly Method for an ApplicationYou can use the IsViewReadOnly method to determine if a view is read-only. This method returns the following information: 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. FormatApplication.InvokeMethod("IsViewReadOnly",viewName) Table 39 describes the arguments for the IsViewReadOnly method.
UsageYou 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 WithTo use this method, you can use an Application.InvokeMethod call with the following interfaces:
ExamplesThe following example for Siebel eScript determines if the active view is read only: var sActive = TheApplication().ActiveViewName(); if (TheApplication().InvokeMethod("IsViewReadOnly",sActive) == "TRUE") TheApplication().RaiseErrorText(sActive + "is read only."); TheApplication().RaiseErrorText(sActive + "is not read only."); Language Method for an ApplicationThe Language method returns the language code of the language that the active Siebel application is running. For example, ENU. FormatApplication.InvokeMethod("Language"); Used WithTo use this method, you can use an Application.InvokeMethod call with Server Script. ExamplesThe following example uses Siebel VB: curLang = TheApplication.InvokeMethod("Language") The following example uses Siebel eScript: curLang = TheApplication().InvokeMethod("Language"); LoadObjects Method for an ApplicationThe LoadObjects method starts the COM Data Server. This method must be the first call to the COM Data Server. This method returns the following information:
FormatApplication.LoadObjects(absoluteCFGfileName) Table 40 describes the arguments for the LoadObjects method. UsagePrior to calling the LoadObjects method, you must modify the current folder to the 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. Used WithExamplesThe following example uses COM Data Server: Private Sub LoadConfig_Click() If errCode = 0 Then Status.Text = SiebelApplication.GetLastErrText LoadUserAttributes Method for an ApplicationThe LoadUserAttributes method loads a user profile to the session. This method does not return any information. FormatTable 41 describes the arguments for the LoadUserAttributes method. UsageTo 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. Used WithExamplesThe 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 The following Siebel VB example unloads the loaded user profile: Function LoadUserProfile As Integer Login Method for an ApplicationThe Login method allows an external application to do the following: 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. FormatApplication.Login([connectString,] username, password) Table 42 describes the arguments for the Login method. UsageVerify that the
Used WithCOM Data Control, COM Data Server, Mobile Web Client Automation Server, Siebel Java Data Bean ExamplesThe connect string for COM Data Control uses a token. For example: host = "Siebel://my_computer/SIEBEL/objsrvr/my_computer" lang = "ENU" Most languages use quotes to enclose a text string, so you must use quotes in parentheses. For example:
The following example logs in to the Siebel Server and determines if errors exist: Call SiebelAppControl.Login("host=""siebel://gtwy/enterprise/ObjMgr""", "SADMIN", "SADMIN") The following is a Siebel Java Data Bean example that logs in to a Siebel Server and then logs off: import com.siebel.data.*; public class JDBLoginLogoffDemo public JDBLoginLogoffDemo() // instantiate the Siebel Java Data Bean // login to the Siebel Servers // logoff catch (SiebelException e) LoginId Method for an ApplicationThe LoginId method returns the login ID of the user who started the Siebel application. FormatUsageThe 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 WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesIn 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, LoginName Method for an ApplicationThe LoginName method returns the login name of the user who started the Siebel application. This login name is the name that the user types in the login dialog box. For more information, see Login Method for an Application. FormatUsed WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesFor examples, see ExecuteQuery Method for a Business Component and TheApplication Method. Logoff Method for an ApplicationThe Logoff method disconnects the Siebel client from the Siebel Server. This method does not return any information. FormatUsageFor 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 WithCOM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server LookupMessage Method for an ApplicationThe LookupMessage method returns message text for a key. It returns this information in the current language. FormatApplication.LookupMessage (category, key, [arg1], [arg2],...., [argN]) Table 43 describes the arguments for the LookupMessage method. UsageUseful for retrieving locale specific custom error messages. Used WithExamplesThe 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: Siebel CRM uses the Account Title parameter to substitute the %1 variable: var sVal = TheApplication().LookupMessage("User Defined Errors", "Test", "Account Title"); LookupValue Method for an ApplicationIf all of the following items are true, then the LookupValue method locates a row in the S_LST_OF_VAL table:
You can use this method to get 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. Formatval = Application.InvokeMethod("LookupValue", type, lang_ind_cd) Table 44 describes the arguments for the LookupValue method. Used WithTo use the LookupValue method, you can use an Application.InvokeMethod call with the following interfaces: ExamplesThe following example is in Siebel eScript: var LOVText = TheApplication().InvokeMethod("LookupValue","SR_AREA","Network"); Name Method for an ApplicationThe Name method returns the name of the Siebel application. FormatUsed WithBrowser Script, Web Client Automation Server NewPropertySet Method for an ApplicationThe NewPropertySet method creates a new property set. It returns a property set. FormatUsageYou can use the NewPropertySet method to create input and output arguments for a business service. 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 WithBrowser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server ExamplesThis example creates a new property set. It uses Browser Script: function Applet_PreInvokeMethod (name, inputPropSet) else The following example is for the Component Object Model (COM): Dim oBS As SiebelService Set inpPS = SiebelApplication.NewPropertySet(errCode) The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) else The following example is in Siebel VB: Function WebApplet_PreInvokeMethod (MethodName As String) As Integer PositionId Method for an ApplicationThe PositionId method returns the position ID of the user position. This position ID is the ROW_ID from the S_POSTN table. Siebel CRM sets this value by default when the Siebel application starts. To modify this value, the user can use the Edit menu, and then the Change Position menu item. FormatUsed WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script PositionName Method for an ApplicationThe PositionName method returns the name of the current user position. Siebel CRM sets this value by default when it starts the Siebel application. FormatUsed WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThe following Siebel VB example determines the position of a user who is attempting to modify the sales stage. If the position does not allow this modification, then this code prevents the modification: Function BusComp_PreSetFieldValue (FieldName As String, FieldValue As String) As Integer Dim sPosName As String sMsgText As String RaiseError Method for an ApplicationThe RaiseError method sends a scripting error message to the browser. The error code is a standard number. To determine the error text, Siebel CRM uses the key to look up the current language from the User-Defined Errors category. To define these errors in Siebel Tools, you can use the Message Category object. You can use the optional arguments to format the string if it contains a substitution argument, such as %1 or %2. This method does not return any information. FormatApplication.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 except the RaiseError Method does not include a category argument. Usage for the RaiseError MethodThe 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. 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. Used WithExamplesIn 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 () 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 () else Siebel CRM sends the following error message: This user-defined test error is used in PreDelete, as an example for RaiseError Method 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: RaiseErrorText Method for an ApplicationThe RaiseErrorText method sends a scripting error message to the browser. This method does not return any information. FormatApplication.RaiseErrorText(value, [arg1], [arg2],...., [argN]) Table 45 describes the arguments for the RaiseErrorText method.
UsageUsage for the RaiseErrorText method is very similar to usage for the RaiseError method. For more information, see Usage for the RaiseError Method. Used WithExamplesIn 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. function BusComp_PreDeleteRecord () 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 () SetPositionId Method for an ApplicationThe SetPositionId method sets the active position to a Position Id. This method returns a Boolean value that indicates if Siebel CRM successfully completed the operation. FormatApplication.SetPositionId(positionId) Table 46 describes the arguments for the SetPositionId method. UsageThe positionId argument must contain the Position Id that is associated with the user who is currently logged in to the Siebel application. Used WithCOM Data Server, COM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script SetPositionName Method for an ApplicationThe SetPositionName method sets the active position to a position name. The method returns a Boolean value that indicates if the method succeeded. FormatApplication.SetPositionName(positionName) Table 47 describes the arguments for the SetPositionName method. UsageThe positionName argument must contain the Position name that is associated with the user who is currently logged in to the Siebel application. Used WithCOM Data Server, COM Data Control, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script SetProfileAttr Method for an ApplicationPersonalization uses the SetProfileAttr method to set a value for an attribute in a user profile. This method does not return any information. FormatApplication.SetProfileAttr(name, value) Table 48 describes the arguments for the SetProfileAttr method. UsageThe 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:
For more information about user profile attributes, see Siebel Applications Administration Guide. Using System Fields with the SetProfileAttr MethodYou 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 modify 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. Siebel CRM does not explicitly define system fields in the Personalization Profile business component, so you cannot use this method with a system field, except for the Id field. For more information, see Siebel Personalization Administration Guide. Used WithBrowser Script, COM Data Control, COM Data Server, Server Script, Siebel Java Data Bean, Mobile Web Client Automation Server ExamplesThe following example is in Browser Script: function Applet_PreInvokeMethod (name, inputPropSet) { This following examples exchange information between an applet Server Script and an applet Browser Script:
The following example is in Siebel eScript: function WebApplet_PreInvokeMethod (MethodName) if (MethodName == "MyCustomMethod") { TheApplication().SetProfileAttr("MyProAttr", "Hello World Siebel eScript"); 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" SetSharedGlobal Method for an ApplicationThe SetSharedGlobal method sets a shared global variable that your code can access with the GetSharedGlobal method. The SetSharedGlobal method does not return any information. FormatApplication.SetSharedGlobal(varName, value) Table 49 describes the arguments for the SetSharedGlobal method. Used WithCOM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script ExamplesThe following example is for the Component Object Model (COM): comVar = SiebelApplication.GetSharedGlobal("myVar", errCode) The following example is in Siebel VB: TheApplication.SetSharedGlobal "myVar", "FOO" 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. ShowModalDialog Method for an ApplicationThe ShowModalDialog method allows you to display a dialog box with the cursor in the default state. This application object method calls the equivalent object method in Microsoft Windows. This method returns the value of the returnValue property. The window of the document specified in the url argument sets this property. FormattheApplication().ShowModalDialog (url[, argin][, options]) Table 50 describes the arguments for the ShowModalDialog method.
Values for the Options ArgumentTable 51 describes values you can use for the options argument of the ShowModalDialog method. You must use a semicolon to separate these values. Used WithExamplesThis example uses Browser Script to display a dialog box that includes a URL: function Applet_Load () SWEAlert Method for an ApplicationThe SWEAlert method displays a modal dialog box that includes a message. This method does not return any information. FormattheApplication().SWEAlert(message) UsageUse the SWEAlert method instead of alert. Note the following:
Used WithExamplesThe following Browser Script example displays a status message: function BusComp_PreSetFieldValue (fieldName, value) { if (fieldName == "Account Status") { return ("CancelOperation"); Trace Method for an ApplicationThe Trace method appends a message to the trace file. Trace helps to debug an SQL query and to monitor how Siebel CRM allocates objects. This method does not return any information. This tracing is not the same as the tracing that you can activate in the Siebel application configuration (CFG) file. For more information, see Tracing a Script. It is recommended that you do not use the Trace method or the TraceOn method in a production environment. For more information, see TraceOn Method for an Application. FormatTable 52 describes the arguments for the Trace method.
Used WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThe following example is for COM Data Server: Private Sub TraceOn_Click() The following example is in Siebel VB: Sub Button2_Click Example Trace OutputThe following is example output of an Allocation trace section: 03/05/98,17:27:47,START,4.0.4 [1425_P3] ENU The following is example output of an SQL trace section: 01/22/98,21:03:49,START,4.0.2 [1416] ENU Related TopicsFor more information, see the following topics: TraceOff Method for an ApplicationThe TraceOff method turns off tracing that the TraceOn method starts. This method does not return any information. FormatUsed WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThis 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 With oBC TraceOn Method for an ApplicationThe TraceOn method turns on tracing for allocations and deallocations of Siebel objects and SQL statements that Siebel CRM creates. This method does not return any information. FormatApplication.TraceOn(filename, type, selection) Table 53 describes the arguments for the TraceOn method.
Filename Argument of the TraceOn MethodYou can use the following values for the filename argument: 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 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:
In this situation, the file name is trace_112.txt for user A and for user B, so 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: UsageTo 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. 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. Used WithCOM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script ExamplesThe following example is for COM Data Server: Private Sub TraceOn_Click() The following example is in Siebel eScript: function BusComp_PreSetFieldValue (FieldName, FieldValue) { The following example is in Siebel VB: Sub Button2_Click For example trace output, see Example Trace Output. 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 () with (oBC) oBC = null; The following example is in Siebel VB: TheApplication.TraceOn "C:\trace_output.txt", "SQL", "" With oBC Set oBC = Nothing Related Topics |
Siebel Object Interfaces Reference | Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |