- In Windows Explorer, navigate to the following folder:
INSTALL_DIR\applicationcontainer\webapps\siebel\scripts\siebel\offline
- Use a JavaScript editor to open the servicecmtparts.js file.
- Add the following code to the InvokeMethod method:
var model= SiebelApp.S_App.GetModel();
var pBusObj = model.GetBusObject("boName");
var pBusComp = pBusObj.GetBusComp("bcName");
This code gets the active business component for the applet that displays the RMA button.
- Add the following code. This code declares the objects:
if (typeof (SiebelApp.commitpartconsumed) === "undefined") {
SiebelJS.Namespace('SiebelApp.commitpartconsumed');
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")]="CanInvokeMethod";
inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";
inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="CanInvokeMethod";
inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");
SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
inputArgs={};
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")]="InvokeMethod";
inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";
inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="InvokeMethod";
inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");
SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
inputArgs={};
For information about the methods that this code uses, see the following topics:
- Add the following code. This code calls the CanInvokeMethod method:
SiebelApp.commitpartconsumed = (function () {
function commitpartconsumed(pm) {
}
var commitObj = new commitpartconsumed();
commitpartconsumed.prototype.CanInvokeMethod = function (psInputArgs) {
var currRetValue={err:false}, retObj;
var psOutArgs = SiebelApp.S_App.NewPropertySet();
var svcMthdName = "";
svcMthdName = psInputArgs.GetProperty("MethodName").toString();
if (svcMthdName === "CommitPartMvmtClient") {
psOutArgs.SetProperty("Invoked", true);
psOutArgs.SetProperty("RetVal", true);
currRetValue={err:false,retVal:psOutArgs};
}
else if (svcMthdName === "OrderPartsRMA") {
psOutArgs.SetProperty("Invoked", true);
psOutArgs.SetProperty("RetVal", true);
currRetValue={err:false,retVal:psOutArgs};
}
else{
psOutArgs.SetProperty("Invoked", false);
psOutArgs.SetProperty("RetVal", false);
currRetValue={err:false,retVal:psOutArgs};
}
return currRetValue;
};
- Add the following code. This code calls the InvokeMethod method:
commitpartconsumed.prototype.InvokeMethod = function (psInputArgs) {
var currRetValue={err:false}, retObj;
var svcMthdName = "";
var psOutArgs = SiebelApp.S_App.NewPropertySet();
svcMthdName = psInputArgs.GetProperty("MethodName").toString();
if (svcMthdName === "CommitPartMvmtClient") {
retObj=currRetValue=this.CommitPartMvmtClient();
psOutArgs.SetProperty("Invoked", true);
currRetValue={err:false,retVal:psOutArgs};
}
else{
psOutArgs.SetProperty("Invoked", false);
currRetValue={err:false,retVal:psOutArgs};
}
if (svcMthdName === "OrderPartsRMA") {
retObj=currRetValue=this.OrderPartsRMA();
psOutArgs.SetProperty("Invoked", true);
currRetValue={err:false,retVal:psOutArgs};
}
else{
psOutArgs.SetProperty("Invoked", false);
currRetValue={err:false,retVal:psOutArgs};
}
return currRetValue;
};
- Add the code that gets values for the following fields:
commitpartconsumed.prototype.createRMAOrder = function (orderType) {
var currRetValue={err:false}, retObj;
var sOrderId;
var cszOrderId;
var sAssetNum;
var sPartNum;
var sStatus;
var sProductId;
var sProductName;
var sQuantity;
var sActivityPartMvmtID;
var pModel;
var pFSActivityPartsMovementBC;
var pActionBC;
var sSR_Id;
var pServiceRequestBC;
var pOrderEntry_OrdersBC;
var pOrderEntry_LineItemBC;
var errParamArray = [];
pModel = SiebelApp.S_App.Model;
var pBusObj = pModel.GetBusObject("boName")
pFSActivityPartsMovementBC=pBusObj.GetBusComp("bcName");
sOrderId=retObj.retVal;
if (utils.IsEmpty(sOrderId)){
retObj=currRetValue=pFSActivityPartsMovementBC.GetFieldValue("");
var oPsDR_Header:PropertySet = SiebelApp.S_App.NewPropertySet();
// Cannot use the same property set in GetMultipleFieldValues, must use a
// different one for the values. The process will not error, but Siebel
// Open UI will not place the values in the property set.
var lPS_values:PropertySet = SiebelApp.S_App.NewPropertySet();
oPsDR_Header.SetProperty("Product Id","");
oPsDR_Header.SetProperty("Used Quantity","");
oPsDR_Header.SetProperty("Id","");
oPsDR_Header.SetProperty("Asset Number","");
oPsDR_Header.SetProperty("Part Number","");
sPartNum=retObj.retVal;
pActionBC = SiebelApp.S_App.GetActiveView().GetActiveApplet().BusComp().ParentBuscomp();
retObj=currRetValue=pActionBC.GetFieldValue("Activity SR Id");
sSR_Id = retObj.retVal;
if(sSR_Id==""){
//Activity has no associated SR... Hence the operation will be aborted
SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("IDS_ERR_FS_MISSING_SR", errParamArray);
currRetValue={err: "IDS_ERR_FS_MISSING_SR", retVal:""};
return currRetValue;
}
}
return currRetValue;
}
For information about the methods that this code uses, see GetFieldValue Method.
- Add the code that gets the parent business component and the following business components:
else{
pModel = SiebelApp.S_App.Model;
pServiceRequestBC = pModel.BusObj("Service Request").BusComp("Service Request");
pOrderEntry_OrdersBC = SiebelApp.S_App.Model.GetBusObj("Service Request").BusComp("Order Entry - Orders");
pOrderEntry_LineItemBC = pModel.BusObj("Service Request").BusComp("Order Entry - Line Items");
//CREATE ORDER Header.
retObj=currRetValue=pOrderEntry_OrdersBC.ExecuteQuery();
- Add the code that creates the Order Header record and sets the field values. For example, for the Order Type field. You add the following code:
retObj=currRetValue=pOrderEntry_OrdersBC.NewRecord(true);
sLocaleVal = SiebelApp.S_App.Model.GetLovNameVal(orderType, "FS_ORDER_TYPE");
retObj=currRetValue=pOrderEntry_OrdersBC.SetFieldValue("Order Type", sLocaleVal, true);
retObj=currRetValue=pOrderEntry_OrdersBC.WriteRecord();
retObj=currRetValue=pOrderEntry_OrdersBC.GetFieldValue("Id");
sOrderItemId=retObj.retVal;
retObj=currRetValue=pOrderEntry_OrdersBC.GetFieldValue("Id");
m_sOrderHeaderId=retObj.retVal;
retObj=currRetValue=pOrderEntry_LineItemBC.ExecuteQuery();
For information about the methods that this code uses, see SetFieldValue Method, WriteRecord Method, NewRecord Method.
- Add the code that creates the order line item record, commits this record, and sets the value for the Order Item Id field in the active business component. This value is the row Id of the order header record that Siebel Open UI creates. This code sets the field value for each of the following fields:
retObj=currRetValue=pOrderEntry_LineItemBC.NewRecord(true);
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product Id", retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product", sProductName, true);
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Quantity Requested",sQuantity, true);
if(!utils.IsEmpty(sAssetNum)){
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Asset Number", sAssetNum, true);
}
if(!utils.IsEmpty(sPartNum)){
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Part Number", sPartNum, true);
}
if(!utils.IsEmpty(sStatus)){
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Product Status Code",sStatus, true);
}
retObj=currRetValue=pOrderEntry_LineItemBC.GetFieldValue("Id");
sOrderItemId=retObj.retVal;
retObj=currRetValue=pOrderEntry_LineItemBC.SetFieldValue("Order Header Id", m_sOrderHeaderId, true)
retObj=currRetValue=pOrderEntry_LineItemBC.WriteRecord();
retObj=currRetValue=pFSActivityPartsMovementBC.SetFieldValue("Order Item Id",sOrderItemId, true);
retObj=currRetValue=pFSActivityPartsMovementBC.WriteRecord();
- Save, and then close the servicecmtparts.js file.
- Test your modifications:
- Log in to the disconnected client.
- Click the Activities tab.
- Create an activity, and then click Part Tracker.
- Create a part tracker record.
- Click the RMA button to create a Return Material Authorization (RMA) record.
- Make sure Siebel Open UI creates the RMA record and displays the correct values in the fields of this record, such as the Product Id, Product Name, Used Quantity, Quantity Requested, Asset #, and so on.