Siebel CRM Configuring Siebel Open UI Siebel Innovation Pack 2016, Rev. A E52417-01 |
|
![]() Previous |
![]() Next |
View PDF |
This topic includes some examples that describe how to customize Siebel Service in Siebel Open UI for a Siebel Mobile disconnected client. It includes the following information:
For more information about:
Work you do in this topic, see "Process of Customizing Siebel Open UI for Siebel Mobile Disconnected"
Methods that these examples use, see "Methods You Can Use to Customize Siebel Mobile Disconnected"
Functionality that these customizations modify, see the chapter that describes how to use the Siebel Mobile Disconnected Application for Siebel Service in Siebel Mobile Guide: Disconnected
The example in this topic describes how to enable the Commit button so that users can commit a Part Tracker record. To set the Commit Flag for a Part Tracker record, the user navigates to the Activities - Part Tracker view, chooses a Part Tracker record, and then clicks Commit. If the part is:
Not already committed, then Siebel Open UI commits the part.
Already committed, then Siebel Open UI displays a message that the part is already committed.
To allow users to commit Part Tracker records
In Windows Explorer, navigate to the following folder:
INSTALL_DIR\eappweb\PUBLIC\scripts\siebel\offline
Copy the servicecommitpartconsumed.js file to the following folder:
INSTALL_DIR\eappweb\PUBLIC\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".
The example in this topic describes how to enable the RMA button so that a user can return a part. To return a part, the user creates a part tracker record, and then clicks the RMA button to create a Return Material Authorization (RMA) record. The work you do to allow a user to return a part is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, calling the CanInvoke method, DoInvoke method, and so on.
You add the code that specifies how to do the RMA return in Step 4 through Step 10. The rma_return.js file contains this code. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support.
To allow users to return parts
In Windows Explorer, navigate to the following folder:
INSTALL_DIR\eappweb\PUBLIC\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:
Product Id
Product Name
Used Quantity
Id
Status
Asset Number
Part Number
You add the following code:
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:
Service Request
Order Entry - Orders
Order Entry - Line Items
This code also determines whether or not a service request is not associated with the activity. If not, then it aborts the operation. You add the following code:
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:
Product
Quantity Requested
Asset #
Part #
Product Status Code
Order Header Id
You add the following code:
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.
The example in this topic describes how to enable the activity status so that the user can update this status during the service call life cycle. For example, a field service representative can examine an Activity that is set to Dispatched, set this status to Acknowledged to acknowledge that this representative examined the activity, set the status to EnRoute, travel to the customer site, set it to Arrive, set it to In Progress while working on the service call, and then set it to Finish after finishing the service call. Siebel Open UI includes the following status values:
Dispatched
Acknowledged
Declined
En Route
Arrive
In Progress
Hold
Resume
Finish
Siebel Open UI enables and disables the status depending on the current value of the status. For example, if the representative sets the status to Acknowledged, then Siebel Open UI allows the user to choose the EnRoute status and disables all other values.
The work you do to allow a user to set the status is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, and so on. For more information, see "Allowing Users to Commit Part Tracker Records".
To allow users to set the activity status
In Windows Explorer, navigate to the following folder:
INSTALL_DIR\eappweb\PUBLIC\scripts\siebel\offline
For more information about the language_code, see "Languages That Siebel Open UI Supports".
Use a JavaScript editor to open the serviceactstat.js file.
Locate the following code:
serviceactstat.prototype.InvokeSetActStatus=function(psInpArgs,svcMthdName){ var psOutArgs=SiebelApp.S_App.NewPropertySet(); if(!psInpArgs){ return (false); } if(psInpArgs.propArray.MethodName=="AcceptStatus") {psOutArgs=this.SetActivityStatus("Acknowledged"); } else if(psInpArgs.propArray.MethodName=="Start"||psInpArgs.propArray. MethodName=="ArrivedStatus"){psOutArgs=this.SetActivityStatus("In Progress","ArrivedStatus"); } else if(psInpArgs.propArray.MethodName=="DeclineStatus"){ psOutArgs=this.SetActivityStatus("Declined"); } else if(psInpArgs.propArray.MethodName=="EnrouteStatus"){ psOutArgs=this.SetActivityStatus("In Progress"); } else if(psInpArgs.propArray.MethodName=="SuspendStatus"){ psOutArgs=this.SetActivityStatus("On Hold"); } else if(psInpArgs.propArray.MethodName=="ResumeStatus"){ psOutArgs=this.SetActivityStatus("In Progress"); } else if(psInpArgs.propArray.MethodName=="End"||psInpArgs.propArray. MethodName=="FinishedStatus"){ psOutArgs = this.SetActivityStatus("Done","FinishedStatus"); }
Add the following code immediately after the code you located in Step 3:
serviceactstat.prototype.SetActivityStatus=function (pStatus,pDateMethodInv){ var currRetValue={err:false}, retObj; SiebelJS.Log('Service Method SetActivityStatus...'); var strstatvalue; var pickName; var pickListDef; var pModel; var pBusComp; pModel= SiebelApp.S_App.GetModel(); var pBusObj = pModel.GetBusObject("boName"); pBusComp = pBusObj.GetBusComp("bcName"); pickName=SiebelApp.S_App.GetActiveView().GetActiveApplet().GetControl("Status").GetPickApplet(); pickListDef=pickListDef = pBusComp.GetPickListInfo(pickName); pModel=SiebelApp.S_App.Model; strstatvalue=pModel.GetLovNameVal("Acknowledged", pickListDef.LOVType); currRetValue=pBusComp.ActivateField("Status"); currRetValue=pBusComp.SetFieldValue("Status",strstatvalue,true); currRetValue=pBusComp.ActivateField("Status"); currRetValue=pBusComp.SetFieldValue("Status",strstatvalue,true); if(pDateMethodInv!="")//Todo - Refine this condition for uninitialized/defined or remove this condition { var now=new Date(); if(pDateMethodInv == "ArrivedStatus") { currRetValue=pBusComp.SetFieldValue("Started",now,true); currRetValue=pBusComp.SetFieldValue("Done","",true); } else if(pDateMethodInv=="FinishedStatus") { currRetValue=pBusComp.SetFieldValue("Done",now,true); currRetValue=pBusComp.SetFieldValue("Percent Complete","100%",true); } } currRetValue=pBusComp.WriteRecord(); return currRetValue; };
For information about the methods that this code uses, see the following:
Test your modifications:
Log in to the disconnected client.
Update the status of an activity.
Make sure Siebel Open UI displays the correct status activity. For example, if you set the status to Acknowledged, then make sure Siebel Open UI allows you to choose the EnRoute status and disables all other values.