- In Windows Explorer, navigate to the following folder:
INSTALL_DIR\applicationcontainer\webapps\siebel\scripts\siebel\offline
- Copy the servicecommitpartconsumed.js file to the following folder:
INSTALL_DIR\applicationcontainer\webapps\siebel\files\custom\
For more information, see Organizing Files That You Customize.
- Use a JavaScript editor to open the file you created in Step 2.
- Locate the following code that resides near the beginning of the file:
if (typeof (SiebelApp.commitpartconsumed) === "undefined") {
SiebelJS.Namespace('SiebelApp.commitpartconsumed');
- Add the following code immediately after the code that you located in Step 4:
var inputArgs = {};
var oconsts = SiebelApp.Offlineconstants;
inputArgs[oconsts.get("DOUIREG_OBJ_NAME")]= "SHCE Service FS Activity Part Movements List Applet - Mobile";
inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]= oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")]= "CommitPartMvmtClient";
inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]= "commitpartconsumed";
inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "CommitPartMvmtClient";
inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]= null;
SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
This code registers the service. For more information, see ServiceRegistry Method.
- Add the following CanInvokeMethod method immediately after the code that you added in Step 5:
commitpartconsumed.prototype.CanInvokeMethod = function (svcMthdName) {
if (svcMthdName === "CommitPartMvmtClient") {
return true;
}
else
return SiebelApp.commitpartconsumed.superclass.CanInvokeMethod.call(
this,svcMthdName);
};
This code determines whether or not Siebel Open UI can call a method in the current context of the business component.
- Add the following InvokeMethod method immediately after the code that you added in Step 6:
commitpartconsumed.prototype.InvokeMethod = function (svcMthdName, psinpargs) {
var psOutArgs = SiebelApp.S_App.NewPropertySet();
if (!svcMthdName) {
return (false);
}
if (svcMthdName === "CommitPartMvmtClient") {
psOutArgs = this.CommitPartMvmtClient();
}
else {
return SiebelApp.commitpartconsumed.superclass.InvokeMethod.call(
this,svcMthdName, psinpargs);
}
return (psOutArgs);
};
This code calls the CommitPartMvmtClient service method if the user clicks the Commit button.
- Add the following code immediately after the code that you added in Step 7:
commitpartconsumed.prototype.CommitPartMvmtClient = function () {
SiebelJS.Log('Invoked CommitPartMvmtClient Method.');
var pServiceInvBC;
var cszCommitFlag;
var pModel;
pModel = SiebelApp.S_App.Model;
var pServiceInvBO = pModel.GetBusObject("boName");
pServiceInvBC = pServiceInvBO.GetBusComp("bcName");
cszCommitFlag = pServiceInvBC.GetFieldValue("Commit Txn Flag");
if (cszCommitFlag === 'Y'){
SiebelJS.Log('Consumed Part Is Already In Committed State');
}
else
{
// pServiceInvBC.ActivateField("Commit Txn Flag");
//pServiceInvBC.UpdateRecord();
pServiceInvBC.SetFieldValue("Commit Txn Flag", "Y", true);
pServiceInvBC.WriteRecord();
}
};
This code determines whether or not the record is already committed. The DoInvoke method calls the CommitPartMvmtClient method, and then the CommitPartMvmtClient method examines the value of the Commit Txn Flag field. If this value is:
- Y. Siebel Open UI has already committed the record and displays a Consumed Part Is Already In Committed State message.
- N. Siebel Open UI has not committed the record and writes the record to the local database.
For more information about the methods that this code uses, see GetFieldValue Method, SetFieldValue Method, and WriteRecord Method.