Siebel Object Interfaces Reference > Invoking Custom Methods with MiniButton Controls >
Invoking Custom Methods with MiniButton Controls
Be sure to set the appropriate Target Browser Group in Siebel Tools. To invoke a custom method with a MiniButton control
- Choose an applet (for example, Account List Applet) and create a control with the following properties:
Name = ButtonTest Caption = Test HTML Type = MiniButton Method Invoked = MyTest
- Right click the applet and choose Edit Web Layout.
The Web Layout Editor appears. The Controls/Columns window opens with the available controls, including the one you just created.
- Change the template mode in the Controls/Columns window to 4: Edit List.
- Drag and drop the ButtonTest control onto an available location. When you release the mouse button, the button appears.
- Click Save, and then close the Web Layout Editor.
- Enable the button using one of the following methods:
- To enable the button declaratively, select the applet in the Object List Editor, expand the Applet object in the Object Explorer, select the Applet User Prop object, and then create a new user property for the applet in the Object List Editor:
|
|
CanInvokeMethod: MyTest |
TRUE |
For more information on the CanInvokeMethod user property, see Siebel Developer's Reference.
NOTE: The declarative method is strongly recommended for performance reasons.
- To add a server script to the applet, right-click the applet and choose Edit Server Scripts. Add the following script to the WebApplet_PreCanInvokeMethod() function.
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke) {
if (MethodName == "MyTest")
{
CanInvoke = "TRUE";
return(CancelOperation);
}
return(ContinueOperation);
}
- Add the following browser script to the applet you are using (for example, the Account List Applet):
function Applet_PreInvokeMethod (name, inputPropSet) {
switch (name) {
case "MyTest":
theApplication().SWEAlert("Browser script!");
return("CancelOperation");
break;
}
return("ContinueOperation");
}
- Compile the applet object by right-clicking on it and then choosing Compile Selected Objects.
- Run any application that has access to accounts, and navigate to My Accounts.
The new button appears.
- Click Test.
The Browser Script displays an alert box indicating "Browser Script!"
|