Siebel Object Interfaces Reference > Using Siebel Visual Basic and Siebel eScript > Configuring Error Handling >

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

  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 Step 6.

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

    Browser Script!

Using Script to Enable a MiniButton

To enable a minibutton, it is strongly recommended that you use the declarative technique described in Step 6. 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 Step 1 through Step 11.
  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.
Siebel Object Interfaces Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.