Configuring Siebel Open UI > Customizing Siebel Open UI > Doing General Customization Tasks >
Calling Methods for Applets and Business Services
This topic includes some examples that describe how to call methods for applets and business services. For other examples that call methods, see the following topics:
The example in this topic describes how to call a method when the user clicks a button. To call methods for buttons
- Modify the plug-in wrapper:
- Use a JavaScript editor to open the plug-in wrapper for the button.
- Locate the click handler for the button.
- Add the following code to the code you located in Step b:
var inPropSet = CCFMiscUtil_CreatePropSet(); //Define the inPropSet property set with the information that InvokeMethod sends as input to the method that it calls. var ai= {}; ai.async = true; ai.selfbusy = true; ai.scope = this; ai.mask = true; ai.opdecode = true; ai.errcb = function(){ //Code occurs here for the method that Siebel Open UI runs if the AJAX call fails }; ai.cb = function(){ //Code occurs here for the method that Siebel Open UI runs if the AJAX call is successful }; this.GetPM().ExecuteMethod("InvokeMethod",input arguments, ai);
where:
this.GetPM().ExecuteMethod("InvokeMethod", "NewRecord", inPropSet, ai)
For more information, see InvokeMethod Method for Application Models and NewRecord Method.
- Modify the presentation model:
- Use a JavaScript editor to open the presentation model for the applet that you must modify.
- Locate the code that calls the Init method.
- Add the following code to the code that you located in Step b:
this.AttachPreProxyExecuteBinding("method_name", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs before the applet proxy sends a reply.});
this.AttachPostProxyExecuteBinding("method_name", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs after the applet proxy sends a reply.});
where:
- method_name identifies the name of the method that InvokeMethod calls. Note that Siebel Open UI comes predefined to set the value of the methodName argument in the following code to WriteRecord, by default. You must not modify this argument:
function(methodName, inputPS, outputPS)
For example:
this.AttachPreProxyExecuteBinding("WriteRecord", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs before the applet proxy sends a reply.});
this.AttachPostProxyExecuteBinding("WriteRecord", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs after the applet proxy sends a reply.});
For more information, see WriteRecord Method, AttachPostProxyExecuteBinding Method, and AttachPreProxyExecuteBinding Method.
Calling Methods for Business Services
The example in this topic describes how to call a method for a business service when the user clicks a button. To call methods for buttons
- Use a JavaScript editor to open the plug-in wrapper for the button.
- Locate the click handler for the button.
- Add the following code to the code that you located in Step 2:
var service = SiebelApp.S_App.GetService("business_service_name"); if (service) { var inPropSet = CCFMiscUtil_CreatePropSet(); //Code occurs here that sets the inPropSet property set with all information that Siebel Open UI must send as input to the method that it calls. var ai = {}; ai.async = true; ai.selfbusy = true; ai.scope = this; ai.mask = true; ai.opdecode = true; ai.errcb = function(){ //Code occurs here for the method that Siebel Open UI runs if the AJAX call fails }; ai.cb = function(){ //Code occurs here for the method that Siebel Open UI runs if the AJAX call is successful }; service.InvokeMethod("method_name", "input_arguments", ai); }
For more information, see InvokeMethod Method for Presentation Models.
|