4Using Siebel Visual Basic and Siebel eScript

Overview of Using Siebel Visual Basic and Siebel eScript

You can use Siebel VB or Siebel eScript to customize and configure Siebel CRM beyond the capabilities that defining object properties provides. These languages integrate with other Siebel tools, such as the Applet Designer, Siebel CTI, and Siebel SmartScript. To define object properties, you can use the Applet Designer or attach scripts.

It is recommended that you use coding only after you determine that you cannot use any other tool. Siebel Tools provides many ways to configure Siebel CRM without coding. The following reasons explain why you must use Siebel Tools before you write your own code:

  • Using Siebel Tools is easier than writing code.

  • Your code might not work with an upgrade. Siebel CRM automatically updates a customization that you create in Siebel Tools during an upgrade. It does not update custom code you create. It might be necessary for you to manually update the code.

  • Configuration through Siebel Tools results in better performance than using the same features through code. For more information, see Siebel Performance Tuning Guide.

Examples of Using Siebel Visual Basic and Siebel eScript

Siebel Visual Basic and Siebel eScript allow you to customize Siebel CRM behavior.

    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 configures 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.

      Modifying and Controlling Data

      Siebel Visual Basic and Siebel eScript allow you to modify and control data, such as update, insert, or delete a record. For example, you can control the value of one field according to the value of another field:

      • Set the probability of the opportunity, such as 98%, according to the sales stage of the opportunity, such as 03 - Closing.

      • If the sales cycle is at or past the Quote Submitted stage, then do not allow the user to modify the Revenue field.

      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 that a predefined Siebel application uses. For example, assume the visibility rules that exist in a predefined Siebel application result in a business object that Siebel CRM can read but not edit. In this situation, a configuration that you create through a Siebel programming language can also read but not edit this same object. You cannot use a Siebel programming language to circumvent the visibility rules or the security constraints that a predefined Siebel application enforces.

        Customizing Behavior for User Interface Elements

        To add a user interface element to an applet, you can use the Applet Layout Editor in Siebel Tools. To associate a behavior with this element, you can use a Siebel programming language. For example, you can add a button on an applet that opens another application, such as Microsoft Excel.

          Declare Your Variables

          To help other developers understand your code and to help you debug your code, it is recommended that you declare your variables.

          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. This type requires 16 bytes and uses twice as much memory as the next smallest data type.

            Use a Standardized Naming Convention

            To improve efficiency and reduce errors, it is recommended that all developers in your programming group use the same standardized naming convention. The convention that you use does not matter. The following table describes a common convention that prefixes each variable with a letter that indicates the type. If necessary, you can also use a suffix.

            Table Naming Conventions for Variables in Scripts

            Data Type Naming Convention Example

            String

            s

            sName

            Integer

            i

            iReturn

            Long integer

            l

            lBigCount

            Single-precision number

            si

            siAllowance

            Double-precision number

            d

            dBudget

            Object

            o

            oBusComp

            Currency

            c

            cAmtOwed

              Use Constants to Standardize Code

              Siebel Visual Basic and Siebel eScript provide constants that you can use to make your code more readable by other developers. A constant clarifies the intent of the operation. Use the constant name in your code. Do not use the integer value in your code. The integer value is included only to aid in debugging. If you store the constant in a local variable, and if the value of the local variable is available, then Siebel CRM displays the integer value in the Debugger.

              The following information lists the Siebel constants you can use.

              It is recommended that you use the constant and that you do not use the integer value because integer values are subject to modification.

              Table Siebel Constants

              Used With Constant Name Integer Value

              Pre Event Handler Methods

              ContinueOperation

              1

              CancelOperation

              2

              Search Methods

              ForwardBackward

              256

              ForwardOnly

              257

              NewRecord Method

              NewBefore

              0

              NewAfter

              1

              NewBeforeCopy (Not available with Siebel Java Data Bean)

              2

              NewAfterCopy (Not available with Siebel Java Data Bean)

              3

              Siebel ViewMode Methods. For more information, see Constants You Can Use with the SetViewMode Method.

              SalesRepView

              0

              ManagerView

              1

              PersonalView

              2

              AllView

              3

              OrganizationView

              5

              GroupView

              7

              CatalogView

              8

              SubOrganizationView

              9

                Avoid Nested If Statements

                To avoid a nested If statement, you can use one of the following statements:

                • In Siebel VB, use the Select Case statement

                • In Siebel eScript, use the Switch statement

                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;
                   }
                }
                

                  Applying Multiple Object Interface Methods to a Single Object

                  To apply multiple object interface methods to a single object, you can use the With statement in Siebel VB or Siebel eScript. It reduces typing and makes the code easier to read.

                  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"
                     .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(); 
                  {
                     var sAccount = oBusComp.GetFieldValue("Account");
                  }
                  . . .
                  

                    Use a Self-Reference to Indicate the Current Object

                    To indicate the current object, you can use the following statements:

                    • In Siebel VB, use the Me statement.

                    • In Siebel eScript, use the This keyword.

                    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:

                    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);
                    

                      Delete Objects You Have Created That You No Longer Require

                      Although the interpreter performs object cleanup, it is recommend that you write code that explicitly deletes objects it created that you no longer require. Your code must delete each Siebel object in the same procedure it used to create it.

                      To delete objects, do the following:

                      • In Siebel VB, set each object to Nothing.

                      • In Siebel eScript, set each object to Null.

                      You can delete these objects in the reverse order that the code created them. Make sure you code deletes child objects before it deletes 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")
                      
                      Your code here
                      
                      Set oBusComp = Nothing
                      Set oBusObj = Nothing
                      

                      Example of Deleting Objects in Siebel eScript

                      The following code is an example of deleting objects in Siebel eScript:

                      var oBusObject = TheApplication().GetBusObject("Contact"");
                      var oBusComp = oBusObject.GetBusComp("Contact");
                      
                      Your code here
                      
                      oBusComp = null;
                      oBusObject = null;
                      

                        Make Sure Function Names Are Unique

                        Make sure that the name is unique for every function you create. If two functions use the same name, and if those functions are in the same view, then results are unpredictable. Consider using a naming convention, such as using the view name as a function name prefix.

                          Manage the Script Buffer

                          The size limit of a non-Unicode script buffer is 65530 bytes. The amount of available memory limits the Unicode script buffer. Make sure your computer possesses enough memory to accommodate this buffer.

                            Using Siebel VB and Siebel eScript Formats

                            There are some important differences between the formats that Siebel VB and Siebel eScript use:

                            • Siebel eScript is case-sensitive. For example, theApplication is different from TheApplication. Siebel VB is not case-sensitive.

                            • Siebel eScript does not distinguish between a subroutine and a function. A subroutine cannot accept an argument. A function can accept an argument. In Siebel eScript, because every object interface method is a function, you must follow it with a pair of parentheses. You must use this technique if the function does or does not accept an argument.

                            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.

                              Handling the Date Format in Siebel VB

                              If you use an object interface method that includes a date, then use caution regarding the date format. The GetFieldValue method returns the date in the following format:

                              dd/mm/yyyy

                              The CVDate function expects the regional setting. If you apply it, then Siebel CRM might return an error. The GetFormattedFieldValue method uses the regional settings of the operating system that is installed on the computer that runs the Siebel client. The regional setting might specify the year with two digits, and can cause an error with the year 2000 problem. For these reasons, use the following procedure for performing date arithmetic.

                              To handle the date format in Siebel VB

                              1. To return the value of the date fields, use the GetFieldValue object interface method.

                                For more information, see GetFieldValue Method for a Business Component.

                              2. Use the DateSerial function convert the value of the date field to a date variable.

                              3. 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)))
                                any date arithmetic

                                Returning Run-Time Errors in Siebel VB

                                This topic describes how to return run-time errors in Siebel VB.

                                To return run-time errors in Siebel VB

                                • Return a run-time error code with one of the following items:

                                  • Predefined Siebel VB properties. 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 use the following code to view the text of the error message:

                                    If errCode <> 0 Then
                                       ErrText = GetLastErrText
                                       TheApplication.RaiseErrorText ErrText
                                       Exit Sub
                                    End If
                                    

                                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.

                                  Opening the Siebel Script Editor

                                  This topic describes how to open the Siebel Script Editor.

                                  To open the Siebel Script Editor

                                  1. In Siebel Tools, in the Object Explorer, click the object type you must modify.

                                    For example, click Applet.

                                  2. 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.

                                  3. In the Scripting Language dialog box, choose one of the following menu items:

                                    • Edit Server Scripts

                                    • Edit Browser Scripts

                                  4. 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.

                                    Declaring a Local Variable

                                    This topic describes how to declare a local variable. You can access the value of a local variable only in the script where you define the local variable.

                                    To declare a local variable

                                    1. Open the Siebel Script Editor.

                                      For more information, see Opening the Siebel Script Editor.

                                    2. In the navigation tree of the script editing window, expand the object tree, and then click the script you must modify.

                                      For example, expand the WebApplet tree, and then click WebApplet_PreInvokeMethod.

                                    3. 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;
                                    }
                                    

                                      Declaring a Module Variable

                                      This topic describes how to declare a module variable. In this situation, a module is a group of methods contained in an object that you can script. For example, a business service, business component, application object, and so forth. You can access the value of a module variable in the script where you define the module variable and in other scripts in the object or module where you define the module variable. To access a module variable, an instance of the object where you define the variable must exist.

                                      To declare a module variable

                                      1. Open the Siebel Script Editor.

                                        For more information, see Opening the Siebel Script Editor.

                                      2. In the navigation tree of the script editing window, expand the general tree, and then click declarations.

                                      3. 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
                                      

                                        Declaring a Global Variable

                                        This topic describes how to declare a global variable.

                                        To declare a global variable

                                        1. Open the Siebel Script Editor for the object you must modify.

                                          For more information, see Opening the Siebel Script Editor.

                                        2. Use the Global statement to declare the variable.

                                          The following example includes the Global statement in Siebel eScript:

                                          TheApplication().gVar = "some value";
                                          
                                        3. Repeat these steps 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.

                                        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.

                                          Calling More Than One Object Interface Method In a Script

                                          You can call more than one object interface method in a script.

                                          To call more than one object interface method in a script

                                          • Use one of the following statements:

                                            • Select statement in Siebel VB

                                            • Switch statement in Siebel eScript.

                                            Example of Calling More Than One Object Interface Method in Siebel VB

                                            The following example uses the Select statement in Siebel VB:

                                            Dim iReturn As Integer
                                            iReturn = ContinueOperation
                                            Select Case methodName
                                               Case "PushOpportunity"
                                                  your custom code
                                                  iReturn = CancelOperation
                                               Case "Stage3"
                                                  your custom code
                                                  iReturn = CancelOperation
                                            End Select
                                            object_PreInvokeMethod = iReturn
                                            

                                              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
                                                    iReturn = CancelOperation;
                                                    break;
                                              
                                                 default:
                                                    iReturn = ContinueOperation;
                                              }
                                              return (iReturn);
                                              

                                                Using Script to Add Business Logic to a Business Component

                                                You can use Server Script or Browser Script to add business logic to a business component.

                                                To use script to add business logic to a business component

                                                1. Open the Siebel Script Editor.

                                                  For more information, see Examples of Using Siebel Visual Basic and Siebel eScript.

                                                2. In the navigation tree of the Siebel Script Editor, choose an event in the BusComp Tree.

                                                3. In the Siebel Script Editor window, write your script.

                                                4. Choose the Debug menu, and then the Check Syntax menu item.

                                                  The Check Syntax menu item is available only for Server Script.

                                                5. Save the modifications.

                                                6. Choose the Tools menu, and then the Compile Selected Objects menu item.

                                                7. Choose the Debug menu, and then the Start menu item.

                                                Using a MiniButton Control to Call a Custom Method

                                                This topic describes how to use a minibutton control to call a custom method.

                                                To use a minibutton control to call a custom method

                                                1. Open Siebel Tools.

                                                2. Expose the Applet User Prop object type:

                                                  1. Choose the View menu, and then the Options menu item.

                                                  2. In the Development Tools Options dialog box, click the Object Explorer tab.

                                                  3. Expand the Applet tree, and then make sure the Applet User Prop object type contains a check mark.

                                                  4. Click Ok.

                                                3. In the Object Explorer, click Applet.

                                                4. In the Applets list, locate the applet you must modify.

                                                5. In the Object Explorer, expand the Applet tree, and then click Control.

                                                6. In the Controls list, add a new control using values from the following table.

                                                  Property Value

                                                  Name

                                                  ButtonTest

                                                  Caption

                                                  Test

                                                  HTML Type

                                                  MiniButton

                                                  Method Invoked

                                                  MyTest

                                                7. In the Applets list, right-click the applet and then choose the Edit Web Layout menu item.

                                                8. In the Controls/Columns window, modify the template mode to Edit List.

                                                9. 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:

                                                  1. In the Object Explorer, click Applet User Prop.

                                                  2. In the Applet User Props list, create a new user property using values from the following table.

                                                    Property Value

                                                    Name

                                                    CanInvokeMethod: MyTest

                                                    For more information about the CanInvokeMethod applet user property, see Siebel Developer's Reference.

                                                    Value

                                                    TRUE

                                                  As an alternative, you can use script to enable the button. For more information, see Using Script to Enable a Mini Button.

                                                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!");
                                                  
                                                      return("CancelOperation");
                                                  
                                                    break;
                                                  
                                                    }
                                                  
                                                  return("ContinueOperation");
                                                  
                                                  }
                                                  
                                                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 earlier in this procedure.

                                                20. Make sure the Siebel client displays an alert box that includes the following message:

                                                  Browser Script!

                                                  Using Script to Enable a Mini Button

                                                  To enable a minibutton, it is strongly recommended that you use the declarative technique described in Using a MiniButton Control to Call a Custom Method. In most situations, declarative programming does not negatively impact performance as much as scripting does. However, in certain situations, you can use a script to enable a button and improve performance. For example, you can use script to avoid a complicated Value expression that is longer than 255 characters that requires multiple calculated fields and declarative programming.

                                                  To use script to enable a minibutton

                                                  1. Complete steps 1 through 11 in Using a MiniButton Control to Call a Custom Method.

                                                  2. In the Applets list, right-click the applet you must modify, and then choose Edit Server Scripts.

                                                  3. In the Scripting Language dialog box, choose Visual Basic or eScript, and then click OK.

                                                  4. In the Script Editor, expand the WebApplet tree, and then click the WebApplet_PreCanInvokeMethod function.

                                                  5. In the Script Editor, add the following script:

                                                      function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
                                                      {
                                                    
                                                      if (MethodName == "MyTest")
                                                    
                                                      {
                                                    
                                                        CanInvoke = "TRUE";
                                                    
                                                        return(CancelOperation);
                                                    
                                                      }
                                                    
                                                      return(ContinueOperation);
                                                    
                                                      }
                                                    
                                                  6. Continue with step 13 in Using a MiniButton Control to Call a Custom Method.

                                                    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

                                                    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. In the Siebel client, navigate to the Administration - Server Configuration screen, and then the Servers view.

                                                    2. In the Components list, choose a component to log.

                                                    3. 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 earlier in this procedure for logging.

                                                    4. Set the Log Level to 1.

                                                    5. (Optional) Modify tracing parameters:

                                                      1. Click the Parameters tab.

                                                      2. In the Component Parameters list, click Menu, and then choose the Columns Displayed menu item.

                                                      3. Move the Parameter Alias and Subsystem columns to the Selected Columns window, and then click Save.

                                                      4. In the Component Parameters list, click Query.

                                                      5. Enter the following values, and then click Go.

                                                        Field Value

                                                        Parameter Alias

                                                        Trace*

                                                        Subsystem

                                                        Object Manager

                                                      6. Set one or more tracing parameters using values from the following table.

                                                        Information to Trace Parameter Alias Settings for Current Value and Value on Restart

                                                        Allocations

                                                        TraceAlloc

                                                        Enter 1 to enable logging. Enter 0 to disable logging.

                                                        Events

                                                        TraceEvents

                                                        Enter 1 to enable logging. Enter 0 to disable logging.

                                                        SQL Commands

                                                        TraceSql

                                                        Enter 1 to enable logging. Enter 0 to disable logging.

                                                        Users

                                                        TraceUser

                                                        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 modify these parameters, enter values in the Current Value column.

                                                        To instruct Siebel CRM to modify these parameters only after a restart, enter values in the Value on Restart column.

                                                    6. Test your work, and then examine the results.

                                                    7. When you are finished logging, set the Log Level that you set to 1 earlier in this procedure, 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
                                                    
                                                    ObjMgrSessionInfo ObjMgrLogin 3 2003-04-09 15:37:20 Login name : SADMIN
                                                    
                                                    ObjMgrSessionInfo ObjMgrAuth 3 2003-04-09 15:37:20 Authentication name : SADMIN
                                                    
                                                    ObjMgrSessionInfo ObjMgrLogin 3 2003-04-09 15:37:20 Session Type: Regular Session
                                                    
                                                    GenericLog GenericError 1 2003-04-09 15:37:20 Invocation of Applet Menu New 
                                                    Service::NewExpense is not allowed.
                                                    
                                                    GenericLog GenericError 1 2003-04-09 15:37:20 Invocation of Applet Menu New 
                                                    Service::NewTimeSheet is not allowed.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:38:27 [User: SADMIN] EVENT, BEGIN, 
                                                    BusComp [Account], BusComp_Query.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:38:27 [User: SADMIN] EVENT, END, 
                                                    BusComp [Account], BusComp_Query.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:38:58 [User: SADMIN] EVENT, BEGIN, 
                                                    BusComp [Account], BusComp_NewRecord.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:38:58 [User: SADMIN] EVENT, END, 
                                                    BusComp [Account], BusComp_NewRecord.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:39:08 [User: SADMIN] EVENT, BEGIN, 
                                                    BusComp [Account], BusComp_PreSetFieldValue.
                                                    
                                                    ObjMgrExtLangLog ObjMgrExtLangLog 0 2003-04-09 15:39:08 [User: SADMIN] EVENT, END, 
                                                    BusComp [Account], BusComp_PreSetFieldValue.
                                                    
                                                    ObjMgrSessionInfo ObjMgrLogin 3 2003-04-09 16:40:52 Username: SADMIN, Login Status: 
                                                    Attempt,  Session Id: !1.690.b816.3e94a0a0, IP Address: 172.20.94.66