Configuring Siebel Open UI > Customizing Siebel Open UI for Siebel Mobile Disconnected > Doing General Customization Tasks for Siebel Mobile Disconnected >
Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects
This topic describes how to use a Siebel business service or a JavaScript service to customize a predefined, Siebel CRM applet or business component. Customizing Predefined Business Components
The example in this topic describes how to register and call a custom JavaScript method that customizes a predefined business component. You must configure Siebel Open UI to register a custom method before Siebel Open UI can call it. To customize predefined business components
- Use a JavaScript editor to create a new JavaScript file.
- Specify the input properties that Siebel Open UI must send to the ServiceRegistry method.
The ServiceRegistry method uses input properties to register your custom method. For more information, see Properties You Must Include to Register Custom Business Services.
You add the following code:
- Create the namespace for the JavaScript class. In this example, you create a namespace for the pharmacallsvc class:
if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
SiebelJS.Namespace('SiebelApp.pharmacallsvc');
- Define the variables:
var oconsts = SiebelApp.Offlineconstants;
var inputObj = {};
- Specify the business component where Siebel Open UI applies your customization. In this example, you specify the Pharma Professional Call - Mobile business component:
inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";
- Specify the type of object that you are customizing. In this example, you are customizing a business component:
inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");
- Specify the name of the predefined method that you are customizing. In this example, you are customizing the WriteRecord method:
inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";
- Specify the name of the JavaScript class where the method you are customizing resides. In this example, this method resides in the pharmacallsvc class:
inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
- Specify the name of the custom service method that contains the customization of the WriteRecord method:
inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";
- Specify the type of customization:
inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
- Register the custom JavaScript method that you specified in Step 2. This code calls the ServiceRegistry method:
SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
- Define the constructor:
SiebelApp.pharmacallsvc = (function () {
function pharmacallsvc() {
}
- Extend the custom JavaScript class:
SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
- Specify the custom WriteRecord method:
pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs
var psOutArgs = SiebelApp.S_App.NewPropertySet();
return psOutArgs;//return the outputs
};
return pharmacallsvc;
} ());
}
The custom method must include your customization logic. This code gets the property set from the predefined WriteRecord method and uses it as input to your custom WriteRecord method. The custom WriteRecord method then returns an output property set to the predefined WriteRecord method.
The following code is the completed code for this topic:
if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
SiebelJS.Namespace('SiebelApp.pharmacallsvc');
var oconsts = SiebelApp.Offlineconstants;
var inputObj = {};
inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";
inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");
inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";
inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";
inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
SiebelApp.pharmacallsvc = (function () {
function pharmacallsvc() {
}
SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs
var psOutArgs = SiebelApp.S_App.NewPropertySet();
return psOutArgs;//return the outputs
};
return pharmacallsvc;
} ());
}
- If you want Siebel Open UI to anonymously register existing applet and business component objects you can use anonymous registration. This allows administrators to have a common customization across all applets or all business components.
For example, in order to have the ability to print or click on a specific button in any applet, the following registration will give the handle of invoke a method in any applet, because the ObjectName is deliberately omitted:
inputArgs[oconsts.get("DOUIREG_OBJ_NAME")] = "";
inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]=oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";
inputArgs[oconsts.get("DOUIREG_SRVC_NAME")] = "CustomDMService";
inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethodPrint";
inputArgs[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
In this case, InvokeMethodPrint will be called for all applets as PRE whenever InvokeMethod is called for any applet.
Customizing Predefined Applets
The example in this topic registers a custom method that customizes a predefined applet. The work you do in this topic is very similar to the work you do in Customizing Predefined Business Components. The only difference occurs when you specify the input object for the applet and the type of object. To customize predefined applets
The following code is the completed code for this topic: if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
SiebelJS.Namespace('SiebelApp.pharmacallsvc');
var oconsts = SiebelApp.Offlineconstants;
var inputObj = {};
inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";
inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethod";
inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
SiebelApp.pharmacallsvc = (function () {
function pharmacallsvc() {
}
SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {//get the inputs
var psOutArgs = SiebelApp.S_App.NewPropertySet();
return psOutArgs;//return the outputs
};
return pharmacallsvc;
} ());
}
|