Thursday, March 22, 2007

Symphony Browser

 

 

 

ABO Offer Config Template Parameter VBC BS SCM
Init
function Init(Inputs, Outputs) { /***************************************************************** * Function: Init() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Initialization of VBC "ABO Offer Config Template Parameter VBC SCM" fields. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** *****************************************************************/ var oAPP:Application; try{ oAPP = TheApplication(); Outputs.SetProperty("Description",""); Outputs.SetProperty("Name", ""); Outputs.SetProperty("Id", ""); } catch(e){ if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ oAPP = null; } }

ABO Offer Config Template Parameter VBC BS SCM
Query
function Query(Inputs, Outputs) { /***************************************************************** * Function: Query() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Fetches "Bulk Template Id" from instance of Active Bus Comp "ABO Offer Catalog SCM" * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** Update : 2016.07.25 TAAEDSU1 :- Added code for Applet level search. *****************************************************************/ //Variable Declarations var oAttrBO:BusObject; var oAttrValBC:BusComp; var sBulkTemplateId:chars; var oAPP:Application; var sSearch:chars; try { oAPP = TheApplication(); sSearch = Inputs.GetProperty("search-string"); oAttrBO = oAPP.ActiveBusObject(); if(oAttrBO.Name() == "ABO Bulk Request") { oAttrValBC = oAttrBO.GetBusComp("ABO Offer Catalog SCM"); sBulkTemplateId = oAttrValBC.GetFieldValue("Bulk Template Id SCM"); fnAddTempParam( sBulkTemplateId , Outputs ,sSearch); } /*Query Order Template Parameter BC */ } catch(e){ if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ oAttrValBC = null; oAttrBO = null; oAPP = null; } }

ABO Offer Config Template Parameter VBC BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** * Function: Service_PreInvokeMethod in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : BS for VBC "ABO Offer Config Template Parameter VBC SCM". It will load Offer Configuration Pick Applet. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** *****************************************************************/ switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } return (CancelOperation); }

ABO Offer Config Template Parameter VBC BS SCM
fnAddTempParam
function fnAddTempParam(sBulkTemplateId , Outputs , sSearch ) { /***************************************************************** * Function: Query() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Query BC "ABO Order Template Parameter SCM" for input Template id for non default values Prepare Outputs PS. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** 2016.08.05 SBL51621 :- Added values for 2 fields in PS. ** 2016.11.17 Defect #16411:2016.11.17 :- TAAEDSU1 *****************************************************************/ // Variable Declaration var oAttrBO:BusObject; var oAttrValBC:BusComp; var psRow:PropertySet; var bRecExist:bool; var oAPP:Application; var sexpr1:chars; try { oAPP = TheApplication(); psRow = oAPP.NewPropertySet(); oAttrBO = oAPP.GetBusObject("ABO Bulk Request"); oAttrValBC = oAttrBO.GetBusComp("ABO Order Template Parameter SCM"); if(sBulkTemplateId != "" || sBulkTemplateId != null ) { oAttrValBC.SetViewMode(AllView); oAttrValBC.ActivateField("Name"); oAttrValBC.ActivateField("Description"); oAttrValBC.ClearToQuery(); sexpr1 = "[Template Id] = '" + sBulkTemplateId + "' AND [Default] <> 'Y'" if(sSearch == "" || sSearch == null) { oAttrValBC.SetSearchExpr(sexpr1); } else { oAttrValBC.SetSearchExpr(sexpr1 + " AND " + sSearch); } oAttrValBC.ExecuteQuery(ForwardOnly); bRecExist = oAttrValBC.FirstRecord(); while(bRecExist) { psRow.SetProperty("Description" , oAttrValBC.GetFieldValue("Description")); psRow.SetProperty("Name" , oAttrValBC.GetFieldValue("Name")); psRow.SetProperty("Id" , oAttrValBC.GetFieldValue("Id")); Outputs.AddChild(psRow.Copy()); psRow.Reset(); bRecExist = oAttrValBC.NextRecord(); } } } catch(e) { if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally { psRow = null; oAttrValBC = null; oAttrBO = null; oAPP = null; } }

ABO Selection Parameters VBC BS SCM
(declarations)
//Your public declarations go here...

ABO Selection Parameters VBC BS SCM
Init
function Init(Inputs, Outputs) { /***************************************************************** * Function: Init() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Initialization of VBC "ABO Offer Config Template Parameter VBC SCM" fields. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** *****************************************************************/ var oAPP:Application; try{ oAPP = TheApplication(); Outputs.SetProperty("Parameter Name",""); } catch(e){ if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ oAPP = null; } }

ABO Selection Parameters VBC BS SCM
Query
function Query(Inputs, Outputs) { /***************************************************************** * Function: Query() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Fetches "Bulk Template Id" from instance of Active Bus Comp "ABO Offer Catalog SCM" * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** Update TAAEDSU1 2016.08.17: Removed GetFieldValues of Template Id and Parameter Name. *****************************************************************/ //Variable Declarations var oAttrBO:BusObject; var oAttrValBC:BusComp; var oAPP:Application; var sSearch:chars; var sSelection:chars; try { oAPP = TheApplication(); sSearch = QueryCheck(Inputs); oAttrBO = oAPP.ActiveBusObject(); if(oAttrBO.Name() == "ABO Bulk Request") { oAttrValBC = oAttrBO.GetBusComp("ABO Offer Configuration SCM"); sSelection = oAttrValBC.GetFieldValue("Selection SCM"); fngetSelectionParam( sSearch ,sSelection, Outputs); } } catch(e){ if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ oAttrValBC = null; oAttrBO = null; oAPP = null; } }

ABO Selection Parameters VBC BS SCM
QueryCheck
function QueryCheck(oInputs) { /***************************************************************** * Function: QueryCheck() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Finds out search-string executed from Applet. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** *****************************************************************/ var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); var iPos = sSearch.indexOf("*"); if (iPos == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

ABO Selection Parameters VBC BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** * Function: Service_PreInvokeMethod in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : BS for VBC "ABO Selections Parameters VBC SCM". It will load Offer Configuration Pick Applet. * Date : 2016-07-20 *-------------------------------------------------------------------------------------------------* ** *****************************************************************/ switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } return (CancelOperation); }

ABO Selection Parameters VBC BS SCM
fngetSelectionParam
function fngetSelectionParam(sSearch, sSelection , Outputs) { /***************************************************************** * Function: Query() in BusService "ABO Offer Config Template Parameter VBC BS SCM" * Author : Sushant Edlabadkar (TAAEDSU1) * Purpose : Query BC "ABO Order Template Parameter SCM" for input Template id and Parameter Name. Prepare Outputs PS. * Date : 2016-07-18 *-------------------------------------------------------------------------------------------------* ** Update TAAEDSU1 2016.08.17: Removed BC Query as its not required now. *****************************************************************/ // Variable Declaration var psRow:PropertySet; var bRecExist:bool; var oAPP:Application; var sParamArr:Array; var sSelectParam:chars; try { oAPP = TheApplication(); psRow = oAPP.NewPropertySet(); sParamArr = new Array; sParamArr = sSelection.split(";"); if(sSearch == "" || sSearch == null) { for (var i = 0; i < sParamArr.length; i++) { sSelectParam = sParamArr[i] psRow.SetProperty("Parameter Name" , sSelectParam); Outputs.AddChild(psRow.Copy()); psRow.Reset(); } } else { for (var i = 0; i < sParamArr.length; i++) { sSelectParam = sParamArr[i] if( sSelectParam.indexOf(sSearch) >= 0) { psRow.SetProperty("Parameter Name" , sSelectParam); Outputs.AddChild(psRow.Copy()); psRow.Reset(); } } } } catch(e) { if(oAPP.isTraceON) oAPP.Trace(this.Name() + " Error: " + e.message); throw(e); } finally { psRow = null; oAPP = null; sParamArr = null; } }

ADRIA Validations BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

ADRIA Validations BS SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

ADRIA Validations BS SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

ADRIA Validations BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /***************************************************************************** ** Name: Preinvoke ** Description: This BS has all script necessary SO 3121 - Validations to know ** when to invoke Adria or not *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2016-07-22 TGDCOMAB created * *****************************************************************************/ try{ oApp = TheApplication(); // enable tracing bIsTraceOn = oApp.isTraceON; // enable tracing if (bIsTraceOn) oApp.Trace(this.Name() + " START --> "+ MethodName); switch (MethodName){ case "ValidateSCM": ValidateSCM(Inputs,Outputs); break; default: break; }//End Case }//End try catch(e){ //Trace and rise error if(bIsTraceOn) TheApplication().Trace(this.Name() + ".Service_PreInvokeMethod Error : " + e.message); throw(e); } finally{ oApp = null; } return (CancelOperation); }

ADRIA Validations BS SCM
ValidateSCM
/******************************************************* ** Name: ValidateSCM ** Created: 22.07.2016 ** Created By: TGDCOMAB, Mario Costa ** Description: This function is called from applet Browser scripts. ** It validates if the ADRIA application should be called or not. ** The following validations are checked: ** - If Segment = CBU -> stay in Symphony ** - If Segment = SME -> check if the agent has the correct responsibility ** - If so, check if there are only contracts which correspond to useCases ** where Symphony is the only master of the Address information ** - If so, jump to Adria ** - If Segment = RES -> check if there are only contracts which correspond to useCases ** where Symphony is the only master of the Address information ** - If so, jump to Adria -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ValidateSCM(Inputs, Outputs) { try { Outputs.SetProperty("InvokeAdria", "Error"); //Get the Account Segment using the input sent from the applet var strAccountId = Inputs.GetProperty("AccountId"); var strSubType = Inputs.GetProperty("SubType"); //Sub Type SCM var strCMAId = Inputs.GetProperty("CMAId"); //Calculated CMA Account Id SCM var oBOAsset; var oBCAsset // If it is an SA, get the CMA to search for the segment if (strSubType == TheApplication().InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","SA")) strAccountId = strCMAId; var oBOAccount = TheApplication().GetBusObject("Account"); var oBCAccount = oBOAccount.GetBusComp("Account"); oBCAccount.ClearToQuery(); oBCAccount.SetViewMode(AllView); oBCAccount.ActivateField("Grobsegment SCM"); oBCAccount.ActivateField("Account Status GUI SCM"); oBCAccount.SetSearchSpec("Id", strAccountId); oBCAccount.ExecuteQuery(ForwardOnly); if (oBCAccount.FirstRecord()) { var strSegment = oBCAccount.GetFieldValue("Grobsegment SCM"); var strStatus = oBCAccount.GetFieldValue("Account Status GUI SCM"); // If the customer is in status Prospect or New, always stay in Symphony if (strStatus == TheApplication().InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect") || strStatus == TheApplication().InvokeMethod("LookupValue","ACCOUNT_STATUS","New")) { Outputs.SetProperty("InvokeAdria", "N"); return; } var oBS = TheApplication().GetService("FE Call External Programs Support SCM"); var oInputsAux = TheApplication().NewPropertySet(); var oOutputsAux = TheApplication().NewPropertySet(); oInputsAux.SetProperty("Responsibility", "SCM Allow Symphony Addres Mgmt"); oInputsAux.SetProperty("EmployeeId", TheApplication().LoginId()); var LoginId = TheApplication().LoginId(); oBS.InvokeMethod("validateUserResponsibility", oInputsAux, oOutputsAux); if (oOutputsAux.GetProperty("Exists") == "true") // user has the correct responsibility - stay in Symphony { Outputs.SetProperty("InvokeAdria", "N"); return; } // If it is CBU - continue in Symphony if (strSegment == TheApplication().InvokeMethod("LookupValue","CUSTOMER_SEGMENT_SCM","CBU")) { Outputs.SetProperty("InvokeAdria", "N"); return; } else if (strSegment == TheApplication().InvokeMethod("LookupValue","CUSTOMER_SEGMENT_SCM","SME")) { var strACVAdria4SME = TheApplication().utils.SCM_RetrieveACV("ADRIA_FOR_SME"); if (strACVAdria4SME == "N") // if it is SME and Adria for SME ACV is set to "N" continue in Symphony { Outputs.SetProperty("InvokeAdria", "N"); return; } else { // if the customer has NO contracts - jump to Adria oBOAsset = TheApplication().GetBusObject("Asset Mgmt - Asset (Order Mgmt) Lite2 BC SCM"); oBCAsset = oBOAsset.GetBusComp("Asset Mgmt - Asset (Order Mgmt) Lite2

AEC Auto Fix Tools SCM
(declarations)
//Your public declarations go here... var oApp:Application;

AEC Auto Fix Tools SCM
(declarations)
//Your public declarations go here... var oApp:Application;

AEC Auto Fix Tools SCM
AECAddComponentToActualInstance
function AECAddComponentToActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is adding component products to the actual Complex Product instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** // Variable Declaration var s2; var psInp1; var psInp2; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lnPortItems:Number; var lnPortItemsMax:Number; var lnDeltaProductQty:Number; var lnChecksum:Number; try { s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); // Get Input Values lnDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Delta Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",Inputs.GetProperty("DeltaProductId")); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Parent Path",Inputs.GetProperty("ParentPath")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); // Count port Items AECCountPortItems(psListOfPortItems,Outputs); lnPortItems = Outputs.GetProperty("PortItems"); lnChecksum = lnPortItemsMax - lnPortItems - lnDeltaProductQty; // Set Properties if action is possible if (lnChecksum >= -1) { // Setup Property Set for Add Item/Replace Item psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Product Id",Inputs.GetProperty("DeltaProductId")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("SetTypeQty","Y"); psInp1.SetProperty("AutoFix","Y"); } // Add Item if possible if (lnChecksum >= 0) { s2.InvokeMethod("AddItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } // Replace Item if necessary else if (lnChecksum == -1 && lnPortItemsMax == 1) { psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); s2.InvokeMethod("ReplaceItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } else { Outputs.SetProperty("AEC Operation Success", "N"); } } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psListOfPortItems = null; psFlatPortList = null; psListOfPorts = null; psInp2 = null; psInp1 = null; s2 = null; } }

AEC Auto Fix Tools SCM
AECAddComponentToActualInstance
function AECAddComponentToActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is adding component products to the actual Complex Product instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** // Variable Declaration var s2; var psInp1; var psInp2; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lnPortItems:Number; var lnPortItemsMax:Number; var lnDeltaProductQty:Number; var lnChecksum:Number; try { s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); // Get Input Values lnDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Delta Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",Inputs.GetProperty("DeltaProductId")); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Parent Path",Inputs.GetProperty("ParentPath")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); // Count port Items AECCountPortItems(psListOfPortItems,Outputs); lnPortItems = Outputs.GetProperty("PortItems"); lnChecksum = lnPortItemsMax - lnPortItems - lnDeltaProductQty; // Set Properties if action is possible if (lnChecksum >= -1) { // Setup Property Set for Add Item/Replace Item psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Product Id",Inputs.GetProperty("DeltaProductId")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("SetTypeQty","Y"); psInp1.SetProperty("AutoFix","Y"); } // Add Item if possible if (lnChecksum >= 0) { s2.InvokeMethod("AddItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } // Replace Item if necessary else if (lnChecksum == -1 && lnPortItemsMax == 1) { psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); s2.InvokeMethod("ReplaceItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } else { Outputs.SetProperty("AEC Operation Success", "N"); } } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psListOfPortItems = null; psFlatPortList = null; psListOfPorts = null; psInp2 = null; psInp1 = null; s2 = null; } }

AEC Auto Fix Tools SCM
AECAddComponentToInstance
function AECAddComponentToInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is instanciating a new Complex Product instance and adds the specified product // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 24/10/2011 Initial Release //************************************************************************** var s1; var s2; var psInp1; var psInp2; var psLoadedInstance; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lsObjectId; var lnDeltaProductQty:Number; var lsRootId; var lsPortId; var lnChecksum:Number; var lnPortItems:Number; var lnPortItemsMax:Number; try { s1 = oApp.GetService("ISS Copy Service"); s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psLoadedInstance = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); // Get Input Values lnDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); //benötigt lsObjectId = Inputs.GetProperty("ObjectId"); //benötigt lsRootId = Inputs.GetProperty("RootId"); // benötigt // Load EAI psInp1.SetProperty("ParentObjectId",lsObjectId); psInp1.SetProperty("IntegrationObjectName",Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",lsRootId); psInp1.SetProperty("SearchSpec","[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"); s1.InvokeMethod("LoadEAI",psInp1,Outputs); // Load Instance psInp1.SetProperty("ObjId",lsObjectId); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); psInp1.SetProperty("TriggerEvent","Y"); s2.InvokeMethod("LoadInstance",psInp1,Outputs); // Get Instance s2.InvokeMethod("GetInstance",psInp1,psLoadedInstance); // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Delta Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",Inputs.GetProperty("DeltaProductId")); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("Parent Path",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); // Count port Items AECCountPortItems(psListOfPortItems,Outputs); lnPortItems = Outputs.GetProperty("PortItems"); lnChecksum = lnPortItemsMax - lnPortItems - lnDeltaProductQty; // Set Properties if action is possible if (lnChecksum >= -1) { // Setup Property Set for Add Item/Replace Item psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Product Id",Inputs.GetProperty("DeltaProductId")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("SetTypeQty","Y"); } // Add Item if possible if (lnChecksum >= 0) { s2.InvokeMethod("AddItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } // Replace Item if necessary else if (lnChecksum == -1 && lnPortItemsMax == 1) { psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); s2.InvokeMethod("

AEC Auto Fix Tools SCM
AECAddComponentToInstance
function AECAddComponentToInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is instanciating a new Complex Product instance and adds the specified product // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 24/10/2011 Initial Release //************************************************************************** var s1; var s2; var psInp1; var psInp2; var psLoadedInstance; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lsObjectId; var lnDeltaProductQty:Number; var lsRootId; var lsPortId; var lnChecksum:Number; var lnPortItems:Number; var lnPortItemsMax:Number; try { s1 = oApp.GetService("ISS Copy Service"); s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psLoadedInstance = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); // Get Input Values lnDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); //benötigt lsObjectId = Inputs.GetProperty("ObjectId"); //benötigt lsRootId = Inputs.GetProperty("RootId"); // benötigt // Load EAI psInp1.SetProperty("ParentObjectId",lsObjectId); psInp1.SetProperty("IntegrationObjectName",Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",lsRootId); psInp1.SetProperty("SearchSpec","[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"); s1.InvokeMethod("LoadEAI",psInp1,Outputs); // Load Instance psInp1.SetProperty("ObjId",lsObjectId); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); psInp1.SetProperty("TriggerEvent","Y"); s2.InvokeMethod("LoadInstance",psInp1,Outputs); // Get Instance s2.InvokeMethod("GetInstance",psInp1,psLoadedInstance); // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Delta Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",Inputs.GetProperty("DeltaProductId")); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("Parent Path",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); // Count port Items AECCountPortItems(psListOfPortItems,Outputs); lnPortItems = Outputs.GetProperty("PortItems"); lnChecksum = lnPortItemsMax - lnPortItems - lnDeltaProductQty; // Set Properties if action is possible if (lnChecksum >= -1) { // Setup Property Set for Add Item/Replace Item psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Product Id",Inputs.GetProperty("DeltaProductId")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("SetTypeQty","Y"); } // Add Item if possible if (lnChecksum >= 0) { s2.InvokeMethod("AddItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } // Replace Item if necessary else if (lnChecksum == -1 && lnPortItemsMax == 1) { psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); s2.InvokeMethod("

AEC Auto Fix Tools SCM
AECAddItem
function AECAddItem (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 01.11.20011 // Purpose: Used for adding items // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // Thomas Trenkler 01.11.11 Initial Release //************************************************************************** //Initialize var lbcBusObject:BusObject; var lbcBusObject2:BusObject; var lbcMainBusComp:BusComp; var lbcBusComp:BusComp; var lbcPickListBC:BusComp; var lbcPromoBusComp:BusComp; var lsHeaderId; var lsProductId; var lsProductName; var lsPromotionId; var lsPromInstId; var lsPromItemId; var sSearchExpr; var lsBAccId; var lsSAccId; var lsBPId; var lsAECServiceId; var lsId:chars; try { lbcBusObject = oApp.GetBusObject(Inputs.GetProperty ("Object Name")); lbcBusComp = lbcBusObject.GetBusComp (Inputs.GetProperty ("Line Item Component Name")); lbcMainBusComp = lbcBusObject.GetBusComp (Inputs.GetProperty ("Header Component Name")); lsHeaderId = Inputs.GetProperty ("Header Id"); lsProductId = Inputs.GetProperty ("Product Id"); lsProductName = Inputs.GetProperty ("Product Name"); lsPromotionId = Inputs.GetProperty ("Promotion Id"); lsPromInstId = Inputs.GetProperty ("Promotion Instance Id"); lsBAccId = Inputs.GetProperty ("BAccId"); lsSAccId = Inputs.GetProperty ("SAccId"); lsBPId = Inputs.GetProperty ("BPId"); lsAECServiceId = Inputs.GetProperty ("AECServiceId"); with (lbcMainBusComp) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec ("Id", lsHeaderId); ExecuteQuery (ForwardOnly); if (FirstRecord() ) { with (lbcBusComp) { InvokeMethod ("EnableCopyExtAttr"); InvokeMethod ("EnableConfigCxProd"); SetProperty ("Skip Loading Default Cfg Instance", "N"); NewRecord (NewAfter); lbcPickListBC = GetPicklistBusComp("Product");//PickList Internal Orderable Product with (lbcPickListBC) { SetViewMode(AllView); ClearToQuery(); if (lsProductName !="") { SetSearchSpec( "Name", "'" + lsProductName + "'"); } else { SetSearchSpec( "Id", "'" + lsProductId + "'"); } ExecuteQuery(ForwardOnly); if (FirstRecord()) { Pick(); } } // ActivateField("AEC Service Id"); ActivateField("Billing Profile Id"); // SetFieldValue("AEC Service Id", lsAECServiceId); SetFieldValue("Billing Account Id", lsBAccId); SetFieldValue("Service Account Id", lsSAccId); SetFieldValue("Billing Profile Id", lsBPId); // Add Item to Promotion if (lsPromotionId !="-" && lsPromInstId !="-") { /* lbcBusObject2 = oApp.GetBusObject(Inputs.GetProperty ("Object Name")); lbcPromoBusComp = lbcBusObject2.GetBusComp ("ISS Promotion Related Product VBC"); // Get Promotion Item Id for the product to be added with (lbcPromoBusComp) { ActivateField("Prom Comp Rule Id"); sSearchExpr = "[Active Promotion Id]='" + lsPromotionId + "' AND [Product Id]='" + lsProductId + "'"; SetSearchExpr(sSearchExpr); ExecuteQuery (ForwardOnly); lsPromItemId = lbcPromoBusComp.GetFieldValue("Prom Comp Rule Id"); } */ ActivateField("Prod Prom Id"); ActivateField("Prod Prom Instance Id"); ActivateField("Prod Prom Rule Id"); SetFieldValue("Prod Prom Id", lsPromotionId); SetFieldValue("Prod Prom Instance Id", lsPromInstId); // SetFieldValue("Prod Prom Rule Id", lsPromItemId); } WriteRecord(); lsId=GetFieldValue("Id"); ClearToQuery() ExecuteQuery(ForwardBackward); } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Obje

AEC Auto Fix Tools SCM
AECAddItem
function AECAddItem (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 01.11.20011 // Purpose: Used for adding items // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // Thomas Trenkler 01.11.11 Initial Release //************************************************************************** //Initialize var lbcBusObject:BusObject; var lbcBusObject2:BusObject; var lbcMainBusComp:BusComp; var lbcBusComp:BusComp; var lbcPickListBC:BusComp; var lbcPromoBusComp:BusComp; var lsHeaderId; var lsProductId; var lsProductName; var lsPromotionId; var lsPromInstId; var lsPromItemId; var sSearchExpr; var lsBAccId; var lsSAccId; var lsBPId; var lsAECServiceId; try { lbcBusObject = oApp.GetBusObject(Inputs.GetProperty ("Object Name")); lbcBusComp = lbcBusObject.GetBusComp (Inputs.GetProperty ("Line Item Component Name")); lbcMainBusComp = lbcBusObject.GetBusComp (Inputs.GetProperty ("Header Component Name")); lsHeaderId = Inputs.GetProperty ("Header Id"); lsProductId = Inputs.GetProperty ("Product Id"); lsProductName = Inputs.GetProperty ("Product Name"); lsPromotionId = Inputs.GetProperty ("Promotion Id"); lsPromInstId = Inputs.GetProperty ("Promotion Instance Id"); lsBAccId = Inputs.GetProperty ("BAccId"); lsSAccId = Inputs.GetProperty ("SAccId"); lsBPId = Inputs.GetProperty ("BPId"); lsAECServiceId = Inputs.GetProperty ("AECServiceId"); with (lbcMainBusComp) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec ("Id", lsHeaderId); ExecuteQuery (ForwardOnly); if (FirstRecord() ) { with (lbcBusComp) { InvokeMethod ("EnableCopyExtAttr"); InvokeMethod ("EnableConfigCxProd"); SetProperty ("Skip Loading Default Cfg Instance", "N"); NewRecord (NewAfter); lbcPickListBC = GetPicklistBusComp("Product");//PickList Internal Orderable Product with (lbcPickListBC) { SetViewMode(AllView); ClearToQuery(); if (lsProductName !="") { SetSearchSpec( "Name", "'" + lsProductName + "'"); } else { SetSearchSpec( "Id", "'" + lsProductId + "'"); } ExecuteQuery(ForwardOnly); if (FirstRecord()) { Pick(); } } // ActivateField("AEC Service Id"); ActivateField("Billing Profile Id"); // SetFieldValue("AEC Service Id", lsAECServiceId); SetFieldValue("Billing Account Id", lsBAccId); SetFieldValue("Service Account Id", lsSAccId); SetFieldValue("Billing Profile Id", lsBPId); // Add Item to Promotion if (lsPromotionId !="-" && lsPromInstId !="-") { /* lbcBusObject2 = oApp.GetBusObject(Inputs.GetProperty ("Object Name")); lbcPromoBusComp = lbcBusObject2.GetBusComp ("ISS Promotion Related Product VBC"); // Get Promotion Item Id for the product to be added with (lbcPromoBusComp) { ActivateField("Prom Comp Rule Id"); sSearchExpr = "[Active Promotion Id]='" + lsPromotionId + "' AND [Product Id]='" + lsProductId + "'"; SetSearchExpr(sSearchExpr); ExecuteQuery (ForwardOnly); lsPromItemId = lbcPromoBusComp.GetFieldValue("Prom Comp Rule Id"); } */ ActivateField("Prod Prom Id"); ActivateField("Prod Prom Instance Id"); ActivateField("Prod Prom Rule Id"); SetFieldValue("Prod Prom Id", lsPromotionId); SetFieldValue("Prod Prom Instance Id", lsPromInstId); // SetFieldValue("Prod Prom Rule Id", lsPromItemId); } WriteRecord(); ClearToQuery() ExecuteQuery(ForwardBackward); } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects lbcPickListBC = null; lbcBusComp = nul

AEC Auto Fix Tools SCM
AECAddToList
function AECAddToList (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 01.11.20011 // Purpose: Used for setting up the ProjectedAssetInput for setting up the PAC when inside eCfg Session // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // Thomas Trenkler 01.11.11 Initial Release //************************************************************************** //Initialize var psTempRowSet; try { psTempRowSet = oApp.NewPropertySet(); psTempRowSet.SetType("ProjectedAssetInput"); psTempRowSet.SetProperty("Product Id",""); psTempRowSet.SetProperty("Product XA Class Id",""); psTempRowSet.SetProperty("Product Primary Product Line Id",""); psTempRowSet.SetProperty("Service Account Id",""); psTempRowSet.SetProperty("Billing Account Id",""); psTempRowSet.SetProperty("Billing Profile Id",""); psTempRowSet.SetProperty("Prod Prom Id",""); psTempRowSet.SetProperty("AEC Root Prod Prom Instance Id",""); // psTempRowSet.SetProperty("AEC Service Id",""); psTempRowSet.SetProperty("Root Asset Id",""); psTempRowSet.SetProperty("Root Product Id",""); psTempRowSet.SetProperty("AEC Root Prod Prom Id",""); psTempRowSet.SetProperty("Quote Id",""); psTempRowSet.SetProperty("Order Header Id",""); psTempRowSet.SetProperty("Asset Integration Id",""); psTempRowSet.SetProperty("Root Integration Id",""); // Defect 58292 Outputs.AddChild(psTempRowSet); } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects psTempRowSet = null; } }

AEC Auto Fix Tools SCM
AECAddToList
function AECAddToList (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 01.11.20011 // Purpose: Used for setting up the ProjectedAssetInput for setting up the PAC when inside eCfg Session // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // Thomas Trenkler 01.11.11 Initial Release //************************************************************************** //Initialize var psTempRowSet; try { psTempRowSet = oApp.NewPropertySet(); psTempRowSet.SetType("ProjectedAssetInput"); psTempRowSet.SetProperty("Product Id",""); psTempRowSet.SetProperty("Product XA Class Id",""); psTempRowSet.SetProperty("Product Primary Product Line Id",""); psTempRowSet.SetProperty("Service Account Id",""); psTempRowSet.SetProperty("Billing Account Id",""); psTempRowSet.SetProperty("Billing Profile Id",""); psTempRowSet.SetProperty("Prod Prom Id",""); psTempRowSet.SetProperty("AEC Root Prod Prom Instance Id",""); // psTempRowSet.SetProperty("AEC Service Id",""); psTempRowSet.SetProperty("Root Asset Id",""); psTempRowSet.SetProperty("Root Product Id",""); psTempRowSet.SetProperty("AEC Root Prod Prom Id",""); psTempRowSet.SetProperty("Quote Id",""); psTempRowSet.SetProperty("Order Header Id",""); psTempRowSet.SetProperty("Asset Integration Id",""); psTempRowSet.SetProperty("Root Integration Id",""); // Defect 58292 Outputs.AddChild(psTempRowSet); } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects psTempRowSet = null; } }

AEC Auto Fix Tools SCM
AECCountPortItems
function AECCountPortItems (psListOfPortItems, psResult) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 03.11.2011 // Purpose: Subfunction - counts how many items are currently assigned to a port, the result is used to decide if it is possible to add (x<MaxQty) or delete (x>Min Qty) // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 12/01/2012 Initial release //************************************************************************** var z:Number; var Result; var x; var xMax; try { Result= 0; xMax = psListOfPortItems.GetChildCount(); for (x=0; x < xMax; x++) { if(psListOfPortItems.GetChild(x).GetType() == "Instance") { z = psListOfPortItems.GetChild(x).GetProperty("Quantity"); Result = Result + z; } } psResult.SetProperty("PortItems",Result); } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects } }

AEC Auto Fix Tools SCM
AECCountPortItems
function AECCountPortItems (psListOfPortItems, psResult) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 03.11.2011 // Purpose: Subfunction - counts how many items are currently assigned to a port, the result is used to decide if it is possible to add (x<MaxQty) or delete (x>Min Qty) // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 12/01/2012 Initial release //************************************************************************** var z:Number; var Result; var x; var xMax; try { Result= 0; xMax = psListOfPortItems.GetChildCount(); for (x=0; x < xMax; x++) { if(psListOfPortItems.GetChild(x).GetType() == "Instance") { z = psListOfPortItems.GetChild(x).GetProperty("Quantity"); Result = Result + z; } } psResult.SetProperty("PortItems",Result); } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects } }

AEC Auto Fix Tools SCM
AECGetPortId
function AECGetPortId (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 17.11.2011 // Purpose: Function to select a specific Port Id from the flat list pf Ports // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 17/11/2011 Initial Release //************************************************************************** var ListOfPorts; var psOutput; var lsPortId; var lsProdItemId; var lsProdName; var lnPortMaxQty; var lsDeltaProductId; var i; var iMax; var z; try { ListOfPorts = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); Outputs.SetProperty ("Field Value 1","#NA"); ListOfPorts = Inputs.GetChild(psOutput); lsDeltaProductId = Inputs.GetProperty("lsDeltaProductId"); iMax=ListOfPorts.GetChildCount(); for (i=0; i < iMax; i++) { z= ListOfPorts.GetChild(i).GetProperty("Product Id"); if (lsDeltaProductId == z) { lsPortId= ListOfPorts.GetChild(i).GetProperty("PortItemId"); Outputs.SetProperty ("lsPortId",lsPortId); lsProdItemId= ListOfPorts.GetChild(i).GetProperty("Prod Item Id"); Outputs.SetProperty ("lsProdItemId",lsProdItemId); lsProdName= ListOfPorts.GetChild(i).GetProperty("Name"); Outputs.SetProperty ("lsProdName",lsProdName); lnPortMaxQty= ListOfPorts.GetChild(i).GetProperty("PortMaxQty"); Outputs.SetProperty ("PortMaxQty",lnPortMaxQty); } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects ListOfPorts = null; psOutput = null; } }

AEC Auto Fix Tools SCM
AECGetPortId
function AECGetPortId (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 17.11.2011 // Purpose: Function to select a specific Port Id from the flat list pf Ports // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 17/11/2011 Initial Release //************************************************************************** var ListOfPorts; var psOutput; var lsPortId; var lsProdItemId; var lsProdName; var lnPortMaxQty; var lsDeltaProductId; var i; var iMax; var z; try { ListOfPorts = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); Outputs.SetProperty ("Field Value 1","#NA"); ListOfPorts = Inputs.GetChild(psOutput); lsDeltaProductId = Inputs.GetProperty("lsDeltaProductId"); iMax=ListOfPorts.GetChildCount(); for (i=0; i < iMax; i++) { z= ListOfPorts.GetChild(i).GetProperty("Product Id"); if (lsDeltaProductId == z) { lsPortId= ListOfPorts.GetChild(i).GetProperty("PortItemId"); Outputs.SetProperty ("lsPortId",lsPortId); lsProdItemId= ListOfPorts.GetChild(i).GetProperty("Prod Item Id"); Outputs.SetProperty ("lsProdItemId",lsProdItemId); lsProdName= ListOfPorts.GetChild(i).GetProperty("Name"); Outputs.SetProperty ("lsProdName",lsProdName); lnPortMaxQty= ListOfPorts.GetChild(i).GetProperty("PortMaxQty"); Outputs.SetProperty ("PortMaxQty",lnPortMaxQty); } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects ListOfPorts = null; psOutput = null; } }

AEC Auto Fix Tools SCM
AECGetSubcomponents
function AECGetSubcomponents(Inputs, Outputs) { /* Method to generate flat child products for given Product Name Inputs : RootName ... string with product identifier Vendor ... Vendor name Org ... Organization name Output: Row Set ... Unique set of prodyuct names to be loaded */ var sRootName:chars=Inputs.GetProperty("RootName"); var sVendor:chars=Inputs.GetProperty("Vendor"); var sOrg:chars=Inputs.GetProperty("Org"); var psInp:PropertySet=oApp.NewPropertySet(); var psOut:PropertySet=oApp.NewPropertySet(); var bsCfgBroker:Service=oApp.GetService("Cfg Object Broker"); var iChildCount:float=0; var iChildTypesCount:float=0; var iSubObjCount:float=0; var iPortItemsCount:float=0; var psStruct:PropertySet; var psSubObj:PropertySet; var psPort:PropertySet; var psPortObj:PropertySet; var psRowSetFlat:PropertySet=oApp.NewPropertySet(); var psRowSet:PropertySet=oApp.NewPropertySet(); var psRow:PropertySet; var sChildTypePort:chars="Port"; var sChildTypeSo:chars="SubObject" var sPropName=""; try { with(psInp) { SetProperty("RootName",sRootName); SetProperty("Vendor", sVendor); SetProperty("Org", sOrg); SetProperty("Full","Y"); } bsCfgBroker.InvokeMethod("GetProdStruct",psInp, psOut); iChildCount=psOut.GetChildCount(); if(iChildCount>1) { psStruct=psOut; iSubObjCount=psStruct.GetChildCount(); for(var iSubObj:float=0;iSubObj<iSubObjCount;iSubObj++) { psSubObj=psStruct.GetChild(iSubObj); iChildTypesCount=psSubObj.GetChildCount(); if(iChildTypesCount>0) { for(var iChildType:float=0;iChildType<iChildTypesCount;iChildType++) { if(psSubObj.GetChild(iChildType).GetType()==sChildTypePort) { // found child type Port ( Attribvutes are skiped) psPort=psSubObj.GetChild(iChildType); iPortItemsCount=psPort.GetChildCount(); for(var iPortItem:float=0;iPortItem<iPortItemsCount;iPortItem++) { psPortObj=psPort.GetChild(iPortItem); psRowSetFlat.SetProperty(psPortObj.GetProperty("Id"),"Y"); } } } } } // now we convert found properties into Row Set Form sPropName=psRowSetFlat.GetFirstProperty(); while(sPropName!="") { psRow=oApp.NewPropertySet(); psRow.SetType("Product"); psRow.SetProperty("Id", sPropName); psRowSet.AddChild(psRow); sPropName=psRowSetFlat.GetNextProperty(); } } } catch (e) { oApp.Trace(e.toString()); throw e; } finally { psRowSet.SetType("Row Set"); Outputs.AddChild(psRowSet); psInp=null; psOut=null; bsCfgBroker=null; psStruct=null; psSubObj=null; psPort=null; psPortObj=null; psRowSetFlat=null; psRowSet=null; } }

AEC Auto Fix Tools SCM
AECGetSubcomponents
function AECGetSubcomponents(Inputs, Outputs) { /* Method to generate flat child products for given Product Name Inputs : RootName ... string with product identifier Vendor ... Vendor name Org ... Organization name Output: Row Set ... Unique set of prodyuct names to be loaded */ var sRootName:chars=Inputs.GetProperty("RootName"); var sVendor:chars=Inputs.GetProperty("Vendor"); var sOrg:chars=Inputs.GetProperty("Org"); var psInp:PropertySet=oApp.NewPropertySet(); var psOut:PropertySet=oApp.NewPropertySet(); var bsCfgBroker:Service=oApp.GetService("Cfg Object Broker"); var iChildCount:float=0; var iChildTypesCount:float=0; var iSubObjCount:float=0; var iPortItemsCount:float=0; var psStruct:PropertySet; var psSubObj:PropertySet; var psPort:PropertySet; var psPortObj:PropertySet; var psRowSetFlat:PropertySet=oApp.NewPropertySet(); var psRowSet:PropertySet=oApp.NewPropertySet(); var psRow:PropertySet; var sChildTypePort:chars="Port"; var sChildTypeSo:chars="SubObject" var sPropName=""; try { with(psInp) { SetProperty("RootName",sRootName); SetProperty("Vendor", sVendor); SetProperty("Org", sOrg); SetProperty("Full","Y"); } bsCfgBroker.InvokeMethod("GetProdStruct",psInp, psOut); iChildCount=psOut.GetChildCount(); if(iChildCount>1) { psStruct=psOut; iSubObjCount=psStruct.GetChildCount(); for(var iSubObj:float=0;iSubObj<iSubObjCount;iSubObj++) { psSubObj=psStruct.GetChild(iSubObj); iChildTypesCount=psSubObj.GetChildCount(); if(iChildTypesCount>0) { for(var iChildType:float=0;iChildType<iChildTypesCount;iChildType++) { if(psSubObj.GetChild(iChildType).GetType()==sChildTypePort) { // found child type Port ( Attribvutes are skiped) psPort=psSubObj.GetChild(iChildType); iPortItemsCount=psPort.GetChildCount(); for(var iPortItem:float=0;iPortItem<iPortItemsCount;iPortItem++) { psPortObj=psPort.GetChild(iPortItem); psRowSetFlat.SetProperty(psPortObj.GetProperty("Id"),"Y"); } } } } } // now we convert found properties into Row Set Form sPropName=psRowSetFlat.GetFirstProperty(); while(sPropName!="") { psRow=oApp.NewPropertySet(); psRow.SetType("Product"); psRow.SetProperty("Id", sPropName); psRowSet.AddChild(psRow); sPropName=psRowSetFlat.GetNextProperty(); } } } catch (e) { oApp.Trace(e.toString()); throw e; } finally { psRowSet.SetType("Row Set"); Outputs.AddChild(psRowSet); psInp=null; psOut=null; bsCfgBroker=null; psStruct=null; psSubObj=null; psPort=null; psPortObj=null; psRowSetFlat=null; psRowSet=null; } }

AEC Auto Fix Tools SCM
AECPrepareFlatPortList
function AECPrepareFlatPortList (psListOfPorts, psFlatListOfPorts) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 03.11.2011 // Purpose: Subfunction - converting hierarchy to flat // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 03/11/2011 Initial release //************************************************************************** var psTempRowSet; var lstype1; var lstPiId; var lstPQMax; var lstPQMin; var lstype2; var x; var xMax; var y; var yMax; var i; var iMax; try { psTempRowSet = null; xMax = psListOfPorts.GetChildCount(); for (x= 0; x < xMax; x++) { yMax = psListOfPorts.GetChild(x).GetChildCount(); for (y = 0; y < yMax; y++) { AECPrepareFlatPortList (psListOfPorts.GetChild(x), psFlatListOfPorts); } psTempRowSet = psListOfPorts.GetChild(x).Copy(); lstype1 = psListOfPorts.GetType(); lstPiId = psListOfPorts.GetProperty("Port Item Id"); lstPQMax = psListOfPorts.GetProperty("MaxCardinality"); lstPQMin = psListOfPorts.GetProperty("MinCardinality"); lstype2 = psTempRowSet.GetType(); if ((lstype1 == "Port") && (lstype2 == "PortObject")) { psTempRowSet.SetProperty("PortItemId",lstPiId); psTempRowSet.SetProperty("PortMaxQty",lstPQMax); psTempRowSet.SetProperty("PortMinQty",lstPQMin); psFlatListOfPorts.AddChild(psTempRowSet); } } iMax = psListOfPorts.GetChildCount(); for (i= 0; i < iMax; i++) { psListOfPorts.RemoveChild(0); } } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects psTempRowSet = null; } }

AEC Auto Fix Tools SCM
AECPrepareFlatPortList
function AECPrepareFlatPortList (psListOfPorts, psFlatListOfPorts) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 03.11.2011 // Purpose: Subfunction - converting hierarchy to flat // Global variables used: // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 03/11/2011 Initial release //************************************************************************** var psTempRowSet; var lstype1; var lstPiId; var lstPQMax; var lstPQMin; var lstype2; var x; var xMax; var y; var yMax; var i; var iMax; try { psTempRowSet = null; xMax = psListOfPorts.GetChildCount(); for (x= 0; x < xMax; x++) { yMax = psListOfPorts.GetChild(x).GetChildCount(); for (y = 0; y < yMax; y++) { AECPrepareFlatPortList (psListOfPorts.GetChild(x), psFlatListOfPorts); } psTempRowSet = psListOfPorts.GetChild(x).Copy(); lstype1 = psListOfPorts.GetType(); lstPiId = psListOfPorts.GetProperty("Port Item Id"); lstPQMax = psListOfPorts.GetProperty("MaxCardinality"); lstPQMin = psListOfPorts.GetProperty("MinCardinality"); lstype2 = psTempRowSet.GetType(); if ((lstype1 == "Port") && (lstype2 == "PortObject")) { psTempRowSet.SetProperty("PortItemId",lstPiId); psTempRowSet.SetProperty("PortMaxQty",lstPQMax); psTempRowSet.SetProperty("PortMinQty",lstPQMin); psFlatListOfPorts.AddChild(psTempRowSet); } } iMax = psListOfPorts.GetChildCount(); for (i= 0; i < iMax; i++) { psListOfPorts.RemoveChild(0); } } catch (e) { oApp.Trace(e.toString()); throw e; } finally { //Release Objects psTempRowSet = null; } }

AEC Auto Fix Tools SCM
AECPromptApply
function AECPromptApply (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is performing the Auto Fix after the User has pressed the "Apply" button on a Prompt message // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var bsWPM; var psTempRowSet; var psContext; var psInp; var psOutp; var lstHeaderId; try { bsWPM = oApp.GetService("Workflow Process Manager"); psTempRowSet = oApp.NewPropertySet(); psContext = oApp.NewPropertySet(); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); // Setup Context psContext.SetType("Context"); psTempRowSet.SetType("Header"); lstHeaderId = Inputs.GetProperty("Doc Id"); psTempRowSet.SetProperty("AEC RVA I Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("AEC RVA AR Qty",Inputs.GetProperty("AEC AR Qty")); psTempRowSet.SetProperty("AEC RVA AR CP Id",Inputs.GetProperty("CP Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Id",Inputs.GetProperty("Promotion Id")); psTempRowSet.SetProperty("AEC RVA AR Product Id",Inputs.GetProperty("Product Id")); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Undo","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Apply","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id","-"); psTempRowSet.SetProperty("AEC RVA AR Undo Action","-"); psTempRowSet.SetProperty("AEC RVA AR Apply Action","-"); psTempRowSet.SetProperty("AEC RVA Skip AR","N"); psTempRowSet.SetProperty("AEC RVA AR Auto Action",Inputs.GetProperty("Apply Action")); psTempRowSet.SetProperty("AEC RVA AR Auto Fix Message",Inputs.GetProperty("Auto Fix Message")); psTempRowSet.SetProperty("AEC RVA AR Compatibility Rule Id",Inputs.GetProperty("Compatibility Rule Id")); psTempRowSet.SetProperty("AEC RVA AR Default Product Id",Inputs.GetProperty("Default Product Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Instance Id",Inputs.GetProperty("Promotion Instance Id")); psTempRowSet.SetProperty("AEC RVA AR I Root Product Id",Inputs.GetProperty("Root Product Id")); if (Inputs.GetProperty("Apply Action") == "Remove Item") { // Setup Property Set for Add Item/ psTempRowSet.SetProperty("AEC RVA AR Check Remove","Y"); psTempRowSet.SetProperty("AEC RVA AR Counter","0"); } psContext.AddChild(psTempRowSet); // Invoke Driver Workflow psInp.SetProperty("ProcessName", "AEC Rules Validation Driver SCM"); psInp.SetProperty("Perform RVE", "N"); psInp.SetProperty("Perform RVR", "Y"); psInp.SetProperty("AEC Cfg Context", "N"); psInp.AddChild(psContext); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects bsWPM = null; psTempRowSet = null; psContext = null; psInp = null; psOutp = null; } }

AEC Auto Fix Tools SCM
AECPromptApply
function AECPromptApply (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is performing the Auto Fix after the User has pressed the "Apply" button on a Prompt message // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var bsWPM; var psTempRowSet; var psContext; var psInp; var psOutp; var lstHeaderId; try { bsWPM = oApp.GetService("Workflow Process Manager"); psTempRowSet = oApp.NewPropertySet(); psContext = oApp.NewPropertySet(); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); // Setup Context psContext.SetType("Context"); psTempRowSet.SetType("Header"); lstHeaderId = Inputs.GetProperty("Doc Id"); psTempRowSet.SetProperty("AEC RVA I Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("AEC RVA AR Qty",Inputs.GetProperty("AEC AR Qty")); psTempRowSet.SetProperty("AEC RVA AR CP Id",Inputs.GetProperty("CP Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Id",Inputs.GetProperty("Promotion Id")); psTempRowSet.SetProperty("AEC RVA AR Product Id",Inputs.GetProperty("Product Id")); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Undo","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Apply","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id","-"); psTempRowSet.SetProperty("AEC RVA AR Undo Action","-"); psTempRowSet.SetProperty("AEC RVA AR Apply Action","-"); psTempRowSet.SetProperty("AEC RVA Skip AR","N"); psTempRowSet.SetProperty("AEC RVA AR Auto Action",Inputs.GetProperty("Apply Action")); psTempRowSet.SetProperty("AEC RVA AR Auto Fix Message",Inputs.GetProperty("Auto Fix Message")); psTempRowSet.SetProperty("AEC RVA AR Compatibility Rule Id",Inputs.GetProperty("Compatibility Rule Id")); psTempRowSet.SetProperty("AEC RVA AR Default Product Id",Inputs.GetProperty("Default Product Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Instance Id",Inputs.GetProperty("Promotion Instance Id")); psTempRowSet.SetProperty("AEC RVA AR I Root Product Id",Inputs.GetProperty("Root Product Id")); if (Inputs.GetProperty("Apply Action") == "Remove Item") { // Setup Property Set for Add Item/ psTempRowSet.SetProperty("AEC RVA AR Check Remove","Y"); psTempRowSet.SetProperty("AEC RVA AR Counter","0"); } psContext.AddChild(psTempRowSet); // Invoke Driver Workflow psInp.SetProperty("ProcessName", "AEC Rules Validation Driver SCM"); psInp.SetProperty("Perform RVE", "N"); psInp.SetProperty("Perform RVR", "Y"); psInp.SetProperty("AEC Cfg Context", "N"); psInp.AddChild(psContext); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects bsWPM = null; psTempRowSet = null; psContext = null; psInp = null; psOutp = null; } }

AEC Auto Fix Tools SCM
AECPromptUndo
function AECPromptUndo (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is performing the Auto Fix after the User has pressed the "Undo" button on a Prompt message // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var bsWPM; var psTempRowSet; var psContext; var psInp; var psOutp; var lstHeaderId; try { bsWPM = oApp.GetService("Workflow Process Manager"); psTempRowSet = oApp.NewPropertySet(); psContext = oApp.NewPropertySet(); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); // Setup Context psContext.SetType("Context"); psTempRowSet.SetType("Header"); lstHeaderId = Inputs.GetProperty("Doc Id"); psTempRowSet.SetProperty("AEC RVA I Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("AEC RVA AR Qty",Inputs.GetProperty("AEC AR Qty")); psTempRowSet.SetProperty("AEC RVA AR CP Id",Inputs.GetProperty("CP Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Id",Inputs.GetProperty("Promotion Id")); psTempRowSet.SetProperty("AEC RVA AR Product Id",Inputs.GetProperty("Product Id")); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Undo","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Apply","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id",Inputs.GetProperty("Remove Item Id Undo")); psTempRowSet.SetProperty("AEC RVA AR Undo Action","-"); psTempRowSet.SetProperty("AEC RVA AR Apply Action","-"); psTempRowSet.SetProperty("AEC RVA Skip AR","N"); psTempRowSet.SetProperty("AEC RVA AR Auto Action",Inputs.GetProperty("Undo Action")); psTempRowSet.SetProperty("AEC RVA AR Auto Fix Message",Inputs.GetProperty("Auto Fix Message")); psTempRowSet.SetProperty("AEC RVA AR Compatibility Rule Id",Inputs.GetProperty("Compatibility Rule Id")); psTempRowSet.SetProperty("AEC RVA AR Default Product Id",Inputs.GetProperty("Default Product Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Instance Id",Inputs.GetProperty("Promotion Instance Id")); psTempRowSet.SetProperty("AEC RVA AR I Root Product Id",Inputs.GetProperty("Root Product Id")); psContext.AddChild(psTempRowSet); // Invoke Driver Workflow psInp.SetProperty("ProcessName", "AEC Rules Validation Driver SCM"); psInp.SetProperty("Perform RVE", "N"); psInp.SetProperty("Perform RVR", "Y"); psInp.SetProperty("AEC Cfg Context", "N"); psInp.AddChild(psContext); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects bsWPM = null; psTempRowSet = null; psContext = null; psInp = null; psOutp = null; } }

AEC Auto Fix Tools SCM
AECPromptUndo
function AECPromptUndo (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is performing the Auto Fix after the User has pressed the "Undo" button on a Prompt message // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var bsWPM; var psTempRowSet; var psContext; var psInp; var psOutp; var lstHeaderId; try { bsWPM = oApp.GetService("Workflow Process Manager"); psTempRowSet = oApp.NewPropertySet(); psContext = oApp.NewPropertySet(); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); // Setup Context psContext.SetType("Context"); psTempRowSet.SetType("Header"); lstHeaderId = Inputs.GetProperty("Doc Id"); psTempRowSet.SetProperty("AEC RVA I Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("Header Id",Inputs.GetProperty("Doc Id")); psTempRowSet.SetProperty("AEC RVA AR Qty",Inputs.GetProperty("AEC AR Qty")); psTempRowSet.SetProperty("AEC RVA AR CP Id",Inputs.GetProperty("CP Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Id",Inputs.GetProperty("Promotion Id")); psTempRowSet.SetProperty("AEC RVA AR Product Id",Inputs.GetProperty("Product Id")); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Undo","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id Apply","-"); psTempRowSet.SetProperty("AEC RVA AR Remove Item Id",Inputs.GetProperty("Remove Item Id Undo")); psTempRowSet.SetProperty("AEC RVA AR Undo Action","-"); psTempRowSet.SetProperty("AEC RVA AR Apply Action","-"); psTempRowSet.SetProperty("AEC RVA Skip AR","N"); psTempRowSet.SetProperty("AEC RVA AR Auto Action",Inputs.GetProperty("Undo Action")); psTempRowSet.SetProperty("AEC RVA AR Auto Fix Message",Inputs.GetProperty("Auto Fix Message")); psTempRowSet.SetProperty("AEC RVA AR Compatibility Rule Id",Inputs.GetProperty("Compatibility Rule Id")); psTempRowSet.SetProperty("AEC RVA AR Default Product Id",Inputs.GetProperty("Default Product Id")); psTempRowSet.SetProperty("AEC RVA AR Promotion Instance Id",Inputs.GetProperty("Promotion Instance Id")); psTempRowSet.SetProperty("AEC RVA AR I Root Product Id",Inputs.GetProperty("Root Product Id")); psContext.AddChild(psTempRowSet); // Invoke Driver Workflow psInp.SetProperty("ProcessName", "AEC Rules Validation Driver SCM"); psInp.SetProperty("Perform RVE", "N"); psInp.SetProperty("Perform RVR", "Y"); psInp.SetProperty("AEC Cfg Context", "N"); psInp.AddChild(psContext); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects bsWPM = null; psTempRowSet = null; psContext = null; psInp = null; psOutp = null; } }

AEC Auto Fix Tools SCM
AECRemoveComponent
function AECRemoveComponent (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is instanciating a new Complex Product instance and removes the specified product // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 24/10/2011 Initial Release //************************************************************************** /* try { var s1 = TheApplication().GetService("ISS Copy Service"); var s2 = TheApplication().GetService("Remote Complex Object Instance Service"); var s3 = TheApplication().GetService("CXInstanceServiceSuppliment"); var inp1 = TheApplication().NewPropertySet(); var out1 = TheApplication().NewPropertySet(); var inp2 = TheApplication().NewPropertySet(); var inp3 = TheApplication().NewPropertySet(); var inp4 = TheApplication().NewPropertySet(); var inp5 = TheApplication().NewPropertySet(); var inp6 = TheApplication().NewPropertySet(); var inp7 = TheApplication().NewPropertySet(); var psOutput = TheApplication().NewPropertySet(); var Instance = TheApplication().NewPropertySet(); var ListOfPorts = TheApplication().NewPropertySet(); var lsIntegrationObjectName:String; var lsObjectId:String; var lsDeltaProductId:String; var lsDeltaProductQty:String; var lsDeltaProductAction:String; var lsDeltaProductItemId:String; var lsDeltaProductName:String; var lsMode:String; var lsRootId:String; var lsCxProdId:String; var lsSearchSpec:String; var lsPortId:String; var lsPath:String; lsIntegrationObjectName = Inputs.GetProperty("IntegrationObjectName"); lsObjectId = Inputs.GetProperty("ObjectId"); lsDeltaProductId = Inputs.GetProperty("DeltaProductId"); lsDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); lsDeltaProductAction = Inputs.GetProperty("DeltaProductAction"); lsMode = Inputs.GetProperty("Mode"); lsRootId = Inputs.GetProperty("RootId"); lsCxProdId = Inputs.GetProperty("CxProdId"); lsSearchSpec = "[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"; inp1.SetProperty("ParentObjectId",lsObjectId); inp1.SetProperty("IntegrationObjectName", lsIntegrationObjectName); inp1.SetProperty("RootId",lsRootId); inp1.SetProperty("SearchSpec","[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"); s1.InvokeMethod("LoadEAI",inp1,out1); // Load Instance inp1.SetProperty("ObjId",lsObjectId); inp1.SetProperty("IntObjName", lsIntegrationObjectName); inp1.SetProperty("Product Id", lsCxProdId); inp1.SetProperty("RootId",lsRootId); inp1.SetProperty("TriggerEvent","Y"); s2.InvokeMethod("LoadInstance",inp1,out1); // Get Instance inp1.SetProperty("ObjId",lsObjectId); inp1.SetProperty("RootId",lsRootId); s2.InvokeMethod("GetInstance",inp1,Instance); lsPath = "8SIA-7IDSA"; // Remove Item inp3.SetProperty("ObjId",lsObjectId); inp3.SetProperty("RootId",lsRootId); inp3.SetProperty("Path",lsPath); s2.InvokeMethod("RemoveItem",inp3,Outputs); // Sync Item inp7.SetProperty("ObjId",lsObjectId); inp7.SetProperty("RootId",lsRootId); inp7.SetProperty("IntObjName",lsIntegrationObjectName); s2.InvokeMethod("SyncInstance",inp7,Outputs); var xc="1"; var xc1="2"; } catch(e) { TheApplication().Trace(e.toString()); throw e; } finally { } */ }

AEC Auto Fix Tools SCM
AECRemoveComponent
function AECRemoveComponent (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is instanciating a new Complex Product instance and removes the specified product // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 24/10/2011 Initial Release //************************************************************************** /* try { var s1 = TheApplication().GetService("ISS Copy Service"); var s2 = TheApplication().GetService("Remote Complex Object Instance Service"); var s3 = TheApplication().GetService("CXInstanceServiceSuppliment"); var inp1 = TheApplication().NewPropertySet(); var out1 = TheApplication().NewPropertySet(); var inp2 = TheApplication().NewPropertySet(); var inp3 = TheApplication().NewPropertySet(); var inp4 = TheApplication().NewPropertySet(); var inp5 = TheApplication().NewPropertySet(); var inp6 = TheApplication().NewPropertySet(); var inp7 = TheApplication().NewPropertySet(); var psOutput = TheApplication().NewPropertySet(); var Instance = TheApplication().NewPropertySet(); var ListOfPorts = TheApplication().NewPropertySet(); var lsIntegrationObjectName:String; var lsObjectId:String; var lsDeltaProductId:String; var lsDeltaProductQty:String; var lsDeltaProductAction:String; var lsDeltaProductItemId:String; var lsDeltaProductName:String; var lsMode:String; var lsRootId:String; var lsCxProdId:String; var lsSearchSpec:String; var lsPortId:String; var lsPath:String; lsIntegrationObjectName = Inputs.GetProperty("IntegrationObjectName"); lsObjectId = Inputs.GetProperty("ObjectId"); lsDeltaProductId = Inputs.GetProperty("DeltaProductId"); lsDeltaProductQty = Inputs.GetProperty("DeltaProductQty"); lsDeltaProductAction = Inputs.GetProperty("DeltaProductAction"); lsMode = Inputs.GetProperty("Mode"); lsRootId = Inputs.GetProperty("RootId"); lsCxProdId = Inputs.GetProperty("CxProdId"); lsSearchSpec = "[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"; inp1.SetProperty("ParentObjectId",lsObjectId); inp1.SetProperty("IntegrationObjectName", lsIntegrationObjectName); inp1.SetProperty("RootId",lsRootId); inp1.SetProperty("SearchSpec","[Header.Id]='" + lsObjectId + "' AND [Line Item.Root Id]='" + lsRootId + "'"); s1.InvokeMethod("LoadEAI",inp1,out1); // Load Instance inp1.SetProperty("ObjId",lsObjectId); inp1.SetProperty("IntObjName", lsIntegrationObjectName); inp1.SetProperty("Product Id", lsCxProdId); inp1.SetProperty("RootId",lsRootId); inp1.SetProperty("TriggerEvent","Y"); s2.InvokeMethod("LoadInstance",inp1,out1); // Get Instance inp1.SetProperty("ObjId",lsObjectId); inp1.SetProperty("RootId",lsRootId); s2.InvokeMethod("GetInstance",inp1,Instance); lsPath = "8SIA-7IDSA"; // Remove Item inp3.SetProperty("ObjId",lsObjectId); inp3.SetProperty("RootId",lsRootId); inp3.SetProperty("Path",lsPath); s2.InvokeMethod("RemoveItem",inp3,Outputs); // Sync Item inp7.SetProperty("ObjId",lsObjectId); inp7.SetProperty("RootId",lsRootId); inp7.SetProperty("IntObjName",lsIntegrationObjectName); s2.InvokeMethod("SyncInstance",inp7,Outputs); var xc="1"; var xc1="2"; } catch(e) { TheApplication().Trace(e.toString()); throw e; } finally { } */ }

AEC Auto Fix Tools SCM
AECRemoveComponentFromActualInstance
function AECRemoveComponentFromActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is removing a component products from the actual Complex Product instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release // TTrenkler 17/01/2012 Added functionality to replace by default product (for fallback support) // TAABAVI3 16/03/2017 defect 5262, added conditions about DefaultProdId with && !=null && !="", to prevent OSI // and other engine to submit wrong request ("-" was the only expected before) //************************************************************************** // Variable Declaration var s2; var psInp1; var psInp2; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lnPortItemsMax:Number; var lsDefaultProdId; try { s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); lsDefaultProdId = Inputs.GetProperty("DefaultProdId"); if(lsDefaultProdId !="-" && lsDefaultProdId !="" && lsDefaultProdId != null) { // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Default Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",lsDefaultProdId); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Parent Path",Inputs.GetProperty("ParentPath")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); if (lnPortItemsMax == 1) { // Replace Item psInp1.SetProperty("Product Id",lsDefaultProdId); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("AutoFix","Y"); s2.InvokeMethod("ReplaceItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } } else { // Remove Item psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Path",Inputs.GetProperty("lsDeltaProductItemId")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); psInp1.SetProperty("AutoFix","Y"); s2.InvokeMethod("RemoveItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psInp1 = null; psInp2 = null; psListOfPorts = null; psFlatPortList = null; psListOfPortItems = null; s2 = null; } }

AEC Auto Fix Tools SCM
AECRemoveComponentFromActualInstance
function AECRemoveComponentFromActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is removing a component products from the actual Complex Product instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release // TTrenkler 17/01/2012 Added functionality to replace by default product (for fallback support) //************************************************************************** // Variable Declaration var s2; var psInp1; var psInp2; var psListOfPorts; var psFlatPortList; var psListOfPortItems; var lnPortItemsMax:Number; var lsDefaultProdId; try { s2 = oApp.GetService("Remote Complex Object Instance Service"); psInp1 = oApp.NewPropertySet(); psInp2 = oApp.NewPropertySet(); psListOfPorts = oApp.NewPropertySet(); psFlatPortList = oApp.NewPropertySet(); psListOfPortItems = oApp.NewPropertySet(); lsDefaultProdId = Inputs.GetProperty("DefaultProdId"); if(lsDefaultProdId !="-") { // Get All Ports psInp1.SetProperty("GetPortDomain","Y"); psInp1.SetProperty("Product Id", Inputs.GetProperty("CxProdId")); s2.InvokeMethod("GetAllPorts",psInp1,psListOfPorts); // Prepare Flat Port List AECPrepareFlatPortList(psListOfPorts,psFlatPortList); // Get Port Id for Default Product psInp2.AddChild(psFlatPortList); psInp2.SetProperty("lsDeltaProductId",lsDefaultProdId); AECGetPortId(psInp2,Outputs); lnPortItemsMax = Outputs.GetProperty("PortMaxQty"); // Get Selected Items psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Parent Path",Inputs.GetProperty("ParentPath")); psInp1.SetProperty("Port Item Id",Outputs.GetProperty("lsPortId")); psInp1.SetProperty("IntObjName", Inputs.GetProperty("IntObjName")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); s2.InvokeMethod("EnumObjects",psInp1,psListOfPortItems); if (lnPortItemsMax == 1) { // Replace Item psInp1.SetProperty("Product Id",lsDefaultProdId); psInp1.SetProperty("Prod Item Id",Outputs.GetProperty("lsProdItemId")); psInp1.SetProperty("Integration Id",Inputs.GetProperty("IntegrationId")); psInp1.SetProperty("Path",psListOfPortItems.GetChild(0).GetProperty("Path")); psInp1.SetProperty("Name",Outputs.GetProperty("lsProdName")); psInp1.SetProperty("Quantity","1"); psInp1.SetProperty("AutoFix","Y"); s2.InvokeMethod("ReplaceItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } } else { // Remove Item psInp1.SetProperty("ObjId",Inputs.GetProperty("ObjectId")); psInp1.SetProperty("Path",Inputs.GetProperty("lsDeltaProductItemId")); psInp1.SetProperty("RootId",Inputs.GetProperty("RootId")); psInp1.SetProperty("AutoFix","Y"); s2.InvokeMethod("RemoveItem",psInp1, Outputs); Outputs.SetProperty("AEC Operation Success", "Y"); } } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psInp1 = null; psInp2 = null; psListOfPorts = null; psFlatPortList = null; psListOfPortItems = null; s2 = null; } }

AEC Auto Fix Tools SCM
AECRemovePromotionItem
function AECRemovePromotionItem (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is removing Promotion Items when inside the EditPromotionUI // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 15/10/2013 Initial Release //************************************************************************** var s1; var inp1; try { s1 = oApp.GetService("ISS Promotion Edit UI Service"); inp1 = oApp.NewPropertySet(); inp1.SetType("Disconnect"); inp1.SetProperty("Item Id",Inputs.GetProperty("IID")); inp1.SetProperty("Promotion Rule Id",Inputs.GetProperty("PRID")); s1.InvokeMethod("UpdateStructure",inp1, Outputs); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects inp1 = null; s1 = null; } }

AEC Auto Fix Tools SCM
AECRemovePromotionItem
function AECRemovePromotionItem (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is removing Promotion Items when inside the EditPromotionUI // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 15/10/2013 Initial Release //************************************************************************** var s1; var inp1; try { s1 = oApp.GetService("ISS Promotion Edit UI Service"); inp1 = oApp.NewPropertySet(); inp1.SetType("Disconnect"); inp1.SetProperty("Item Id",Inputs.GetProperty("IID")); inp1.SetProperty("Promotion Rule Id",Inputs.GetProperty("PRID")); s1.InvokeMethod("UpdateStructure",inp1, Outputs); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects inp1 = null; s1 = null; } }

AEC Auto Fix Tools SCM
AECSetActiveJWS
function AECSetActiveJWS(Inputs,Outputs) { /* SPE Supporting method, for query of Joint Workspace and set this workspace as active Logic behind Write record on BC is not available as another business service call Inputs : JWS Id ... row id of Joint Workspace to be activated/deactivated Active Mode ... Y/N Value to be set for Activation or Deactivation of JWS History: ----------------------------------------------------------- TAABIVA1 2015/01/13 Script created */ var oBoJws:BusObject; var oBcJws=BusComp; try { oApp=TheApplication(); oBoJws=oApp.GetBusObject("Admin ISS Joint Workspace Definition"); oBcJws=oBoJws.GetBusComp("ISS Joint Workspace BusComp"); oBcJws.SetViewMode(AllView); oBcJws.ActivateField("Active Workspace Flag"); oBcJws.ActivateField("Tesing DateTime"); // field used by Background logic, not by this script !!!!! oBcJws.ClearToQuery(); oBcJws.SetSearchSpec("Id","'" + Inputs.GetProperty("JWS Id") +"'" ); oBcJws.ExecuteQuery(ForwardOnly); if(oBcJws.FirstRecord()) { oBcJws.SetFieldValue("Active Workspace Flag",Inputs.GetProperty("Active Mode")); oBcJws.WriteRecord(); } } catch(e) { } finally { oBcJws=null; oBoJws=null; oApp=null; } }

AEC Auto Fix Tools SCM
AECSetActiveJWS
function AECSetActiveJWS(Inputs,Outputs) { /* SPE Supporting method, for query of Joint Workspace and set this workspace as active Logic behind Write record on BC is not available as another business service call Inputs : JWS Id ... row id of Joint Workspace to be activated/deactivated Active Mode ... Y/N Value to be set for Activation or Deactivation of JWS History: ----------------------------------------------------------- TAABIVA1 2015/01/13 Script created */ var oBoJws:BusObject; var oBcJws=BusComp; try { oApp=TheApplication(); oBoJws=oApp.GetBusObject("Admin ISS Joint Workspace Definition"); oBcJws=oBoJws.GetBusComp("ISS Joint Workspace BusComp"); oBcJws.SetViewMode(AllView); oBcJws.ActivateField("Active Workspace Flag"); oBcJws.ActivateField("Tesing DateTime"); // field used by Background logic, not by this script !!!!! oBcJws.ClearToQuery(); oBcJws.SetSearchSpec("Id","'" + Inputs.GetProperty("JWS Id") +"'" ); oBcJws.ExecuteQuery(ForwardOnly); if(oBcJws.FirstRecord()) { oBcJws.SetFieldValue("Active Workspace Flag",Inputs.GetProperty("Active Mode")); oBcJws.WriteRecord(); } } catch(e) { } finally { oBcJws=null; oBoJws=null; oApp=null; } }

AEC Auto Fix Tools SCM
AECUpdateDefaultDiscountsSCMinIntance
//*************************************************************************** // Purpose: this function cycles trough and rowset containing actions from the scoring engine // and calls a setfield value to update the scoring engine flag. // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TGDLOHU1 17/13/2011 Initial Release //************************************************************************** function AECUpdateDefaultDiscountsSCMinIntance(Inputs, Outputs) { var psRowSet; var psRow; var bsRCOIS; var psInputs; var psOutputs; try { var intChildren = Inputs.GetChildCount(); for (var y = 0; y < intChildren; y++) { psRowSet = Inputs.GetChild(y); var sTypeOut = psRowSet.GetType(); if (sTypeOut == "Promotion") { var intRows = psRowSet.GetChildCount(); for (var z = 0; z < intRows; z++) { psRow = psRowSet.GetChild(z); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); bsRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); var sObjId = TheApplication().GetProfileAttr("PMCCreateSessionObjId"); var sRootId = TheApplication().GetProfileAttr("PMCCreateSessionRootId"); var sAECId = psRow.GetProperty("AECID"); psInputs.SetProperty("ObjId", sObjId); psInputs.SetProperty("RootId", sRootId); psInputs.SetProperty("Path", sAECId); psInputs.SetProperty("FieldName", "Default Discounts SCM"); psInputs.SetProperty("Value", "Y"); bsRCOIS.InvokeMethod("SetFieldValue", psInputs, psOutputs); var breakPoint = "1"; } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psRowSet = null; psOutputs = null; psInputs = null; bsRCOIS = null; psRow = null; } }

AEC Auto Fix Tools SCM
AECUpdateDefaultDiscountsSCMinIntance
//*************************************************************************** // Purpose: this function cycles trough and rowset containing actions from the scoring engine // and calls a setfield value to update the scoring engine flag. // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TGDLOHU1 17/13/2011 Initial Release //************************************************************************** function AECUpdateDefaultDiscountsSCMinIntance(Inputs, Outputs) { var psRowSet; var psRow; var bsRCOIS; var psInputs; var psOutputs; try { var intChildren = Inputs.GetChildCount(); for (var y = 0; y < intChildren; y++) { psRowSet = Inputs.GetChild(y); var sTypeOut = psRowSet.GetType(); if (sTypeOut == "Promotion") { var intRows = psRowSet.GetChildCount(); for (var z = 0; z < intRows; z++) { psRow = psRowSet.GetChild(z); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); bsRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); var sObjId = TheApplication().GetProfileAttr("PMCCreateSessionObjId"); var sRootId = TheApplication().GetProfileAttr("PMCCreateSessionRootId"); var sAECId = psRow.GetProperty("AECID"); psInputs.SetProperty("ObjId", sObjId); psInputs.SetProperty("RootId", sRootId); psInputs.SetProperty("Path", sAECId); psInputs.SetProperty("FieldName", "Default Discounts SCM"); psInputs.SetProperty("Value", "Y"); bsRCOIS.InvokeMethod("SetFieldValue", psInputs, psOutputs); var breakPoint = "1"; } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psRowSet = null; psOutputs = null; psInputs = null; bsRCOIS = null; psRow = null; } }

AEC Auto Fix Tools SCM
AECUpdateDefaultDiscountsSCMinIntance2
//*************************************************************************** // Purpose: this function cycles trough the Row Set Propertie set and updates the Default Discounts SCM flag in instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TGDTRTH6 24/10/2013 Initial Release //************************************************************************** function AECUpdateDefaultDiscountsSCMinIntance2(Inputs, Outputs) { var psRowSet; var psRow; var bsRCOIS; var psInputs; var psOutputs; try { var intChildren = Inputs.GetChildCount(); for (var y = 0; y < intChildren; y++) { psRowSet = Inputs.GetChild(y); var sTypeOut = psRowSet.GetType(); if (sTypeOut == "Promotion") { var intRows = psRowSet.GetChildCount(); for (var z = 0; z < intRows; z++) { psRow = psRowSet.GetChild(z); if (psRow.GetProperty("UpdDefDisc") =="Y") { psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); bsRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); var sObjId = TheApplication().GetProfileAttr("PMCCreateSessionObjId"); var sRootId = TheApplication().GetProfileAttr("PMCCreateSessionRootId"); var sAECId = psRow.GetProperty("Id"); psInputs.SetProperty("ObjId", sObjId); psInputs.SetProperty("RootId", sRootId); psInputs.SetProperty("Path", sAECId); psInputs.SetProperty("FieldName", "Default Discounts SCM"); psInputs.SetProperty("Value", "Y"); bsRCOIS.InvokeMethod("SetFieldValue", psInputs, psOutputs); var breakPoint = "1"; } } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psRowSet = null; psOutputs = null; psInputs = null; bsRCOIS = null; psRow = null; } }

AEC Auto Fix Tools SCM
AECUpdateDefaultDiscountsSCMinIntance2
//*************************************************************************** // Purpose: this function cycles trough the Row Set Propertie set and updates the Default Discounts SCM flag in instance // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TGDTRTH6 24/10/2013 Initial Release //************************************************************************** function AECUpdateDefaultDiscountsSCMinIntance2(Inputs, Outputs) { var psRowSet; var psRow; var bsRCOIS; var psInputs; var psOutputs; try { var intChildren = Inputs.GetChildCount(); for (var y = 0; y < intChildren; y++) { psRowSet = Inputs.GetChild(y); var sTypeOut = psRowSet.GetType(); if (sTypeOut == "Promotion") { var intRows = psRowSet.GetChildCount(); for (var z = 0; z < intRows; z++) { psRow = psRowSet.GetChild(z); if (psRow.GetProperty("UpdDefDisc") =="Y") { psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); bsRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); var sObjId = TheApplication().GetProfileAttr("PMCCreateSessionObjId"); var sRootId = TheApplication().GetProfileAttr("PMCCreateSessionRootId"); var sAECId = psRow.GetProperty("Id"); psInputs.SetProperty("ObjId", sObjId); psInputs.SetProperty("RootId", sRootId); psInputs.SetProperty("Path", sAECId); psInputs.SetProperty("FieldName", "Default Discounts SCM"); psInputs.SetProperty("Value", "Y"); bsRCOIS.InvokeMethod("SetFieldValue", psInputs, psOutputs); var breakPoint = "1"; } } } } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects psRowSet = null; psOutputs = null; psInputs = null; bsRCOIS = null; psRow = null; } }

AEC Auto Fix Tools SCM
AECValidateActualInstance
function AECValidateActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is validating the actual Complex Product instance after an AutoFix Action has been done // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var s1; var inp1; try { s1 = oApp.GetService("Cfg Web UI Service (JS)"); inp1 = oApp.NewPropertySet(); inp1.SetProperty("ObjId",Inputs.GetProperty("RootId")); inp1.SetProperty("Parent Path",Inputs.GetProperty("ObjectId")); inp1.SetProperty("RootId",Inputs.GetProperty("RootId")); inp1.SetProperty("RequestType","ExternalValidate"); s1.InvokeMethod("SubmitRequest",inp1, Outputs); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects inp1 = null; s1 = null; } }

AEC Auto Fix Tools SCM
AECValidateActualInstance
function AECValidateActualInstance (Inputs, Outputs) { //*************************************************************************** // Author: Trenkler, Thomas // Company: Oracle // Date Created: 24.10.2011 // Purpose: This Business Service is validating the actual Complex Product instance after an AutoFix Action has been done // Modification List // Name Date Modification Description // ---------- ---- ----------------------------- // TTrenkler 20/12/2011 Initial Release //************************************************************************** var s1; var inp1; try { s1 = oApp.GetService("Cfg Web UI Service (JS)"); inp1 = oApp.NewPropertySet(); inp1.SetProperty("ObjId",Inputs.GetProperty("RootId")); inp1.SetProperty("Parent Path",Inputs.GetProperty("ObjectId")); inp1.SetProperty("RootId",Inputs.GetProperty("RootId")); inp1.SetProperty("RequestType","ExternalValidate"); s1.InvokeMethod("SubmitRequest",inp1, Outputs); } catch(e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects inp1 = null; s1 = null; } }

AEC Auto Fix Tools SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

AEC Auto Fix Tools SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

AEC Auto Fix Tools SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { oApp = TheApplication(); iReturn = CancelOperation; switch (MethodName) { case "AECAddComponentToActualInstance": AECAddComponentToActualInstance (Inputs, Outputs); break; case "AECAddComponentToInstance": AECAddComponentToInstance (Inputs, Outputs); break; case "AddItem": AECAddItem (Inputs, Outputs); break; case "RemoveComponent": AECRemoveComponent (Inputs, Outputs); break; case "AECValidateActualInstance": AECValidateActualInstance (Inputs, Outputs); break; case "AECRemoveComponentFromActualInstance": AECRemoveComponentFromActualInstance (Inputs, Outputs); break; case "AECPromptApply": AECPromptApply (Inputs, Outputs); break; case "AECPromptUndo": AECPromptUndo (Inputs, Outputs); break; case "AECAddToList": AECAddToList (Inputs, Outputs); break; case "AECUpdateDefaultDiscountsSCMinIntance": AECUpdateDefaultDiscountsSCMinIntance (Inputs, Outputs); break; case "AECUpdateDefaultDiscountsSCMinIntance2": AECUpdateDefaultDiscountsSCMinIntance2 (Inputs, Outputs); break; case "AECRemovePromotionItem": AECRemovePromotionItem (Inputs, Outputs); break; case "AECSetActiveJWS": AECSetActiveJWS(Inputs,Outputs); break; case "AECGetHeaderFields": getHeaderFields(Inputs,Outputs); break; case "AECSetHeaderFields": setHeaderFields(Inputs,Outputs); break; case "AECGetSubcomponents": AECGetSubcomponents(Inputs,Outputs); break; default: iReturn = ContinueOperation; break; } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects oApp = null; } return (iReturn); }

AEC Auto Fix Tools SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { oApp = TheApplication(); iReturn = CancelOperation; switch (MethodName) { case "AECAddComponentToActualInstance": AECAddComponentToActualInstance (Inputs, Outputs); break; case "AECAddComponentToInstance": AECAddComponentToInstance (Inputs, Outputs); break; case "AddItem": AECAddItem (Inputs, Outputs); break; case "RemoveComponent": AECRemoveComponent (Inputs, Outputs); break; case "AECValidateActualInstance": AECValidateActualInstance (Inputs, Outputs); break; case "AECRemoveComponentFromActualInstance": AECRemoveComponentFromActualInstance (Inputs, Outputs); break; case "AECPromptApply": AECPromptApply (Inputs, Outputs); break; case "AECPromptUndo": AECPromptUndo (Inputs, Outputs); break; case "AECAddToList": AECAddToList (Inputs, Outputs); break; case "AECUpdateDefaultDiscountsSCMinIntance": AECUpdateDefaultDiscountsSCMinIntance (Inputs, Outputs); break; case "AECUpdateDefaultDiscountsSCMinIntance2": AECUpdateDefaultDiscountsSCMinIntance2 (Inputs, Outputs); break; case "AECRemovePromotionItem": AECRemovePromotionItem (Inputs, Outputs); break; case "AECSetActiveJWS": AECSetActiveJWS(Inputs,Outputs); break; case "AECGetHeaderFields": getHeaderFields(Inputs,Outputs); break; case "AECSetHeaderFields": setHeaderFields(Inputs,Outputs); break; case "AECGetSubcomponents": AECGetSubcomponents(Inputs,Outputs); break; default: iReturn = ContinueOperation; break; } } catch (e) { Outputs.SetProperty("AEC Operation Success", "N"); oApp.Trace(e.toString()); throw e; } finally { //Release Objects oApp = null; } return (iReturn); }

AEC Auto Fix Tools SCM
getHeaderFields
function getHeaderFields(Inputs,Outputs) { /* function to extract Header Fields from SIS OM Quote Message an return these fields as output property delimited by given delimiter. Inputs: SiebelMessage ... child property set containing SIS OM Quote Delimiter ... delimiter to be used for extracted field values FieldName N Quote Field[:Asset Field] Quote Header property with optional Asset property (if is not specified, Quote and Asset property should be same Outputs: Field Set .... list for Field=Value delimited by delimiter TAABIVA1 2015-10-19 Function Created */ var sDelimiter:chars=""; var psMessage:PropertySet; var sPropName:chars; var sFieldMapping:chars; var arFieldMapping:Array; var sFieldName:chars=""; var sFieldValue:chars="" var sNewFieldName:chars=""; var psHeader:PropertySet=null; var iIndex:float=0; var arOutList:Array=new Array(); try { if(Inputs.PropertyExists("Delimiter")) { sDelimiter=Inputs.GetProperty("Delimiter"); } else sDelimiter="~"; if(Inputs.GetChildCount()>0) { psMessage=Inputs.GetChild(0); } if(oApp.GetProfileAttr("PMC_HEADER_FIELD_LIST")!="") { // admin code value was specified, we will add these fields // as appendix to inpus starting from 999 arFieldMapping=oApp.GetProfileAttr("PMC_HEADER_FIELD_LIST").split("|"); for(iIndex=0;iIndex<arFieldMapping.length;iIndex++) { Inputs.SetProperty("FieldName " + iIndex+99, arFieldMapping[iIndex]); } } sPropName=Inputs.GetFirstProperty(); psHeader=psMessage.GetChild(0).GetChild(0); // .GetChild(0); do { if(sPropName.indexOf("FieldName")>=0) { // property is fieldmapping property, other props are ignored. if(Inputs.GetProperty(sPropName).indexOf(":")>0) { // cross property mapping found arFieldMapping=null; arFieldMapping=Inputs.GetProperty(sPropName).split(":"); sFieldName=arFieldMapping[0]; sNewFieldName=arFieldMapping[1]; } else { // same input and output property sFieldName=Inputs.GetProperty(sPropName); sNewFieldName=sFieldName; } // now read arOutList.push(sNewFieldName+"=" + psHeader.GetProperty(sFieldName)); // increment counter iIndex++; } sPropName=Inputs.GetNextProperty(); }while(sPropName!=""); Outputs.SetProperty("Field Set", arOutList.join(sDelimiter)); } finally { psMessage=null; arFieldMapping=null; arOutList=null; psHeader=null; } }

AEC Auto Fix Tools SCM
getHeaderFields
function getHeaderFields(Inputs,Outputs) { /* function to extract Header Fields from SIS OM Quote Message an return these fields as output property delimited by given delimiter. Inputs: SiebelMessage ... child property set containing SIS OM Quote Delimiter ... delimiter to be used for extracted field values FieldName N Quote Field[:Asset Field] Quote Header property with optional Asset property (if is not specified, Quote and Asset property should be same Outputs: Field Set .... list for Field=Value delimited by delimiter TAABIVA1 2015-10-19 Function Created */ var sDelimiter:chars=""; var psMessage:PropertySet; var sPropName:chars; var sFieldMapping:chars; var arFieldMapping:Array; var sFieldName:chars=""; var sFieldValue:chars="" var sNewFieldName:chars=""; var psHeader:PropertySet=null; var iIndex:float=0; var arOutList:Array=new Array(); try { if(Inputs.PropertyExists("Delimiter")) { sDelimiter=Inputs.GetProperty("Delimiter"); } else sDelimiter="~"; if(Inputs.GetChildCount()>0) { psMessage=Inputs.GetChild(0); } if(oApp.GetProfileAttr("PMC_HEADER_FIELD_LIST")!="") { // admin code value was specified, we will add these fields // as appendix to inpus starting from 999 arFieldMapping=oApp.GetProfileAttr("PMC_HEADER_FIELD_LIST").split("|"); for(iIndex=0;iIndex<arFieldMapping.length;iIndex++) { Inputs.SetProperty("FieldName " + iIndex+99, arFieldMapping[iIndex]); } } sPropName=Inputs.GetFirstProperty(); psHeader=psMessage.GetChild(0).GetChild(0); // .GetChild(0); do { if(sPropName.indexOf("FieldName")>=0) { // property is fieldmapping property, other props are ignored. if(Inputs.GetProperty(sPropName).indexOf(":")>0) { // cross property mapping found arFieldMapping=null; arFieldMapping=Inputs.GetProperty(sPropName).split(":"); sFieldName=arFieldMapping[0]; sNewFieldName=arFieldMapping[1]; } else { // same input and output property sFieldName=Inputs.GetProperty(sPropName); sNewFieldName=sFieldName; } // now read arOutList.push(sNewFieldName+"=" + psHeader.GetProperty(sFieldName)); // increment counter iIndex++; } sPropName=Inputs.GetNextProperty(); }while(sPropName!=""); Outputs.SetProperty("Field Set", arOutList.join(sDelimiter)); } finally { psMessage=null; arFieldMapping=null; arOutList=null; psHeader=null; } }

AEC Auto Fix Tools SCM
setHeaderFields
function setHeaderFields(Inputs,Outputs) { /* Function which applies list of given fields Inputs : SiebelMessage .... hierarchy with SIS OM Asset structure expected Delimiter .... delimiter for fields Field Set .... list of field=value delimiter by delimtier Outputs: SiebelMessage with Header modified TAABIVA1 2015-10-19 Function Created */ var psMessage:PropertySet; var sDelimiter:chars; var sFieldSet:chars=Inputs.GetProperty("Field Set"); var arFields:Array; var arField:Array; var iIndex:float; if(Inputs.PropertyExists("Delimiter")) sDelimiter=Inputs.GetProperty("Delimiter"); else sDelimiter="~"; try { if(Inputs.GetChildCount()>0) { psMessage=Inputs.GetChild(0); } if((psMessage!=null)&&(sFieldSet!=null)) { // convert input string to arFields=sFieldSet.split(sDelimiter); for(iIndex=0;iIndex<arFields.length;iIndex++) { arField=arFields[iIndex].split("="); if(arField[1]==null) arField[1]=""; psMessage.GetChild(0).GetChild(0).SetProperty(arField[0],arField[1]); } } } finally { Outputs.AddChild(psMessage.Copy()); arFields=null; arField=null; psMessage=null; } }

AEC Auto Fix Tools SCM
setHeaderFields
function setHeaderFields(Inputs,Outputs) { /* Function which applies list of given fields Inputs : SiebelMessage .... hierarchy with SIS OM Asset structure expected Delimiter .... delimiter for fields Field Set .... list of field=value delimiter by delimtier Outputs: SiebelMessage with Header modified TAABIVA1 2015-10-19 Function Created */ var psMessage:PropertySet; var sDelimiter:chars; var sFieldSet:chars=Inputs.GetProperty("Field Set"); var arFields:Array; var arField:Array; var iIndex:float; if(Inputs.PropertyExists("Delimiter")) sDelimiter=Inputs.GetProperty("Delimiter"); else sDelimiter="~"; try { if(Inputs.GetChildCount()>0) { psMessage=Inputs.GetChild(0); } if((psMessage!=null)&&(sFieldSet!=null)) { // convert input string to arFields=sFieldSet.split(sDelimiter); for(iIndex=0;iIndex<arFields.length;iIndex++) { arField=arFields[iIndex].split("="); if(arField[1]==null) arField[1]=""; psMessage.GetChild(0).GetChild(0).SetProperty(arField[0],arField[1]); } } } finally { Outputs.AddChild(psMessage.Copy()); arFields=null; arField=null; psMessage=null; } }

AEC Compatibility Query VBC SCM
(declarations)
var oApp:Application;

AEC Compatibility Query VBC SCM
(declarations)
var oApp:Application;

AEC Compatibility Query VBC SCM
Init
/***************************************************************************** * Function: Init * Purpose : Initializes the vBC *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2013-06-24 Thomas Trenkler created * 2013-09-12 Thomas Trenkler Added "AC" field (Action Code) * 2013-09-12 Thomas Trenkler Added "GCF" field (Gigabit Capable Flag) * 2014-03-21 Matthieu Hattab Added "AF" field (Application Filter) for Stargate Project May 2014 Release * 2014-04-01 Matthieu Hattab Added "CW" field (Capability WLAN) for Stargate Project May 2014 Release (CR16) * 2014-09-04 Vaclav Bittmann Added "AEC List Name" Field * 2014-11-18 Vaclav Bittmann Added CHRGUI, PSTACKSRC, Group Name * 2015-03-17 Adarsh Sharma Added new field 'Commitment Period SCM' for REQ_WP-0700_SBL-39047 * 2015-04-15 Vaclav Bittmann Added Retention Flag * 2015-05-27 Martin Jurko Added NAS, Dect for REQ_WP-775_SBL-41161:Add new Capabilities to E&C engine * 2015-06-05 Martin Jurko Added Object Action * 2015-06-05 Martin Jurko Added Subject Action, Capability Bonding * 2015-10-08 Martin Jurko Added Midrange Capable SCM * 2015-11-23 Pavel Kamir Added Account Segment SCM, Simple Pay Blocked SCM, Care Customer SCM for REQ_WP-1054_SBL-48197:Extend E&C Framework to Support new conditions * 2015-12-15 Vaclav Bittmann Added Activation Correction Flg * 2016-03-30 Nishant Singhal Added Status, Workspace for TTP-135 * 2016-07-06 Pavel Kamir Added Bonding Capacity and Bonding Availability *****************************************************************************/ function Init (Inputs, Outputs) { Outputs.SetProperty("Name", ""); Outputs.SetProperty("AFAction", ""); Outputs.SetProperty("Adjustment Group", ""); Outputs.SetProperty("Adjustment Group Id", ""); Outputs.SetProperty("Analyze", ""); Outputs.SetProperty("BbType", ""); Outputs.SetProperty("Chain", ""); Outputs.SetProperty("Channel", ""); Outputs.SetProperty("DefProdId", ""); Outputs.SetProperty("Effective End Date", ""); Outputs.SetProperty("Effective Start Date", ""); Outputs.SetProperty("Info", ""); Outputs.SetProperty("MAXDS", ""); Outputs.SetProperty("MAXUS", ""); Outputs.SetProperty("MDS", ""); Outputs.SetProperty("MUS", ""); Outputs.SetProperty("Matrix Rule Num", ""); Outputs.SetProperty("MaxAge", ""); Outputs.SetProperty("Message Id SCM", ""); Outputs.SetProperty("MinAge", ""); Outputs.SetProperty("OMaxQty", ""); Outputs.SetProperty("OMinQty", ""); Outputs.SetProperty("OPRID", ""); Outputs.SetProperty("OPromId", ""); Outputs.SetProperty("ORProdId", ""); Outputs.SetProperty("ORQO", ""); Outputs.SetProperty("Order", ""); Outputs.SetProperty("Path", ""); Outputs.SetProperty("PrePick", ""); Outputs.SetProperty("Product", ""); Outputs.SetProperty("Product Class", ""); Outputs.SetProperty("Product Class Id", ""); Outputs.SetProperty("Product Id", ""); Outputs.SetProperty("Product Line", ""); Outputs.SetProperty("Product Line Id", ""); Outputs.SetProperty("Rel Product", ""); Outputs.SetProperty("Rel Product Class", ""); Outputs.SetProperty("Rel Product Class Id", ""); Outputs.SetProperty("Rel Product Id", ""); Outputs.SetProperty("Rel Product Line", ""); Outputs.SetProperty("Rel Product Line Id", ""); Outputs.SetProperty("Router", ""); Outputs.SetProperty("SMaxQty", ""); Outputs.SetProperty("SMinQty", ""); Outputs.SetProperty("SPRID", ""); Outputs.SetProperty("SPromId", ""); Outputs.SetProperty("SRProdId", ""); Outputs.SetProperty("Scenario", ""); Outputs.SetProperty("Scope", ""); Outputs.SetProperty("Scope-LIC", ""); Outputs.SetProperty("Seq", ""); Outputs.SetProperty("Type", ""); Outputs.SetProperty("Type-LIC", ""); Outputs.SetProperty("Id", ""); Outputs.SetProperty("CRuleId", ""); Outputs.SetProperty("AC", ""); Outputs.SetProperty("GCF",

AEC Compatibility Query VBC SCM
Init
/***************************************************************************** * Function: Init * Purpose : Initializes the vBC *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2013-06-24 Thomas Trenkler created * 2013-09-12 Thomas Trenkler Added "AC" field (Action Code) * 2013-09-12 Thomas Trenkler Added "GCF" field (Gigabit Capable Flag) * 2014-03-21 Matthieu Hattab Added "AF" field (Application Filter) for Stargate Project May 2014 Release * 2014-04-01 Matthieu Hattab Added "CW" field (Capability WLAN) for Stargate Project May 2014 Release (CR16) * 2014-09-04 Vaclav Bittmann Added "AEC List Name" Field * 2014-11-18 Vaclav Bittmann Added CHRGUI, PSTACKSRC, Group Name * 2015-03-17 Adarsh Sharma Added new field 'Commitment Period SCM' for REQ_WP-0700_SBL-39047 * 2015-04-15 Vaclav Bittmann Added Retention Flag * 2015-05-27 Martin Jurko Added NAS, Dect for REQ_WP-775_SBL-41161:Add new Capabilities to E&C engine * 2015-06-05 Martin Jurko Added Object Action * 2015-06-05 Martin Jurko Added Subject Action, Capability Bonding * 2015-10-08 Martin Jurko Added Midrange Capable SCM * 2015-11-23 Pavel Kamir Added Account Segment SCM, Simple Pay Blocked SCM, Care Customer SCM for REQ_WP-1054_SBL-48197:Extend E&C Framework to Support new conditions * 2015-12-15 Vaclav Bittmann Added Activation Correction Flg * 2016-03-30 Nishant Singhal Added Status, Workspace for TTP-135 *****************************************************************************/ function Init (Inputs, Outputs) { Outputs.SetProperty("Name", ""); Outputs.SetProperty("AFAction", ""); Outputs.SetProperty("Adjustment Group", ""); Outputs.SetProperty("Adjustment Group Id", ""); Outputs.SetProperty("Analyze", ""); Outputs.SetProperty("BbType", ""); Outputs.SetProperty("Chain", ""); Outputs.SetProperty("Channel", ""); Outputs.SetProperty("DefProdId", ""); Outputs.SetProperty("Effective End Date", ""); Outputs.SetProperty("Effective Start Date", ""); Outputs.SetProperty("Info", ""); Outputs.SetProperty("MAXDS", ""); Outputs.SetProperty("MAXUS", ""); Outputs.SetProperty("MDS", ""); Outputs.SetProperty("MUS", ""); Outputs.SetProperty("Matrix Rule Num", ""); Outputs.SetProperty("MaxAge", ""); Outputs.SetProperty("Message Id SCM", ""); Outputs.SetProperty("MinAge", ""); Outputs.SetProperty("OMaxQty", ""); Outputs.SetProperty("OMinQty", ""); Outputs.SetProperty("OPRID", ""); Outputs.SetProperty("OPromId", ""); Outputs.SetProperty("ORProdId", ""); Outputs.SetProperty("ORQO", ""); Outputs.SetProperty("Order", ""); Outputs.SetProperty("Path", ""); Outputs.SetProperty("PrePick", ""); Outputs.SetProperty("Product", ""); Outputs.SetProperty("Product Class", ""); Outputs.SetProperty("Product Class Id", ""); Outputs.SetProperty("Product Id", ""); Outputs.SetProperty("Product Line", ""); Outputs.SetProperty("Product Line Id", ""); Outputs.SetProperty("Rel Product", ""); Outputs.SetProperty("Rel Product Class", ""); Outputs.SetProperty("Rel Product Class Id", ""); Outputs.SetProperty("Rel Product Id", ""); Outputs.SetProperty("Rel Product Line", ""); Outputs.SetProperty("Rel Product Line Id", ""); Outputs.SetProperty("Router", ""); Outputs.SetProperty("SMaxQty", ""); Outputs.SetProperty("SMinQty", ""); Outputs.SetProperty("SPRID", ""); Outputs.SetProperty("SPromId", ""); Outputs.SetProperty("SRProdId", ""); Outputs.SetProperty("Scenario", ""); Outputs.SetProperty("Scope", ""); Outputs.SetProperty("Scope-LIC", ""); Outputs.SetProperty("Seq", ""); Outputs.SetProperty("Type", ""); Outputs.SetProperty("Type-LIC", ""); Outputs.SetProperty("Id", ""); Outputs.SetProperty("CRuleId", ""); Outputs.SetProperty("AC", ""); Outputs.SetProperty("GCF", ""); Outputs.SetProperty("RF", ""); Outputs.SetProperty("OBbType", "");

AEC Compatibility Query VBC SCM
Query
/***************************************************************************** * Function: Query * Purpose : Querys for the corresponding Rules, this VBC is necessary as we use outer joins to join Rule condition attributes to the rule * as there can be more than one condition per rule, the corresponding record is duplicated but the cache will only fetch the attributes of the first * Condition, because the duplicated Rules have the same Id. This VBC is now generating a separate Id for each record by concatenating the Row Id of the * Rule Condition with the Row_Id of the Rule (VRId). *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2013-06-24 Thomas Trenkler created * 2013-09-12 Thomas Trenkler Added "AC" field (Action Code) * 2013-09-12 Thomas Trenkler Added "GCF" field (Gigabit Capable Flag) * 2014-03-21 Matthieu Hattab Added "AF" field (Application Filter) for Stargate Project May 2014 Release * 2014-04-01 Matthieu Hattab Added "CW" field (Capability WLAN) for Stargate Project May 2014 Release (CR16)$ * 2014-09-04 Vaclav Bittmann Added "AEC List Name" Field * 2014-11-18 Vaclav Bittmann Added CHRGUI, PSTACKSRC, Group Name * 2015-03-17 Adarsh Sharma Added new field 'Commitment Period SCM' for REQ_WP-0700_SBL-39047 * 2015-04-15 Vaclav Bittmann Added Retention Flag * 2015-05-27 Martin Jurko Added NAS, Dect for REQ_WP-775_SBL-41161:Add new Capabilities to E&C engine * 2015-06-05 Martin Jurko Added Object Action * 2015-10-08 Martin Jurko Added Midrange Capable SCM * 2015-11-23 Pavel Kamir Added Account Segment SCM, Simple Pay Blocked SCM, Care Customer SCM for REQ_WP-1054_SBL-48197:Extend E&C Framework to Support new conditions * 2015-12-15 Vaclav Bittmann Added Activation Correction Flg * 2016-03-30 Nishant Singhal Added Status, Workspace for TTP-135 * 2016-04-21 Vincenzo Barra Added Adoption TV Flag * 2016-07-06 Pavel Kamir Added Bonding Capacity and Bonding Availability *****************************************************************************/ function Query(Inputs, Outputs) { var lbcBusObject; var lbcBusComp; oApp = TheApplication(); var lsrecord; var row1; try { lbcBusObject = oApp.GetBusObject("Adjustment Group"); lbcBusComp = lbcBusObject.GetBusComp ("AEC Product Compatibility Condition Query SCM"); with (lbcBusComp) { SetViewMode(AllView); ClearToQuery(); SetSearchExpr(Inputs.GetProperty ("search-string")); ExecuteQuery (ForwardOnly); lsrecord=FirstRecord(); while(lsrecord) { row1=TheApplication().NewPropertySet (); row1.SetProperty("AFAction", GetFieldValue("AFAction")); row1.SetProperty("Adjustment Group", GetFieldValue("Adjustment Group")); row1.SetProperty("Adjustment Group Id", GetFieldValue("Adjustment Group Id")); row1.SetProperty("Analyze", GetFieldValue("Analyze")); row1.SetProperty("BbType", GetFieldValue("BbType")); row1.SetProperty("Chain", GetFieldValue("Chain")); row1.SetProperty("Channel", GetFieldValue("Channel")); row1.SetProperty("DefProdId", GetFieldValue("DefProdId")); row1.SetProperty("Effective End Date", GetFieldValue("Effective End Date")); row1.SetProperty("Effective Start Date", GetFieldValue("Effective Start Date")); row1.SetProperty("Info", GetFieldValue("Info")); row1.SetProperty("MAXDS", GetFieldValue("MAXDS")); row1.SetProperty("MAXUS", GetFieldValue("MAXUS")); row1.SetProperty("MDS", GetFieldValue("MDS")); row1.SetProperty("MUS", GetFieldValue("MUS")); row1.SetProperty("Matrix Rule Num", GetFieldValue("Matrix Rule Num")); row1.SetProperty("MaxAge", GetFieldValue("MaxAge")); row1.SetProperty("Message Id SCM", GetFieldValue("Message Id SCM")); row1.SetProperty("MinAge", GetFieldValue("MinAge")); row1.SetProperty("OM

AEC Compatibility Query VBC SCM
Query
/***************************************************************************** * Function: Query * Purpose : Querys for the corresponding Rules, this VBC is necessary as we use outer joins to join Rule condition attributes to the rule * as there can be more than one condition per rule, the corresponding record is duplicated but the cache will only fetch the attributes of the first * Condition, because the duplicated Rules have the same Id. This VBC is now generating a separate Id for each record by concatenating the Row Id of the * Rule Condition with the Row_Id of the Rule (VRId). *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2013-06-24 Thomas Trenkler created * 2013-09-12 Thomas Trenkler Added "AC" field (Action Code) * 2013-09-12 Thomas Trenkler Added "GCF" field (Gigabit Capable Flag) * 2014-03-21 Matthieu Hattab Added "AF" field (Application Filter) for Stargate Project May 2014 Release * 2014-04-01 Matthieu Hattab Added "CW" field (Capability WLAN) for Stargate Project May 2014 Release (CR16)$ * 2014-09-04 Vaclav Bittmann Added "AEC List Name" Field * 2014-11-18 Vaclav Bittmann Added CHRGUI, PSTACKSRC, Group Name * 2015-03-17 Adarsh Sharma Added new field 'Commitment Period SCM' for REQ_WP-0700_SBL-39047 * 2015-04-15 Vaclav Bittmann Added Retention Flag * 2015-05-27 Martin Jurko Added NAS, Dect for REQ_WP-775_SBL-41161:Add new Capabilities to E&C engine * 2015-06-05 Martin Jurko Added Object Action * 2015-10-08 Martin Jurko Added Midrange Capable SCM * 2015-11-23 Pavel Kamir Added Account Segment SCM, Simple Pay Blocked SCM, Care Customer SCM for REQ_WP-1054_SBL-48197:Extend E&C Framework to Support new conditions * 2015-12-15 Vaclav Bittmann Added Activation Correction Flg * 2016-03-30 Nishant Singhal Added Status, Workspace for TTP-135 * 2016-04-21 Vincenzo Barra Added Adoption TV Flag *****************************************************************************/ function Query(Inputs, Outputs) { var lbcBusObject; var lbcBusComp; oApp = TheApplication(); var lsrecord; var row1; try { lbcBusObject = oApp.GetBusObject("Adjustment Group"); lbcBusComp = lbcBusObject.GetBusComp ("AEC Product Compatibility Condition Query SCM"); with (lbcBusComp) { SetViewMode(AllView); ClearToQuery(); SetSearchExpr(Inputs.GetProperty ("search-string")); ExecuteQuery (ForwardOnly); lsrecord=FirstRecord(); while(lsrecord) { row1=TheApplication().NewPropertySet (); row1.SetProperty("AFAction", GetFieldValue("AFAction")); row1.SetProperty("Adjustment Group", GetFieldValue("Adjustment Group")); row1.SetProperty("Adjustment Group Id", GetFieldValue("Adjustment Group Id")); row1.SetProperty("Analyze", GetFieldValue("Analyze")); row1.SetProperty("BbType", GetFieldValue("BbType")); row1.SetProperty("Chain", GetFieldValue("Chain")); row1.SetProperty("Channel", GetFieldValue("Channel")); row1.SetProperty("DefProdId", GetFieldValue("DefProdId")); row1.SetProperty("Effective End Date", GetFieldValue("Effective End Date")); row1.SetProperty("Effective Start Date", GetFieldValue("Effective Start Date")); row1.SetProperty("Info", GetFieldValue("Info")); row1.SetProperty("MAXDS", GetFieldValue("MAXDS")); row1.SetProperty("MAXUS", GetFieldValue("MAXUS")); row1.SetProperty("MDS", GetFieldValue("MDS")); row1.SetProperty("MUS", GetFieldValue("MUS")); row1.SetProperty("Matrix Rule Num", GetFieldValue("Matrix Rule Num")); row1.SetProperty("MaxAge", GetFieldValue("MaxAge")); row1.SetProperty("Message Id SCM", GetFieldValue("Message Id SCM")); row1.SetProperty("MinAge", GetFieldValue("MinAge")); row1.SetProperty("OMaxQty", GetFieldValue("OMaxQty")); row1.SetProperty("OMinQty", GetField

AEC Compatibility Query VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { return(Init(Inputs, Outputs)); } else if (MethodName == "Query") { Query(Inputs, Outputs); return (CancelOperation); } else { return (ContinueOperation); } }

AEC Compatibility Query VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { return(Init(Inputs, Outputs)); } else if (MethodName == "Query") { Query(Inputs, Outputs); return (CancelOperation); } else { return (ContinueOperation); } }

AEC Log
Service_PreInvokeMethod
function Service_PreInvokeMethod(MethodName, Inputs, Outputs){ var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; try{ if (MethodName == "LogString"){ var sFileString = Inputs.GetProperty("File"); var bWindows = oApp.GetProfileAttr("OPERATING_SYSTEM") == "WINDOWS"; // for dedicated client if(bWindows) sFileString = "C:" + sFileString.replace(/[\/]/g, "\\"); var sString = Inputs.GetProperty("String"); var file = Clib.fopen(sFileString, "at"); if(file != null){ Clib.fputs(sString + "\n", file); Clib.fclose(file); } else{ oApp.RaiseErrorText("File: " + sFileString + " could not be opened"); } } if (MethodName == "GetTime"){ var sProfileAttrName = Inputs.GetProperty("sProfileAttrNameCascade"); var now = new Date(); var timeStamp = now.toGMTString() + " " + now.getUTCMilliseconds(); TheApplication().SetProfileAttr(sProfileAttrName, timeStamp); } if (MethodName == "GetEndOfLine"){ TheApplication().SetProfileAttr("sEndOfLine","\n"); } return (CancelOperation); } catch (e){ // Trace error and ... var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(Name() + " -> Method Error: " + sError); // ... throw the error message back to the WF throw (e); } finally{ this.oApp = null; } }

AEC Log
Service_PreInvokeMethod
function Service_PreInvokeMethod(MethodName, Inputs, Outputs){ var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; try{ if (MethodName == "LogString"){ var sFileString = Inputs.GetProperty("File"); var bWindows = oApp.GetProfileAttr("OPERATING_SYSTEM") == "WINDOWS"; // for dedicated client if(bWindows) sFileString = "C:" + sFileString.replace(/[\/]/g, "\\"); var sString = Inputs.GetProperty("String"); var file = Clib.fopen(sFileString, "at"); if(file != null){ Clib.fputs(sString + "\n", file); Clib.fclose(file); } else{ oApp.RaiseErrorText("File: " + sFileString + " could not be opened"); } } if (MethodName == "GetTime"){ var sProfileAttrName = Inputs.GetProperty("sProfileAttrNameCascade"); var now = new Date(); var timeStamp = now.toGMTString() + " " + now.getUTCMilliseconds(); TheApplication().SetProfileAttr(sProfileAttrName, timeStamp); } if (MethodName == "GetEndOfLine"){ TheApplication().SetProfileAttr("sEndOfLine","\n"); } return (CancelOperation); } catch (e){ // Trace error and ... var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(Name() + " -> Method Error: " + sError); // ... throw the error message back to the WF throw (e); } finally{ this.oApp = null; } }

AEC SPE Wrapper SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

AEC SPE Wrapper SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

AEC SPE Wrapper SCM
ApplyCfgActions
function ApplyCfgActions(Inputs,Outputs) { /* Method to execute actions against opened eCfg Sessions Inputs: SPE Sessions ... Row Set with SPE Session Identifiers and RootId ObjId ... ObjId of eCfg Session AEC Actions Row Set ... Row set with Actions to be aplied against sesions Context ... processing context Row Set .... full row set of existing quote SPE Use Case ... name of SPE Use case to be called SPE Context Id .... context id ( quote ID or any different uniq context id Workflow Process Name ... name of workflow process name to be called before Process : For each Session will be sent all actions and retuned */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var oPsSessions:PropertySet; var oPsActions:PropertySet; var oPsContext:PropertySet; var oPsRowSet:PropertySet; var sObjId:chars=Inputs.GetProperty("ObjId"); var sSpeContextId:chars=Inputs.GetProperty("SPE Context Id"); var sSpeUseCase:chars=Inputs.GetProperty("SPE Use Case"); var oPsSpeInp:PropertySet=oApp.NewPropertySet(); var oPsSpeOut:PropertySet=oApp.NewPropertySet(); var sWfName:chars=Inputs.GetProperty("Workflow Process Name"); var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var iChild:float; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars; try { // first load proper inputs for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "SPE Sessions": oPsSessions=Inputs.GetChild(iChild); break; case "AEC Actions Row Set": oPsActions=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; } } // start building inputs for SPE Service with(oPsSpeInp) { SetProperty("ContextId",sSpeContextId); SetProperty("UseCase",sSpeUseCase); // now common arguments for all threads oPsContext.SetType("Req_Context"); AddChild(oPsContext); oPsActions.SetType("Req_Row Set"); AddChild(oPsActions); oPsRowSet.SetType("Req_Full Row Set"); AddChild(oPsRowSet); } // now configure each request Individually iChildCount=oPsSessions.GetChildCount(); for(iChild=1;iChild<=iChildCount;iChild++) { sReqTmpl="Req"+iChild; oPsSpeInp.SetProperty(sReqTmpl+"_SessionId",oPsSessions.GetChild(iChild-1).GetProperty("SessionId")); oPsSpeInp.SetProperty(sReqTmpl+"_RootId",oPsSessions.GetChild(iChild-1).GetProperty("RootId")); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcName","Workflow Process Manager"); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcMethod","RunProcess"); oPsSpeInp.SetProperty(sReqTmpl+"_ProcessName",sWfName); oPsSpeInp.SetProperty("Req_ObjId",sObjId); } // execute SPE Request oSpeService.InvokeMethod("ExecuteStatefulRequest",oPsSpeInp,oPsSpeOut); oPsSpeOut.SetType("SPE Response"); Outputs.AddChild(oPsSpeOut); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outputs.SetProperty("Error Message", e.toString()); Outputs.SetProperty("Error Flag","Y"); } finally { oPsSpeInp=null; oPsSpeOut=null; oPsSessions=null; oPsActions=null; oPsContext=null; oPsRowSet=null; oSpeService=null; oApp=null; } }

AEC SPE Wrapper SCM
ApplyCfgActions
function ApplyCfgActions(Inputs,Outputs) { /* Method to execute actions against opened eCfg Sessions Inputs: SPE Sessions ... Row Set with SPE Session Identifiers and RootId ObjId ... ObjId of eCfg Session AEC Actions Row Set ... Row set with Actions to be aplied against sesions Context ... processing context Row Set .... full row set of existing quote SPE Use Case ... name of SPE Use case to be called SPE Context Id .... context id ( quote ID or any different uniq context id Workflow Process Name ... name of workflow process name to be called before Process : For each Session will be sent all actions and retuned */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var oPsSessions:PropertySet; var oPsActions:PropertySet; var oPsContext:PropertySet; var oPsRowSet:PropertySet; var sObjId:chars=Inputs.GetProperty("ObjId"); var sSpeContextId:chars=Inputs.GetProperty("SPE Context Id"); var sSpeUseCase:chars=Inputs.GetProperty("SPE Use Case"); var oPsSpeInp:PropertySet=oApp.NewPropertySet(); var oPsSpeOut:PropertySet=oApp.NewPropertySet(); var sWfName:chars=Inputs.GetProperty("Workflow Process Name"); var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var iChild:float; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars; try { // first load proper inputs for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "SPE Sessions": oPsSessions=Inputs.GetChild(iChild); break; case "AEC Actions Row Set": oPsActions=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; } } // start building inputs for SPE Service with(oPsSpeInp) { SetProperty("ContextId",sSpeContextId); SetProperty("UseCase",sSpeUseCase); // now common arguments for all threads oPsContext.SetType("Req_Context"); AddChild(oPsContext); oPsActions.SetType("Req_Row Set"); AddChild(oPsActions); oPsRowSet.SetType("Req_Full Row Set"); AddChild(oPsRowSet); } // now configure each request Individually iChildCount=oPsSessions.GetChildCount(); for(iChild=1;iChild<=iChildCount;iChild++) { sReqTmpl="Req"+iChild; oPsSpeInp.SetProperty(sReqTmpl+"_SessionId",oPsSessions.GetChild(iChild-1).GetProperty("SessionId")); oPsSpeInp.SetProperty(sReqTmpl+"_RootId",oPsSessions.GetChild(iChild-1).GetProperty("RootId")); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcName","Workflow Process Manager"); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcMethod","RunProcess"); oPsSpeInp.SetProperty(sReqTmpl+"_ProcessName",sWfName); oPsSpeInp.SetProperty("Req_ObjId",sObjId); } // execute SPE Request oSpeService.InvokeMethod("ExecuteStatefulRequest",oPsSpeInp,oPsSpeOut); oPsSpeOut.SetType("SPE Response"); Outputs.AddChild(oPsSpeOut); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outputs.SetProperty("Error Message", e.toString()); Outputs.SetProperty("Error Flag","Y"); } finally { oPsSpeInp=null; oPsSpeOut=null; oPsSessions=null; oPsActions=null; oPsContext=null; oPsRowSet=null; oSpeService=null; oApp=null; } }

AEC SPE Wrapper SCM
ApplyVarMap
function ApplyVarMap(Inputs,Outputs) { /* Inputs : Row Set ... orig, flatenized row Set Varmap Def ... Hierarchy variable Map definition Output Type ... Output type definition Context Sequence ... Quote,Any (No Spaces) Outputs : Var Map Expr ... string containg translated variable map to expression {Output Row Set} += New('Line Item', [Varible Name]={Row.Source Property}, [Variable Name]=GetProfileAttr('Prof Attr Name'), [Variable Name]=SystemPreference('')) for each row Contexts will be processed depending on sequence in inputs */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sOutType:chars=Inputs.GetProperty("Output Type"); var sContextSeq:chars=Inputs.GetProperty("Context Sequence"); var sExplicitMapping:chars = Inputs.GetProperty("Explicit Mapping"); var sOutput:chars="{Output Row Set} += New('"; var oPsRowSet:PropertySet; var oPsVarMap:PropertySet; var oPsMapped:PropertySet=oApp.NewPropertySet(); var oPsMap:PropertySet; var iChild:float; var iChildCount:float; var iContext:float; var arMapping:Array; var arContexts:Array; try { iChildCount=Inputs.GetChildCount(); for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; case "Varmap Def": oPsVarMap=Inputs.GetChild(iChild); break; } } arContexts=sContextSeq.split(","); if(sExplicitMapping!=null&&sExplicitMapping!="" ) { sOutput=sOutput+"," + sExplicitMapping; } for(iContext=0;iContext<arContexts.length;iContext++) { iChildCount=oPsVarMap.GetChildCount(); for(iChild=0;iChild<iChildCount;iChild++) { oPsMap=oPsVarMap.GetChild(iChild); if(oPsMap.GetProperty("Mode")==arContexts[iContext]) { // check if property was mapped if(!oPsMapped.PropertyExists(oPsMap.GetProperty("Var Name"))) { switch(oPsMap.GetProperty("Source Type")) { case "Instance": // instance field is last element after splitting with / arMapping=oPsMap.GetProperty("Path").split("/"); sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]={Row."+ arMapping[arMapping.length-1] + "}"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; case "Profile Attribute": sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]=GetProfileAttr('"+ oPsMap.GetProperty("Path") + "')"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; case "System Preference": sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]=SystemPreference('"+ oPsMap.GetProperty("Path") + "')"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; } // switch } // if } // if } // for varmap contetnt } // for contexts sOutput= sOutput + " )"; Outputs.SetProperty("PSP Expression", sOutput); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outputs.SetProperty("Error Flag","Y"); } finally { oPsMapped=null; arMapping=null; arContexts=null; oPsMap=null; oPsRowSet=null; oPsVarMap=null; oApp=null; } }

AEC SPE Wrapper SCM
ApplyVarMap
function ApplyVarMap(Inputs,Outputs) { /* Inputs : Row Set ... orig, flatenized row Set Varmap Def ... Hierarchy variable Map definition Output Type ... Output type definition Context Sequence ... Quote,Any (No Spaces) Outputs : Var Map Expr ... string containg translated variable map to expression {Output Row Set} += New('Line Item', [Varible Name]={Row.Source Property}, [Variable Name]=GetProfileAttr('Prof Attr Name'), [Variable Name]=SystemPreference('')) for each row Contexts will be processed depending on sequence in inputs */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sOutType:chars=Inputs.GetProperty("Output Type"); var sContextSeq:chars=Inputs.GetProperty("Context Sequence"); var sExplicitMapping:chars = Inputs.GetProperty("Explicit Mapping"); var sOutput:chars="{Output Row Set} += New('"; var oPsRowSet:PropertySet; var oPsVarMap:PropertySet; var oPsMapped:PropertySet=oApp.NewPropertySet(); var oPsMap:PropertySet; var iChild:float; var iChildCount:float; var iContext:float; var arMapping:Array; var arContexts:Array; try { iChildCount=Inputs.GetChildCount(); for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; case "Varmap Def": oPsVarMap=Inputs.GetChild(iChild); break; } } arContexts=sContextSeq.split(","); if(sExplicitMapping!=null&&sExplicitMapping!="" ) { sOutput=sOutput+"," + sExplicitMapping; } for(iContext=0;iContext<arContexts.length;iContext++) { iChildCount=oPsVarMap.GetChildCount(); for(iChild=0;iChild<iChildCount;iChild++) { oPsMap=oPsVarMap.GetChild(iChild); if(oPsMap.GetProperty("Mode")==arContexts[iContext]) { // check if property was mapped if(!oPsMapped.PropertyExists(oPsMap.GetProperty("Var Name"))) { switch(oPsMap.GetProperty("Source Type")) { case "Instance": // instance field is last element after splitting with / arMapping=oPsMap.GetProperty("Path").split("/"); sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]={Row."+ arMapping[arMapping.length-1] + "}"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; case "Profile Attribute": sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]=GetProfileAttr('"+ oPsMap.GetProperty("Path") + "')"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; case "System Preference": sOutput=sOutput+", ["+ oPsMap.GetProperty("Var Name") + "]=SystemPreference('"+ oPsMap.GetProperty("Path") + "')"; oPsMapped.SetProperty(oPsMap.GetProperty("Var Name"),"Y"); break; } // switch } // if } // if } // for varmap contetnt } // for contexts sOutput= sOutput + " )"; Outputs.SetProperty("PSP Expression", sOutput); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outputs.SetProperty("Error Flag","Y"); } finally { oPsMapped=null; arMapping=null; arContexts=null; oPsMap=null; oPsRowSet=null; oPsVarMap=null; oApp=null; } }

AEC SPE Wrapper SCM
CopyInp
function CopyInp(Inputs:PropertySet, Output:PropertySet, sOrigPrefix:chars, sNewPrefix:chars) { /* function will copy input properties from Input to Output PS and will rename them from sOrigPrefix to sNewPrefix Same will be done with child property sets Example : Input Property Scoring_Foo will be renamed to Req1_Foo 2015-09-25 TAABIVA1 Added loop for cycling by propertz set list */ var sPropName:chars=""; var iTargCount:float=0; var iPropInd:float=0; var sPropElem:Array; var psTmp:PropertySet; var arPaList:Array; var i:float=0; sPropName=Inputs.GetFirstProperty(); iTargCount=Inputs.GetPropertyCount(); for(iPropInd=0;iPropInd<iTargCount;iPropInd++) { sPropElem=sPropName.split("_"); if(sPropElem[0]==sOrigPrefix) { sPropElem[0]=sNewPrefix; Output.SetProperty(sPropElem.join("_") ,Inputs.GetProperty(sPropName)); } sPropName=Inputs.GetNextProperty(); } iTargCount=Inputs.GetChildCount(); for(iPropInd=0;iPropInd<iTargCount;iPropInd++) { sPropName=Inputs.GetChild(iPropInd).GetType(); sPropElem=sPropName.split("_"); if(sPropElem[0]==sOrigPrefix) { sPropElem[0]=sNewPrefix; psTmp=Inputs.GetChild(iPropInd).Copy(); psTmp.SetType(sPropElem.join("_")); Output.AddChild(psTmp); } } // now copy profile attributes to each request if((Inputs.GetProperty("PA")!="") && (Inputs.GetProperty("PA")!=null) && (sOrigPrefix!="Common")) { // profile attrs are spefied on input arPaList=Inputs.GetProperty("PA").split(","); for(i=0;i<arPaList.length;i++) { Output.SetProperty(sNewPrefix + "_PA_" + arPaList[i], oApp.GetProfileAttr(arPaList[i])); } } arPaList=null; sPropElem=null; psTmp=null; }

AEC SPE Wrapper SCM
CopyInp
function CopyInp(Inputs:PropertySet, Output:PropertySet, sOrigPrefix:chars, sNewPrefix:chars) { /* function will copy input properties from Input to Output PS and will rename them from sOrigPrefix to sNewPrefix Same will be done with child property sets Example : Input Property Scoring_Foo will be renamed to Req1_Foo 2015-09-25 TAABIVA1 Added loop for cycling by propertz set list */ var sPropName:chars=""; var iTargCount:float=0; var iPropInd:float=0; var sPropElem:Array; var psTmp:PropertySet; var arPaList:Array; var i:float=0; sPropName=Inputs.GetFirstProperty(); iTargCount=Inputs.GetPropertyCount(); for(iPropInd=0;iPropInd<iTargCount;iPropInd++) { sPropElem=sPropName.split("_"); if(sPropElem[0]==sOrigPrefix) { sPropElem[0]=sNewPrefix; Output.SetProperty(sPropElem.join("_") ,Inputs.GetProperty(sPropName)); } sPropName=Inputs.GetNextProperty(); } iTargCount=Inputs.GetChildCount(); for(iPropInd=0;iPropInd<iTargCount;iPropInd++) { sPropName=Inputs.GetChild(iPropInd).GetType(); sPropElem=sPropName.split("_"); if(sPropElem[0]==sOrigPrefix) { sPropElem[0]=sNewPrefix; psTmp=Inputs.GetChild(iPropInd).Copy(); psTmp.SetType(sPropElem.join("_")); Output.AddChild(psTmp); } } // now copy profile attributes to each request if((Inputs.GetProperty("PA")!="") && (Inputs.GetProperty("PA")!=null) && (sOrigPrefix!="Common")) { // profile attrs are spefied on input arPaList=Inputs.GetProperty("PA").split(","); for(i=0;i<arPaList.length;i++) { Output.SetProperty(sNewPrefix + "_PA_" + arPaList[i], oApp.GetProfileAttr(arPaList[i])); } } arPaList=null; sPropElem=null; psTmp=null; }

AEC SPE Wrapper SCM
CreateNewRoots
function CreateNewRoots(Inputs,Outputs) { /* function will generate new SPE Session for each root to be created and then call workflow, which will create new root item. Inputs: Row Set .... contains product IDs to be created Context .... processing context, will be sent to child workflow ObjId .... quote header identifier to be used SPE Use Case ... Use Case for SPE Caller Service SPE Context Id ... Context Id for SPE Caller logs Workflow Process Name ... name of Workflow to be exexuted for root creation ... process must return RootId property for newly created root item Outputs: SPE Sessions ... row set containing newly created sessions with SessionId and RootId to be merged with existing sessions for whole process */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeUseCase:chars = Inputs.GetProperty("SPE Use Case"); var sSpeContextId:chars = Inputs.GetProperty("SPE Context Id"); var sObjId:chars = Inputs.GetProperty("ObjId"); var sWfName:chars = Inputs.GetProperty("Workflow Process Name"); var oPsRowSet:PropertySet; var oPsContext:PropertySet; var oPsSpeInp:PropertySet=oApp.NewPropertySet(); var oPsSpeOut:PropertySet=oApp.NewPropertySet(); var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var oPsQteHeader:PropertySet; var oPsFullRs:PropertySet; var iChild:float; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars; var oPsSession:PropertySet; var oPsSessions:PropertySet; var oPsRowSetParam:PropertySet; var oPsContextParam:PropertySet; try { for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Quote Header": oPsQteHeader=Inputs.GetChild(iChild); break; case "Full Row Set": oPsFullRs=Inputs.GetChild(iChild); } } // we will request new SPE Session for each Row iChildCount=oPsRowSet.GetChildCount(); oPsSpeInp.SetProperty("UseCase",sSpeUseCase); oPsSpeInp.SetProperty("NumberOfSessions",iChildCount); oPsSpeInp.SetProperty("ContextId",sSpeContextId); oSpeService.InvokeMethod("GetStatefulSessions",oPsSpeInp,oPsSpeOut); // now attach each session to Row Set for(iChild=1;iChild<=iChildCount;iChild++) { oPsRowSet.GetChild(iChild-1).SetProperty("SessionId",oPsSpeOut.GetProperty("SessionId"+iChild)); } // now prepare main call for SPE Session to launch target Workflow oPsSpeInp.Reset(); oPsSpeOut.Reset(); // generic SPE Call Setup oPsSpeInp.SetProperty("UseCase",sSpeUseCase); oPsSpeInp.SetProperty("NumberOfSessions",iChildCount); oPsSpeInp.SetProperty("ContextId",sSpeContextId); oPsSpeInp.SetProperty("Req_ObjId",sObjId); // and now prepare context shared argument oPsContextParam=oPsContext.Copy(); oPsContextParam.SetType("Req_Context"); oPsSpeInp.AddChild(oPsContextParam); oPsQteHeader.SetType("Req_Quote Header"); oPsSpeInp.AddChild(oPsQteHeader); oPsFullRs.SetType("Req_Full Row Set"); oPsSpeInp.AddChild(oPsFullRs); // and request details for(iChild=0;iChild<iChildCount;iChild++) { sReqTmpl="Req" + ToString(iChild+1); oPsSpeInp.SetProperty(sReqTmpl+"_SessionId", oPsRowSet.GetChild(iChild).GetProperty("SessionId")); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcName","Workflow Process Manager"); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcMethod","RunProcess"); oPsSpeInp.SetProperty(sReqTmpl+"_ProcessName",sWfName); // and now Structures oPsRowSetParam=oApp.NewPropertySet(); oPsRowSetParam.SetType(sReqTmpl+"_Row Set"); oPsRowSetParam.AddChild(oPsRowSet.GetChild(iChild)); oPsSpeInp.AddChild(oPsRowSetParam); } // physical call to SPE // copy of Input is passed because SPE Service modifies property Set provided by reference oSpeService.InvokeMethod("ExecuteStatefulRequest",oPsSpeInp,oPsSpeOu

AEC SPE Wrapper SCM
CreateNewRoots
function CreateNewRoots(Inputs,Outputs) { /* function will generate new SPE Session for each root to be created and then call workflow, which will create new root item. Inputs: Row Set .... contains product IDs to be created Context .... processing context, will be sent to child workflow ObjId .... quote header identifier to be used SPE Use Case ... Use Case for SPE Caller Service SPE Context Id ... Context Id for SPE Caller logs Workflow Process Name ... name of Workflow to be exexuted for root creation ... process must return RootId property for newly created root item Outputs: SPE Sessions ... row set containing newly created sessions with SessionId and RootId to be merged with existing sessions for whole process */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeUseCase:chars = Inputs.GetProperty("SPE Use Case"); var sSpeContextId:chars = Inputs.GetProperty("SPE Context Id"); var sObjId:chars = Inputs.GetProperty("ObjId"); var sWfName:chars = Inputs.GetProperty("Workflow Process Name"); var oPsRowSet:PropertySet; var oPsContext:PropertySet; var oPsSpeInp:PropertySet=oApp.NewPropertySet(); var oPsSpeOut:PropertySet=oApp.NewPropertySet(); var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var oPsQteHeader:PropertySet; var oPsFullRs:PropertySet; var iChild:float; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars; var oPsSession:PropertySet; var oPsSessions:PropertySet; var oPsRowSetParam:PropertySet; var oPsContextParam:PropertySet; try { for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Quote Header": oPsQteHeader=Inputs.GetChild(iChild); break; case "Full Row Set": oPsFullRs=Inputs.GetChild(iChild); } } // we will request new SPE Session for each Row iChildCount=oPsRowSet.GetChildCount(); oPsSpeInp.SetProperty("UseCase",sSpeUseCase); oPsSpeInp.SetProperty("NumberOfSessions",iChildCount); oPsSpeInp.SetProperty("ContextId",sSpeContextId); oSpeService.InvokeMethod("GetStatefulSessions",oPsSpeInp,oPsSpeOut); // now attach each session to Row Set for(iChild=1;iChild<=iChildCount;iChild++) { oPsRowSet.GetChild(iChild-1).SetProperty("SessionId",oPsSpeOut.GetProperty("SessionId"+iChild)); } // now prepare main call for SPE Session to launch target Workflow oPsSpeInp.Reset(); oPsSpeOut.Reset(); // generic SPE Call Setup oPsSpeInp.SetProperty("UseCase",sSpeUseCase); oPsSpeInp.SetProperty("NumberOfSessions",iChildCount); oPsSpeInp.SetProperty("ContextId",sSpeContextId); oPsSpeInp.SetProperty("Req_ObjId",sObjId); // and now prepare context shared argument oPsContextParam=oPsContext.Copy(); oPsContextParam.SetType("Req_Context"); oPsSpeInp.AddChild(oPsContextParam); oPsQteHeader.SetType("Req_Quote Header"); oPsSpeInp.AddChild(oPsQteHeader); oPsFullRs.SetType("Req_Full Row Set"); oPsSpeInp.AddChild(oPsFullRs); // and request details for(iChild=0;iChild<iChildCount;iChild++) { sReqTmpl="Req" + ToString(iChild+1); oPsSpeInp.SetProperty(sReqTmpl+"_SessionId", oPsRowSet.GetChild(iChild).GetProperty("SessionId")); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcName","Workflow Process Manager"); oPsSpeInp.SetProperty(sReqTmpl+"_BusSvcMethod","RunProcess"); oPsSpeInp.SetProperty(sReqTmpl+"_ProcessName",sWfName); // and now Structures oPsRowSetParam=oApp.NewPropertySet(); oPsRowSetParam.SetType(sReqTmpl+"_Row Set"); oPsRowSetParam.AddChild(oPsRowSet.GetChild(iChild)); oPsSpeInp.AddChild(oPsRowSetParam); } // physical call to SPE // copy of Input is passed because SPE Service modifies property Set provided by reference oSpeService.InvokeMethod("ExecuteStatefulRequest",oPsSpeInp,oPsSpeOu

AEC SPE Wrapper SCM
GetSessions
function GetSessions(Inputs,Outputs) { /* function for calling statefull sessions on SPE and which will apply delta between eCfg Session between Current Asset and eCfg State asset Inputs: SPE Use Case ... name of SPE Use case to be called SPE Context Id .... context id ( quote ID or any different uniq context id ObjId ... shared argument to address eCfg sessions Root Sessions .... hierarchy (Row Set ) containing list of Session Handles, Callback URL and RootId to Address session Current Assets ... property set containing child SIS OM Messages in state before each eCfg session Workflow Process Name ... name of workflow process name to be called before Init Sessions .... debugging argument, Y means that Root Sessions will be populated with data instead of inputed Asset Id Root Field .... Property name on header level to be used for geting proper RootId for eCfg Session mapping DestroySessions .... optional for debugging purposes to be able destroy all SPE Sessions */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeUseCase:chars = Inputs.GetProperty("SPE Use Case"); var sSpeContextId:chars = Inputs.GetProperty("SPE Context Id"); var sObjId:chars = Inputs.GetProperty("ObjId"); var sWfName:chars = Inputs.GetProperty("Workflow Process Name"); var sInitSessions:chars = Inputs.GetProperty("Init Sessions"); var sRootIdProp:chars = Inputs.GetProperty("Asset Id Root Field"); var sDestroySess:chars = Inputs.GetProperty("DestroySessions"); var oSessions:PropertySet; var oCurrAssets:PropertySet; var oSpeInp:PropertySet=oApp.NewPropertySet(); var oSpeOut:PropertySet=oApp.NewPropertySet(); var oPsActions:PropertySet=null; var oPsContext:PropertySet=null; var oPsRowSet:PropertySet=null; var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var oSession:PropertySet; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars=""; var iChild; var iAssCount:float=0; var iAss:float; var bFound:bool=false; var sChar1:chars; var sChar2:chars; // first load proper inputs try { for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Root Sessions": oSessions=Inputs.GetChild(iChild); break; case "Current Assets": oCurrAssets=Inputs.GetChild(iChild); iAssCount=oCurrAssets.GetChildCount(); break; case "AEC Actions Row Set": oPsActions=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; } } if(oSessions==null) { oSessions=oApp.NewPropertySet(); } iChildCount=oSessions.GetChildCount(); // first we have to handle opening of SPE Sessions, if they are missing if(iChildCount==0) { // get set of provided assets iChildCount=oCurrAssets.GetChildCount(); // oSpeInp=oApp.NewPropertySet(); // oSpeOut=oApp.NewPropertySet(); // set SPE Broker Request oSpeInp.SetProperty("ContextId",sSpeContextId); oSpeInp.SetProperty("UseCase",sSpeUseCase); oSpeInp.SetProperty("NumberOfSessions",iChildCount); oSpeService.InvokeMethod("GetStatefulSessions",oSpeInp,oSpeOut); for(iChild=1;iChild<=iChildCount;iChild++) { // build own row set with root-session mapping oSession=oApp.NewPropertySet(); // oSession.SetProperty("CallbackURL",oSpeOut.GetProperty("CallbackURL")); oSession.SetProperty("SessionId",oSpeOut.GetProperty("SessionId"+iChild)); oSession.SetProperty("RootId",oCurrAssets.GetChild(iChild-1).GetProperty(sRootIdProp)); oSession.SetType("SPE Session"); oSessions.AddChild(oSession); } oSpeInp.Reset(); oSpeOut.Reset(); } // we assume, that all sessions are prepared .... we can call WF in paralel with each session with(oSpeInp) { SetProperty("ContextId",sSpeContextId); SetProperty("UseCase",sSpeUseCase); if(oPsContext!=null) { oPsContext.SetTyp

AEC SPE Wrapper SCM
GetSessions
function GetSessions(Inputs,Outputs) { /* function for calling statefull sessions on SPE and which will apply delta between eCfg Session between Current Asset and eCfg State asset Inputs: SPE Use Case ... name of SPE Use case to be called SPE Context Id .... context id ( quote ID or any different uniq context id ObjId ... shared argument to address eCfg sessions Root Sessions .... hierarchy (Row Set ) containing list of Session Handles, Callback URL and RootId to Address session Current Assets ... property set containing child SIS OM Messages in state before each eCfg session Workflow Process Name ... name of workflow process name to be called before Init Sessions .... debugging argument, Y means that Root Sessions will be populated with data instead of inputed Asset Id Root Field .... Property name on header level to be used for geting proper RootId for eCfg Session mapping DestroySessions .... optional for debugging purposes to be able destroy all SPE Sessions */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeUseCase:chars = Inputs.GetProperty("SPE Use Case"); var sSpeContextId:chars = Inputs.GetProperty("SPE Context Id"); var sObjId:chars = Inputs.GetProperty("ObjId"); var sWfName:chars = Inputs.GetProperty("Workflow Process Name"); var sInitSessions:chars = Inputs.GetProperty("Init Sessions"); var sRootIdProp:chars = Inputs.GetProperty("Asset Id Root Field"); var sDestroySess:chars = Inputs.GetProperty("DestroySessions"); var oSessions:PropertySet; var oCurrAssets:PropertySet; var oSpeInp:PropertySet=oApp.NewPropertySet(); var oSpeOut:PropertySet=oApp.NewPropertySet(); var oPsActions:PropertySet=null; var oPsContext:PropertySet=null; var oPsRowSet:PropertySet=null; var oSpeService:Service=oApp.GetService("EAI SPE Caller SCM"); var oSession:PropertySet; var iChildCount:float=Inputs.GetChildCount(); var sReqTmpl:chars=""; var iChild; var iAssCount:float=0; var iAss:float; var bFound:bool=false; var sChar1:chars; var sChar2:chars; // first load proper inputs try { for(iChild=0;iChild<iChildCount;iChild++) { switch(Inputs.GetChild(iChild).GetType()) { case "Root Sessions": oSessions=Inputs.GetChild(iChild); break; case "Current Assets": oCurrAssets=Inputs.GetChild(iChild); iAssCount=oCurrAssets.GetChildCount(); break; case "AEC Actions Row Set": oPsActions=Inputs.GetChild(iChild); break; case "Context": oPsContext=Inputs.GetChild(iChild); break; case "Row Set": oPsRowSet=Inputs.GetChild(iChild); break; } } if(oSessions==null) { oSessions=oApp.NewPropertySet(); } iChildCount=oSessions.GetChildCount(); // first we have to handle opening of SPE Sessions, if they are missing if(iChildCount==0) { // get set of provided assets iChildCount=oCurrAssets.GetChildCount(); // oSpeInp=oApp.NewPropertySet(); // oSpeOut=oApp.NewPropertySet(); // set SPE Broker Request oSpeInp.SetProperty("ContextId",sSpeContextId); oSpeInp.SetProperty("UseCase",sSpeUseCase); oSpeInp.SetProperty("NumberOfSessions",iChildCount); oSpeService.InvokeMethod("GetStatefulSessions",oSpeInp,oSpeOut); for(iChild=1;iChild<=iChildCount;iChild++) { // build own row set with root-session mapping oSession=oApp.NewPropertySet(); // oSession.SetProperty("CallbackURL",oSpeOut.GetProperty("CallbackURL")); oSession.SetProperty("SessionId",oSpeOut.GetProperty("SessionId"+iChild)); oSession.SetProperty("RootId",oCurrAssets.GetChild(iChild-1).GetProperty(sRootIdProp)); oSession.SetType("SPE Session"); oSessions.AddChild(oSession); } oSpeInp.Reset(); oSpeOut.Reset(); } // we assume, that all sessions are prepared .... we can call WF in paralel with each session with(oSpeInp) { SetProperty("ContextId",sSpeContextId); SetProperty("UseCase",sSpeUseCase); if(oPsContext!=null) { oPsContext.SetTyp

AEC SPE Wrapper SCM
RemoveChildLi
function RemoveChildLi(Inputs,Outputs) { /* Just Root item will remain in SIS OM Message */ var oPsInp=Inputs.GetChild(0).Copy(); // ListOfSIS OM.Header var iChildCount:float=0; var iChild:float; iChildCount=oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChildCount(); for(iChild=iChildCount-1;iChild>=0;iChild--) { oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChild(0).RemoveChild(iChild); } Outputs.AddChild(oPsInp); oPsInp=null; }

AEC SPE Wrapper SCM
RemoveChildLi
function RemoveChildLi(Inputs,Outputs) { /* Just Root item will remain in SIS OM Message */ var oPsInp=Inputs.GetChild(0).Copy(); // ListOfSIS OM.Header var iChildCount:float=0; var iChild:float; iChildCount=oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChildCount(); for(iChild=iChildCount-1;iChild>=0;iChild--) { oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChild(0).RemoveChild(iChild); } Outputs.AddChild(oPsInp); oPsInp=null; }

AEC SPE Wrapper SCM
RemoveLineItems
function RemoveLineItems(Inputs,Outputs) { /* function will remove ListOf Line Item and Child Elements from Input Siebel Message */ var oPsInp=Inputs.GetChild(0).Copy(); var iChild:float=0; var iChildCount:float=oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChildCount(); // ListOfSIS OM.Header for(iChild=iChildCount-1;iChild>=0;iChild--) { oPsInp.GetChild(0).GetChild(0).GetChild(0).RemoveChild(iChild); } Outputs.AddChild(oPsInp); oPsInp=null; }

AEC SPE Wrapper SCM
RemoveLineItems
function RemoveLineItems(Inputs,Outputs) { /* function will remove ListOf Line Item and Child Elements from Input Siebel Message */ var oPsInp=Inputs.GetChild(0).Copy(); var iChild:float=0; var iChildCount:float=oPsInp.GetChild(0).GetChild(0).GetChild(0).GetChildCount(); // ListOfSIS OM.Header for(iChild=iChildCount-1;iChild>=0;iChild--) { oPsInp.GetChild(0).GetChild(0).GetChild(0).RemoveChild(iChild); } Outputs.AddChild(oPsInp); oPsInp=null; }

AEC SPE Wrapper SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch(MethodName) { case "SPE Request": SpeRequest(Inputs, Outputs); break; case "Get SPE Output": SpeOutputs(Inputs, Outputs); break; case "Get Instances": GetSessions(Inputs,Outputs); break; case "Apply Var Map": ApplyVarMap(Inputs,Outputs); break; case "Apply eCfg Actions": ApplyCfgActions(Inputs,Outputs); break; case "Remove Line Items": RemoveLineItems(Inputs,Outputs); break; case "Create New Roots": CreateNewRoots(Inputs,Outputs); break; case "Remove Child Li": RemoveChildLi(Inputs,Outputs); break; } return (CancelOperation); }

AEC SPE Wrapper SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch(MethodName) { case "SPE Request": SpeRequest(Inputs, Outputs); break; case "Get SPE Output": SpeOutputs(Inputs, Outputs); break; case "Get Instances": GetSessions(Inputs,Outputs); break; case "Apply Var Map": ApplyVarMap(Inputs,Outputs); break; case "Apply eCfg Actions": ApplyCfgActions(Inputs,Outputs); break; case "Remove Line Items": RemoveLineItems(Inputs,Outputs); break; case "Create New Roots": CreateNewRoots(Inputs,Outputs); break; case "Remove Child Li": RemoveChildLi(Inputs,Outputs); break; } return (CancelOperation); }

AEC SPE Wrapper SCM
SpeOutputs
function SpeOutputs(Inputs, Outputs) { /* function to get specific SPE Outputs from merged SPE Response Inputs: SPE Response ..... child hierarchy with overall SPE Response Request Num ..... request num to be processed processed Hierarchy List .. list of child property sets, comma delimited without spaces Property List .... list of properties from this requesty to be returned, comma delimited, without spaces eg. for Request num 2 and Hierarchy List=Row Set, Context will be returend outputs Req2_Row Set and Req2_Context Outputs: Hierachies and Properties based on provided inputs */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var psSpeResponse:PropertySet; var arChildList:Array; var arTargetNames:Array; var sPropList:chars=Inputs.GetProperty("Property List"); var sHierList:chars=Inputs.GetProperty("Hierarchy List"); var iReqNum:float=Inputs.GetProperty("Request Num"); var iCounter:float=0; var iChild:float=0; var iChildCount:float=0; var sPrefix:chars="Req"+iReqNum+"_"; var psTmp:PropertySet; try { // first to take properties if(Inputs.GetChildCount()>0) { psSpeResponse=Inputs.GetChild(0); if(sPropList!=null&&sPropList!="") { arChildList=sPropList.split(","); // arTargetNames=sPropList.split(","); for(iCounter=0;iCounter<arChildList.length;iCounter++) { Outputs.SetProperty(arChildList[iCounter],psSpeResponse.GetProperty(sPrefix+arChildList[iCounter])); } // for child propsets will be more complex, no direct name access is done } arChildList=sHierList.split(","); arTargetNames=sHierList.split(","); // build expected type names for(iCounter=0;iCounter<arChildList.length;iCounter++) { arChildList[iCounter]=sPrefix+arChildList[iCounter]; } iChildCount=psSpeResponse.GetChildCount(); for(iCounter=0;iCounter<iChildCount;iCounter++) { for(iChild=0;iChild<arChildList.length;iChild++) { if(psSpeResponse.GetChild(iCounter).GetType()==arChildList[iChild]) { // found match between child type and array psTmp=psSpeResponse.GetChild(iCounter); psTmp.SetType(arTargetNames[iChild]); Outputs.AddChild(psTmp); // clear target name to know, that has been found in response arTargetNames[iChild]=""; // stop array loop break; } } } // now we have to create new empty childs, which has not been found in reponse for(iCounter=0;iCounter<arTargetNames.length;iCounter++) { if(arTargetNames[iCounter].length>0) { psTmp=oApp.NewPropertySet(); psTmp.SetType(arTargetNames[iCounter]); Outputs.AddChild(psTmp); } } } else { // missing input hierarchy, just build empty outputs to // not kill workflow arTargetNames=sHierList.split(","); for(iCounter=0;iCounter<arTargetNames.length;iCounter++) { psTmp=oApp.NewPropertySet(); psTmp.SetType(arTargetNames[iCounter]); Outputs.AddChild(psTmp); } } } catch(e) { if(bIsTraceOn) { oApp.Trace("BusinessService->Method Error: " + e.toString()); } } finally { psTmp=null; psSpeResponse=null; arChildList=null; arTargetNames=null; } }

AEC SPE Wrapper SCM
SpeOutputs
function SpeOutputs(Inputs, Outputs) { /* function to get specific SPE Outputs from merged SPE Response Inputs: SPE Response ..... child hierarchy with overall SPE Response Request Num ..... request num to be processed processed Hierarchy List .. list of child property sets, comma delimited without spaces Property List .... list of properties from this requesty to be returned, comma delimited, without spaces eg. for Request num 2 and Hierarchy List=Row Set, Context will be returend outputs Req2_Row Set and Req2_Context Outputs: Hierachies and Properties based on provided inputs */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var psSpeResponse:PropertySet; var arChildList:Array; var arTargetNames:Array; var sPropList:chars=Inputs.GetProperty("Property List"); var sHierList:chars=Inputs.GetProperty("Hierarchy List"); var iReqNum:float=Inputs.GetProperty("Request Num"); var iCounter:float=0; var iChild:float=0; var iChildCount:float=0; var sPrefix:chars="Req"+iReqNum+"_"; var psTmp:PropertySet; try { // first to take properties if(Inputs.GetChildCount()>0) { psSpeResponse=Inputs.GetChild(0); if(sPropList!=null&&sPropList!="") { arChildList=sPropList.split(","); // arTargetNames=sPropList.split(","); for(iCounter=0;iCounter<arChildList.length;iCounter++) { Outputs.SetProperty(arChildList[iCounter],psSpeResponse.GetProperty(sPrefix+arChildList[iCounter])); } // for child propsets will be more complex, no direct name access is done } arChildList=sHierList.split(","); arTargetNames=sHierList.split(","); // build expected type names for(iCounter=0;iCounter<arChildList.length;iCounter++) { arChildList[iCounter]=sPrefix+arChildList[iCounter]; } iChildCount=psSpeResponse.GetChildCount(); for(iCounter=0;iCounter<iChildCount;iCounter++) { for(iChild=0;iChild<arChildList.length;iChild++) { if(psSpeResponse.GetChild(iCounter).GetType()==arChildList[iChild]) { // found match between child type and array psTmp=psSpeResponse.GetChild(iCounter); psTmp.SetType(arTargetNames[iChild]); Outputs.AddChild(psTmp); // clear target name to know, that has been found in response arTargetNames[iChild]=""; // stop array loop break; } } } // now we have to create new empty childs, which has not been found in reponse for(iCounter=0;iCounter<arTargetNames.length;iCounter++) { if(arTargetNames[iCounter].length>0) { psTmp=oApp.NewPropertySet(); psTmp.SetType(arTargetNames[iCounter]); Outputs.AddChild(psTmp); } } } else { // missing input hierarchy, just build empty outputs to // not kill workflow arTargetNames=sHierList.split(","); for(iCounter=0;iCounter<arTargetNames.length;iCounter++) { psTmp=oApp.NewPropertySet(); psTmp.SetType(arTargetNames[iCounter]); Outputs.AddChild(psTmp); } } } catch(e) { if(bIsTraceOn) { oApp.Trace("BusinessService->Method Error: " + e.toString()); } } finally { psTmp=null; psSpeResponse=null; arChildList=null; arTargetNames=null; } }

AEC SPE Wrapper SCM
SpeRequest
function SpeRequest(Inputs,Outputs) { /* function for encapsulation of SPE Call with amount defined amount of threads Inputs: SPE Service ... name of SPE Service to be called SPE U ContextId ... ContextId for SPE Service to find reques in their log Scoring Enabled .... Y/N .. enables one thread for scoring Maximum Threads .... number with maximum amount of EnC threads to be executed Scoring Workflow ... name of Scoring Workflow to be executed EnC Workflow ... EnC Workflow Name EnC Thread Prop ... EnC Thread Property name for Req_ .... properties or Child property Sets which should be same for all EnC and Scoring requests EnC_ .... properties or child propsets to be sent into EnC process Name Scoring_ .... properties or Childs to be passed into Scoring PA .... comma separated list of profile attributes, to be passed into each request */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeServiceName:chars=Inputs.GetProperty("SPE Service"); var sSpeUseCase:chars=Inputs.GetProperty("SPE UseCase"); var sContext:chars=Inputs.GetProperty("ContextId"); var sScoringEnabled=Inputs.GetProperty("Scoring Enabled"); var sOSIEnabled=Inputs.GetProperty("OSI Enabled"); var iMaxThreads:float=Inputs.GetProperty("Maximum Threads"); var sScoringWf:chars=Inputs.GetProperty("Scoring Workflow"); var sOSIWf:chars=Inputs.GetProperty("OSI Workflow"); var sEligWf:chars=Inputs.GetProperty("EnC Workflow"); var sThreadProp:chars=Inputs.GetProperty("EnC Thread Prop"); // SPE Inputs var psSpeInputs:PropertySet=oApp.NewPropertySet(); var psSpeOutputs:PropertySet=oApp.NewPropertySet(); var oSpeService:Service=oApp.GetService(sSpeServiceName); // working objects (counters, strings etc) var sPropName:chars=""; var sChildName:chars=""; var iPropInd:float = 0; var iTargCount:float = 0; var sPropElem:Array; var iThreadNum:float; var iReqOffset:float=0; var sReqPrefix:chars=""; try { Outputs.SetProperty("Error Flag","N"); // simple arguments for SPE Call with(psSpeInputs) { SetProperty("ContextId",sContext); SetProperty("UseCase",sSpeUseCase); } // now copy common arguments CopyInp(Inputs,psSpeInputs,"Common","Req"); // now build Scoring Request if(sScoringEnabled=="Y") { with(psSpeInputs) { SetProperty("Req1_BusSvcName","Workflow Process Manager"); SetProperty("Req1_BusSvcMethod","RunProcess"); SetProperty("Req1_ProcessName",sScoringWf); } CopyInp(Inputs, psSpeInputs, "Scoring", "Req1"); iReqOffset=1; } if(sOSIEnabled=="Y") { iPropInd=1+iReqOffset; sReqPrefix="Req"+iPropInd; with(psSpeInputs) { SetProperty(sReqPrefix+"_BusSvcName","Workflow Process Manager"); SetProperty(sReqPrefix+"_BusSvcMethod","RunProcess"); SetProperty(sReqPrefix+"_ProcessName",sOSIWf); } CopyInp(Inputs, psSpeInputs, "OSI", sReqPrefix); iReqOffset=iReqOffset+1; } // now build data for EnC requests for(iThreadNum=1;iThreadNum<=iMaxThreads;iThreadNum++) { iPropInd=iThreadNum+iReqOffset; sReqPrefix="Req"+iPropInd; with(psSpeInputs) { SetProperty(sReqPrefix+"_BusSvcName","Workflow Process Manager"); SetProperty(sReqPrefix+"_BusSvcMethod","RunProcess"); SetProperty(sReqPrefix+"_ProcessName",sEligWf); SetProperty(sReqPrefix+"_"+sThreadProp,iThreadNum); } CopyInp(Inputs,psSpeInputs,"EnC",sReqPrefix); } // request parameters build finished Outputs.AddChild(psSpeInputs.Copy()); Outputs.GetChild(0).SetType("RequestBefore"); oSpeService.InvokeMethod("ExecuteStatelessRequest",psSpeInputs,psSpeOutputs); // take outputs and pass them as child response of service psSpeOutputs.SetType("Response"); psSpeInputs.SetType("Request"); //just for debugging purposes Outputs.AddChild(psSpeOutputs); Outputs.AddChild(psSpeInputs); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outp

AEC SPE Wrapper SCM
SpeRequest
function SpeRequest(Inputs,Outputs) { /* function for encapsulation of SPE Call with amount defined amount of threads Inputs: SPE Service ... name of SPE Service to be called SPE U ContextId ... ContextId for SPE Service to find reques in their log Scoring Enabled .... Y/N .. enables one thread for scoring Maximum Threads .... number with maximum amount of EnC threads to be executed Scoring Workflow ... name of Scoring Workflow to be executed EnC Workflow ... EnC Workflow Name EnC Thread Prop ... EnC Thread Property name for Req_ .... properties or Child property Sets which should be same for all EnC and Scoring requests EnC_ .... properties or child propsets to be sent into EnC process Name Scoring_ .... properties or Childs to be passed into Scoring PA .... comma separated list of profile attributes, to be passed into each request */ oApp=TheApplication(); bIsTraceOn=oApp.isTraceON; var sSpeServiceName:chars=Inputs.GetProperty("SPE Service"); var sSpeUseCase:chars=Inputs.GetProperty("SPE UseCase"); var sContext:chars=Inputs.GetProperty("ContextId"); var sScoringEnabled=Inputs.GetProperty("Scoring Enabled"); var sOSIEnabled=Inputs.GetProperty("OSI Enabled"); var iMaxThreads:float=Inputs.GetProperty("Maximum Threads"); var sScoringWf:chars=Inputs.GetProperty("Scoring Workflow"); var sOSIWf:chars=Inputs.GetProperty("OSI Workflow"); var sEligWf:chars=Inputs.GetProperty("EnC Workflow"); var sThreadProp:chars=Inputs.GetProperty("EnC Thread Prop"); // SPE Inputs var psSpeInputs:PropertySet=oApp.NewPropertySet(); var psSpeOutputs:PropertySet=oApp.NewPropertySet(); var oSpeService:Service=oApp.GetService(sSpeServiceName); // working objects (counters, strings etc) var sPropName:chars=""; var sChildName:chars=""; var iPropInd:float = 0; var iTargCount:float = 0; var sPropElem:Array; var iThreadNum:float; var iReqOffset:float=0; var sReqPrefix:chars=""; try { Outputs.SetProperty("Error Flag","N"); // simple arguments for SPE Call with(psSpeInputs) { SetProperty("ContextId",sContext); SetProperty("UseCase",sSpeUseCase); } // now copy common arguments CopyInp(Inputs,psSpeInputs,"Common","Req"); // now build Scoring Request if(sScoringEnabled=="Y") { with(psSpeInputs) { SetProperty("Req1_BusSvcName","Workflow Process Manager"); SetProperty("Req1_BusSvcMethod","RunProcess"); SetProperty("Req1_ProcessName",sScoringWf); } CopyInp(Inputs, psSpeInputs, "Scoring", "Req1"); iReqOffset=1; } if(sOSIEnabled=="Y") { iPropInd=1+iReqOffset; sReqPrefix="Req"+iPropInd; with(psSpeInputs) { SetProperty(sReqPrefix+"_BusSvcName","Workflow Process Manager"); SetProperty(sReqPrefix+"_BusSvcMethod","RunProcess"); SetProperty(sReqPrefix+"_ProcessName",sOSIWf); } CopyInp(Inputs, psSpeInputs, "OSI", sReqPrefix); iReqOffset=iReqOffset+1; } // now build data for EnC requests for(iThreadNum=1;iThreadNum<=iMaxThreads;iThreadNum++) { iPropInd=iThreadNum+iReqOffset; sReqPrefix="Req"+iPropInd; with(psSpeInputs) { SetProperty(sReqPrefix+"_BusSvcName","Workflow Process Manager"); SetProperty(sReqPrefix+"_BusSvcMethod","RunProcess"); SetProperty(sReqPrefix+"_ProcessName",sEligWf); SetProperty(sReqPrefix+"_"+sThreadProp,iThreadNum); } CopyInp(Inputs,psSpeInputs,"EnC",sReqPrefix); } // request parameters build finished Outputs.AddChild(psSpeInputs.Copy()); Outputs.GetChild(0).SetType("RequestBefore"); oSpeService.InvokeMethod("ExecuteStatelessRequest",psSpeInputs,psSpeOutputs); // take outputs and pass them as child response of service psSpeOutputs.SetType("Response"); psSpeInputs.SetType("Request"); //just for debugging purposes Outputs.AddChild(psSpeOutputs); Outputs.AddChild(psSpeInputs); } catch(e) { if(bIsTraceOn) { oApp.Trace("AEC SPE Wrapper SCM->SPE Request Error: " + e.toString()); } Outp

AIP Access Info Service SCM
(declarations)
//Your public declarations go here... var bFirst = false; var oApp = TheApplication(); var curBO:BusObject = null; var bIsTraceOn:bool = true;

AIP Access Info Service SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) { /************************************************************************************************************** ** Name: Init ** Created: 24.11.2016 ** Created By: Binu Krishnan ** Description: Do the VBC Init ** *************************************************************************************************************** ** Modification: ** Modified By: ** Description: ***************************************************************************************************************/ try { if (bIsTraceOn) oApp.Trace(this.Name()+".Init() START"); with(Outputs) { SetProperty("Access Id SCM",""); SetProperty("Service Utilization SCM",""); SetProperty("Connection Type SCM",""); SetProperty("Temporary Access Id SCM",""); SetProperty("Temporary Service Utilization SCM",""); SetProperty("Temporary Connection Type SCM",""); SetProperty("Error Message SCM",""); } } catch(e) { throw(e); } finally { if (bIsTraceOn) oApp.Trace(this.Name()+".Init() END"); } }

AIP Access Info Service SCM
Query
function Query(Inputs: PropertySet, Outputs: PropertySet) { /************************************************************************************************************** ** Name: Query ** Created: 24.11.2016 ** Created By: Binu Krishnan ** Description: Do the VBC Query ** *************************************************************************************************************** ** Modification: Def:1830: Geographic address nodes is optional in response XML ** Modified By: TAARARA7 *************************************************************************************************************** ** Modification: Def:2024:07.02.17 CI3: OUT_995 is getting called for non LQS dependent bundles when we navigate to Access Info tab in "Asset Mgmt - Asset Bundle Detail View SCM" view. Bypass the webservice call if Access call is not required, check for value of field :[Requires Access Flag SCM] ** Modified By: TAARARA7 ** Modification: Def:3499,3501:16.02.17 CI3: Street data incorrectly dispalyed, data quality test issues ** Modified By: TAARARA7 ***************************************************************************************************************/ var psInputs: PropertySet; var psOutputs: PropertySet; var psIn: PropertySet; var psOut: PropertySet; var sErrorCode; var bsCallAccessWF; var sErrorMessage; var pschildPropset: PropertySet; var oPSOutputStruct: PropertySet; var sblueaditAccountNumber; var psPropset: PropertySet; var psListofPH: PropertySet; var sBlueaditAccountNumber = ""; var sContractId = ""; var sCustomerRowId = ""; var boAsset: BusObject; ; var bcAsset: BusComp; try { if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Start VBQ BS "); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Fetching contract Id"); sContractId = Inputs.GetChild(0).GetProperty("Parent Contract Id"); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Contract Id: " + sContractId); if (sContractId == "") { if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Exiting, Contract Id is null"); return; } boAsset = oApp.GetBusObject("Asset Management"); bcAsset = boAsset.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (bcAsset) { if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Querying asset id: " + sContractId); ClearToQuery(); SetSearchSpec("Id", sContractId); ActivateField("Auto Type"); ActivateField("Bundle Configuration Mobile SCM"); ActivateField("AIP User External Integration Id"); ActivateField("Requires Access Flag SCM"); ActivateField("Owner Account Id"); SetViewMode(3); ExecuteQuery(ForwardOnly); if (FirstRecord()) { //IIf([Asset Auto Type Calc SCM] = "Bundle" and [Asset Bundle Configuration Mobile Calc SCM] = "0", "Y", "N") var sAutType = GetFieldValue("Auto Type"); var sBundleConfig = GetFieldValue("Bundle Configuration Mobile SCM"); if (GetFieldValue("Requires Access Flag SCM") == "Y" && GetFieldValue("Auto Type") == "Bundle" && GetFieldValue("Bundle Configuration Mobile SCM") == "0") { /*Def:2024:07.02.17.TAARARA7 Bypass the webservice call if Access call is not required */ sBlueaditAccountNumber = GetFieldValue("AIP User External Integration Id"); sCustomerRowId = GetFieldValue("Owner Account Id"); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : BlueAdit number:" + sBlueaditAccountNumber); } else { if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Exiting, not Wireline bundle"); oPSOutputStruct = oApp.NewPropertySet(); oPSOutputStruct.SetProperty("Is Wireline Bundle Flag", "Y"); Outputs.AddChild(oPSOutputStruct); return; } } else { oPSOutputStruct = oApp.NewPropertySet(); oPSOutputStruct.SetProperty("Is Wireline Bundle Flag", "N"); Outputs.AddChild(oPSOutputStruct); return; } } psInputs = oApp.NewPropertySet(); ps

AIP Access Info Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod(MethodName, Inputs: PropertySet, Outputs: PropertySet) { /************************************************************************************************************** ** Name: Main ** Created: 24.11.2016 ** Created By: Binu Krishnan ** Description: Main method handler ** *************************************************************************************************************** ** Modification: ** Modified By: ** Description: ***************************************************************************************************************/ var iReturn; try { iReturn = CancelOperation; oApp = TheApplication(); switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; case "openUIInvoke": openUIInvoke(Inputs, Outputs); break; default: iReturn = ContinueOperation; break; } } catch (e) { throw (e); } finally { curBO = null; oApp = null; } return (iReturn); }

AIP Access Info Service SCM
openUIInvoke
function openUIInvoke(Inputs: PropertySet, Outputs: PropertySet) { /************************************************************************************************************** ** Name: Query ** Created: 24.11.2016 ** Created By: TAARARA7 ** Description: Do the VBC Query ** *************************************************************************************************************** ** Modification: Def:1830: Geographic address nodes is optional in response XML ** Modified By: TAARARA7 ** Modification: Def:3499,3501:16.02.17 CI3: Street data incorrectly dispalyed, data quality test issues ** Modified By: TAARARA7 ***************************************************************************************************************/ var psInputs: PropertySet; var psOutputs: PropertySet; var psIn: PropertySet; var psOut: PropertySet; var sErrorCode; var bsCallAccessWF; var sErrorMessage; var pschildPropset: PropertySet; var psAccessSource: PropertySet; var psPropset: PropertySet; var psListofPH: PropertySet; var sBlueaditAccountNumber = ""; var sCustomerRowId = ""; var sContractId = ""; var boAsset: BusObject; ; var bcAsset: BusComp; try { sBlueaditAccountNumber = Inputs.GetProperty("sBlueaditAccountNumber"); sCustomerRowId = Inputs.GetProperty("sCustomerRowId"); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Contract Id: " + sContractId); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); psPropset = oApp.NewPropertySet(); pschildPropset = oApp.NewPropertySet(); psListofPH = oApp.NewPropertySet(); sErrorCode = ""; //sBlueaditAccountNumber = "ServUsrId5-67543"; //test two addresses psIn.SetProperty("BlueaditAccountNumber", sBlueaditAccountNumber); /* TAARARA7:02.02.17: Passing Customer Row Id for language preference */ psIn.SetProperty("CustomerId", sCustomerRowId); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : Invoking WF: EAI Get Access SCM"); psIn.SetProperty("ProcessName", "EAI Get Access SCM"); bsCallAccessWF = oApp.GetService("Workflow Process Manager"); bsCallAccessWF.InvokeMethod("RunProcess", psIn, psOut); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : WF invoked"); sErrorCode = psOut.GetProperty("Error Code"); sErrorMessage = psOut.GetProperty("Error Message"); if (bIsTraceOn) TheApplication().Trace(this.Name() + " : WF error" + sErrorMessage); //sErrorCode="DDD"; // for testing if (sErrorCode == "") { Outputs.SetProperty("Error Occurred SCM", "N"); Outputs.SetProperty("Error Message SCM", ""); var sMainAddress = ""; var sMainStreet = ""; var sMainHouseNumber = ""; var sMainHouseName = ""; var sMainZipCode = ""; var sMainCity = ""; var sMainLocationIdentifier = ""; var sNomadicAddress = ""; var sNomadicStreet = ""; var sNomadicHouseNumber = ""; var sNomadicHouseName = ""; var sNomadicZipCode = ""; var sNomadicCity = ""; var sNomadicLocationIdentifier = ""; sMainStreet = psOut.GetProperty("MainAddressStreetName"); sMainHouseNumber = psOut.GetProperty("HouseNumber"); sMainHouseName = psOut.GetProperty("HouseName"); sMainZipCode = psOut.GetProperty("ZipCode"); sMainCity = psOut.GetProperty("City"); sMainLocationIdentifier = psOut.GetProperty("LocationIdentifier"); sNomadicStreet = psOut.GetProperty("StreetName"); sNomadicHouseNumber = psOut.GetProperty("NHouseNumber"); sNomadicHouseName = psOut.GetProperty("NHouseName"); sNomadicZipCode = psOut.GetProperty("NZipCode"); sNomadicCity = psOut.GetProperty("NCity"); sNomadicLocationIdentifier = psOut.GetProperty("NLocationIdentifier"); sMainAddress = sMainStreet; sMainAddress += (sMainHouseNumber == "" ? "" : (sMainAddress == "" ? "" : ", ") + sMainHouseNumber); sMainAddress += (sMainHouseName == "" ? "" : (sMainAddress == "" ? "" : ", ") + sMainHouseName);

ATP ASI Test
(declarations)
#include "eaisiebel.js"

ATP ASI Test
(declarations)
#include "eaisiebel.js"

ATP ASI Test
(declarations)
#include "eaisiebel.js"

ATP ASI Test
AddOneDay
function AddOneDay (Indate) { var ObjDate = new Date(Indate); return (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/" + (ObjDate.getYear()+1900); }

ATP ASI Test
AddOneDay
function AddOneDay (Indate) { var ObjDate = new Date(Indate); return (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/" + (ObjDate.getYear()+1900); }

ATP ASI Test
AddOneDay
function AddOneDay (Indate) { var ObjDate = new Date(Indate); return (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/" + (ObjDate.getYear()+1900); }

ATP ASI Test
GeneratePromised
function GeneratePromised (Inputs, Outputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var reqQty; var reqDate; var halfQty; var rowId; var ATPstatus; var pATPItem; var i =0; if (Inputs.GetChildCount()>0) { SiebelMessage = Inputs.GetChild(0); ListOfHeader = SiebelMessage.GetChild(0); Header = ListOfHeader.GetChild(0); Header.SetProperty("Available Message","ATP Test eScript Success"); ListOfItems = Header.GetChild(0); while (ListOfItems.GetChildCount() > i) { pATPItem = ListOfItems.GetChild(i); ATPstatus = pATPItem.GetProperty("ATP Action") + "d"; pATPItem.RemoveProperty("ATP Action"); while (pATPItem.GetChildCount()>0) { pATPItem.RemoveChild(0); } reqQty = pATPItem.GetProperty("Requested Quantity"); reqDate = pATPItem.GetProperty("Requested Date"); if (reqDate == ""){ reqDate = (ObjDate.getMonth()+1) + "/" + ObjDate.getDate() + "/2002"; } var reqDate1 = AddOneDay(reqDate); halfQty = reqQty / 2; halfQty = Math.ceil(halfQty); logResults ("halfQty",halfQty); logResults ("reqDate",reqDate); logResults ("reqDate1",reqDate1); var availList = TheApplication().NewPropertySet(); availList.SetType("ListOfPromised Schedule Line"); var avail1 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,halfQty,reqDate1,ATPstatus,"1",avail1); availList.AddChild(avail1); if (reqQty > 1){ var avail2 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,(reqQty-halfQty),reqDate1,ATPstatus,"2",avail2); availList.AddChild(avail2); } pATPItem.AddChild(availList); i++; } } SiebelMessage = Inputs.GetChild(0); Outputs.AddChild(SiebelMessage); }

ATP ASI Test
GeneratePromised
function GeneratePromised (Inputs, Outputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var reqQty; var reqDate; var halfQty; var rowId; var ATPstatus; var pATPItem; var i =0; if (Inputs.GetChildCount()>0) { SiebelMessage = Inputs.GetChild(0); ListOfHeader = SiebelMessage.GetChild(0); Header = ListOfHeader.GetChild(0); Header.SetProperty("Available Message","ATP Test eScript Success"); ListOfItems = Header.GetChild(0); while (ListOfItems.GetChildCount() > i) { pATPItem = ListOfItems.GetChild(i); ATPstatus = pATPItem.GetProperty("ATP Action") + "d"; pATPItem.RemoveProperty("ATP Action"); while (pATPItem.GetChildCount()>0) { pATPItem.RemoveChild(0); } reqQty = pATPItem.GetProperty("Requested Quantity"); reqDate = pATPItem.GetProperty("Requested Date"); if (reqDate == ""){ reqDate = (ObjDate.getMonth()+1) + "/" + ObjDate.getDate() + "/2002"; } var reqDate1 = AddOneDay(reqDate); halfQty = reqQty / 2; halfQty = Math.ceil(halfQty); logResults ("halfQty",halfQty); logResults ("reqDate",reqDate); logResults ("reqDate1",reqDate1); var availList = TheApplication().NewPropertySet(); availList.SetType("ListOfPromised Schedule Line"); var avail1 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,halfQty,reqDate1,ATPstatus,"1",avail1); availList.AddChild(avail1); if (reqQty > 1){ var avail2 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,(reqQty-halfQty),reqDate1,ATPstatus,"2",avail2); availList.AddChild(avail2); } pATPItem.AddChild(availList); i++; } } SiebelMessage = Inputs.GetChild(0); Outputs.AddChild(SiebelMessage); }

ATP ASI Test
GeneratePromised
function GeneratePromised (Inputs, Outputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var reqQty; var reqDate; var halfQty; var rowId; var ATPstatus; var pATPItem; var i =0; if (Inputs.GetChildCount()>0) { SiebelMessage = Inputs.GetChild(0); ListOfHeader = SiebelMessage.GetChild(0); Header = ListOfHeader.GetChild(0); Header.SetProperty("Available Message","ATP Test eScript Success"); ListOfItems = Header.GetChild(0); while (ListOfItems.GetChildCount() > i) { pATPItem = ListOfItems.GetChild(i); ATPstatus = pATPItem.GetProperty("ATP Action") + "d"; pATPItem.RemoveProperty("ATP Action"); while (pATPItem.GetChildCount()>0) { pATPItem.RemoveChild(0); } reqQty = pATPItem.GetProperty("Requested Quantity"); reqDate = pATPItem.GetProperty("Requested Date"); if (reqDate == ""){ reqDate = (ObjDate.getMonth()+1) + "/" + ObjDate.getDate() + "/2002"; } var reqDate1 = AddOneDay(reqDate); halfQty = reqQty / 2; halfQty = Math.ceil(halfQty); logResults ("halfQty",halfQty); logResults ("reqDate",reqDate); logResults ("reqDate1",reqDate1); var availList = TheApplication().NewPropertySet(); availList.SetType("ListOfPromised Schedule Line"); var avail1 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,halfQty,reqDate1,ATPstatus,"1",avail1); availList.AddChild(avail1); if (reqQty > 1){ var avail2 = TheApplication().NewPropertySet(); GetPromiseLine(pATPItem,(reqQty-halfQty),reqDate1,ATPstatus,"2",avail2); availList.AddChild(avail2); } pATPItem.AddChild(availList); i++; } } SiebelMessage = Inputs.GetChild(0); Outputs.AddChild(SiebelMessage); }

ATP ASI Test
GetPromiseLine
function GetPromiseLine (pATPItem,availQty,availDate,status,LineNumber,avail1) { var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var rowId; var prodId; var prodIntId; var dateStr = (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/2004"; //promisedLine = TheApplication().NewPropertySet(); logResults("datestr=",dateStr); rowId = pATPItem.GetProperty("Id"); prodId = pATPItem.GetProperty("Product Id"); prodIntId = pATPItem.GetProperty("Product Integration Id"); var srcInvId = pATPItem.GetProperty("Source Inventory Loc Id"); var srcInvIntId = pATPItem.GetProperty("Source Inventory Loc Integration Id"); var srcInvLoc = pATPItem.GetProperty("Source Inventory Location"); if (status != "Reserved") status = "Available"; avail1.SetType("Promised Schedule Line"); // avail1.SetProperty("Line Row Id",rowId); avail1.SetProperty("Id",rowId+LineNumber); avail1.SetProperty("Line Number",LineNumber); avail1.SetProperty("Available Quantity",availQty); avail1.SetProperty("Available Date",availDate); avail1.SetProperty("Available Status",status); avail1.SetProperty("Product Id",prodId); avail1.SetProperty("Product Integration Id",prodIntId); avail1.SetProperty("Available Status As Of Date",dateStr); avail1.SetProperty("Source Inventory Loc Id",srcInvId); avail1.SetProperty("Source Inventory Loc Integration Id",srcInvIntId); avail1.SetProperty("Source Inventory Location",srcInvLoc); }

ATP ASI Test
GetPromiseLine
function GetPromiseLine (pATPItem,availQty,availDate,status,LineNumber,avail1) { var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var rowId; var prodId; var prodIntId; var dateStr = (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/2004"; //promisedLine = TheApplication().NewPropertySet(); logResults("datestr=",dateStr); rowId = pATPItem.GetProperty("Id"); prodId = pATPItem.GetProperty("Product Id"); prodIntId = pATPItem.GetProperty("Product Integration Id"); var srcInvId = pATPItem.GetProperty("Source Inventory Loc Id"); var srcInvIntId = pATPItem.GetProperty("Source Inventory Loc Integration Id"); var srcInvLoc = pATPItem.GetProperty("Source Inventory Location"); if (status != "Reserved") status = "Available"; avail1.SetType("Promised Schedule Line"); // avail1.SetProperty("Line Row Id",rowId); avail1.SetProperty("Id",rowId+LineNumber); avail1.SetProperty("Line Number",LineNumber); avail1.SetProperty("Available Quantity",availQty); avail1.SetProperty("Available Date",availDate); avail1.SetProperty("Available Status",status); avail1.SetProperty("Product Id",prodId); avail1.SetProperty("Product Integration Id",prodIntId); avail1.SetProperty("Available Status As Of Date",dateStr); avail1.SetProperty("Source Inventory Loc Id",srcInvId); avail1.SetProperty("Source Inventory Loc Integration Id",srcInvIntId); avail1.SetProperty("Source Inventory Location",srcInvLoc); }

ATP ASI Test
GetPromiseLine
function GetPromiseLine (pATPItem,availQty,availDate,status,LineNumber,avail1) { var SysDate = Clib.time(); var ObjDate = Date.fromSystem(SysDate); var rowId; var prodId; var prodIntId; var dateStr = (ObjDate.getMonth()+1) + "/" + (ObjDate.getDate()+1) + "/2004"; //promisedLine = TheApplication().NewPropertySet(); logResults("datestr=",dateStr); rowId = pATPItem.GetProperty("Id"); prodId = pATPItem.GetProperty("Product Id"); prodIntId = pATPItem.GetProperty("Product Integration Id"); var srcInvId = pATPItem.GetProperty("Source Inventory Loc Id"); var srcInvIntId = pATPItem.GetProperty("Source Inventory Loc Integration Id"); var srcInvLoc = pATPItem.GetProperty("Source Inventory Location"); if (status != "Reserved") status = "Available"; avail1.SetType("Promised Schedule Line"); // avail1.SetProperty("Line Row Id",rowId); avail1.SetProperty("Id",rowId+LineNumber); avail1.SetProperty("Line Number",LineNumber); avail1.SetProperty("Available Quantity",availQty); avail1.SetProperty("Available Date",availDate); avail1.SetProperty("Available Status",status); avail1.SetProperty("Product Id",prodId); avail1.SetProperty("Product Integration Id",prodIntId); avail1.SetProperty("Available Status As Of Date",dateStr); avail1.SetProperty("Source Inventory Loc Id",srcInvId); avail1.SetProperty("Source Inventory Loc Integration Id",srcInvIntId); avail1.SetProperty("Source Inventory Location",srcInvLoc); }

ATP ASI Test
GetShipmentInfo
function GetShipmentInfo (InputPropset, OutputPropSet) { //ThrowError("This funtionality is not yet implemented."); var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; ResponseFile = "d:\\ATPResponse.xml"; OutputFile = "d:\\ATPOutput.xml"; xmlService = TheApplication().GetService("EAI XML Converter"); psInputs2 = TheApplication().NewPropertySet(); child1 = InputPropset.GetChild(0); getType1 = child1.GetType(); logResults(logfile, "Output Child Type returns: " + getType1); psInputs2 = InputPropset; psOutputs2 = TheApplication().NewPropertySet(); xmlService.InvokeMethod("PropSetToXML", psInputs2, psOutputs2); value2 = psOutputs2.GetValue(); bsFILE = TheApplication().GetService("EAI File Transport"); psInputs3 = TheApplication().NewPropertySet(); psOutputs3 = TheApplication().NewPropertySet(); psInputs3.SetProperty("FileName", OutputFile); psInputs3.SetValue(value2); bsFILE.InvokeMethod("Send", psInputs3, psOutputs3); psInputs4 = TheApplication().NewPropertySet(); psOutputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); psInputs4.SetProperty("IsReceivingTextData","false"); bsFILE.InvokeMethod("Receive",psInputs4,psOutputs4); psOutputs4.SetProperty("StripNameSpace",""); xmlService.InvokeMethod("XMLToPropSet", psOutputs4, OutputPropSet); }

ATP ASI Test
GetShipmentInfo
function GetShipmentInfo (InputPropset, OutputPropSet) { //ThrowError("This funtionality is not yet implemented."); var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; ResponseFile = "d:\\ATPResponse.xml"; OutputFile = "d:\\ATPOutput.xml"; xmlService = TheApplication().GetService("EAI XML Converter"); psInputs2 = TheApplication().NewPropertySet(); child1 = InputPropset.GetChild(0); getType1 = child1.GetType(); logResults(logfile, "Output Child Type returns: " + getType1); psInputs2 = InputPropset; psOutputs2 = TheApplication().NewPropertySet(); xmlService.InvokeMethod("PropSetToXML", psInputs2, psOutputs2); value2 = psOutputs2.GetValue(); bsFILE = TheApplication().GetService("EAI File Transport"); psInputs3 = TheApplication().NewPropertySet(); psOutputs3 = TheApplication().NewPropertySet(); psInputs3.SetProperty("FileName", OutputFile); psInputs3.SetValue(value2); bsFILE.InvokeMethod("Send", psInputs3, psOutputs3); psInputs4 = TheApplication().NewPropertySet(); psOutputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); psInputs4.SetProperty("IsReceivingTextData","false"); bsFILE.InvokeMethod("Receive",psInputs4,psOutputs4); psOutputs4.SetProperty("StripNameSpace",""); xmlService.InvokeMethod("XMLToPropSet", psOutputs4, OutputPropSet); }

ATP ASI Test
GetShipmentInfo
function GetShipmentInfo (InputPropset, OutputPropSet) { //ThrowError("This funtionality is not yet implemented."); var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; ResponseFile = "d:\\ATPResponse.xml"; OutputFile = "d:\\ATPOutput.xml"; xmlService = TheApplication().GetService("EAI XML Converter"); psInputs2 = TheApplication().NewPropertySet(); child1 = InputPropset.GetChild(0); getType1 = child1.GetType(); logResults(logfile, "Output Child Type returns: " + getType1); psInputs2 = InputPropset; psOutputs2 = TheApplication().NewPropertySet(); xmlService.InvokeMethod("PropSetToXML", psInputs2, psOutputs2); value2 = psOutputs2.GetValue(); bsFILE = TheApplication().GetService("EAI File Transport"); psInputs3 = TheApplication().NewPropertySet(); psOutputs3 = TheApplication().NewPropertySet(); psInputs3.SetProperty("FileName", OutputFile); psInputs3.SetValue(value2); bsFILE.InvokeMethod("Send", psInputs3, psOutputs3); psInputs4 = TheApplication().NewPropertySet(); psOutputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); psInputs4.SetProperty("IsReceivingTextData","false"); bsFILE.InvokeMethod("Receive",psInputs4,psOutputs4); psOutputs4.SetProperty("StripNameSpace",""); xmlService.InvokeMethod("XMLToPropSet", psOutputs4, OutputPropSet); }

ATP ASI Test
RunATPTest
function RunATPTest (InputPropset, OutputPropSet) { var OutputFile; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if ( (envPath == ("null" + envSlash)) || (envPath == envSlash) ) { envPath = Clib.getenv("SIEBEL_HOME"); if ((envPath == "null") || (envPath == "")) { envPath = ""; } else { envPath = envPath + envSlash + "bin" + envSlash; } } OutputFile = envPath + "ATPOutput.xml"; WriteXMLFile(InputPropset,OutputFile); GeneratePromised(InputPropset,OutputPropSet); var ResponseFile = envPath + "ATPFinished.xml"; WriteXMLFile(OutputPropSet,ResponseFile); }

ATP ASI Test
RunATPTest
function RunATPTest (InputPropset, OutputPropSet) { var OutputFile; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if ( (envPath == ("null" + envSlash)) || (envPath == envSlash) ) { envPath = Clib.getenv("SIEBEL_HOME"); if ((envPath == "null") || (envPath == "")) { envPath = ""; } else { envPath = envPath + envSlash + "bin" + envSlash; } } OutputFile = envPath + "ATPOutput.xml"; WriteXMLFile(InputPropset,OutputFile); GeneratePromised(InputPropset,OutputPropSet); var ResponseFile = envPath + "ATPFinished.xml"; WriteXMLFile(OutputPropSet,ResponseFile); }

ATP ASI Test
RunATPTest
function RunATPTest (InputPropset, OutputPropSet) { var OutputFile; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if ( (envPath == ("null" + envSlash)) || (envPath == envSlash) ) { envPath = Clib.getenv("SIEBEL_HOME"); if ((envPath == "null") || (envPath == "")) { envPath = ""; } else { envPath = envPath + envSlash + "bin" + envSlash; } } OutputFile = envPath + "ATPOutput.xml"; WriteXMLFile(InputPropset,OutputFile); GeneratePromised(InputPropset,OutputPropSet); var ResponseFile = envPath + "ATPFinished.xml"; WriteXMLFile(OutputPropSet,ResponseFile); }

ATP ASI Test
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Execute") { //GetShipmentInfo (Inputs, Outputs); RunATPTest (Inputs, Outputs); } if (MethodName == "WriteXML") { //GetShipmentInfo (Inputs, Outputs); WriteXMLFile (Inputs,"d:\\ATPBeforeExecute.xml"); } return (CancelOperation); }

ATP ASI Test
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Execute") { //GetShipmentInfo (Inputs, Outputs); RunATPTest (Inputs, Outputs); } if (MethodName == "WriteXML") { //GetShipmentInfo (Inputs, Outputs); WriteXMLFile (Inputs,"d:\\ATPBeforeExecute.xml"); } return (CancelOperation); }

ATP ASI Test
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Execute") { //GetShipmentInfo (Inputs, Outputs); RunATPTest (Inputs, Outputs); } if (MethodName == "WriteXML") { //GetShipmentInfo (Inputs, Outputs); WriteXMLFile (Inputs,"d:\\ATPBeforeExecute.xml"); } return (CancelOperation); }

ATP ASI Test
WriteJunk
function WriteJunk (Inputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var Item; var ListOfATP; var Promised; var data; logResults ("jnk","WriteJunk"); SiebelMessage = Inputs.GetChild(0); data = SiebelMessage.GetType(); logResults ("SiebMes",data); ListOfHeader = SiebelMessage.GetChild(0); data = ListOfHeader.GetType(); logResults ("ListOHeader",data); Header = ListOfHeader.GetChild(0); data = Header.GetType(); logResults ("DaHeader",data); ListOfItems = Header.GetChild(0); data = ListOfItems.GetType(); logResults ("LstOItems",data); Item = ListOfItems.GetChild(0); data = Item.GetType(); logResults ("Item",data); ListOfATP = Item.GetChild(0); data = ListOfATP.GetType(); logResults ("ListOAtp",data); Promised = ListOfATP.GetChild(0); data = Promised.GetType(); logResults ("Promised",data); }

ATP ASI Test
WriteJunk
function WriteJunk (Inputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var Item; var ListOfATP; var Promised; var data; logResults ("jnk","WriteJunk"); SiebelMessage = Inputs.GetChild(0); data = SiebelMessage.GetType(); logResults ("SiebMes",data); ListOfHeader = SiebelMessage.GetChild(0); data = ListOfHeader.GetType(); logResults ("ListOHeader",data); Header = ListOfHeader.GetChild(0); data = Header.GetType(); logResults ("DaHeader",data); ListOfItems = Header.GetChild(0); data = ListOfItems.GetType(); logResults ("LstOItems",data); Item = ListOfItems.GetChild(0); data = Item.GetType(); logResults ("Item",data); ListOfATP = Item.GetChild(0); data = ListOfATP.GetType(); logResults ("ListOAtp",data); Promised = ListOfATP.GetChild(0); data = Promised.GetType(); logResults ("Promised",data); }

ATP ASI Test
WriteJunk
function WriteJunk (Inputs) { var SiebelMessage; var ListOfHeader; var Header; var ListOfItems; var Item; var ListOfATP; var Promised; var data; logResults ("jnk","WriteJunk"); SiebelMessage = Inputs.GetChild(0); data = SiebelMessage.GetType(); logResults ("SiebMes",data); ListOfHeader = SiebelMessage.GetChild(0); data = ListOfHeader.GetType(); logResults ("ListOHeader",data); Header = ListOfHeader.GetChild(0); data = Header.GetType(); logResults ("DaHeader",data); ListOfItems = Header.GetChild(0); data = ListOfItems.GetType(); logResults ("LstOItems",data); Item = ListOfItems.GetChild(0); data = Item.GetType(); logResults ("Item",data); ListOfATP = Item.GetChild(0); data = ListOfATP.GetType(); logResults ("ListOAtp",data); Promised = ListOfATP.GetChild(0); data = Promised.GetType(); logResults ("Promised",data); }

ATP ASI Test
WriteXMLFile
function WriteXMLFile (Inputs, fileName) { var xmlService; var value2; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", fileName); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); }

ATP ASI Test
WriteXMLFile
function WriteXMLFile (Inputs, fileName) { var xmlService; var value2; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", fileName); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); }

ATP ASI Test
WriteXMLFile
function WriteXMLFile (Inputs, fileName) { var xmlService; var value2; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", fileName); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); }

ATP ASI Test
logResults
function logResults (lf,data) { var logfile; //var logfile = Clib.fopen("craiglog.txt", "a"); // Clib.fputs(" \n", logfile); // data = lf + " " + data + " \n"; // if ( !Clib.fputs(data, logfile)) // { // Clib.ferror(logfile); // } // Clib.fputs(" \n", logfile); //Clib.fclose(logfile); }

ATP ASI Test
logResults
function logResults (lf,data) { var logfile; //var logfile = Clib.fopen("craiglog.txt", "a"); // Clib.fputs(" \n", logfile); // data = lf + " " + data + " \n"; // if ( !Clib.fputs(data, logfile)) // { // Clib.ferror(logfile); // } // Clib.fputs(" \n", logfile); //Clib.fclose(logfile); }

ATP ASI Test
logResults
function logResults (lf,data) { var logfile; //var logfile = Clib.fopen("craiglog.txt", "a"); // Clib.fputs(" \n", logfile); // data = lf + " " + data + " \n"; // if ( !Clib.fputs(data, logfile)) // { // Clib.ferror(logfile); // } // Clib.fputs(" \n", logfile); //Clib.fclose(logfile); }

ATP ASI Test XML
Execute
function Execute(Inputs, Outputs) { var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if (envPath == ("null" + envSlash)) { envPath = Clib.getenv("SIEBEL_HOME") + envSlash + "bin" + envSlash; } OutputFile = envPath + "ATPOutput.xml"; ResponseFile = envPath + "ATPResponse.xml"; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", OutputFile); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); psInputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); xmlService = TheApplication().GetService("EAI XML Read from File"); xmlService.InvokeMethod("ReadEAIMsg", psInputs4, Outputs); }

ATP ASI Test XML
Execute
function Execute(Inputs, Outputs) { var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if (envPath == ("null" + envSlash)) { envPath = Clib.getenv("SIEBEL_HOME") + envSlash + "bin" + envSlash; } OutputFile = envPath + "ATPOutput.xml"; ResponseFile = envPath + "ATPResponse.xml"; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", OutputFile); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); psInputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); xmlService = TheApplication().GetService("EAI XML Read from File"); xmlService.InvokeMethod("ReadEAIMsg", psInputs4, Outputs); }

ATP ASI Test XML
Execute
function Execute(Inputs, Outputs) { var ResponseFile; var OutputFile; var xmlService; var Outdata; var Indata; var psInputs2; var psOutputs2; var bsFILE; var psInputs3; var psOutputs3; var psInputs4; var psOutputs4; var value2; var child1; var logfile; var getType1; var envPath; var envSlash; if (Clib.getenv("OS") == "Windows_NT") { envSlash = "\\"; } else { envSlash = "/"; } envPath = Clib.getenv("REQUEST_ASI_PATH") + envSlash; if (envPath == ("null" + envSlash)) { envPath = Clib.getenv("SIEBEL_HOME") + envSlash + "bin" + envSlash; } OutputFile = envPath + "ATPOutput.xml"; ResponseFile = envPath + "ATPResponse.xml"; psInputs2 = TheApplication().NewPropertySet(); psInputs2 = Inputs; psOutputs2 = TheApplication().NewPropertySet(); xmlService = TheApplication().GetService("EAI XML Write to File"); psInputs2.SetProperty ("FileName", OutputFile); xmlService.InvokeMethod("WriteEAIMsg", psInputs2, psOutputs2); psInputs4 = TheApplication().NewPropertySet(); psInputs4.SetProperty("FileName", ResponseFile); xmlService = TheApplication().GetService("EAI XML Read from File"); xmlService.InvokeMethod("ReadEAIMsg", psInputs4, Outputs); }

ATP ASI Test XML
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="Execute") { Execute(Inputs,Outputs); } else { TheApplication.ErrorText("Invalid function name. Valid method name is 'Execute'"); ret=ContinueOperation; } return ret; }

ATP ASI Test XML
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="Execute") { Execute(Inputs,Outputs); } else { TheApplication().ErrorText("Invalid function name. Valid method name is 'Execute'"); ret=ContinueOperation; } return ret; }

ATP ASI Test XML
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="Execute") { Execute(Inputs,Outputs); } else { TheApplication().ErrorText("Invalid function name. Valid method name is 'Execute'"); ret=ContinueOperation; } return ret; }

Abo MOCCA SCM
(declarations)
//Variable Declarations var bIsTraceOn:bool = TheApplication().isTraceON; var STARS:String = "****"; var STARS_DT:String ="**/**/**/ **:**:**"; var oApp = TheApplication(); //ERROR String var ERROR_VBC:String = "Error in VBC"; //Field names in VBC var TARGET_ABO_VBC:String = "Target Abo SCM"; var TARGET_ABO_NAME_VBC:String = "Target Abo Name SCM"; var FEE_VBC:String = "Fee SCM";

Abo MOCCA SCM
(declarations)
//Variable Declarations var bIsTraceOn:bool = TheApplication().isTraceON; var STARS:String = "****"; var STARS_DT:String ="**/**/**/ **:**:**"; var oApp = TheApplication(); //ERROR String var ERROR_VBC:String = "Error in VBC"; //Field names in VBC var TARGET_ABO_VBC:String = "Target Abo SCM"; var TARGET_ABO_NAME_VBC:String = "Target Abo Name SCM"; var FEE_VBC:String = "Fee SCM";

Abo MOCCA SCM
AboGetValidate
function AboGetValidate (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function CalculateDuration ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Calculates the duration based on star and end date and returns as an HH:MM format *****************************************************************/ //Variable declaration var psInputs:PropertySet; var psReturnRecord:PropertySet; var psListOfAbos:PropertySet; var psListOfType:PropertySet; var psListOfListAbos:PropertySet; var psSourceAbo:PropertySet; var psMandatoryFlag:PropertySet; var psListOfErrors:PropertySet; var psErrors:PropertySet; var aFinalAbosList = new Array(); var bsCallWFGetAbos:Service; var wsInputs; var wsOutputs; var sMandatory; var sSourceAbo; var intRecords; var intIndex; var strMSISDN; var strExecDate; var strSegment; var strLang; var sFinalAbosList = ""; var strErrorCode = ""; var strErrorMessage = ""; // BEGIN - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 var dtToday = new Date; var nYearToday:Number; var sMonthToday:String; var sDayToday:String; var dtBirthDay; var nYearBD:Number; var sMonthBD:String; var sDayBD:String; var nAgeInYears:Number; var strAgeInYears:String; // END - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 try{ strMSISDN = Inputs.GetProperty("MSISDN"); strExecDate = Inputs.GetProperty("ExecDate"); strSegment = Inputs.GetProperty("Segment"); strLang = Inputs.GetProperty("Language"); dtBirthDay = Inputs.GetProperty("AccountBirthDate"); // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); // BEGIN - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 // Calculate age in Years nYearToday = dtToday.getFullYear(); sMonthToday = ToString(dtToday.getMonth() + 1); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} sDayToday = ToString(dtToday.getDate()); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} if ( dtBirthDay == "" ) { nAgeInYears = null; strAgeInYears = ""; } else { nYearBD = parseInt(dtBirthDay.substr(6,4)); sMonthBD = dtBirthDay.substr(0,2); sDayBD = dtBirthDay.substr(3,2); if (( sMonthToday + sDayToday ) < ( sMonthBD + sDayBD )) { nAgeInYears = nYearToday - nYearBD - 1; } else { nAgeInYears = nYearToday - nYearBD; } strAgeInYears = nAgeInYears.toString(); } if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Today: " + sDayToday + sMonthToday + nYearToday ); TheApplication().Trace(this.Name() + " ... BirthDay: " + sDayBD + sMonthBD + nYearBD ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + nAgeInYears ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + strAgeInYears ); } wsInputs.SetProperty("age", strAgeInYears); // END - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 wsInputs.SetProperty("number", strMSISDN); wsInputs.SetProperty("mainSegment", strSegment); wsInputs.SetProperty("executionDate", strExecDate); wsInputs.SetProperty("employeeLanguage", strLang); //Call EAI Service to getAbos bsCallWFGetAbos = TheApplication().GetService("EAI Subscription SCM"); bsCallWFGetAbos.InvokeMethod("getValidAbos", wsInputs,wsOutputs); psErrors = getHierElement(wsOutputs, "ListOfgetAvailableSubscriptionTypesResMsg"); if(psErrors == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".Error: response message not found"); } strErrorCode = psErrors.GetProperty("Error Code"); strErrorMessage = psErrors.GetProperty("Error Message"); if (strErrorCode == "0") { //Obtain the list of Target abos Ids. psInputs = getHierElement(wsOutputs, "ListOfg

Abo MOCCA SCM
AboGetValidate
function AboGetValidate (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function CalculateDuration ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Calculates the duration based on star and end date and returns as an HH:MM format *****************************************************************/ //Variable declaration var psInputs:PropertySet; var psReturnRecord:PropertySet; var psListOfAbos:PropertySet; var psListOfType:PropertySet; var psListOfListAbos:PropertySet; var psSourceAbo:PropertySet; var psMandatoryFlag:PropertySet; var psListOfErrors:PropertySet; var psErrors:PropertySet; var aFinalAbosList = new Array(); var bsCallWFGetAbos:Service; var wsInputs; var wsOutputs; var sMandatory; var sSourceAbo; var intRecords; var intIndex; var strMSISDN; var strExecDate; var strSegment; var strLang; var sFinalAbosList = ""; var strErrorCode = ""; var strErrorMessage = ""; // BEGIN - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 var dtToday = new Date; var nYearToday:Number; var sMonthToday:String; var sDayToday:String; var dtBirthDay; var nYearBD:Number; var sMonthBD:String; var sDayBD:String; var nAgeInYears:Number; var strAgeInYears:String; // END - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 try{ strMSISDN = Inputs.GetProperty("MSISDN"); strExecDate = Inputs.GetProperty("ExecDate"); strSegment = Inputs.GetProperty("Segment"); strLang = Inputs.GetProperty("Language"); dtBirthDay = Inputs.GetProperty("AccountBirthDate"); // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); // BEGIN - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 // Calculate age in Years nYearToday = dtToday.getFullYear(); sMonthToday = ToString(dtToday.getMonth() + 1); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} sDayToday = ToString(dtToday.getDate()); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} if ( dtBirthDay == "" ) { nAgeInYears = null; strAgeInYears = ""; } else { nYearBD = parseInt(dtBirthDay.substr(6,4)); sMonthBD = dtBirthDay.substr(0,2); sDayBD = dtBirthDay.substr(3,2); if (( sMonthToday + sDayToday ) < ( sMonthBD + sDayBD )) { nAgeInYears = nYearToday - nYearBD - 1; } else { nAgeInYears = nYearToday - nYearBD; } strAgeInYears = nAgeInYears.toString(); } if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Today: " + sDayToday + sMonthToday + nYearToday ); TheApplication().Trace(this.Name() + " ... BirthDay: " + sDayBD + sMonthBD + nYearBD ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + nAgeInYears ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + strAgeInYears ); } wsInputs.SetProperty("age", strAgeInYears); // END - 17.10.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" / Defect 42876 wsInputs.SetProperty("number", strMSISDN); wsInputs.SetProperty("mainSegment", strSegment); wsInputs.SetProperty("executionDate", strExecDate); wsInputs.SetProperty("employeeLanguage", strLang); //Call EAI Service to getAbos bsCallWFGetAbos = TheApplication().GetService("EAI Subscription SCM"); bsCallWFGetAbos.InvokeMethod("getValidAbos", wsInputs,wsOutputs); psErrors = getHierElement(wsOutputs, "ListOfgetAvailableSubscriptionTypesResMsg"); if(psErrors == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".Error: response message not found"); } strErrorCode = psErrors.GetProperty("Error Code"); strErrorMessage = psErrors.GetProperty("Error Message"); if (strErrorCode == "0") { //Obtain the list of Target abos Ids. psInputs = getHierElement(wsOutputs, "ListOfg

Abo MOCCA SCM
Init
function Init (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty(TARGET_ABO_VBC, ""); Outputs.SetProperty(TARGET_ABO_NAME_VBC, ""); Outputs.SetProperty(FEE_VBC, ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } finally{ //Do nothing } }

Abo MOCCA SCM
Init
function Init (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty(TARGET_ABO_VBC, ""); Outputs.SetProperty(TARGET_ABO_NAME_VBC, ""); Outputs.SetProperty(FEE_VBC, ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } finally{ //Do nothing } }

Abo MOCCA SCM
Query
function Query(Inputs, Outputs){ /************************************************************************************************** * Function: Query in BusService "Appointments Slots VBC SCM" * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking Call the EAI WS and process the response to display in VBC * Date : 03.08.2010 **************************************************************************************************/ //Declare variables var wsInputs:PropertySet; var wsOutputs:PropertySet; var bsCallWFGetAbos:Service; var strMSISDN; var strExecDate; var strSegment; var strLang; var BO; var BC; // BEGIN - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" var dtToday = new Date; var nYearToday:Number; var sMonthToday:String; var sDayToday:String; var dtBirthDay; var nYearBD:Number; var sMonthBD:String; var sDayBD:String; var nAgeInYears:Number; var strAgeInYears:String; // END - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" try{ BO = TheApplication().ActiveBusObject(); BC = BO.GetBusComp("Service Request"); strMSISDN = BC.GetFieldValue("MSISDN Take Over SCM"); strExecDate = BC.GetFieldValue("Calc Commit Time"); //BEGIN - OneCRM - TGDPADA4 - 2010.11.13 - Defect 27845 //strSegment = BC.GetFieldValue("Account Grobsegment SCM"); strSegment = BC.GetFieldValue("Calculated Account Grobsegment SCM"); //END - OneCRM - TGDPADA4 - 2010.11.13 - Defect 27845 strLang = BC.GetFieldValue("Language"); //TGDBLRO4 07.10.2010: Added for Defect 27859 if ((strMSISDN == "") || (strExecDate == "") || (strSegment == "") || (strLang == "")) { oApp.RaiseError("TOAC Order Not Configured"); } // BEGIN - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" // Calculate age in Years nYearToday = dtToday.getFullYear(); sMonthToday = ToString(dtToday.getMonth() + 1); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} sDayToday = ToString(dtToday.getDate()); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} dtBirthDay = BC.GetFieldValue("Account Primary Contact Birth Date SCM"); if ( dtBirthDay == "" ) { nAgeInYears = null; strAgeInYears = ""; } else { nYearBD = parseInt(dtBirthDay.substr(6,4)); sMonthBD = dtBirthDay.substr(0,2); sDayBD = dtBirthDay.substr(3,2); if (( sMonthToday + sDayToday ) < ( sMonthBD + sDayBD )) { nAgeInYears = nYearToday - nYearBD - 1; } else { nAgeInYears = nYearToday - nYearBD; } strAgeInYears = nAgeInYears.toString(); } if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Today: " + sDayToday + sMonthToday + nYearToday ); TheApplication().Trace(this.Name() + " ... BirthDay: " + sDayBD + sMonthBD + nYearBD ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + nAgeInYears ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + strAgeInYears ); } // END - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); wsInputs.SetProperty("number", strMSISDN); wsInputs.SetProperty("mainSegment", strSegment); wsInputs.SetProperty("executionDate", strExecDate); wsInputs.SetProperty("employeeLanguage", strLang); // BEGIN - 23.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" wsInputs.SetProperty("age", strAgeInYears); // END - 23.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" //Call EAI Service to getAbos bsCallWFGetAbos = TheApplication().GetService("EAI Subscription SCM"); bsCallWFGetAbos.InvokeMethod("getValidAbos", wsInputs,wsOutputs); //Go trough records returned by the EAI BS and process them one by one returnTransformedAbos(wsOutputs, Outputs); return(Outputs); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty O

Abo MOCCA SCM
Query
function Query(Inputs, Outputs){ /************************************************************************************************** * Function: Query in BusService "Appointments Slots VBC SCM" * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking Call the EAI WS and process the response to display in VBC * Date : 03.08.2010 **************************************************************************************************/ //Declare variables var wsInputs:PropertySet; var wsOutputs:PropertySet; var bsCallWFGetAbos:Service; var strMSISDN; var strExecDate; var strSegment; var strLang; var BO; var BC; // BEGIN - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" var dtToday = new Date; var nYearToday:Number; var sMonthToday:String; var sDayToday:String; var dtBirthDay; var nYearBD:Number; var sMonthBD:String; var sDayBD:String; var nAgeInYears:Number; var strAgeInYears:String; // END - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" try{ BO = TheApplication().ActiveBusObject(); BC = BO.GetBusComp("Service Request"); strMSISDN = BC.GetFieldValue("MSISDN Take Over SCM"); strExecDate = BC.GetFieldValue("Calc Commit Time"); //BEGIN - OneCRM - TGDPADA4 - 2010.11.13 - Defect 27845 //strSegment = BC.GetFieldValue("Account Grobsegment SCM"); strSegment = BC.GetFieldValue("Calculated Account Grobsegment SCM"); //END - OneCRM - TGDPADA4 - 2010.11.13 - Defect 27845 strLang = BC.GetFieldValue("Language"); //TGDBLRO4 07.10.2010: Added for Defect 27859 if ((strMSISDN == "") || (strExecDate == "") || (strSegment == "") || (strLang == "")) { oApp.RaiseError("TOAC Order Not Configured"); } // BEGIN - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" // Calculate age in Years nYearToday = dtToday.getFullYear(); sMonthToday = ToString(dtToday.getMonth() + 1); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} sDayToday = ToString(dtToday.getDate()); if (sMonthToday.length == 1) {sMonthToday = "0" + sMonthToday;} dtBirthDay = BC.GetFieldValue("Account Primary Contact Birth Date SCM"); if ( dtBirthDay == "" ) { nAgeInYears = null; strAgeInYears = ""; } else { nYearBD = parseInt(dtBirthDay.substr(6,4)); sMonthBD = dtBirthDay.substr(0,2); sDayBD = dtBirthDay.substr(3,2); if (( sMonthToday + sDayToday ) < ( sMonthBD + sDayBD )) { nAgeInYears = nYearToday - nYearBD - 1; } else { nAgeInYears = nYearToday - nYearBD; } strAgeInYears = nAgeInYears.toString(); } if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Today: " + sDayToday + sMonthToday + nYearToday ); TheApplication().Trace(this.Name() + " ... BirthDay: " + sDayBD + sMonthBD + nYearBD ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + nAgeInYears ); TheApplication().Trace(this.Name() + " ... AgeInYears: " + strAgeInYears ); } // END - 22.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); wsInputs.SetProperty("number", strMSISDN); wsInputs.SetProperty("mainSegment", strSegment); wsInputs.SetProperty("executionDate", strExecDate); wsInputs.SetProperty("employeeLanguage", strLang); // BEGIN - 23.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" wsInputs.SetProperty("age", strAgeInYears); // END - 23.08.2011 - TGDSTER2 - CR770 "Changes Taking Over Process" //Call EAI Service to getAbos bsCallWFGetAbos = TheApplication().GetService("EAI Subscription SCM"); bsCallWFGetAbos.InvokeMethod("getValidAbos", wsInputs,wsOutputs); //Go trough records returned by the EAI BS and process them one by one returnTransformedAbos(wsOutputs, Outputs); return(Outputs); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty O

Abo MOCCA SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking: BS for the VBC , Appointment Slots VBC SCM to initialize and fill the BC with data from ** the external WS call *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; case "AboGetValidate": AboGetValidate (Inputs, Outputs); break; default: break; } return (CancelOperation); }

Abo MOCCA SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking: BS for the VBC , Appointment Slots VBC SCM to initialize and fill the BC with data from ** the external WS call *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; case "AboGetValidate": AboGetValidate (Inputs, Outputs); break; default: break; } return (CancelOperation); }

Abo MOCCA SCM
createDummyRecord
function createDummyRecord(){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment booking record *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set all the record with stars pOutputRecord.SetProperty(TARGET_ABO_VBC, "472"); pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, "NATEL business basic"); pOutputRecord.SetProperty(FEE_VBC,"23"); // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Abo MOCCA SCM
createDummyRecord
function createDummyRecord(){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment booking record *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set all the record with stars pOutputRecord.SetProperty(TARGET_ABO_VBC, "472"); pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, "NATEL business basic"); pOutputRecord.SetProperty(FEE_VBC,"23"); // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Abo MOCCA SCM
createErrorRecord
function createErrorRecord(strError){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment to display error *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set slot id with stars -> disable the button on the Applet pOutputRecord.SetProperty(TARGET_ABO_VBC, STARS); //Set Rank field with the error message pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, strError); //Set rest of the fields with the ERROR string pOutputRecord.SetProperty(FEE_VBC, ERROR_VBC) // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Abo MOCCA SCM
createErrorRecord
function createErrorRecord(strError){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment to display error *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set slot id with stars -> disable the button on the Applet pOutputRecord.SetProperty(TARGET_ABO_VBC, STARS); //Set Rank field with the error message pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, strError); //Set rest of the fields with the ERROR string pOutputRecord.SetProperty(FEE_VBC, ERROR_VBC) // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Abo MOCCA SCM
getHierElement
function getHierElement(psElement, sPath) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 30.08.2010 ** Descr: Returns child property set identified by path. The path consists of property set types ** which are used to traverse parent/child/grandchild .. property sets until the indicated ** element is found. Cardinality must be one, multiple children with the same type cannot ** be identified. ** Params: psElement - hierarchical property set containing child property set ** sPath - forward slash-separated string containing property set types ** Returns: child property set or null if child ps was not found ***************************************************************************************************/ var psCurrElmt:PropertySet; try { var iChildCount:Number; var bElementFound:bool; var aHierarchy:Array = sPath.split("/"); psCurrElmt = psElement; for(var i:Number = 0; i < aHierarchy.length; i++) { iChildCount = psCurrElmt.GetChildCount(); bElementFound = false; for(var j:Number = 0; j < iChildCount; j++) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: current type " + psCurrElmt.GetChild(j).GetType()); if(psCurrElmt.GetChild(j).GetType() == aHierarchy[i]) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: found " + aHierarchy[i]); psCurrElmt = psCurrElmt.GetChild(j); // set child as next current element bElementFound = true; break; } } if(!bElementFound) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement:" + aHierarchy[i] + " not found"); return; // return null if hierarchy doesn't match } } return psCurrElmt; } finally { psCurrElmt = null; aHierarchy = null; } }

Abo MOCCA SCM
getHierElement
function getHierElement(psElement, sPath) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 30.08.2010 ** Descr: Returns child property set identified by path. The path consists of property set types ** which are used to traverse parent/child/grandchild .. property sets until the indicated ** element is found. Cardinality must be one, multiple children with the same type cannot ** be identified. ** Params: psElement - hierarchical property set containing child property set ** sPath - forward slash-separated string containing property set types ** Returns: child property set or null if child ps was not found ***************************************************************************************************/ var psCurrElmt:PropertySet; try { var iChildCount:Number; var bElementFound:bool; var aHierarchy:Array = sPath.split("/"); psCurrElmt = psElement; for(var i:Number = 0; i < aHierarchy.length; i++) { iChildCount = psCurrElmt.GetChildCount(); bElementFound = false; for(var j:Number = 0; j < iChildCount; j++) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: current type " + psCurrElmt.GetChild(j).GetType()); if(psCurrElmt.GetChild(j).GetType() == aHierarchy[i]) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: found " + aHierarchy[i]); psCurrElmt = psCurrElmt.GetChild(j); // set child as next current element bElementFound = true; break; } } if(!bElementFound) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement:" + aHierarchy[i] + " not found"); return; // return null if hierarchy doesn't match } } return psCurrElmt; } finally { psCurrElmt = null; aHierarchy = null; } }

Abo MOCCA SCM
processRecord
function processRecord(wsRecord){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: processRecord * Author : TGDJUVI1 * Purpose : MBG Autmatisierung: Abos Booking this method will return a property set with the structure in the VBC * Date : 03.08.2010 **************************************************************************************************/ //Variable Declarations var pInputs:PropertySet; var pOutputRecord:PropertySet; var psPenalties:PropertySet; try{ //Initialize variables pInputs = TheApplication().NewPropertySet(); pOutputRecord = TheApplication().NewPropertySet(); //Fields mapped directly from EAI return pOutputRecord.SetProperty(TARGET_ABO_VBC, wsRecord.GetProperty("id")); pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, wsRecord.GetProperty("name")); psPenalties = getHierElement(wsRecord, "ListOfpenalties/penalties"); if(psPenalties == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } pOutputRecord.SetProperty(FEE_VBC, psPenalties.GetProperty("totalPenalties")); // TGDDERO7, 31.05.2011, move line behind finally statement // return(pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " ProcessRecord function. Error: " + e.message); throw(e); } finally{ //Variable Destruction pInputs = null; psPenalties = null; // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return(pOutputRecord); }

Abo MOCCA SCM
processRecord
function processRecord(wsRecord){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: processRecord * Author : TGDJUVI1 * Purpose : MBG Autmatisierung: Abos Booking this method will return a property set with the structure in the VBC * Date : 03.08.2010 **************************************************************************************************/ //Variable Declarations var pInputs:PropertySet; var pOutputRecord:PropertySet; var psPenalties:PropertySet; try{ //Initialize variables pInputs = TheApplication().NewPropertySet(); pOutputRecord = TheApplication().NewPropertySet(); //Fields mapped directly from EAI return pOutputRecord.SetProperty(TARGET_ABO_VBC, wsRecord.GetProperty("id")); pOutputRecord.SetProperty(TARGET_ABO_NAME_VBC, wsRecord.GetProperty("name")); psPenalties = getHierElement(wsRecord, "ListOfpenalties/penalties"); if(psPenalties == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } pOutputRecord.SetProperty(FEE_VBC, psPenalties.GetProperty("totalPenalties")); // TGDDERO7, 31.05.2011, move line behind finally statement // return(pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " ProcessRecord function. Error: " + e.message); throw(e); } finally{ //Variable Destruction pInputs = null; psPenalties = null; // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return(pOutputRecord); }

Abo MOCCA SCM
returnTransformedAbos
function returnTransformedAbos(wsOutput, Outputs){ /************************************************************************************************** * Service : ABO MOCCA SCM * Function : getTargetRestoreTime * Author : TGDJUVI1 * Purpose : MBG Autmatisierung: Abos Booking this method will return a property set with the structure in the VBC * Date : 10.09.2010 * Input : wsOutput: Property set with the EAI Output ****************psReturnOutput**********************************************************************************/ //Variable declarations var psInputs:PropertySet; var psReturnRecord:PropertySet; var psListOfAbos:PropertySet; var psListOfType:PropertySet; var psListOfListAbos:PropertySet; var psListOfErrors:PropertySet; var psErrors:PropertySet; var intRecords; var intIndex; var strErrorCode; var strErrorMessage = ""; try{ // variable initialization psInputs = TheApplication().NewPropertySet(); psListOfAbos = TheApplication().NewPropertySet(); psReturnRecord = TheApplication().NewPropertySet(); psErrors = TheApplication().NewPropertySet(); psErrors = getHierElement(wsOutput, "ListOfgetAvailableSubscriptionTypesResMsg"); if(psErrors == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".Error: response message not found"); } strErrorCode = psErrors.GetProperty("Error Code"); strErrorMessage = psErrors.GetProperty("Error Message"); if (strErrorCode != "0") { oApp.RaiseErrorText(Name() + psErrors.GetProperty("Error Message")); } else { psInputs = getHierElement(wsOutput, "ListOfgetAvailableSubscriptionTypesResMsg/getAvailableSubscriptionTypesResMsg"); if(psInputs == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesResMsg: response message not found"); } psListOfType = getHierElement(psInputs, "ListOfgetAvailableSubscriptionTypesRes/getAvailableSubscriptionTypesRes"); if(psListOfType == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } psListOfErrors = getHierElement(psListOfType, "ListOfconcatenatedRemark/concatenatedRemark"); if(psListOfErrors == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } strErrorCode = psListOfErrors.GetProperty("code"); strErrorMessage = psListOfErrors.GetProperty("message"); if ((strErrorCode == 0) || (strErrorCode == "") || (strErrorCode == null)) { psListOfListAbos = getHierElement(psListOfType, "ListOfavailableSubscriptionTypes/availableSubscriptionTypes"); if(psListOfListAbos == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } psListOfAbos = getHierElement(psListOfListAbos, "ListOfavailableSubscriptionType"); if(psListOfAbos == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } //Process each abo one by one callin function processRecord intRecords = psListOfAbos.GetChildCount(); for(intIndex = 0; intIndex<intRecords;intIndex++) { psReturnRecord = processRecord(psListOfAbos.GetChild(intIndex)); Outputs.AddChild(psReturnRecord);//Add the current record }//End for } else { oApp.RaiseErrorText(Name() + strErrorMessage); } }// End Else }//End try catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " returnTransformedSlots Error:" + e.message); throw(e); } finally{ //variable destruction psInputs = null; psReturnRecord = null; psListOfAbos = null; psListOfType = null; psListOfListAbos = null; psListOfErrors = null; psErrors = null; intRecords = null; intIndex = null; } }

Abo MOCCA SCM
returnTransformedAbos
function returnTransformedAbos(wsOutput, Outputs){ /************************************************************************************************** * Service : ABO MOCCA SCM * Function : getTargetRestoreTime * Author : TGDJUVI1 * Purpose : MBG Autmatisierung: Abos Booking this method will return a property set with the structure in the VBC * Date : 10.09.2010 * Input : wsOutput: Property set with the EAI Output ****************psReturnOutput**********************************************************************************/ //Variable declarations var psInputs:PropertySet; var psReturnRecord:PropertySet; var psListOfAbos:PropertySet; var psListOfType:PropertySet; var psListOfListAbos:PropertySet; var psListOfErrors:PropertySet; var psErrors:PropertySet; var intRecords; var intIndex; var strErrorCode; var strErrorMessage = ""; try{ // variable initialization psInputs = TheApplication().NewPropertySet(); psListOfAbos = TheApplication().NewPropertySet(); psReturnRecord = TheApplication().NewPropertySet(); psErrors = TheApplication().NewPropertySet(); psErrors = getHierElement(wsOutput, "ListOfgetAvailableSubscriptionTypesResMsg"); if(psErrors == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".Error: response message not found"); } strErrorCode = psErrors.GetProperty("Error Code"); strErrorMessage = psErrors.GetProperty("Error Message"); if (strErrorCode != "0") { oApp.RaiseErrorText(Name() + psErrors.GetProperty("Error Message")); } else { psInputs = getHierElement(wsOutput, "ListOfgetAvailableSubscriptionTypesResMsg/getAvailableSubscriptionTypesResMsg"); if(psInputs == null) { // WS response msg is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesResMsg: response message not found"); } psListOfType = getHierElement(psInputs, "ListOfgetAvailableSubscriptionTypesRes/getAvailableSubscriptionTypesRes"); if(psListOfType == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } psListOfErrors = getHierElement(psListOfType, "ListOfconcatenatedRemark/concatenatedRemark"); if(psListOfErrors == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } strErrorCode = psListOfErrors.GetProperty("code"); strErrorMessage = psListOfErrors.GetProperty("message"); if ((strErrorCode == 0) || (strErrorCode == "") || (strErrorCode == null)) { psListOfListAbos = getHierElement(psListOfType, "ListOfavailableSubscriptionTypes/availableSubscriptionTypes"); if(psListOfListAbos == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } psListOfAbos = getHierElement(psListOfListAbos, "ListOfavailableSubscriptionType"); if(psListOfAbos == null) { // WS response is reqd oApp.RaiseErrorText(Name() + ".getAvailableSubscriptionTypesRes: response not found"); } //Process each abo one by one callin function processRecord intRecords = psListOfAbos.GetChildCount(); for(intIndex = 0; intIndex<intRecords;intIndex++) { psReturnRecord = processRecord(psListOfAbos.GetChild(intIndex)); Outputs.AddChild(psReturnRecord);//Add the current record }//End for } else { oApp.RaiseErrorText(Name() + strErrorMessage); } }// End Else }//End try catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " returnTransformedSlots Error:" + e.message); throw(e); } finally{ //variable destruction psInputs = null; psReturnRecord = null; psListOfAbos = null; psListOfType = null; psListOfListAbos = null; psListOfErrors = null; psErrors = null; intRecords = null; intIndex = null; } }

Abochange SCM
(declarations)
var oApp; var bIsTraceOn;

Abochange SCM
(declarations)
var oApp; var bIsTraceOn;

Abochange SCM
RefreshProduct
function RefreshProduct(Inputs,Outputs) { var sOrderId; var sOrderProdId; var sAssetId; var sAssetProdId; var oBOOLI; var oBCOLI; var oBOAss; var oBCAss; try { sOrderId = Inputs.GetProperty("Order Id"); oBOOLI = oApp.GetBusObject("Order Item"); oBCOLI = oBOOLI.GetBusComp("Order Entry - Line Items (Simple)"); oBCOLI.SetViewMode(AllView); oBCOLI.ClearToQuery(); oBCOLI.ActivateField("Product Id"); oBCOLI.ActivateField("Asset Id"); oBCOLI.SetSearchExpr("[Order Header Id]='"+sOrderId+"' AND [Root Order Item Id]=[Id]"); oBCOLI.ExecuteQuery(ForwardBackward); if (isRecord(oBCOLI)) { sOrderProdId = oBCOLI.GetFieldValue("Product Id"); sAssetId = oBCOLI.GetFieldValue("Asset Id"); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sAssetId=" + sAssetId); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sOrderProdId=" + sOrderProdId); oBOAss = oApp.GetBusObject("Asset Management"); oBCAss = oBOAss.GetBusComp("Asset Mgmt - Asset - Header"); oBCAss.SetViewMode(AllView); oBCAss.ClearToQuery(); oBCAss.ActivateField("Product Id"); oBCAss.SetSearchSpec("Id", sAssetId); oBCAss.ExecuteQuery(ForwardBackward); if (isRecord(oBCAss)) { sAssetProdId = oBCAss.GetFieldValue("Product Id"); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sAssetProdId=" + sAssetProdId); if (sOrderProdId != sAssetProdId) { oBCOLI.SetFieldValue("Product Id", sAssetProdId); oBCOLI.WriteRecord(); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: WriteRecord()"); } } } } finally { oBCAss = null; oBOAss = null; oBCOLI = null; oBOOLI = null; } }

Abochange SCM
RefreshProduct
function RefreshProduct(Inputs,Outputs) { var sOrderId; var sOrderProdId; var sAssetId; var sAssetProdId; var oBOOLI; var oBCOLI; var oBOAss; var oBCAss; try { sOrderId = Inputs.GetProperty("Order Id"); oBOOLI = oApp.GetBusObject("Order Item"); oBCOLI = oBOOLI.GetBusComp("Order Entry - Line Items (Simple)"); oBCOLI.SetViewMode(AllView); oBCOLI.ClearToQuery(); oBCOLI.ActivateField("Product Id"); oBCOLI.ActivateField("Asset Id"); oBCOLI.SetSearchExpr("[Order Header Id]='"+sOrderId+"' AND [Root Order Item Id]=[Id]"); oBCOLI.ExecuteQuery(ForwardBackward); if (isRecord(oBCOLI)) { sOrderProdId = oBCOLI.GetFieldValue("Product Id"); sAssetId = oBCOLI.GetFieldValue("Asset Id"); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sAssetId=" + sAssetId); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sOrderProdId=" + sOrderProdId); oBOAss = oApp.GetBusObject("Asset Management"); oBCAss = oBOAss.GetBusComp("Asset Mgmt - Asset - Header"); oBCAss.SetViewMode(AllView); oBCAss.ClearToQuery(); oBCAss.ActivateField("Product Id"); oBCAss.SetSearchSpec("Id", sAssetId); oBCAss.ExecuteQuery(ForwardBackward); if (isRecord(oBCAss)) { sAssetProdId = oBCAss.GetFieldValue("Product Id"); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: sAssetProdId=" + sAssetProdId); if (sOrderProdId != sAssetProdId) { oBCOLI.SetFieldValue("Product Id", sAssetProdId); oBCOLI.WriteRecord(); if (bIsTraceOn) oApp.Trace("Abochange SCM - RefreshProduct: WriteRecord()"); } } } } finally { oBCAss = null; oBOAss = null; oBCOLI = null; oBOOLI = null; } }

Abochange SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "Refresh Product": RefreshProduct(Inputs,Outputs); break; } } catch(e) { if (bIsTraceOn) oApp.Trace("Abochange SCM - PreInvokeMethod: " + e.toString()); throw e; } finally { oApp = null; } return (CancelOperation); }

Abochange SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "Refresh Product": RefreshProduct(Inputs,Outputs); break; } } catch(e) { if (bIsTraceOn) oApp.Trace("Abochange SCM - PreInvokeMethod: " + e.toString()); throw e; } finally { oApp = null; } return (CancelOperation); }

Abochange SCM
isRecord
function isRecord(oBC) { var bBack; var sId; try { sId = oBC.GetFieldValue("Id"); bBack = true; } catch(e) { bBack = false; } return (bBack); }

Abochange SCM
isRecord
function isRecord(oBC) { var bBack; var sId; try { sId = oBC.GetFieldValue("Id"); bBack = true; } catch(e) { bBack = false; } return (bBack); }

Abochange SCS
(declarations)
var oApp; var bIsTraceOn;

Abochange SCS
(declarations)
var oApp; var bIsTraceOn;

Abochange SCS
GenerateBatchFile
function GenerateBatchFile(sPath, Outputs) { /*************************************************************************************** ** Name: GenerateBatchFile ** Created: 28.6.2007 ** Created By: Petra Graber ** Description: Generates a batch file for MOCCA ** with all closed Retention orders from Shop and POS which contain ** a Abochange. ** abochange is executed ** Parameters: ** strPath,input Optional path where to store file ** Important: file has to be created one day before the abo change should be executed!! ** ** Update: TGDSCTHO, 20070912 ** Changed file name according to MOCCA design *****************************************************************************************/ //BEGIN OneCRM R1 SCM 2009-02-26 TGDHIAN4 - BL2: New vars to retrieve BC data. var sTarget; var sRateplan; var sBundles; var sDealerId; //END OneCRM R1 SCM 2009-02-26 TGDHIAN4 - BL2: New vars to retrieve BC data. var boAboChng; var bcAboChng; var sFileNameOut; var sPathOut; var dToday; var sExecDate; var sExecDateFile; var sExec; var oFile; var iCounter; var bIsRecord; // 03.04.2012; tgdstre0; defect 49217 var sOrderDate; var dOrderDate; try { //search all abo-change-orders which are not exported yet. sFileNameOut = ""; sPathOut = ""; dToday = new Date; sExecDate = Clib.rsprintf("%02d/%02d/%04d", dToday.getMonth()+1, dToday.getDate(), dToday.getFullYear()); sExecDateFile = ""; Clib.strftime(sExecDateFile, "%Y_%m_%d_%H_%M", Clib.localtime(Clib.time()) ); sExec = Clib.rsprintf("%02d.%02d.%04d", dToday.getDate(), dToday.getMonth()+1, dToday.getFullYear()); iCounter = 0; if (sPath.length != 0) { sPathOut = sPath; } else { sPathOut = GetPath(); } sFileNameOut = sPathOut +sExecDateFile+"_REIS"+".txt"; //TGDSCTHO, 20070912 changed boAboChng = TheApplication().GetBusObject("Abochange MOCCA SCS"); bcAboChng = boAboChng.GetBusComp("Abochange MOCCA SCS"); with (bcAboChng) { ActivateField("Abostufe"); //OneCRM R1 SCM 2009-08-24 TGDHIAN4 - BL2: Changed retrieved and written field "Account Number Calc" to "Asset Reference Number SCM" due to Issue 12467 //ActivateField("Account Number Calc"); ActivateField("Asset Reference Number SCM"); ActivateField("Bundles"); ActivateField("Dealer Id"); ActivateField("Exec Date"); ActivateField("Exec Date Calc"); ActivateField("Konsolidierung MM"); ActivateField("MMV"); ActivateField("MSISDN Calc"); ActivateField("Rateplan"); ActivateField("Status"); ActivateField("Target # SCS"); // 03.04.2012; tgdstre0; defect 49217 ActivateField("Mindestvertragsdauer SCM"); ActivateField("Kuendigungsfrist SCM"); ActivateField("Rollover SCM"); ActivateField("Datum SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchExpr("[Status] IS NULL OR [Status] <> 'Exported'"); ExecuteQuery(ForwardOnly); bIsRecord = FirstRecord(); if (bIsRecord) { //create file oFile = Clib.fopen(sFileNameOut, "at+"); //reformat exec date while(bIsRecord) { sTarget=GetFieldValue("Target # SCS"); sTarget = sTarget.replace("BSC:SUB:",""); sRateplan=GetFieldValue("Rateplan"); sBundles=GetFieldValue("Bundles"); sDealerId=GetFieldValue("Dealer Id"); // 03.04.2012; tgdstre0; defect 49217 sOrderDate = GetFieldValue("Datum SCM"); dOrderDate = new Date (sOrderDate); sOrderDate = Clib.rsprintf("%02d%02d%04d", dOrderDate.getDate(), dOrderDate.getMonth()+1, dOrderDate.getFullYear()); Clib.fputs(GetFieldValue("Asset Reference Number SCM") +";" + GetFieldValue("MSISDN Calc") + ";" + sTarget + ";" + GetFieldValue("Mindestvertragsdauer SCM") + "/" + GetFieldValue("Kuendigungsfrist SCM") + "/" + GetFieldValue("Rollover SCM") + ";" + GetFieldValue("Abostufe") + ";" + sExec + ";" + sRateplan + ";" + GetFieldValue("Konsolidierung MM") + ";" + sBundles + ";" + sDealerId + ";"

Abochange SCS
GenerateBatchFile
function GenerateBatchFile(sPath, Outputs) { /*************************************************************************************** ** Name: GenerateBatchFile ** Created: 28.6.2007 ** Created By: Petra Graber ** Description: Generates a batch file for MOCCA ** with all closed Retention orders from Shop and POS which contain ** a Abochange. ** abochange is executed ** Parameters: ** strPath,input Optional path where to store file ** Important: file has to be created one day before the abo change should be executed!! ** ** Update: TGDSCTHO, 20070912 ** Changed file name according to MOCCA design *****************************************************************************************/ //BEGIN OneCRM R1 SCM 2009-02-26 TGDHIAN4 - BL2: New vars to retrieve BC data. var sTarget; var sRateplan; var sBundles; var sDealerId; //END OneCRM R1 SCM 2009-02-26 TGDHIAN4 - BL2: New vars to retrieve BC data. var boAboChng; var bcAboChng; var sFileNameOut; var sPathOut; var dToday; var sExecDate; var sExecDateFile; var sExec; var oFile; var iCounter; var bIsRecord; // 03.04.2012; tgdstre0; defect 49217 var sOrderDate; var dOrderDate; try { //search all abo-change-orders which are not exported yet. sFileNameOut = ""; sPathOut = ""; dToday = new Date; sExecDate = Clib.rsprintf("%02d/%02d/%04d", dToday.getMonth()+1, dToday.getDate(), dToday.getFullYear()); sExecDateFile = ""; Clib.strftime(sExecDateFile, "%Y_%m_%d_%H_%M", Clib.localtime(Clib.time()) ); sExec = Clib.rsprintf("%02d.%02d.%04d", dToday.getDate(), dToday.getMonth()+1, dToday.getFullYear()); iCounter = 0; if (sPath.length != 0) { sPathOut = sPath; } else { sPathOut = GetPath(); } sFileNameOut = sPathOut +sExecDateFile+"_REIS"+".txt"; //TGDSCTHO, 20070912 changed boAboChng = TheApplication().GetBusObject("Abochange MOCCA SCS"); bcAboChng = boAboChng.GetBusComp("Abochange MOCCA SCS"); with (bcAboChng) { ActivateField("Abostufe"); //OneCRM R1 SCM 2009-08-24 TGDHIAN4 - BL2: Changed retrieved and written field "Account Number Calc" to "Asset Reference Number SCM" due to Issue 12467 //ActivateField("Account Number Calc"); ActivateField("Asset Reference Number SCM"); ActivateField("Bundles"); ActivateField("Dealer Id"); ActivateField("Exec Date"); ActivateField("Exec Date Calc"); ActivateField("Konsolidierung MM"); ActivateField("MMV"); ActivateField("MSISDN Calc"); ActivateField("Rateplan"); ActivateField("Status"); ActivateField("Target # SCS"); // 03.04.2012; tgdstre0; defect 49217 ActivateField("Mindestvertragsdauer SCM"); ActivateField("Kuendigungsfrist SCM"); ActivateField("Rollover SCM"); ActivateField("Datum SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchExpr("[Status] IS NULL OR [Status] <> 'Exported'"); ExecuteQuery(ForwardOnly); bIsRecord = FirstRecord(); if (bIsRecord) { //create file oFile = Clib.fopen(sFileNameOut, "at+"); //reformat exec date while(bIsRecord) { sTarget=GetFieldValue("Target # SCS"); sTarget = sTarget.replace("BSC:SUB:",""); sRateplan=GetFieldValue("Rateplan"); sBundles=GetFieldValue("Bundles"); sDealerId=GetFieldValue("Dealer Id"); // 03.04.2012; tgdstre0; defect 49217 sOrderDate = GetFieldValue("Datum SCM"); dOrderDate = new Date (sOrderDate); sOrderDate = Clib.rsprintf("%02d%02d%04d", dOrderDate.getDate(), dOrderDate.getMonth()+1, dOrderDate.getFullYear()); Clib.fputs(GetFieldValue("Asset Reference Number SCM") +";" + GetFieldValue("MSISDN Calc") + ";" + sTarget + ";" + GetFieldValue("Mindestvertragsdauer SCM") + "/" + GetFieldValue("Kuendigungsfrist SCM") + "/" + GetFieldValue("Rollover SCM") + ";" + GetFieldValue("Abostufe") + ";" + sExec + ";" + sRateplan + ";" + GetFieldValue("Konsolidierung MM") + ";" + sBundles + ";" + sDealerId + ";"

Abochange SCS
GetPath
function GetPath() { var sDirectory; try { sDirectory = oApp.utils.SCM_RetrieveACV("OVSD Share"); if (sDirectory.lenght == 0) { sDirectory = "/tmp/"; } else { //check whether at end of path there is already a "/" if (sDirectory.charAt(sDirectory.length - 1) != "/") sDirectory += "/"; //Append MOCCA/ sDirectory += "MOCCA/"; } if (bIsTraceOn) oApp.Trace("MOCCA: Path: "+sDirectory); } catch(e) { if (bIsTraceOn) oApp.Trace("Error within GetPath: " + e.toString() ); sDirectory = "/tmp/"; } return (sDirectory); }

Abochange SCS
GetPath
function GetPath() { var sDirectory; try { sDirectory = oApp.utils.SCM_RetrieveACV("OVSD Share"); if (sDirectory.lenght == 0) { sDirectory = "/tmp/"; } else { //check whether at end of path there is already a "/" if (sDirectory.charAt(sDirectory.length - 1) != "/") sDirectory += "/"; //Append MOCCA/ sDirectory += "MOCCA/"; } if (bIsTraceOn) oApp.Trace("MOCCA: Path: "+sDirectory); } catch(e) { if (bIsTraceOn) oApp.Trace("Error within GetPath: " + e.toString() ); sDirectory = "/tmp/"; } return (sDirectory); }

Abochange SCS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Name: Service_PreInvokeMethod ** Created: 28.06.2007 ** Created By: Petra Graber ** Description: *****************************************************************/ var strPath; try { oApp = TheApplication(); // TGDSOAN5 4.02.08 bIsTraceOn = oApp.isTraceON; // TGDSOAN5 4.02.08 switch (MethodName) { case "Generate Batch File": // generates the batch file of all abochanges gathered "today" strPath = Inputs.GetProperty("Path"); GenerateBatchFile(strPath, Outputs); break; } } finally { oApp = null; // TGDSOAN5 4.02.08 } return (CancelOperation); }

Abochange SCS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Name: Service_PreInvokeMethod ** Created: 28.06.2007 ** Created By: Petra Graber ** Description: *****************************************************************/ var strPath; try { oApp = TheApplication(); // TGDSOAN5 4.02.08 bIsTraceOn = oApp.isTraceON; // TGDSOAN5 4.02.08 switch (MethodName) { case "Generate Batch File": // generates the batch file of all abochanges gathered "today" strPath = Inputs.GetProperty("Path"); GenerateBatchFile(strPath, Outputs); break; } } finally { oApp = null; // TGDSOAN5 4.02.08 } return (CancelOperation); }

Accept Campaign SCM
Accept_Campaign
/* ** @Author TGDESIS1 ** @Date Creation 01.12.2008 ** Accept Campaign for the received Asset and it create a Service Request ** and a order (for that Service Request) if Service Change is 'Y' (Field Has ** Product of Business Component Contact-Prospect Campaign) */ function Accept_Campaign (MethodName,Inputs, Outputs) { try{ var sAsset_Id = Inputs.GetProperty("sAsset_Id"); var parConID = Inputs.GetProperty("parConID"); var sAccepted = Inputs.GetProperty("sAccepted"); var sActivated = Inputs.GetProperty("sActivated"); var numberAsset = Inputs.GetProperty("numberAsset"); var gsAMTName = Inputs.GetProperty("gsAMTName"); var sAMTId = Inputs.GetProperty("sAMTId"); var strInfoCode; var sSRId = ""; var psInput; var psOutput; var bcSR = null; var change_sr; var CampRespBC = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaign Response"); var campaignBC = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaigns"); var bcPickBC; var sAccntId; var sSetAssetNumber; var oBCLoV; var bsService; var strCampaingId; var strLanguageCode; if (campaignBC.GetFieldValue("Has Product") == "Y" && sAsset_Id != null && sAsset_Id !="") { // SCM 2009.08.28 TGDRARO6: bring Language from campaingn for PoS Application. if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { strCampaingId = campaignBC.GetFieldValue("Id"); campaignBC.ActivateField("Account Language Calc SCM"); campaignBC.ClearToQuery(); campaignBC.SetSearchSpec("Id", strCampaingId); campaignBC.ExecuteQuery(ForwardOnly); strLanguageCode = campaignBC.GetFieldValue("Account Language Calc SCM"); } // only create sr if asset id is set and campaign has a product bcSR = TheApplication().ActiveBusObject().GetBusComp("Service Request"); //RAL bcSR.ActivateField("Sub-Area"); bcSR.ActivateField("Status"); bcSR.ActivateField("Info Consult CD Not GUI SCM"); // Active only in PoS Application if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { bcSR.ActivateField("SR Language Code SCM"); } //if a sr exists this var will be set to true (cannot change asset when already set) change_sr = false; bcSR.ClearToQuery(); bcSR.SetSearchSpec("Sub-Area", "Contact in Shop"); bcSR.SetSearchSpec("Status", "Open"); bcSR.SetSearchSpec("Created By", TheApplication().LoginId()); bcSR.SetSearchSpec("Asset Id", sAsset_Id); bcSR.ExecuteQuery(ForwardOnly); if (bcSR.FirstRecord()) { TheApplication().Trace("bef. Alter Record"); change_sr = true; } else { TheApplication().Trace("bef. New Record"); bcSR.NewRecord(NewAfter); } //EORAL bcSR.SetFieldValue("Area", "Modification Order Management"); bcSR.SetFieldValue("Sub-Area", "Contract mutation"); bcSR.SetFieldValue("Info Consult CD Not GUI SCM", "Mutation"); // Write Language in PoS Application if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { bcSR.SetFieldValue("SR Language Code SCM", strLanguageCode); } //SSN Start 19.1.2006: Set Retailer in SR if (MethodName == "ButtonOrderShop"){ if (parConID != null && parConID != ""){ bcSR.SetFieldValue("Retailer Id SCM", parConID); TheApplication().Trace("Set Retailer Id " + parConID + " in SR"); } } //RAL if(!change_sr) { //EORAL bcPickBC = bcSR.GetPicklistBusComp("MSISDN SCM"); with (bcPickBC) { ActivateField("Id"); ActivateField("MSISDN SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", sAsset_Id); ExecuteQuery(ForwardBackward); if(FirstRecord()) { Pick(); } } bcPickBC = null; //RAL } //EORAL bcSR.WriteRecord(); sSRId = bcSR.GetFieldValue("Id"); sAccntId = bcSR.GetFieldValue("Account Id");

Accept Campaign SCM
Accept_Campaign
/* ** @Author TGDESIS1 ** @Date Creation 01.12.2008 ** Accept Campaign for the received Asset and it create a Service Request ** and a order (for that Service Request) if Service Change is 'Y' (Field Has ** Product of Business Component Contact-Prospect Campaign) */ function Accept_Campaign (MethodName,Inputs, Outputs) { try{ var sAsset_Id = Inputs.GetProperty("sAsset_Id"); var parConID = Inputs.GetProperty("parConID"); var sAccepted = Inputs.GetProperty("sAccepted"); var sActivated = Inputs.GetProperty("sActivated"); var numberAsset = Inputs.GetProperty("numberAsset"); var gsAMTName = Inputs.GetProperty("gsAMTName"); var sAMTId = Inputs.GetProperty("sAMTId"); var strInfoCode; var sSRId = ""; var psInput; var psOutput; var bcSR = null; var change_sr; var CampRespBC = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaign Response"); var campaignBC = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaigns"); var bcPickBC; var sAccntId; var sSetAssetNumber; var oBCLoV; var bsService; var strCampaingId; var strLanguageCode; if (campaignBC.GetFieldValue("Has Product") == "Y" && sAsset_Id != null && sAsset_Id !="") { // SCM 2009.08.28 TGDRARO6: bring Language from campaingn for PoS Application. if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { strCampaingId = campaignBC.GetFieldValue("Id"); campaignBC.ActivateField("Account Language Calc SCM"); campaignBC.ClearToQuery(); campaignBC.SetSearchSpec("Id", strCampaingId); campaignBC.ExecuteQuery(ForwardOnly); strLanguageCode = campaignBC.GetFieldValue("Account Language Calc SCM"); } // only create sr if asset id is set and campaign has a product bcSR = TheApplication().ActiveBusObject().GetBusComp("Service Request"); //RAL bcSR.ActivateField("Sub-Area"); bcSR.ActivateField("Status"); bcSR.ActivateField("Info Consult CD Not GUI SCM"); // Active only in PoS Application if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { bcSR.ActivateField("SR Language Code SCM"); } //if a sr exists this var will be set to true (cannot change asset when already set) change_sr = false; bcSR.ClearToQuery(); bcSR.SetSearchSpec("Sub-Area", "Contact in Shop"); bcSR.SetSearchSpec("Status", "Open"); bcSR.SetSearchSpec("Created By", TheApplication().LoginId()); bcSR.SetSearchSpec("Asset Id", sAsset_Id); bcSR.ExecuteQuery(ForwardOnly); if (bcSR.FirstRecord()) { TheApplication().Trace("bef. Alter Record"); change_sr = true; } else { TheApplication().Trace("bef. New Record"); bcSR.NewRecord(NewAfter); } //EORAL bcSR.SetFieldValue("Area", "Modification Order Management"); bcSR.SetFieldValue("Sub-Area", "Contract mutation"); bcSR.SetFieldValue("Info Consult CD Not GUI SCM", "Mutation"); // Write Language in PoS Application if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel eChannel for CME") { bcSR.SetFieldValue("SR Language Code SCM", strLanguageCode); } //SSN Start 19.1.2006: Set Retailer in SR if (MethodName == "ButtonOrderShop"){ if (parConID != null && parConID != ""){ bcSR.SetFieldValue("Retailer Id SCM", parConID); TheApplication().Trace("Set Retailer Id " + parConID + " in SR"); } } //RAL if(!change_sr) { //EORAL bcPickBC = bcSR.GetPicklistBusComp("MSISDN SCM"); with (bcPickBC) { ActivateField("Id"); ActivateField("MSISDN SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", sAsset_Id); ExecuteQuery(ForwardBackward); if(FirstRecord()) { Pick(); } } bcPickBC = null; //RAL } //EORAL bcSR.WriteRecord(); sSRId = bcSR.GetFieldValue("Id"); sAccntId = bcSR.GetFieldValue("Account Id");

Accept Campaign SCM
Delete_Campaign
/* ** @Author TGDESIS1 ** @Date Creation 02.12.2008 ** Delete this campaign associate to Contact if the client Accept ** (completely o partly) the campaign or if he rejects it */ function Delete_Campaign (idCamp){ try{ var bcContact = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaigns"); var bcAssetContact = TheApplication().ActiveBusObject().GetBusComp("Asset Contact Campaign SCM"); /*with(bcContact){ ClearToQuery(); SetSearchSpec("Id", idCamp); ExecuteQuery(ForwardOnly); DeleteRecord(); } with(bcAssetContact){ ActivateField("Asset Id SCM"); ActivateField("Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Campaign Contact Id SCM", idCamp); ExecuteQuery(); if(FirstRecord()){ do{ DeleteRecord(); }while(NextRecord()) } }*/ }catch(e){ TheApplication().Trace(this.Name()+"Error: "+e.toString()); throw e; } finally{ bcContact = null; bcAssetContact = null; } }

Accept Campaign SCM
Delete_Campaign
/* ** @Author TGDESIS1 ** @Date Creation 02.12.2008 ** Delete this campaign associate to Contact if the client Accept ** (completely o partly) the campaign or if he rejects it */ function Delete_Campaign (idCamp){ try{ var bcContact = TheApplication().ActiveBusObject().GetBusComp("Contact-Prospect Campaigns"); var bcAssetContact = TheApplication().ActiveBusObject().GetBusComp("Asset Contact Campaign SCM"); /*with(bcContact){ ClearToQuery(); SetSearchSpec("Id", idCamp); ExecuteQuery(ForwardOnly); DeleteRecord(); } with(bcAssetContact){ ActivateField("Asset Id SCM"); ActivateField("Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Campaign Contact Id SCM", idCamp); ExecuteQuery(); if(FirstRecord()){ do{ DeleteRecord(); }while(NextRecord()) } }*/ }catch(e){ TheApplication().Trace(this.Name()+"Error: "+e.toString()); throw e; } finally{ bcContact = null; bcAssetContact = null; } }

Accept Campaign SCM
Service_PreInvokeMethod
/* ** @Author TGDESIS1 ** @Date Creation 01.12.2008 ** Business Service for Accept Campaign (completely or partly) or ** delete associate campaign to a contact */ function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { try{ switch(MethodName){ case "AcceptCampaign": Accept_Campaign(MethodName,Inputs,Outputs); return (CancelOperation); break; case "DeleteCampaign": Delete_Campaign(Inputs.GetProperty("idCamp")); return (CancelOperation); break; default: TheApplication().Trace("Default"); return (ContinueOperation); break; } }catch(e){ } }

Accept Campaign SCM
Service_PreInvokeMethod
/* ** @Author TGDESIS1 ** @Date Creation 01.12.2008 ** Business Service for Accept Campaign (completely or partly) or ** delete associate campaign to a contact */ function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { try{ switch(MethodName){ case "AcceptCampaign": Accept_Campaign(MethodName,Inputs,Outputs); return (CancelOperation); break; case "DeleteCampaign": Delete_Campaign(Inputs.GetProperty("idCamp")); return (CancelOperation); break; default: TheApplication().Trace("Default"); return (ContinueOperation); break; } }catch(e){ } }

Account - SAP 46C Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 46C Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 46C Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 46C Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send

Account - SAP 46C Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 46C Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 46C Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 46C Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send

Account - SAP 46C Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 46C Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 46C Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 46C Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send

Account - SAP 46C Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 46C Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 46C Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 46C Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 46C Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 46C Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_46CIDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 46C Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 46C Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_46CIDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = OrgBusObject.GetBusComp("SAP Organization"); SABusComp.ClearToQuery(); // SABusComp.SetSearchSpec("Back Office Sales Organization", TheApplication().InvokeMethod ("LookupValue", "SAP_SALES_ORG", SalesOrg)); // SABusComp.SetSearchSpec("Back Office Distribution Channel", TheApplication().InvokeMethod ("LookupValue", "SAP_DISTRIBUTION_CHANNEL", DistChannel)); // SABusComp.SetSearchSpec("Back Office Division", TheApplication().InvokeMethod ("LookupValue", "SAP_DIVN_CD", DivCode)); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); SABusComp.ActivateField("Organization Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Organization Id"); } else return null; }

Account - SAP 46C Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_46CIDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = OrgBusObject.GetBusComp("SAP Organization"); SABusComp.ClearToQuery(); // SABusComp.SetSearchSpec("Back Office Sales Organization", TheApplication().InvokeMethod ("LookupValue", "SAP_SALES_ORG", SalesOrg)); // SABusComp.SetSearchSpec("Back Office Distribution Channel", TheApplication().InvokeMethod ("LookupValue", "SAP_DISTRIBUTION_CHANNEL", DistChannel)); // SABusComp.SetSearchSpec("Back Office Division", TheApplication().InvokeMethod ("LookupValue", "SAP_DIVN_CD", DivCode)); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); SABusComp.ActivateField("Organization Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Organization Id"); } else return null; }

Account - SAP 46C Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_46CIDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = OrgBusObject.GetBusComp("SAP Organization"); SABusComp.ClearToQuery(); // SABusComp.SetSearchSpec("Back Office Sales Organization", TheApplication().InvokeMethod ("LookupValue", "SAP_SALES_ORG", SalesOrg)); // SABusComp.SetSearchSpec("Back Office Distribution Channel", TheApplication().InvokeMethod ("LookupValue", "SAP_DISTRIBUTION_CHANNEL", DistChannel)); // SABusComp.SetSearchSpec("Back Office Division", TheApplication().InvokeMethod ("LookupValue", "SAP_DIVN_CD", DivCode)); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); SABusComp.ActivateField("Organization Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Organization Id"); } else return null; }

Account - SAP 46C Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps
ReceiveAccount_46CIDOCToSiebel
function ReceiveAccount_46CIDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 46C Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 46C Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM005, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account Status", "Active"); else oAccountComp.

Account - SAP 46C Maps
ReceiveAccount_46CIDOCToSiebel
function ReceiveAccount_46CIDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 46C Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 46C Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM005, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account Status", "Active"); else oAccountComp.

Account - SAP 46C Maps
ReceiveAccount_46CIDOCToSiebel
function ReceiveAccount_46CIDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 46C Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 46C Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM005, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 46C Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account Status", "Active"); else oAccountComp.

Account - SAP 46C Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 46C Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 46C Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 46C Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 46C Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 46C Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 46C Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 46C Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 46C Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 46C Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 46C Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 46C Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 46C Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 46C Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 46C Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 46C Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 46C Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 46C Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 46C Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 46C Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 46C Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 46C Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 46C Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 46C Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 46C Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 46C Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 46C Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 46C Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 46C Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 46C Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 46C Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 46C Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 46C Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */

Account - SAP 46C Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 46C Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */

Account - SAP 46C Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 46C Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 46C Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */

Account - SAP 46C Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 46C Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 46C Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 46C Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 46C Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 46C Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 46C Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 46C Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 46C Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 46C Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 46C Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 46C Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 46C Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 46C Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 46C Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 46C Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 46C Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 46C Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 46C Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 46C Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 46C Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 46C Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 46C Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 46C Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 46C Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 46C Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 46C Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 46C Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 46C Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 46C Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 47 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 47 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 47 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 47 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 47 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 47 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 47 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 47 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 47 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 47 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 47 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 47 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 47 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 47 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 47 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 47 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 47 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 47 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 47 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 47 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 47 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 47 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 47 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 47 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 47 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 47 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error??? /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 47 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 47 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 47 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 47 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 47 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 47 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 47 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 47 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR", "In

Account - SAP 47 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 47 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR", "In

Account - SAP 47 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 47 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 47 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 47 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 47 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR", "In

Account - SAP 47 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 47 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 47 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 47 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 47 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 47 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 47 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 47 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 47 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 47 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 47 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 47 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 47 Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps - History
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 47 Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 47 Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oG

Account - SAP 47 Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 47 Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oG

Account - SAP 47 Maps - History
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP 47 Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oG

Account - SAP 47 Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 47 Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 47 Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 47 Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 47 Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 47 Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 47 Maps - History
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP 47 Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP 47 Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP 47 Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("TRANSACTION_GROUP", "0"); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP 47 Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 47 Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 47 Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 47 Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 47 Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 47 Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 47 Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 47 Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 47 Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 47 Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 47 Maps - History
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP 47 Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP 47 Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP 47 Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP 47 Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp); oOrderOrgComp.SetFieldValue ( "IsPrimaryMVG", "Y"); oOrderOrgComp.CopyFieldValue ( "Organization Id", "SAP Organization Id (MO)"); } } }

Account - SAP 47 Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps - History
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 47 Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 47 Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 47 Maps - History
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP 50 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 50 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 50 Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP 50 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 50 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 50 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 50 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 50 Maps
CheckSAPCustomer_CallBAPI
function CheckSAPCustomer_CallBAPI (inputMsg, outputMsg) { /* Referenced in workflow Account - Check SAP 46C Customer * Input Object: * Account - Send or Receive SAP 50 Customer (Siebel 77) * * * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * set property "customerExists" to true or false in outputMsg * if customer does not exist, set "EAI Sync Error Text" */ // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * temporary variables */ var customerExists = false; var errorType; /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account var oAccountObj; var oAccountComp; iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Create new property sets for BAPI call to SAP and create adapter bus service */ var inputBAPI = TheApplication().NewPropertySet(); var outputBAPI = TheApplication().NewPropertySet(); var inputBAPIMsg = EAICreateIntMsgOut (inputBAPI); var iBAPIObj = inputBAPIMsg.CreateIntObj ("Account - Check SAP 47 Customer Existence (BAPI Input)"); inputBAPIMsg.SetArgument ("OutputIntObjectName", "Account - Check SAP 47 Customer Existence (BAPI Output)"); inputBAPIMsg.SetArgument ("SAPAutoError","False"); var bapiAdapter = TheApplication().GetService("EAI SAP BAPI Adapter"); var oBAPIObj; var oBAPIExportComp; var iBAPIImportComp; /* * create top-level integration object */ if (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ iBAPIObj.NewInstance (); iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); iBAPIImportComp = iBAPIObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { var IntId = iAccountComp.GetFieldValue ("Integration Id"); var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ iBAPIImportComp.NewRecord (); iBAPIImportComp.SetFieldValue ("CUSTOMERNO", IntId); /* * Loop over sales orgs, call BAPI for each until one suceeds */ var iSalesAreaAccountComp = iAccountComp.GetIntComp ("SAP 4x Account Sales Area"); while (iSalesAreaAccountComp.NextRecord() ) { /* Copy sales org info */ iBAPIImportComp.SetCopySource ( iSalesAreaAccountComp ); iBAPIImportComp.CopyFieldValue( "SALES_ORGANIZATION", "Back Office Sales Organization"); iBAPIImportComp.CopyFieldValue( "DISTRIBUTION_CHANNEL", "Back Office Distribution Channel"); iBAPIImportComp.CopyFieldValue( "DIVISION", "Back Office Sales Area Division Code"); // call BAPI bapiAdapter.InvokeMethod ("Execute", inputBAPI, outputBAPI); // test output oBAPIExportComp = ((outputBAPI.GetChild(0)).GetChild(0)).GetChild(0); errorType = oBAPIExportComp.GetProperty ("RETURN-TYPE"); if (errorType != "E") { customerExists = true; break; } outputBAPI.Reset(); } // endloop iSalesAreaAccountComp.NextRecord() } // endif iAccountComp.NextRecord() } // endif iAccountObj.NextInstance() oAccountObj = outputMsg.CreateIntObj ("Account - Send or Re

Account - SAP 50 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 50 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 50 Maps
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { // not currently used /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("SAP 4x BAPI_TRANSACTION_COMMIT (BAPI Input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

Account - SAP 50 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetAccountName
function GetAccountName (Int_ID) {// referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", Int_ID); AccBusComp.ActivateField("Name"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 50 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 50 Maps
GetAccountStatus
function GetAccountStatus (oIntId) { // referenced by script ReceiveAccount_47IDOCToSiebel var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Integration Id", oIntId); AccBusComp.ActivateField("Account Status"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { return AccBusComp.GetFieldValue("Account Status"); } else return null; }

Account - SAP 50 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetLangIndCode
function GetLangIndCode (Type, DisplayVal) { var CatBusObject = TheApplication().GetBusObject("PickList Generic"); var SABusComp = CatBusObject.GetBusComp("PickList Generic"); SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Type", Type); SABusComp.SetSearchSpec("Value", DisplayVal); SABusComp.ActivateField("Name"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { return SABusComp.GetFieldValue("Name"); } else return null; }

Account - SAP 50 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 50 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 50 Maps
GetSalesArea
function GetSalesArea (SalesOrg, DistChannel, DivCode) { // referenced by script ReceiveAccount_47IDOCToSiebel var OrgBusObject = TheApplication().GetBusObject("Organizations"); var SABusComp = OrgBusObject.GetBusComp("Organization"); SABusComp.SetViewMode(3); // All Mode SABusComp.ClearToQuery(); SABusComp.SetSearchSpec("Back Office Sales Organization", SalesOrg); SABusComp.SetSearchSpec("Back Office Distribution Channel", DistChannel); SABusComp.SetSearchSpec("Back Office Division", DivCode); // SABusComp.ActivateField("Organization Id"); SABusComp.ActivateField("Party Id"); SABusComp.ExecuteQuery(); if(SABusComp.FirstRecord()) { // return SABusComp.GetFieldValue("Organization Id"); return SABusComp.GetFieldValue("Party Id"); } else return null; }

Account - SAP 50 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 50 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 50 Maps
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP 50 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 50 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 50 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM001, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 50 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 50 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 50 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM001, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 50 Maps
ReceiveAccount_47IDOCToSiebel
function ReceiveAccount_47IDOCToSiebel (inputMsg, outputMsg) { // referenced by workflow Account - Receive SAP 50 Customer /* Input Objects' Integration Components * Account - Send or Receive SAP 50 Customer (DEBMAS05) * E2KNA1M005, E2KNVKM001, E2DNVVM006, E2KNKKM001, E2KNVPM002 * Output Object's Integration Components: * Account - Send or Receive SAP 50 Customer (Siebel 77) * Account * Contact * Business Address */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); var defaultOrgLM = EAIGetValueMap ("Default Org", "Siebel Inbound"); var undefinedOrgLM = EAIGetValueMap ("Undefined SAP Org", "Siebel Inbound"); var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Inbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Inbound"); /* Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact var oCustAcctGrp; // Customer Account Group var oIntId; // SAP Customer Number var oAcctSts; // Account Status var regCode; // SAP Country + Region Code (12-90S337) var sapCode; // SAP Region Code (12-90S337) var osiebReg; // Siebel Region (12-90S337) var AcctIntId // Account Integration Id for Contact (12-C34KYN) /* Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* Misc set up */ // var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only /* Read int object instances from EAI message */ enumObj: while (iIDOCObj.NextInstance ()) { /* Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); if( !iIDOCComp.NextRecord() ) continue enumObj; // TODO: Root component is missing - log an error /* Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M005"); if( !iKNA1MComp.NextRecord() ) continue enumObj; /* Create "Account" object */ oAccountObj.NewInstance (); /* Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* Set Integration Id and Name */ oIntId = iKNA1MComp.GetFieldValue ("KUNNR"); var Name = iKNA1MComp.GetFieldValue ("NAME1"); oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); AcctIntId = oIntId ; // Account Integration Id for Contact (12-C34KYN) oCustAcctGrp = acctGroupLM.Translate (iKNA1MComp.GetFieldValue ("KTOKD")); var AcctGrp = TheApplication().InvokeMethod ("LookupValue", "ACCOUNT_GROUP_TYPE", oCustAcctGrp); oAccountComp.SetFieldValue ("Customer Account Group", AcctGrp); /* Set location to "<City> KUNNR1" If <City> is null, put "No City" */ var location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if customer is Marked for Deletion */ if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") { oAccountComp.SetFieldValue ("Account Status", "Marked For Deletion"); } else { oAcctSts = GetAccountStatus (oIntId); if (oAcctSts == "Marked For Deletion") oAccountComp.SetFieldValue ("Account

Account - SAP 50 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 50 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 50 Maps
RequestCustomerNumber_BAPIToSiebel
function RequestCustomerNumber_BAPIToSiebel (inputMsg, outputMsg) { /* Input Objects' Integration Components * BAPI Export (Account - Get SAP 47 Internal Customer Number (BAPI Output)) * Export Parameters (output) * CUSTOMERID * * Output Object's Integration Components: * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Integration Id, Location, Sync status data (oAccount) */ /* * Set up EAI Input Message objects */ var iBAPIObj; // BAPI object instance var iExportComp; // BAPI Export Parameters // Store inputId for later use var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account /* * Find and create top-level integration object */ iBAPIObj = inputMsg.GetIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); /* * Read int object instances from EAI message */ while (iBAPIObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iExportComp = iBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oAccountComp.SetCopySource (iExportComp); oAccountComp.CopyFieldValue ("EAI Sync Error Text", "RETURN-MESSAGE"); var ErrorType = iExportComp.GetFieldValue ("RETURN-TYPE"); if (ErrorType != "E") { /* * Update "Account" component */ oAccountComp.CopyFieldValue ("Integration Id", "CUSTOMERID"); var customerno = iExportComp.GetFieldValue ("CUSTOMERID"); var timenow = Timestamp(); var SyncStat = TheApplication().InvokeMethod ("LookupValue", "EAI_ACCOUNT_SYNC_STATUS", "Created in Back Office"); oAccountComp.SetFieldValue ("EAI Sync Status Code", SyncStat); oAccountComp.SetFieldValue ("EAI Sync Date",timenow); /* * Get Address Info to create the location field with * embedded customer number */ var AccBusObject = TheApplication().GetBusObject("Account"); var AccBusComp = AccBusObject.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusComp.SetViewMode(3); AccBusComp.ClearToQuery(); AccBusComp.SetSearchSpec("Id", inputId); AccBusComp.ActivateField("Location"); AccBusComp.ExecuteQuery(); if(AccBusComp.FirstRecord()) { var city = AccBusComp.GetFieldValue("City"); var location = AccBusComp.GetFieldValue("Location"); /* * Site */ if (location == "") { location = AccBusComp.GetFieldValue("City"); } location += " " + customerno; oAccountComp.SetFieldValue ("Location", location ); } } } } // while (iCreateAccountObj.NextInstance ()) } //function RequestCustomerNumber_BAPIToSiebel

Account - SAP 50 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 50 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 50 Maps
RequestCustomerNumber_SiebelToBAPI
function RequestCustomerNumber_SiebelToBAPI (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * Account (Account) * * * Output Object's Integration Components: * Account - Get SAP 47 Internal Customer Number (BAPI Input) */ /* Set up EAI Lookup maps */ var acctGroupLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); /* * Set up EAI Input Message objects */ var iAccountObj; // Account object instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oBAPIObj; // BAPI object instance var oBAPIImportComp; // BAPI Import parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oBAPIObj = outputMsg.CreateIntObj ("Account - Get SAP 47 Internal Customer Number (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create BAPI object in output message */ oBAPIObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oBAPIImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); while (iAccountComp.NextRecord ()) { /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") != "") { var IntId = iAccountComp.GetFieldValue ("Integration Id"); EAIRaiseError(LocalizeMessage("ERR_MSG_ACCOUNT_EXISTS,"+IntId+""));//nbc } /* * Validate Address */ var iAddrComp = iAccountComp.GetIntComp ("Account_Business Address"); var AddressFlag = "N"; if (iAddrComp.Exists ()) { while (iAddrComp.NextRecord()) { if (iAddrComp.GetFieldValue ("IsPrimaryMVG") == "Y") { AddressFlag = "Y"; } } } /* * Return an error if no address is found */ if (AddressFlag == "N") { EAIRaiseError(LocalizeMessage("ERR_MSG_INVALID_ADDRESS," + "")); } /* * Write "Import Parameters" component */ oBAPIImportComp.NewRecord (); oBAPIImportComp.SetFieldValue ("QUANTITY", "1"); var acctGroup = iAccountComp.GetFieldValue("Customer Account Group"); oBAPIImportComp.SetFieldValue ("ACCOUNTGROUP", acctGroupLM.Translate(acctGroup)); } //while (iAccountComp.NextRecord ()) } //while (iAccountObj.NextInstance ()) } //function RequestCustomerNumber_SiebelToBAPI

Account - SAP 50 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 50 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM001", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 50 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 50 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM001", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 50 Maps
SendAccount_SiebelToDEBMAS05
function SendAccount_SiebelToDEBMAS05 (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Send or Receive SAP 50 Customer (Siebel 77)) * * Output Object's Integration Components: * Customer IDOC (Account - Send or Receive SAP 50 Customer (DEBMAS05)) */ /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var languageLM = EAIGetValueMap ("SAP Language 4x", "Siebel Outbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Outbound"); var acctGrpLM = EAIGetValueMap ("SAP Customer Acct Group Code", "Siebel Outbound"); var regCodeLM = EAIGetValueMap ("Back Office Region", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iAddrComp; // Address var iContactComp; // Contact /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oKNA1MComp; // IDOC Customer Header var oComp; // for reading child components /* Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Send or Receive SAP 50 Customer (Siebel 77)"); oIDOCObj = outputMsg.CreateIntObj ("Account - Send or Receive SAP 50 Customer (DEBMAS05)"); /* Misc set up */ var generateMasterRecord = 1; // Set to '0' to generate sub-organization records only var custAccntGrp; var currencyCode; var ctr = 0; var countryCode; var regCode; var sapCode; /* Read int object instances from EAI message */ enumObj: while (iAccountObj.NextInstance ()) { /* Read root Account component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); if( !iAccountComp.NextRecord() ) continue enumObj; /* * Return an error if Integration Id is not null */ if (iAccountComp.GetFieldValue ("Integration Id") == "") { var errMsg = iAccountComp.GetFieldValue ("EAI Sync Error Text"); EAIRaiseError ( errMsg ); } /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); oKNA1MComp = oIDOCComp.CreateIntComp ("E2KNA1M005",false); oKNA1MComp.NewRecord (); oKNA1MComp.SetCopySource (iAccountComp); /* Set Integration Id, Name and Account Group*/ oKNA1MComp.CopyFieldValue ("KUNNR", "Integration Id"); oKNA1MComp.CopyFieldValue ("NAME1", "Name"); oKNA1MComp.SetFieldValue ("KTOKD", acctGrpLM.Translate (iAccountComp.GetFieldValue("Customer Account Group"))); /* Set location */ // oKNA1MComp.CopyFieldValue ("ORT01", "Location"); /* Account Status */ // oKNA1MComp.CopyFieldValue ("AUFSD", "Account Status" ); oKNA1MComp.SetFieldValue ("LOEVM", ""); if (iAccountComp.GetFieldValue ("Account Status") == "Marked For Deletion") oKNA1MComp.SetFieldValue ("LOEVM", "X"); /* Primary Industry */ // oKNA1MComp.CopyFieldValue ("BRSCH", "Primary Industry Id"); /* Tax Exempt Number (not created in bus comp for VAT_REGN_NUM yet) */ // oKNA1MComp.CopyFieldValue ("STCEG", "" ); /* Search Term */ oKNA1MComp.CopyFieldValue ("SORTL", "Name"); /* Transportation Zone */ // oKNA1MComp.SetFieldValue ("LZONE", "0000000001"); /* Set language code */ oKNA1MComp.SetFieldValue ("SPRAS", languageLM.Translate (iAccountComp.GetFieldValue ("Language Code"))); /* Set main Phone/FAX numbers */ oKNA1MComp.CopyFieldValue ("TELF1", "Main Phone Number" ); oKNA1MComp.CopyFieldValue ("TELFX", "Main Fax Number" ); /* Read "KNVKM" component */ iContactComp = iAccountComp.GetIntComp ("Contact"); oComp = oKNA1MComp.CreateIntComp ("E2KNVKM001", false); while (iContactComp.NextRecord ()) { /* Write "Contact" component */ oComp.NewRecord (); oComp.SetCopySource (iContactComp); // oComp.CopyFieldValue ("PARNR",

Account - SAP 50 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 50 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 50 Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Account - SAP 50 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 50 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 50 Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Account - SAP 50 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 50 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 50 Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account - SAP 50 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 50 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP 50 Maps
Timestamp()
function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account - SAP Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: P. Lim // // DESCRIPTION // Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: P. Lim // // DESCRIPTION // Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: P. Lim // // DESCRIPTION // Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (Siebel)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (Siebel)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Get List for Account Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.NewRecord (); oGLOutputComp.SetCopySource (iGLExportComp); oGLOutputComp.SetFieldValue ("Input Id", inputId); oGLOutputComp.CopyFieldValue ("Return Code", "RETURN-CODE"); oGLOutputComp.CopyFieldValue ("Return Log Msg No", "RETURN-LOG_MSG_NO"); oGLOutputComp.CopyFieldValue ("Return Log No", "RETURN-LOG_NO"); oGLOutputComp.CopyFieldValue ("Return Message", "RETURN-MESSAGE"); oGLOutputComp.CopyFieldValue ("Return Type", "RETURN-TYPE"); /* * Read "Order Header" component to */ iGLHeaderComp = iGLExportComp.GetIntComp ("Order Header"); oGLHeaderComp = oAccountComp.CreateIntComp ("Get List for Account Header", oAccountComp); while (iGLHeaderComp.NextRecord ()) { oGLHeaderComp.NewRecord (); oGLHeaderComp.SetCopySource (iGLHeaderComp); oGLHeaderComp.SetFieldValue ("Input Id", inputId); oGLHeaderComp.CopyFieldValue ("Currency", "CURRENCY"); oGLHeaderComp.CopyFieldValue ("Distribution Channel", "DISTR_CHAN"); oGLHeaderComp.CopyFieldValue ("Division", "DIVISION"); oGLHeaderComp.CopyFieldValue ("Order Date", "DOC_DATE"); oGLHeaderComp.CopyFieldValue ("Order Number", "SD_DOC"); oGLHeaderComp.CopyFieldValue ("Order Status", "DOC_STATUS"); oGLHeaderComp.CopyFieldValue ("Order Type", "DOC_TYPE"); oGLHeaderComp.CopyFieldValue ("Purchase Order", "PURCH_NO"); oGLHeaderComp.CopyFieldValue ("Sales Organization", "SALES_ORG"

Account - SAP Maps
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (Siebel)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (Siebel)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Get List for Account Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.NewRecord (); oGLOutputComp.SetCopySource (iGLExportComp); oGLOutputComp.SetFieldValue ("Input Id", inputId); oGLOutputComp.CopyFieldValue ("Return Code", "RETURN-CODE"); oGLOutputComp.CopyFieldValue ("Return Log Msg No", "RETURN-LOG_MSG_NO"); oGLOutputComp.CopyFieldValue ("Return Log No", "RETURN-LOG_NO"); oGLOutputComp.CopyFieldValue ("Return Message", "RETURN-MESSAGE"); oGLOutputComp.CopyFieldValue ("Return Type", "RETURN-TYPE"); /* * Read "Order Header" component to */ iGLHeaderComp = iGLExportComp.GetIntComp ("Order Header"); oGLHeaderComp = oAccountComp.CreateIntComp ("Get List for Account Header", oAccountComp); while (iGLHeaderComp.NextRecord ()) { oGLHeaderComp.NewRecord (); oGLHeaderComp.SetCopySource (iGLHeaderComp); oGLHeaderComp.SetFieldValue ("Input Id", inputId); oGLHeaderComp.CopyFieldValue ("Currency", "CURRENCY"); oGLHeaderComp.CopyFieldValue ("Distribution Channel", "DISTR_CHAN"); oGLHeaderComp.CopyFieldValue ("Division", "DIVISION"); oGLHeaderComp.CopyFieldValue ("Order Date", "DOC_DATE"); oGLHeaderComp.CopyFieldValue ("Order Number", "SD_DOC"); oGLHeaderComp.CopyFieldValue ("Order Status", "DOC_STATUS"); oGLHeaderComp.CopyFieldValue ("Order Type", "DOC_TYPE"); oGLHeaderComp.CopyFieldValue ("Purchase Order", "PURCH_NO"); oGLHeaderComp.CopyFieldValue ("Sales Organization", "SALES_ORG"

Account - SAP Maps
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (Siebel)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (Siebel)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Get List for Account Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.NewRecord (); oGLOutputComp.SetCopySource (iGLExportComp); oGLOutputComp.SetFieldValue ("Input Id", inputId); oGLOutputComp.CopyFieldValue ("Return Code", "RETURN-CODE"); oGLOutputComp.CopyFieldValue ("Return Log Msg No", "RETURN-LOG_MSG_NO"); oGLOutputComp.CopyFieldValue ("Return Log No", "RETURN-LOG_NO"); oGLOutputComp.CopyFieldValue ("Return Message", "RETURN-MESSAGE"); oGLOutputComp.CopyFieldValue ("Return Type", "RETURN-TYPE"); /* * Read "Order Header" component to */ iGLHeaderComp = iGLExportComp.GetIntComp ("Order Header"); oGLHeaderComp = oAccountComp.CreateIntComp ("Get List for Account Header", oAccountComp); while (iGLHeaderComp.NextRecord ()) { oGLHeaderComp.NewRecord (); oGLHeaderComp.SetCopySource (iGLHeaderComp); oGLHeaderComp.SetFieldValue ("Input Id", inputId); oGLHeaderComp.CopyFieldValue ("Currency", "CURRENCY"); oGLHeaderComp.CopyFieldValue ("Distribution Channel", "DISTR_CHAN"); oGLHeaderComp.CopyFieldValue ("Division", "DIVISION"); oGLHeaderComp.CopyFieldValue ("Order Date", "DOC_DATE"); oGLHeaderComp.CopyFieldValue ("Order Number", "SD_DOC"); oGLHeaderComp.CopyFieldValue ("Order Status", "DOC_STATUS"); oGLHeaderComp.CopyFieldValue ("Order Type", "DOC_TYPE"); oGLHeaderComp.CopyFieldValue ("Purchase Order", "PURCH_NO"); oGLHeaderComp.CopyFieldValue ("Sales Organization", "SALES_ORG"

Account - SAP Maps
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (Siebel)) * Account (iAccount) * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (Siebel)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); oGLImportComp.CopyFieldValue ("CUSTOMER_NUMBER", "Integration Id"); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("SALES_ORGANIZATION", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", ""); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", ""); // Empty string means "00000000" } } }

Account - SAP Maps
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (Siebel)) * Account (iAccount) * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (Siebel)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); oGLImportComp.CopyFieldValue ("CUSTOMER_NUMBER", "Integration Id"); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("SALES_ORGANIZATION", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", ""); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", ""); // Empty string means "00000000" } } }

Account - SAP Maps
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (Siebel)) * Account (iAccount) * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iAccountObj; // Siebel Account instance var iAccountComp; // Account /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (Siebel)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); oGLImportComp.CopyFieldValue ("CUSTOMER_NUMBER", "Integration Id"); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("SALES_ORGANIZATION", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", ""); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", ""); // Empty string means "00000000" } } }

Account - SAP Maps
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); oOrderComp.CopyFieldValue ("Order Number", "Order Number"); oOrderComp.SetFieldValue ("Order Type", orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderComp.CopyFieldValue ("SAP Sales Area", "SAP Sales Area"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // oOrderComp.SetFieldValue ("Organization", "Siebel Administration"); } } }

Account - SAP Maps
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); oOrderComp.CopyFieldValue ("Order Number", "Order Number"); oOrderComp.SetFieldValue ("Order Type", orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderComp.CopyFieldValue ("SAP Sales Area", "SAP Sales Area"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // oOrderComp.SetFieldValue ("Organization", "Siebel Administration"); } } }

Account - SAP Maps
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); oOrderComp.CopyFieldValue ("Order Number", "Order Number"); oOrderComp.SetFieldValue ("Order Type", orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); oOrderComp.CopyFieldValue ("SAP Sales Area", "SAP Sales Area"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // oOrderComp.SetFieldValue ("Organization", "Siebel Administration"); } } }

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel
function ReceiveSAPCustomer_IDOCToSiebel (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAccountComp.

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel
function ReceiveSAPCustomer_IDOCToSiebel (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAccountComp.

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel
function ReceiveSAPCustomer_IDOCToSiebel (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAccountComp.

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel_4x
function ReceiveSAPCustomer_IDOCToSiebel_4x (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (4x IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (4x IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAcc

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel_4x
function ReceiveSAPCustomer_IDOCToSiebel_4x (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (4x IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (4x IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAcc

Account - SAP Maps
ReceiveSAPCustomer_IDOCToSiebel_4x
function ReceiveSAPCustomer_IDOCToSiebel_4x (inputMsg, outputMsg) { var app = TheApplication(); var msg; /* Input Objects' Integration Components * Customer IDOC (Account - Receive SAP Customer (4x IDOC Input)) * E2KNA1M * E2KNB1M002 (?) * E2KNVKM (?) * E2KNVVM (?) * * Output Object's Integration Components: * Account Object (Account - Receive SAP Customer (Siebel)) * Account (oAccount) * Contact * Business Address */ /* * Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Inbound"); var languageLM = EAIGetValueMap ("SAP Language", "Siebel Inbound"); var countryLM = EAIGetValueMap ("SAP Country", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iIDOCObj; // IDOC instance var iIDOCComp; // top level IDOC segment var iKNA1MComp; // IDOC Customer Header var iComp; // for reading child components /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Account instance var oAccountComp; // Account var oAddrComp; // Address var oContactComp; // Contact /* * Find and create top-level integration object */ iIDOCObj = inputMsg.GetIntObj ("Account - Receive SAP Customer (4x IDOC Input)"); oAccountObj = outputMsg.CreateIntObj ("Account - Receive SAP Customer (Siebel)"); /* * Read int object instances from EAI message */ while (iIDOCObj.NextInstance ()) { /* * Create "Account" object */ oAccountObj.NewInstance (); // app.MsgBox("foo"); /* * Read virtual root component that IDOC RFC Adapter populates */ iIDOCComp = iIDOCObj.GetPrimaryIntComp ("Idoc Segments"); iIDOCComp.NextRecord (); /* * Read "KNA1M" component */ iKNA1MComp = iIDOCComp.GetIntComp ("E2KNA1M"); if (iKNA1MComp.NextRecord ()) { /* * Create "Account" component in output message */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); oAccountComp.SetCopySource (iKNA1MComp); /* * Set Integration Id and Name */ oAccountComp.CopyFieldValue ("Integration Id", "KUNNR"); oAccountComp.CopyFieldValue ("Name", "NAME1"); /* * Set location to "<City> KUNNR1" * If <City> is null, put "No City" */ var location; location = iKNA1MComp.GetFieldValue ("ORT01"); if (location == null) location = "No City"; location += " " + iKNA1MComp.GetFieldValue ("KUNNR"); oAccountComp.SetFieldValue ("Location", location); /* Check if product is marked as deleted */ /* P Lim. 3/16/00. Deletes not supported in this release. Next release: Add a column to show that the item is marked for deletion. */ // if (iKNA1MComp.GetFieldValue ("LOEVM") == "X") // { /* The customer is marked as deleted: delete the account from Siebel */ // oAccountComp.SetFieldValue ("operation", "delete"); // continue; // } // Set operation to "upsert" since we are using the "Execute" method. oAccountComp.SetFieldValue ("operation", "upsert"); /* * Set telephone numbers */ oAccountComp.CopyFieldValue ("Main Phone Number", "TELF1"); oAccountComp.CopyFieldValue ("Main Fax Number", "TELFX"); /* * Set other fields */ // Defaults from buscomp: // oAccountComp.CopyFieldValue (account, "Account Status", "Active"); // oAccountComp.CopyFieldValue (account, "Disable DataCleansing", "N"); oAccountComp.CopyFieldValue ("Row Status", "Y"); /* * Set language code */ oAcc

Account - SAP Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

Account - SAP Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

Account - SAP Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

Account - SAP Maps (MO)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps (MO)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps (MO)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 1999, Siebel Systems, Inc., All rights reserved. // // $Revision: 4 $ // $Date: 12/10/99 10:29a $ // $Author: Achaudhr $ of last update // // CREATOR: R.Lankinen // // DESCRIPTION // Multi-organization Javascript maps from Siebel Account to SAP entities // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account - SAP Maps (MO)
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.

Account - SAP Maps (MO)
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.

Account - SAP Maps (MO)
GetSAPOrderList_BAPIToSiebel
function GetSAPOrderList_BAPIToSiebel (inputMsg, outputMsg) { /* * Input Objects' Integration Components * BAPI Export (Account - Get SAP Order List (BAPI Output)) * Export Parameters (output) * Order Header (header) * Order Item (item) * * Output Object's Integration Components: * Account Object (Account - Get SAP Order List (MO)) * Account (oAccount) * Get List for Account Output * Get List for Account Header * Get List for Account Item */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var iGLOrderObj; // BAPI Order instance var iGLExportComp; // BAPI Export Parameters var iGLHeaderComp; // BAPI Order Header var iGLItemComp; // BAPI Order Item // Store inputId (ROW_ID) to be denormalized to all RFC table rows var inputId = inputMsg.GetArgument ("Siebel Account Id"); /* * Set up EAI Output Message objects */ var oAccountObj; // Siebel Order instance var oAccountComp; // Account var oGLOutputComp; // Get List Output var oGLHeaderComp; // Get List Header var oGLItemComp; // Get List Item var theApp = TheApplication(); /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Get SAP Order List (BAPI Output)"); oAccountObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (MO)"); /* * Read int object instances from EAI message */ while (iGLOrderObj.NextInstance ()) { /* * Create "Account" object in output message */ oAccountObj.NewInstance (); /* * Create "Account" component */ oAccountComp = oAccountObj.CreatePrimaryIntComp ("Account"); oAccountComp.NewRecord (); // Set "Id" so Siebel Adapter can synchronize oAccountComp.SetFieldValue ("Id", inputId); // Get Primary Sales Area of the account var SalesOrg; var SalesChn; var SalesDiv; var AccBusObj = theApp.GetBusObject("Account"); var AccBusCmp = AccBusObj.GetBusComp("Account"); // Set View Mode to 3 (or AllView) AccBusCmp.SetViewMode(3); AccBusCmp.ClearToQuery(); AccBusCmp.SetSearchSpec("Id", inputId); AccBusCmp.ActivateField("Primary Organization Id"); AccBusCmp.ExecuteQuery(); if(AccBusCmp.FirstRecord()) { var PrimOrg = AccBusCmp.GetFieldValue("Primary Organization Id"); var OrgBusObj = theApp.GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", PrimOrg); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ActivateField("Back Office Distribution Channel"); OrgBusCmp.ActivateField("Back Office Division"); OrgBusCmp.ExecuteQuery(); // get saleOrg, distChnl and division of the primary SA if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); var SalesChn = OrgBusCmp.GetFieldValue("Back Office Distribution Channel"); var SalesDiv = OrgBusCmp.GetFieldValue("Back Office Division"); } // else // { // EAIRaiseError("Unable to get sales area info for the primary organization"); // } } // else // { // EAIRaiseError("Invalid account"); // } /* * Read "Export Parameters" component */ iGLExportComp = iGLOrderObj.GetPrimaryIntComp ("Export Parameters"); oGLOutputComp = oAccountComp.CreateIntComp ("Account - Get SAP Order List Output", oAccountComp); if (iGLExportComp.NextRecord ()) { /* * Write "Get List for Account Output" component */ oGLOutputComp.

Account - SAP Maps (MO)
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP Maps (MO)
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP Maps (MO)
GetSAPOrderList_SiebelToBAPI
function GetSAPOrderList_SiebelToBAPI (inputMsg, outputMsg) { /* Input Objects' Integration Components * Account Object (Account - Get SAP Order List (MO)) * Account (iAccount) * Get List for Account Header * * Output Object's Integration Components: * BAPI Import (Account - Get SAP Order List (BAPI Input)) * Import Parameters (output) */ /* * Set up EAI Lookup objects */ /* * Set up EAI Input Message objects */ var theApp = TheApplication(); // nbc var iAccountObj; // Siebel Account instance var iAccountComp; // Account var iHeaderComp; // Account Header /* * Set up EAI Output Message objects */ var oGLObj; // BAPI instance var oGLImportComp; // Import Parameters /* * Find and create top-level integration object */ iAccountObj = inputMsg.GetIntObj ("Account - Get SAP Order List (MO)"); oGLObj = outputMsg.CreateIntObj ("Account - Get SAP Order List (BAPI Input)"); /* * Read int object instances from EAI message */ while (iAccountObj.NextInstance ()) { /* * Create "Get List for Account" object */ oGLObj.NewInstance (); /* * Read "Account" component */ iAccountComp = iAccountObj.GetPrimaryIntComp ("Account"); oGLImportComp = oGLObj.CreatePrimaryIntComp ("Import Parameters"); if (iAccountComp.NextRecord ()) { /* * Write "Import Parameters" component */ oGLImportComp.NewRecord (); oGLImportComp.SetCopySource (iAccountComp); var intId = iAccountComp.GetFieldValue( "Integration Id" ); var fromDate = iAccountComp.GetFieldValue( "Back Office Order Query Start Dt" ); //nbc var toDate = iAccountComp.GetFieldValue( "Back Office Order Query End Dt" ); //nbc oGLImportComp.SetFieldValue ("CUSTOMER_NUMBER",intId ); oGLImportComp.SetFieldValue ("MATERIAL", ""); oGLImportComp.SetFieldValue ("PURCHASE_ORDER", ""); // "Peter 1"; oGLImportComp.SetFieldValue ("DOCUMENT_DATE", fromDate ); // Empty string means "00000000" oGLImportComp.SetFieldValue ("DOCUMENT_DATE_TO", toDate ); // Empty string means "00000000" // Read the primary sales area var primOrgId = iAccountComp.GetFieldValue("Primary Organization Id"); var OrgBusObj = TheApplication().GetBusObject("Organizations"); var OrgBusCmp = OrgBusObj.GetBusComp("Organization"); // Set View Mode to 3 (or AllView) OrgBusCmp.SetViewMode(3); OrgBusCmp.ClearToQuery(); OrgBusCmp.SetSearchSpec("Id", primOrgId); OrgBusCmp.ActivateField("Back Office Sales Organization"); OrgBusCmp.ExecuteQuery(); if(OrgBusCmp.FirstRecord()) { var SalesOrg = OrgBusCmp.GetFieldValue("Back Office Sales Organization"); // Write "Import Parameters" component oGLImportComp.SetFieldValue( "SALES_ORGANIZATION", SalesOrg ); } } } }

Account - SAP Maps (MO)
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ /* * Get ActiveBusComp & RowID */ // var CurBC = TheApplication().ActiveBusComp(); // var rowid = CurBC.GetFieldValue("Id"); //nbc while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx // oOrderComp.CopyFieldValue ("Order Number", "Order Number"); //nbcxx // oOrderComp.CopyFieldValue ("Order Number", rowid); //nbc // oOrderComp.SetFieldValue ("Order Type", // orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); // oOrderComp.CopyFieldValue ("Primary Organization Id", "SAP Organization Id (MO)"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // was: oOrderComp.CopyFieldValue ("Organization", "Organization"); // oOrderComp.CopyFieldValue ("Account Location", "Account Location"); // } // oOrderOrgComp.NewInstance (); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); // while (iGLOrderComp.NextRecord ()) // { oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp);

Account - SAP Maps (MO)
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ /* * Get ActiveBusComp & RowID */ // var CurBC = TheApplication().ActiveBusComp(); // var rowid = CurBC.GetFieldValue("Id"); //nbc while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx // oOrderComp.CopyFieldValue ("Order Number", "Order Number"); //nbcxx // oOrderComp.CopyFieldValue ("Order Number", rowid); //nbc // oOrderComp.SetFieldValue ("Order Type", // orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); // oOrderComp.CopyFieldValue ("Primary Organization Id", "SAP Organization Id (MO)"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // was: oOrderComp.CopyFieldValue ("Organization", "Organization"); // oOrderComp.CopyFieldValue ("Account Location", "Account Location"); // } // oOrderOrgComp.NewInstance (); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); // while (iGLOrderComp.NextRecord ()) // { oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp);

Account - SAP Maps (MO)
ImportSAPOrder_GetSAPOrderListToSiebelOrder
function ImportSAPOrder_GetSAPOrderListToSiebelOrder (inputMsg, outputMsg) { /* * Input Objects' Integration Components * Import Get List for Account (Account - Import SAP Order (Get SAP Order List) (MO)) * Get List for Account Header * * Output Object's Integration Components: * Import (Account - Import SAP Order (Siebel Order) (MO)) * Order (oOrder) */ /* * Set up EAI Lookup maps */ var orderTypeLM = EAIGetValueMap ("SAP Order Types", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iGLOrderObj; // Get List instance var iGLOrderComp; // Get List Order /* * Set up EAI Output Message objects */ var oOrderObj; // Siebel Order instance var oOrderComp; // Order var oOrderOrgComp; // Order Organization /* * Find and create top-level integration object */ iGLOrderObj = inputMsg.GetIntObj ("Account - Import SAP Order (Get SAP Order List) (MO)"); oOrderObj = outputMsg.CreateIntObj ("Account - Import SAP Order (Siebel Order) (MO)"); /* * Read int object instances from EAI message */ /* * Get ActiveBusComp & RowID */ // var CurBC = TheApplication().ActiveBusComp(); // var rowid = CurBC.GetFieldValue("Id"); //nbc while (iGLOrderObj.NextInstance ()) { /* * Create "Order" object */ oOrderObj.NewInstance (); /* * Read "Get List Order" component */ iGLOrderComp = iGLOrderObj.GetPrimaryIntComp ("Get List for Account Header"); oOrderComp = oOrderObj.CreatePrimaryIntComp ("Order"); while (iGLOrderComp.NextRecord ()) { /* * Write "Order" component */ oOrderComp.NewRecord (); oOrderComp.SetCopySource (iGLOrderComp); var SiebOrdNo = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx if (SiebOrdNo == "") //xx { //xx var OrdNumber = iGLOrderComp.GetFieldValue("Order Number"); //xx } //xx else { //xx var OrdNumber = iGLOrderComp.GetFieldValue ("Siebel Order Number");//xx } //xx oOrderComp.SetFieldValue ("Order Number", OrdNumber);//xx // oOrderComp.CopyFieldValue ("Order Number", "Order Number"); //nbcxx // oOrderComp.CopyFieldValue ("Order Number", rowid); //nbc // oOrderComp.SetFieldValue ("Order Type", // orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type"))); var oTypeSAP = orderTypeLM.Translate (iGLOrderComp.GetFieldValue ("Order Type")); var oType = TheApplication().InvokeMethod ("LookupValue", "FS_ORDER_TYPE", oTypeSAP); oOrderComp.SetFieldValue ("Order Type", oType); oOrderComp.CopyFieldValue ("Order Date", "Order Date"); oOrderComp.CopyFieldValue ("Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Bill To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Ship To Account Integration Id", "Sold To Customer"); oOrderComp.CopyFieldValue ("Integration Id", "Order Number"); // oOrderComp.CopyFieldValue ("Primary Organization Id", "SAP Organization Id (MO)"); // PLim. ??? Set Organization until we can figure out how to fix dup key index problem // was: oOrderComp.CopyFieldValue ("Organization", "Organization"); // oOrderComp.CopyFieldValue ("Account Location", "Account Location"); // } // oOrderOrgComp.NewInstance (); oOrderOrgComp = oOrderComp.CreateIntComp("Order Entry - Orders_Organization"); // while (iGLOrderComp.NextRecord ()) // { oOrderOrgComp.NewRecord(); oOrderOrgComp.SetCopySource (iGLOrderComp);

Account - SAP Maps (MO)
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP Maps (MO)
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP Maps (MO)
LocalizeMessage
function LocalizeMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ERR_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ERR_MSG"; var LOVType = "CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account - SAP Maps (MO)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP Maps (MO)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account - SAP Maps (MO)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var result = EAIExecuteMap (MethodName, Inputs, Outputs); return result; }

Account BS SCM
(declarations)
var oApp : Application; var bIsTraceOn : bool;

Account BS SCM
(declarations)
var oApp : Application; var bIsTraceOn : bool;

Account BS SCM
BCActivateRecord
function BCActivateRecord(&BCAdd, bActivate:bool) { /***************************************************************************** * Function: BCActivateRecord * Purpose : Function to activate necessary records in BC * 'Account Address Ligth SCM' before EceuteQuery it is called from * 'DuplicateAccountSearchCompany' and 'DuplicateAccountSearchPerson' * Params : BCAdd - a reference to the above BC * bActivate - if true activate the fields *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2009-11-04 Gema Torres created * 2010-07-26 Gema Torres CR 412 Required to display Id Type and Id # * 2011-08-29 tgdstre0 defect # 40504 * 2012-02-16 TGDHURO9 new header added; defect 46847 PROD: Duplicate * check shows the wrong main address. *****************************************************************************/ try { if (bActivate) { BCAdd.ActivateField("Account Contact First Name SCM"); BCAdd.ActivateField("Account Phonetic Name SCM"); BCAdd.ActivateField("Strassennummer"); BCAdd.ActivateField("Account Contact BirhtDate SCM"); BCAdd.ActivateField("Primary Account Postal Code SCM"); BCAdd.ActivateField("Primary Account City SCM"); BCAdd.ActivateField("Residence Description SCM"); BCAdd.ActivateField("Location Supplement SCM"); BCAdd.ActivateField("Account Grobsegment SCM"); BCAdd.ActivateField("Primary Account Street Address SCM"); BCAdd.ActivateField("Calculated Duplicate Name SCM"); BCAdd.ActivateField("Account Sub Type SCM"); BCAdd.ActivateField("Account Status SCM"); BCAdd.ActivateField("Location Id denormalized SCM"); BCAdd.ActivateField("Account Swisscom Customer Number SCM"); BCAdd.ActivateField("Parent Grobsegment SCM"); BCAdd.ActivateField("Prepayment Flag SCM"); BCAdd.ActivateField("Account Id"); //CR 412 TGDTOGE3 26.07.2010 Required to display Id Type and Id # BCAdd.ActivateField("Id Type SCM"); BCAdd.ActivateField("Id # SCM"); BCAdd.ActivateField("Address Relation Type SCM"); // 2011-08-29; tgdstre0; defect # 40504 BCAdd.ActivateField("Address Status SCM"); // 2012-02-16 TGDHURO9 Defect 46847 } BCAdd.SetViewMode(AllView); BCAdd.ClearToQuery(); // SCM 2012-02-16 TGDHURO9 Defect 46847 var INACTIVE = "'" + oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Inactive") + "'"; var DELETED = "'" + oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Deleted") + "'"; var f = "Address Status SCM"; BCAdd.SetSearchSpec(f, " <> " + INACTIVE + " AND [" + f + "] <> " + DELETED); } catch(e) { oApp.RaiseErrorText(e.toString()); } }

Account BS SCM
BCActivateRecord
function BCActivateRecord(&BCAdd, bActivate:bool) { /***************************************************************************** * Function: BCActivateRecord * Purpose : Function to activate necessary records in BC * 'Account Address Ligth SCM' before EceuteQuery it is called from * 'DuplicateAccountSearchCompany' and 'DuplicateAccountSearchPerson' * Params : BCAdd - a reference to the above BC * bActivate - if true activate the fields *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2009-11-04 Gema Torres created * 2010-07-26 Gema Torres CR 412 Required to display Id Type and Id # * 2011-08-29 tgdstre0 defect # 40504 * 2012-02-16 TGDHURO9 new header added; defect 46847 PROD: Duplicate * check shows the wrong main address. *****************************************************************************/ try { if (bActivate) { BCAdd.ActivateField("Account Contact First Name SCM"); BCAdd.ActivateField("Account Phonetic Name SCM"); BCAdd.ActivateField("Strassennummer"); BCAdd.ActivateField("Account Contact BirhtDate SCM"); BCAdd.ActivateField("Primary Account Postal Code SCM"); BCAdd.ActivateField("Primary Account City SCM"); BCAdd.ActivateField("Residence Description SCM"); BCAdd.ActivateField("Location Supplement SCM"); BCAdd.ActivateField("Account Grobsegment SCM"); BCAdd.ActivateField("Primary Account Street Address SCM"); BCAdd.ActivateField("Calculated Duplicate Name SCM"); BCAdd.ActivateField("Account Sub Type SCM"); BCAdd.ActivateField("Account Status SCM"); BCAdd.ActivateField("Location Id denormalized SCM"); BCAdd.ActivateField("Account Swisscom Customer Number SCM"); BCAdd.ActivateField("Parent Grobsegment SCM"); BCAdd.ActivateField("Prepayment Flag SCM"); BCAdd.ActivateField("Account Id"); //CR 412 TGDTOGE3 26.07.2010 Required to display Id Type and Id # BCAdd.ActivateField("Id Type SCM"); BCAdd.ActivateField("Id # SCM"); BCAdd.ActivateField("Address Relation Type SCM"); // 2011-08-29; tgdstre0; defect # 40504 BCAdd.ActivateField("Address Status SCM"); // 2012-02-16 TGDHURO9 Defect 46847 } BCAdd.SetViewMode(AllView); BCAdd.ClearToQuery(); // SCM 2012-02-16 TGDHURO9 Defect 46847 var INACTIVE = "'" + oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Inactive") + "'"; var DELETED = "'" + oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Deleted") + "'"; var f = "Address Status SCM"; BCAdd.SetSearchSpec(f, " <> " + INACTIVE + " AND [" + f + "] <> " + DELETED); } catch(e) { oApp.RaiseErrorText(e.toString()); } }

Account BS SCM
BCHasRecord
/******************************************************* ** Name:noed: 14.03.2009 ** Created By: Iñaki R. Zabalegui ** Description: Generic script to check if the applet is displaying ** any record. Normally used to activate or inactivate buttons in the ** precaninvoke method. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function BCHasRecord(&oBC) { try { var cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Account BS SCM
BCHasRecord
/******************************************************* ** Name:noed: 14.03.2009 ** Created By: Iñaki R. Zabalegui ** Description: Generic script to check if the applet is displaying ** any record. Normally used to activate or inactivate buttons in the ** precaninvoke method. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function BCHasRecord(&oBC) { try { var cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Account BS SCM
ChangeHQFlg
function ChangeHQFlg(){ /******************************************************* ** Name: ChangeHQFlg ** Created: 17.07.2008 ** Created By: Rosalyn Ramùrez ** Description: ** -------------------- Modifications --------------------- ** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM ******************************************************/ var BOAccnt:BusObject = null; var BOServiceRequest:BusObject = null; var BCAccnt:BusComp = null; var BCSA:BusComp = null; var BCSR:BusComp = null; var svc:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var strCMAId:chars = ""; var strPrepayment:chars = ""; var strOldSAId:chars = ""; var strSAId:chars = ""; var SRId:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg START"); BOAccnt = TheApplication().ActiveBusObject(); BCAccnt = BOAccnt.GetBusComp("Account"); strCMAId =BCAccnt.GetFieldValue("Id"); BCSA = BOAccnt.GetBusComp("Service Account SCM"); strPrepayment = BCAccnt.GetFieldValue("Prepayment Flag SCM"); strOldSAId =BCAccnt.GetFieldValue("Primary Service Account Id SCM"); strSAId = BCSA.GetFieldValue("Id"); if(strPrepayment == "N"){ //Neccesary properties and variables svc = TheApplication().GetService("Workflow Process Manager"); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); //Set the properties psInputs.SetProperty("ProcessName", "Automatic SR Creation SCM"); psInputs.SetProperty("Object Id", strSAId); //LIC of the desired Area psInputs.SetProperty("Area", "Customer Data"); psInputs.SetProperty("Sub-Area", "09.13 Maintain customer struct"); psInputs.SetProperty("Detail", "change headquarter"); psInputs.SetProperty("Entity", "Customer"); //Invoke the workflow svc.InvokeMethod("RunProcess", psInputs, psOutputs); //Get the Id of the SR that has just been created SRId = psOutputs.GetProperty("Siebel Operation Object Id"); //The Headquater change must be done after the SR creation BCAccnt.SetFieldValue("Primary Service Account Id SCM",strSAId); BCAccnt.WriteRecord(); //Get BC Service Request BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCSR = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR recently created BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", SRId); BCSR.ExecuteQuery(ForwardOnly); BCSR.WriteRecord(); //The SR must be submitted*/ BCSR.InvokeMethod("SubmitSR"); //2014-06-02 TGDGEMAM: added due to DROP Aug14 MaintainFGPAssets("Transfer", strOldSAId, strSAId); } else{ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg ERROR X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM"); TheApplication().RaiseError("X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM"); } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg ERROR: " + e.message); throw(e) } finally{ strCMAId = null; strPrepayment = null; strSAId = null; SRId = null; BCSR = null; BOServiceRequest = null; BCSA = null; BCAccnt = null; BOAccnt = null; psOutputs = null; psInputs = null; svc = null; } }

Account BS SCM
ChangeHQFlg
function ChangeHQFlg(){ /******************************************************* ** Name: ChangeHQFlg ** Created: 17.07.2008 ** Created By: Rosalyn Ramùrez ** Description: ** -------------------- Modifications --------------------- ** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM ******************************************************/ var BOAccnt:BusObject = null; var BOServiceRequest:BusObject = null; var BCAccnt:BusComp = null; var BCSA:BusComp = null; var BCSR:BusComp = null; var svc:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var strCMAId:chars = ""; var strPrepayment:chars = ""; var strOldSAId:chars = ""; var strSAId:chars = ""; var SRId:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg START"); BOAccnt = TheApplication().ActiveBusObject(); BCAccnt = BOAccnt.GetBusComp("Account"); strCMAId =BCAccnt.GetFieldValue("Id"); BCSA = BOAccnt.GetBusComp("Service Account SCM"); strPrepayment = BCAccnt.GetFieldValue("Prepayment Flag SCM"); strOldSAId =BCAccnt.GetFieldValue("Primary Service Account Id SCM"); strSAId = BCSA.GetFieldValue("Id"); if(strPrepayment == "N"){ //Neccesary properties and variables svc = TheApplication().GetService("Workflow Process Manager"); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); //Set the properties psInputs.SetProperty("ProcessName", "Automatic SR Creation SCM"); psInputs.SetProperty("Object Id", strSAId); //LIC of the desired Area psInputs.SetProperty("Area", "Customer Data"); psInputs.SetProperty("Sub-Area", "09.13 Maintain customer struct"); psInputs.SetProperty("Detail", "change headquarter"); psInputs.SetProperty("Entity", "Customer"); //Invoke the workflow svc.InvokeMethod("RunProcess", psInputs, psOutputs); //Get the Id of the SR that has just been created SRId = psOutputs.GetProperty("Siebel Operation Object Id"); //The Headquater change must be done after the SR creation BCAccnt.SetFieldValue("Primary Service Account Id SCM",strSAId); BCAccnt.WriteRecord(); //Get BC Service Request BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCSR = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR recently created BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", SRId); BCSR.ExecuteQuery(ForwardOnly); BCSR.WriteRecord(); //The SR must be submitted*/ BCSR.InvokeMethod("SubmitSR"); //2014-06-02 TGDGEMAM: added due to DROP Aug14 MaintainFGPAssets("Transfer", strOldSAId, strSAId); } else{ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg ERROR X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM"); TheApplication().RaiseError("X_NO_CHANGE_HEADQUARTER_FOR_PREPAID_SCM"); } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".ChangeHQFlg ERROR: " + e.message); throw(e) } finally{ strCMAId = null; strPrepayment = null; strSAId = null; SRId = null; BCSR = null; BOServiceRequest = null; BCSA = null; BCAccnt = null; BOAccnt = null; psOutputs = null; psInputs = null; svc = null; } }

Account BS SCM
ChangeInStructuring
/* ** Name of the Method: OneCRM Change in Structuring ** Description: This method changes the Owner Account Id relation in the asset, from one CMA to anoher one. */ /*-------------------- Modifications --------------------- ** Date: 26.7.2011 ** Changed By: TGDLABR1 ** Description: remove check if old cma is not set on SR anymore ** ** Date: 25.6.2013 ** Changed By: TGDGEMAM ** Description: added function call "RefreshSAContracts" ** ******************************************************/ function ChangeInStructuring(Inputs,Outputs) { var BOAcc; var BOActiveSR; var BCSR; var BCAcc; var BOAsset; var BCAsset; // TGDHAKA8 01.09.2010 CR 342 var BCInvoiceProfile; var SRId=""; var strSAId=""; var strCMAId=""; var strHQSAId=""; var searchSpec=""; //Added CDM tgdpima25.08.2010 var svcBS; var InputPS; var OutputPS; // TGDHAKA8 20.09.2010 Project CDM var aBOAccount=null; var bBOAccount=null; var aBCAccount=null; var aBCAccountContact=null; var bBCAccountContact=null; var bBCContactRole=null; var isRecord; try{ BOActiveSR = oApp.GetBusObject("EAI Plain Entity Model (Service Request) SCM"); BCSR = BOActiveSR.GetBusComp("Service Request"); SRId = Inputs.GetProperty("SRId"); BCSR.ActivateField("Account Id"); BCSR.ActivateField("Secondary Account Id SCM"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",SRId); BCSR.ExecuteQuery(ForwardOnly); strSAId = BCSR.GetFieldValue("Account Id"); /* 24.02.10: Begin - issue# 20264*/ BOAcc = TheApplication().GetBusObject("Account"); //BOAcc = TheApplication().GetBusObject("EAI Account Asset IO SCM"); //End - issue# 20264 BCAcc = BOAcc.GetBusComp("Account"); /* 22.02.10: Begin - issue# 20099 BCAcc.ActivateField("Parent Account Id");*/ BCAcc.ActivateField("Calculated CMA Account Id SCM"); //End - issue# 20099 BCAcc.ActivateField("Customer Master Account Id SCM"); //TGDGEMAM 2014-06-02: added due to DROP Aug14 BCAcc.ActivateField("Parent Primary SA Id SCM"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id",strSAId); BCAcc.ExecuteQuery(ForwardOnly); if (BCAcc.FirstRecord()){ /* 24.02.10: Begin - issue# 20099 strCMAId = BCAcc.GetFieldValue("Parent Account Id");*/ strCMAId = BCAcc.GetFieldValue("Calculated CMA Account Id SCM"); //End - issue# 20099 //TGDGEMAM 2014-06-02: added due to DROP Aug14 strHQSAId = BCAcc.GetFieldValue("Parent Primary SA Id SCM"); /*24.02.10: Begin - issue# 20264 BCAsset = BOAcc.GetBusComp("Asset Mgmt - Subscription Asset SCM"); old: BOAsset = TheApplication().GetBusObject("Asset Management"); old: BCAsset = BOAsset.GetBusComp("Asset Mgmt - Asset"); */ //End - issue# 20264 // 10.09.13: Begin - issue# 73327 // changed BO/BC due to class-based readonly side-effects BOAsset = TheApplication().GetBusObject("Asset Lite SCM"); BCAsset = BOAsset.GetBusComp("Asset Lite SCM"); //End - issue# 73327 /*24.02.10: Begin - issue# 20264 BCAsset.ActivateField("Owner Account Id SCM");*/ BCAsset.ActivateField("Owner Account Id"); //End - issue# 20264 BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); /*24.02.10: Begin - issue# 20264 old: BCAsset.SetSearchSpec("Service Account Id",strSAId); new: searchSpec="[Service Account Id]='"+strSAId+"' and [Parent Asset Id] IS NULL"; */ //End - issue# 20264 /*10.09.13: Begin - issue# 73327 old: searchSpec="[Service Account Id]='"+strSAId+"' and [Parent Asset Id] IS NULL"; new: searchSpec="[Service Account Id]='"+strSAId+"'"; */ searchSpec="[Service Account Id]='"+strSAId+"'"; //End - issue# 73327 BCAsset.SetSearchExpr(searchSpec); BCAsset.ExecuteQuery(ForwardOnly); if (BCAsset.FirstRecord()){ do{ /*24.02.10: Begin - issue# 20264 BCAsset.SetFieldValue("Owner Account Id SCM", strCMAId);*/ BCAsset.SetFieldValue("Owner Account Id", strCMAId); //End - issue# 20264 BCAsset.WriteRecord(); } while(BCAsset.NextRecord())

Account BS SCM
ChangeInStructuring
/* ** Name of the Method: OneCRM Change in Structuring ** Description: This method changes the Owner Account Id relation in the asset, from one CMA to anoher one. */ /*-------------------- Modifications --------------------- ** Date: 26.7.2011 ** Changed By: TGDLABR1 ** Description: remove check if old cma is not set on SR anymore ** ** Date: 25.6.2013 ** Changed By: TGDGEMAM ** Description: added function call "RefreshSAContracts" ** ******************************************************/ function ChangeInStructuring(Inputs,Outputs) { var BOAcc; var BOActiveSR; var BCSR; var BCAcc; var BOAsset; var BCAsset; // TGDHAKA8 01.09.2010 CR 342 var BCInvoiceProfile; var SRId=""; var strSAId=""; var strCMAId=""; var strHQSAId=""; var searchSpec=""; //Added CDM tgdpima25.08.2010 var svcBS; var InputPS; var OutputPS; // TGDHAKA8 20.09.2010 Project CDM var aBOAccount=null; var bBOAccount=null; var aBCAccount=null; var aBCAccountContact=null; var bBCAccountContact=null; var bBCContactRole=null; var isRecord; try{ BOActiveSR = oApp.GetBusObject("EAI Plain Entity Model (Service Request) SCM"); BCSR = BOActiveSR.GetBusComp("Service Request"); SRId = Inputs.GetProperty("SRId"); BCSR.ActivateField("Account Id"); BCSR.ActivateField("Secondary Account Id SCM"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",SRId); BCSR.ExecuteQuery(ForwardOnly); strSAId = BCSR.GetFieldValue("Account Id"); /* 24.02.10: Begin - issue# 20264*/ BOAcc = TheApplication().GetBusObject("Account"); //BOAcc = TheApplication().GetBusObject("EAI Account Asset IO SCM"); //End - issue# 20264 BCAcc = BOAcc.GetBusComp("Account"); /* 22.02.10: Begin - issue# 20099 BCAcc.ActivateField("Parent Account Id");*/ BCAcc.ActivateField("Calculated CMA Account Id SCM"); //End - issue# 20099 BCAcc.ActivateField("Customer Master Account Id SCM"); //TGDGEMAM 2014-06-02: added due to DROP Aug14 BCAcc.ActivateField("Parent Primary SA Id SCM"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id",strSAId); BCAcc.ExecuteQuery(ForwardOnly); if (BCAcc.FirstRecord()){ /* 24.02.10: Begin - issue# 20099 strCMAId = BCAcc.GetFieldValue("Parent Account Id");*/ strCMAId = BCAcc.GetFieldValue("Calculated CMA Account Id SCM"); //End - issue# 20099 //TGDGEMAM 2014-06-02: added due to DROP Aug14 strHQSAId = BCAcc.GetFieldValue("Parent Primary SA Id SCM"); /*24.02.10: Begin - issue# 20264 BCAsset = BOAcc.GetBusComp("Asset Mgmt - Subscription Asset SCM"); old: BOAsset = TheApplication().GetBusObject("Asset Management"); old: BCAsset = BOAsset.GetBusComp("Asset Mgmt - Asset"); */ //End - issue# 20264 // 10.09.13: Begin - issue# 73327 // changed BO/BC due to class-based readonly side-effects BOAsset = TheApplication().GetBusObject("Asset Lite SCM"); BCAsset = BOAsset.GetBusComp("Asset Lite SCM"); //End - issue# 73327 /*24.02.10: Begin - issue# 20264 BCAsset.ActivateField("Owner Account Id SCM");*/ BCAsset.ActivateField("Owner Account Id"); //End - issue# 20264 BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); /*24.02.10: Begin - issue# 20264 old: BCAsset.SetSearchSpec("Service Account Id",strSAId); new: searchSpec="[Service Account Id]='"+strSAId+"' and [Parent Asset Id] IS NULL"; */ //End - issue# 20264 /*10.09.13: Begin - issue# 73327 old: searchSpec="[Service Account Id]='"+strSAId+"' and [Parent Asset Id] IS NULL"; new: searchSpec="[Service Account Id]='"+strSAId+"'"; */ searchSpec="[Service Account Id]='"+strSAId+"'"; //End - issue# 73327 BCAsset.SetSearchExpr(searchSpec); BCAsset.ExecuteQuery(ForwardOnly); if (BCAsset.FirstRecord()){ do{ /*24.02.10: Begin - issue# 20264 BCAsset.SetFieldValue("Owner Account Id SCM", strCMAId);*/ BCAsset.SetFieldValue("Owner Account Id", strCMAId); //End - issue# 20264 BCAsset.WriteRecord(); } while(BCAsset.NextRecord())

Account BS SCM
CheckPrimarySA
/******************************************************* ** Name: Primary_Contact_Search ** Created: 30.08.2008 ** Created By: F. Javier Gomez Ayerbe / Gema Torres ** Description: ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CheckPrimarySA() { var BOActiveAccount; var BCActiveAccount; var sSubType; var AccId; var ParAccId; var BOParAccount; var BCParAccount; var sPrimarySA; try { //Get Active BO, BCs from the context BOActiveAccount = TheApplication().ActiveBusObject(); BCActiveAccount = BOActiveAccount.GetBusComp("Account"); sSubType = BCActiveAccount.GetFieldValue("Sub Type SCM"); if(sSubType == TheApplication().InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","SA")) { AccId = BCActiveAccount.GetFieldValue("Id"); ParAccId = BCActiveAccount.GetFieldValue("Parent Account Id"); //Get the SA Parent Account from DB BOParAccount = TheApplication().GetBusObject("Account"); BCParAccount = BOParAccount.GetBusComp("Account"); BCParAccount.ActivateField("Primary Service Account Id SCM"); BCParAccount.ClearToQuery(); BCParAccount.SetSearchSpec("Id",ParAccId); //BCParAccount.SetSearchSpec("Sub Type SCM", TheApplication().InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","CMA")); BCParAccount.ExecuteQuery(ForwardOnly); if (BCParAccount.FirstRecord()) { sPrimarySA = BCParAccount.GetFieldValue("Primary Service Account Id SCM"); //Check if the active SA is the primary SA to delete this relationship if (sPrimarySA == AccId){ BCParAccount.SetFieldValue("Primary Service Account Id SCM", ""); BCParAccount.WriteRecord(); } } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCParAccount = null; BOParAccount = null; BCActiveAccount = null; BOActiveAccount = null; AccId = null; ParAccId = null; } }

Account BS SCM
CheckPrimarySA
/******************************************************* ** Name: Primary_Contact_Search ** Created: 30.08.2008 ** Created By: F. Javier Gomez Ayerbe / Gema Torres ** Description: ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CheckPrimarySA() { var BOActiveAccount; var BCActiveAccount; var sSubType; var AccId; var ParAccId; var BOParAccount; var BCParAccount; var sPrimarySA; try { //Get Active BO, BCs from the context BOActiveAccount = TheApplication().ActiveBusObject(); BCActiveAccount = BOActiveAccount.GetBusComp("Account"); sSubType = BCActiveAccount.GetFieldValue("Sub Type SCM"); if(sSubType == TheApplication().InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","SA")) { AccId = BCActiveAccount.GetFieldValue("Id"); ParAccId = BCActiveAccount.GetFieldValue("Parent Account Id"); //Get the SA Parent Account from DB BOParAccount = TheApplication().GetBusObject("Account"); BCParAccount = BOParAccount.GetBusComp("Account"); BCParAccount.ActivateField("Primary Service Account Id SCM"); BCParAccount.ClearToQuery(); BCParAccount.SetSearchSpec("Id",ParAccId); //BCParAccount.SetSearchSpec("Sub Type SCM", TheApplication().InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","CMA")); BCParAccount.ExecuteQuery(ForwardOnly); if (BCParAccount.FirstRecord()) { sPrimarySA = BCParAccount.GetFieldValue("Primary Service Account Id SCM"); //Check if the active SA is the primary SA to delete this relationship if (sPrimarySA == AccId){ BCParAccount.SetFieldValue("Primary Service Account Id SCM", ""); BCParAccount.WriteRecord(); } } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCParAccount = null; BOParAccount = null; BCActiveAccount = null; BOActiveAccount = null; AccId = null; ParAccId = null; } }

Account BS SCM
ContactBelongsToCustomer
/******************************************************* ** Name:noed: 03.11.2009 ** Created By: TGDTOGE3 ** Description: method that checks if a contact belongs to other customer ** This script is invoked when a customer is inactivated. If the contact ** which is customer is not related to any other customer then the contact ** should have the status inactive. ** ** In case contact is not found function returns false. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ContactBelongsToCustomer(Inputs, Outputs) { var strAccountId; var strPrimContact; var BOAccContact; var BCAccContact; var BCAccContactInter; var searchExpr=""; try { strAccountId = Inputs.GetProperty("Account Id"); strPrimContact = Inputs.GetProperty("Contact Id"); //Intance of Business Component Account Contact SCM BOAccContact = TheApplication().GetBusObject("Contact"); BCAccContact = BOAccContact.GetBusComp("Contact"); BCAccContactInter = BOAccContact.GetBusComp("Account Contact SCM"); BCAccContact.SetViewMode(AllView); BCAccContact.ActivateField("Status"); BCAccContact.ClearToQuery(); BCAccContact.SetSearchSpec("Id", strPrimContact); BCAccContact.ExecuteQuery(ForwardOnly); if (BCAccContact.FirstRecord()) { searchExpr= BCAccContactInter.GetSearchExpr(); if (searchExpr != null && searchExpr != "") { //TGDBEJA6 03.09.2010 Project CDM //searchExpr=searchExpr+" AND [Accnt Id] <> '"+strAccountId+"'"; searchExpr=searchExpr+" AND [Accnt Id] <> '"+strAccountId+"' AND [End Date SCM] IS NULL"; } else { //TGDBEJA6 03.09.2010 Project CDM //searchExpr="[Accnt Id] <> '"+strAccountId+"' AND"; searchExpr="[Accnt Id] <> '"+strAccountId+"' AND [End Date SCM] IS NULL"; } BCAccContactInter.ClearToQuery(); BCAccContactInter.SetSearchExpr (searchExpr); BCAccContactInter.ExecuteQuery(ForwardOnly); if (BCAccContactInter.FirstRecord()) {//If a record is found that means the contact is related to other customer. Outputs.SetProperty("ContactCustomer", "TRUE");//This property set is used to display a custom browser script in the applet return false; } else { //TGDBEJA6 03.09.2010 Project CDM Remove Inactivation of Contact //BCAccContact.SetFieldValue("Status", TheApplication().InvokeMethod("LookupValue", "CONTACT_STATUS", "Inactive")); //BCAccContact.WriteRecord(); //This property set is used to display a custom browser script in the applet Outputs.SetProperty("ContactCustomer", "FALSE"); return true; } } else //In case the contact is not found. return false; } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { searchExpr=null; strAccountId=null; strPrimContact = null; BCAccContact = null; BCAccContactInter = null; BOAccContact = null; } }

Account BS SCM
ContactBelongsToCustomer
/******************************************************* ** Name:noed: 03.11.2009 ** Created By: TGDTOGE3 ** Description: method that checks if a contact belongs to other customer ** This script is invoked when a customer is inactivated. If the contact ** which is customer is not related to any other customer then the contact ** should have the status inactive. ** ** In case contact is not found function returns false. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ContactBelongsToCustomer(Inputs, Outputs) { var strAccountId; var strPrimContact; var BOAccContact; var BCAccContact; var BCAccContactInter; var searchExpr=""; try { strAccountId = Inputs.GetProperty("Account Id"); strPrimContact = Inputs.GetProperty("Contact Id"); //Intance of Business Component Account Contact SCM BOAccContact = TheApplication().GetBusObject("Contact"); BCAccContact = BOAccContact.GetBusComp("Contact"); BCAccContactInter = BOAccContact.GetBusComp("Account Contact SCM"); BCAccContact.SetViewMode(AllView); BCAccContact.ActivateField("Status"); BCAccContact.ClearToQuery(); BCAccContact.SetSearchSpec("Id", strPrimContact); BCAccContact.ExecuteQuery(ForwardOnly); if (BCAccContact.FirstRecord()) { searchExpr= BCAccContactInter.GetSearchExpr(); if (searchExpr != null && searchExpr != "") { //TGDBEJA6 03.09.2010 Project CDM //searchExpr=searchExpr+" AND [Accnt Id] <> '"+strAccountId+"'"; searchExpr=searchExpr+" AND [Accnt Id] <> '"+strAccountId+"' AND [End Date SCM] IS NULL"; } else { //TGDBEJA6 03.09.2010 Project CDM //searchExpr="[Accnt Id] <> '"+strAccountId+"' AND"; searchExpr="[Accnt Id] <> '"+strAccountId+"' AND [End Date SCM] IS NULL"; } BCAccContactInter.ClearToQuery(); BCAccContactInter.SetSearchExpr (searchExpr); BCAccContactInter.ExecuteQuery(ForwardOnly); if (BCAccContactInter.FirstRecord()) {//If a record is found that means the contact is related to other customer. Outputs.SetProperty("ContactCustomer", "TRUE");//This property set is used to display a custom browser script in the applet return false; } else { //TGDBEJA6 03.09.2010 Project CDM Remove Inactivation of Contact //BCAccContact.SetFieldValue("Status", TheApplication().InvokeMethod("LookupValue", "CONTACT_STATUS", "Inactive")); //BCAccContact.WriteRecord(); //This property set is used to display a custom browser script in the applet Outputs.SetProperty("ContactCustomer", "FALSE"); return true; } } else //In case the contact is not found. return false; } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { searchExpr=null; strAccountId=null; strPrimContact = null; BCAccContact = null; BCAccContactInter = null; BOAccContact = null; } }

Account BS SCM
CreateHQ
/*** ** Name: CreateHQ ** Created: 27.07.2010, Created By: TGDTOGE3 ** Description: New method to create automatically the HQ SA when the company CMA is created ***/ function CreateHQ(Inputs,Outputs) { var BOAcc; //Main Vbles var BCAcc; var BCAdd; var strCMAId; var strPrimaryName; var strMainAddId; var strAddSA; var strSAId; var strName; //Account Vbles var strName1; var strName2; var strDetSegment; var strSubSegment; var strCorrLang; var strCorrLangCode; var strDesc; var strLettSal; var strTitle; var strItPlat; //Address Vbles var strMasterId; var strPostalCode; var strCity; var strAddType; var strAddId; var strAdd; var strAssStatus; var strLocSup; var strResDes; var strAddNum; var strAddSup; var strApNum; var strCOName; var strCountry; var strFloor; var strGeoflg; var strLangGaia; var strLocId; var strStreetId; var strValStatus; var strPostalExt; var strIntId; var strPhone; //Company Main Contact Vbles var strCellPhone; var strFax; var strEmailAddr; var strSpokLang; var strSpokLangCode; var strSupplierCode; // TAADAPE2 14.01.2015 - fix for defect #95906 - Populate SA Account with Supplier Code from CMA var BSCAM; var Input; var Output; var sAccStatus:chars; try { // defect # 70443 sAccStatus = ""; if (Inputs.PropertyExists("Account Status")) { sAccStatus = Inputs.GetProperty("Account Status"); } if (sAccStatus == "") { sAccStatus = oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active"); } Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); //Get Active BO and Account BC from the context BOAcc = oApp.GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); BCAdd = BOAcc.GetBusComp("Account Address Usage SCM"); //get Id of the company CMA strCMAId = Inputs.GetProperty("CMAId"); //Search company CMA BCAcc.ActivateField("Primary Name Id SCM"); BCAcc.ActivateField("Primary Usage Address Id SCM"); BCAcc.ActivateField("Name"); BCAcc.ActivateField("Customer Name 1 SCM"); BCAcc.ActivateField("Customer Name 2 SCM"); BCAcc.ActivateField("DetailedSegment SCM"); BCAcc.ActivateField("Subfine Segment SCM"); BCAcc.ActivateField("Correspondence Language SCM"); BCAcc.ActivateField("Correspondence Language Code SCM"); BCAcc.ActivateField("Language"); BCAcc.ActivateField("Language Code"); BCAcc.ActivateField("Comment SCM"); //SCM 29.09.2010 Project CDM: Data Model Change, following fields do not exist any more in BC Account //BCAcc.ActivateField("Touch Point SCM"); //BCAcc.ActivateField("Main VoIP Identification SCM"); //BCAcc.ActivateField("Preferred Communication Method"); //BCAcc.ActivateField("Suppress Proku Flag SCM"); //END CDM BCAcc.ActivateField("Letter Salutation SCM"); BCAcc.ActivateField("Title SCM"); BCAcc.ActivateField("IT PlatForm SCM"); BCAcc.ActivateField("Master Account Id"); //TGDBEJA6 02.09.2010 Project CDM:Create default Contact in the HQ SA BCAcc.ActivateField("Account Company Main Contact Cell Phone # SCM"); BCAcc.ActivateField("Account Company Main Contact Email Address SCM"); BCAcc.ActivateField("Account Company Main Contact Fax SCM"); BCAcc.ActivateField("Account Company Main Contact Phone # SCM"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id",strCMAId); BCAcc.ExecuteQuery(ForwardOnly); //Get CMA data strPrimaryName = BCAcc.GetFieldValue("Primary Name Id SCM"); strMainAddId = BCAcc.GetFieldValue("Primary Usage Address Id SCM"); strName = BCAcc.GetFieldValue("Name"); strName1 = BCAcc.GetFieldValue("Customer Name 1 SCM"); strName2 = BCAcc.GetFieldValue("Customer Name 2 SCM"); strDetSegment = BCAcc.GetFieldValue("DetailedSegment SCM"); strSubSegment = BCAcc.GetFieldValue("Subfine Segment SCM"); strCorrLang = BCAcc.GetFieldValue("Correspondence Language SCM"); strCorrLangCode = BCAcc.GetFieldValue("Correspondence Language Code SCM"); strDesc = BCAcc.GetFieldValu

Account BS SCM
CreateHQ
/*** ** Name: CreateHQ ** Created: 27.07.2010, Created By: TGDTOGE3 ** Description: New method to create automatically the HQ SA when the company CMA is created -------------------- Modifications --------------------- ** Date Changed By Description ** 20161215 TAACONU1 Defect # 1144 ***/ function CreateHQ(Inputs,Outputs) { var BOAcc; //Main Vbles var BCAcc; var BCAdd; var strCMAId; var strPrimaryName; var strMainAddId; var strAddSA; var strSAId; var strName; //Account Vbles var strName1; var strName2; var strDetSegment; var strSubSegment; var strCorrLang; var strCorrLangCode; var strDesc; var strLettSal; var strTitle; var strItPlat; //Address Vbles var strMasterId; var strPostalCode; var strCity; var strAddType; var strAddId; var strAdd; var strAssStatus; var strLocSup; var strResDes; var strAddNum; var strAddSup; var strApNum; var strCOName; var strCountry; var strFloor; var strGeoflg; var strLangGaia; var strLocId; var strStreetId; var strValStatus; var strPostalExt; var strIntId; var strPhone; //Company Main Contact Vbles var strCellPhone; var strFax; var strEmailAddr; var strSpokLang; var strSpokLangCode; var strSupplierCode; // TAADAPE2 14.01.2015 - fix for defect #95906 - Populate SA Account with Supplier Code from CMA var BSCAM; var Input; var Output; var sAccStatus:chars; var loBCAccountPick:BusComp; try { // defect # 70443 sAccStatus = ""; if (Inputs.PropertyExists("Account Status")) { sAccStatus = Inputs.GetProperty("Account Status"); } if (sAccStatus == "") { sAccStatus = oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active"); } Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); //Get Active BO and Account BC from the context BOAcc = oApp.GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); BCAdd = BOAcc.GetBusComp("Account Address Usage SCM"); //get Id of the company CMA strCMAId = Inputs.GetProperty("CMAId"); //Search company CMA BCAcc.ActivateField("Primary Name Id SCM"); BCAcc.ActivateField("Primary Usage Address Id SCM"); BCAcc.ActivateField("Name"); BCAcc.ActivateField("Customer Name 1 SCM"); BCAcc.ActivateField("Customer Name 2 SCM"); BCAcc.ActivateField("DetailedSegment SCM"); BCAcc.ActivateField("Subfine Segment SCM"); BCAcc.ActivateField("Correspondence Language SCM"); BCAcc.ActivateField("Correspondence Language Code SCM"); BCAcc.ActivateField("Language"); BCAcc.ActivateField("Language Code"); BCAcc.ActivateField("Comment SCM"); //SCM 29.09.2010 Project CDM: Data Model Change, following fields do not exist any more in BC Account //BCAcc.ActivateField("Touch Point SCM"); //BCAcc.ActivateField("Main VoIP Identification SCM"); //BCAcc.ActivateField("Preferred Communication Method"); //BCAcc.ActivateField("Suppress Proku Flag SCM"); //END CDM BCAcc.ActivateField("Letter Salutation SCM"); BCAcc.ActivateField("Title SCM"); BCAcc.ActivateField("IT PlatForm SCM"); BCAcc.ActivateField("Master Account Id"); //TGDBEJA6 02.09.2010 Project CDM:Create default Contact in the HQ SA BCAcc.ActivateField("Account Company Main Contact Cell Phone # SCM"); BCAcc.ActivateField("Account Company Main Contact Email Address SCM"); BCAcc.ActivateField("Account Company Main Contact Fax SCM"); BCAcc.ActivateField("Account Company Main Contact Phone # SCM"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id",strCMAId); BCAcc.ExecuteQuery(ForwardOnly); //Get CMA data strPrimaryName = BCAcc.GetFieldValue("Primary Name Id SCM"); strMainAddId = BCAcc.GetFieldValue("Primary Usage Address Id SCM"); strName = BCAcc.GetFieldValue("Name"); strName1 = BCAcc.GetFieldValue("Customer Name 1 SCM"); strName2 = BCAcc.GetFieldValue("Customer Name 2 SCM"); strDetSegment = BCAcc.GetFieldValue("DetailedSegment SCM"); strSubSegment = BCAcc.GetFieldValue("Subfine Segment SCM");

Account BS SCM
CreateSASR
function CreateSASR(Inputs,Outputs){ var BOSR:BusObject; var BCSR:BusComp; var BCAcc:BusComp; var strSAId:chars =""; var strOldCMAId:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".CreateSASR START"); //Get Active BO and Account BC from the context BOSR = TheApplication().GetBusObject("Account"); BCSR = BOSR.GetBusComp("Service Request"); strSAId = Inputs.GetProperty("SAId"); BCAcc = BOSR.GetBusComp("Account"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.ActivateField("SA Name Id SCM"); BCAcc.SetSearchSpec("Id",strSAId); BCAcc.ExecuteQuery(ForwardOnly); strOldCMAId = BCAcc.GetFieldValue("Parent Account Id"); //Create a new SR BCSR.SetViewMode(AllView); BCSR.NewRecord(NewAfter); BCSR.SetFieldValue("Account Id", strSAId); BCSR.SetFieldValue("Area", "Customer Data"); BCSR.SetFieldValue("Sub-Area", "09.13 Maintain customer struct"); BCSR.SetFieldValue("Info Consult CD Not GUI SCM", "Manage enterprise structure"); BCSR.SetFieldValue("Secondary Account Id SCM",strOldCMAId); BCSR.SetFieldValue("SA Name Id Aux SCM", BCAcc.GetFieldValue("SA Name Id SCM")); BCSR.SetFieldValue("Previous Account Id SCM", strOldCMAId); //TGDLOAL3 OneCRM 2010-05-14:Moved before writerecord because after writing it lose the context. Outputs.SetProperty("SRId", BCSR.GetFieldValue("Id")); BCSR.WriteRecord(); } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".CreateSASR Error: " + e.message); TheApplication().RaiseErrorText(e.toString()); } finally{ strOldCMAId = null; BCAcc = null; strSAId = null; BCSR = null; BOSR = null; } }

Account BS SCM
CreateSASR
function CreateSASR(Inputs,Outputs){ var BOSR:BusObject; var BCSR:BusComp; var BCAcc:BusComp; var strSAId:chars =""; var strOldCMAId:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".CreateSASR START"); //Get Active BO and Account BC from the context BOSR = TheApplication().GetBusObject("Account"); BCSR = BOSR.GetBusComp("Service Request"); strSAId = Inputs.GetProperty("SAId"); BCAcc = BOSR.GetBusComp("Account"); BCAcc.SetViewMode(AllView); BCAcc.ClearToQuery(); BCAcc.ActivateField("SA Name Id SCM"); BCAcc.SetSearchSpec("Id",strSAId); BCAcc.ExecuteQuery(ForwardOnly); strOldCMAId = BCAcc.GetFieldValue("Parent Account Id"); //Create a new SR BCSR.SetViewMode(AllView); BCSR.NewRecord(NewAfter); BCSR.SetFieldValue("Account Id", strSAId); BCSR.SetFieldValue("Area", "Customer Data"); BCSR.SetFieldValue("Sub-Area", "09.13 Maintain customer struct"); BCSR.SetFieldValue("Info Consult CD Not GUI SCM", "Manage enterprise structure"); BCSR.SetFieldValue("Secondary Account Id SCM",strOldCMAId); BCSR.SetFieldValue("SA Name Id Aux SCM", BCAcc.GetFieldValue("SA Name Id SCM")); BCSR.SetFieldValue("Previous Account Id SCM", strOldCMAId); //TGDLOAL3 OneCRM 2010-05-14:Moved before writerecord because after writing it lose the context. Outputs.SetProperty("SRId", BCSR.GetFieldValue("Id")); BCSR.WriteRecord(); } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".CreateSASR Error: " + e.message); TheApplication().RaiseErrorText(e.toString()); } finally{ strOldCMAId = null; BCAcc = null; strSAId = null; BCSR = null; BOSR = null; } }

Account BS SCM
DeleteActiveSR
/******************************************************* ** Name: DuplicateAccountSearch ** Created: 21.08.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: Deletes the active SR associated to the active customer ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function DeleteActiveSR(Inputs, Outputs) { var BOActiveAccount; var BCActiveSR; var SRId; var BOSR; var BCSR; try { //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCActiveSR = BOActiveAccount.GetBusComp("Service Request"); SRId = BCActiveSR.GetFieldValue("Id"); //Since BC Service Request does not allow to delete records, deletion is done through another BC BOSR = TheApplication().GetBusObject("Service Request EAI SCM"); BCSR = BOSR.GetBusComp("Service Request EAI SCM"); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",SRId); BCSR.ExecuteQuery(ForwardOnly); //var numRec = BCSR.CountRecords(); //var strIDToDelete = BCSR.GetFieldValue("Id"); //var strtemp = BCSR.GetFieldValue("Account Id"); BCSR.DeleteRecord(); } catch(e){ throw(e); } finally{ BCSR = null; BOSR = null; SRId = null; BCActiveSR = null; BOActiveAccount = null; } }

Account BS SCM
DeleteActiveSR
/******************************************************* ** Name: DuplicateAccountSearch ** Created: 21.08.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: Deletes the active SR associated to the active customer ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function DeleteActiveSR(Inputs, Outputs) { var BOActiveAccount; var BCActiveSR; var SRId; var BOSR; var BCSR; try { //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCActiveSR = BOActiveAccount.GetBusComp("Service Request"); SRId = BCActiveSR.GetFieldValue("Id"); //Since BC Service Request does not allow to delete records, deletion is done through another BC BOSR = TheApplication().GetBusObject("Service Request EAI SCM"); BCSR = BOSR.GetBusComp("Service Request EAI SCM"); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",SRId); BCSR.ExecuteQuery(ForwardOnly); //var numRec = BCSR.CountRecords(); //var strIDToDelete = BCSR.GetFieldValue("Id"); //var strtemp = BCSR.GetFieldValue("Account Id"); BCSR.DeleteRecord(); } catch(e){ throw(e); } finally{ BCSR = null; BOSR = null; SRId = null; BCActiveSR = null; BOActiveAccount = null; } }

Account BS SCM
DeleteBillingProfileStructure
/******************************************************* ** Name: Karin Haack ** Created: 01.09.2010 ** Description: Delete all Customer Care Support Structure on BP -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function DeleteBillingProfileStructure(Inputs) { var BOAccount; var BCBillingProfile; var BPId; var BCBPContacts; var BCUserAuth; try { BPId = Inputs.GetProperty ("BPId"); /* set Partner Group on BP to Null*/ BOAccount = TheApplication().GetBusObject("Account"); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile Lite SCM"); BCBillingProfile.ActivateField("Partner Group Id"); BCBillingProfile.SetViewMode(AllView); BCBillingProfile.ClearToQuery(); BCBillingProfile.SetSearchSpec("Id", BPId); BCBillingProfile.ExecuteQuery(ForwardBackward); if (BCBillingProfile.FirstRecord()) { BCBillingProfile.SetFieldValue("Partner Group Id",""); BCBillingProfile.WriteRecord(); } /* delete all contacts and employee assigned to the BP*/ BCBPContacts = BOAccount.GetBusComp("Contact Invoice Profile Intersection SCM"); BCBPContacts.SetViewMode(AllView); BCBPContacts.ClearToQuery(); BCBPContacts.SetSearchSpec("Billing Profile Id", BPId); BCBPContacts.ExecuteQuery(ForwardBackward); while (BCBPContacts.FirstRecord()) { BCBPContacts.DeleteRecord(); } /* delete all user authorizations assigned to the BP*/ BCUserAuth = BOAccount.GetBusComp("Authorization Billing Profile Intersection SCM"); BCUserAuth.SetViewMode(AllView); BCUserAuth.ClearToQuery(); BCUserAuth.SetSearchSpec("Billing Profile Id", BPId); BCUserAuth.ExecuteQuery(ForwardBackward); while (BCUserAuth.FirstRecord()) { BCUserAuth.DeleteRecord(); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { BPId = null; BCBillingProfile = null; BCBPContacts = null; BCUserAuth = null; BOAccount = null; } }

Account BS SCM
DeleteBillingProfileStructure
/******************************************************* ** Name: Karin Haack ** Created: 01.09.2010 ** Description: Delete all Customer Care Support Structure on BP -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function DeleteBillingProfileStructure(Inputs) { var BOAccount; var BCBillingProfile; var BPId; var BCBPContacts; var BCUserAuth; try { BPId = Inputs.GetProperty ("BPId"); /* set Partner Group on BP to Null*/ BOAccount = TheApplication().GetBusObject("Account"); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile Lite SCM"); BCBillingProfile.ActivateField("Partner Group Id"); BCBillingProfile.SetViewMode(AllView); BCBillingProfile.ClearToQuery(); BCBillingProfile.SetSearchSpec("Id", BPId); BCBillingProfile.ExecuteQuery(ForwardBackward); if (BCBillingProfile.FirstRecord()) { BCBillingProfile.SetFieldValue("Partner Group Id",""); BCBillingProfile.WriteRecord(); } /* delete all contacts and employee assigned to the BP*/ BCBPContacts = BOAccount.GetBusComp("Contact Invoice Profile Intersection SCM"); BCBPContacts.SetViewMode(AllView); BCBPContacts.ClearToQuery(); BCBPContacts.SetSearchSpec("Billing Profile Id", BPId); BCBPContacts.ExecuteQuery(ForwardBackward); while (BCBPContacts.FirstRecord()) { BCBPContacts.DeleteRecord(); } /* delete all user authorizations assigned to the BP*/ BCUserAuth = BOAccount.GetBusComp("Authorization Billing Profile Intersection SCM"); BCUserAuth.SetViewMode(AllView); BCUserAuth.ClearToQuery(); BCUserAuth.SetSearchSpec("Billing Profile Id", BPId); BCUserAuth.ExecuteQuery(ForwardBackward); while (BCUserAuth.FirstRecord()) { BCUserAuth.DeleteRecord(); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { BPId = null; BCBillingProfile = null; BCBPContacts = null; BCUserAuth = null; BOAccount = null; } }

Account BS SCM
DuplicateAccountSearch
/***************************************************** ** Name: DuplicateAccountSearch ** Created: 28.07.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: Look for duplicate accounts -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 09.10.2009 ** Changed By: Javier Amor ** Description: Issue 14309. Now duplicate search must only look for New,Customer or Prospect customers ** Scripting was too long for only one file and the process has been split into two differents ** files, one for Companies and another for persons. ******************************************************/ function DuplicateAccountSearch (Inputs, Outputs){ var strCustomerType; //Stores Person, CMA or SA trc(""); try { strCustomerType = Inputs.GetProperty("strCustomerType"); if(strCustomerType == "Person"){ //this.InvokeMethod("DuplicateAccountSearchPerson",Inputs,Outputs); DuplicateAccountSearchPerson(Inputs,Outputs); } else //this.InvokeMethod("DuplicateAccountSearchCompany",Inputs,Outputs); DuplicateAccountSearchCompany(Inputs,Outputs); } catch(e){ trc(e.toString()); TheApplication().RaiseErrorText(e.toString()); } finally{ strCustomerType = null; } }

Account BS SCM
DuplicateAccountSearch
/***************************************************** ** Name: DuplicateAccountSearch ** Created: 28.07.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: Look for duplicate accounts -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 09.10.2009 ** Changed By: Javier Amor ** Description: Issue 14309. Now duplicate search must only look for New,Customer or Prospect customers ** Scripting was too long for only one file and the process has been split into two differents ** files, one for Companies and another for persons. ******************************************************/ function DuplicateAccountSearch (Inputs, Outputs){ var strCustomerType; //Stores Person, CMA or SA trc(""); try { strCustomerType = Inputs.GetProperty("strCustomerType"); if(strCustomerType == "Person"){ //this.InvokeMethod("DuplicateAccountSearchPerson",Inputs,Outputs); DuplicateAccountSearchPerson(Inputs,Outputs); } else //this.InvokeMethod("DuplicateAccountSearchCompany",Inputs,Outputs); DuplicateAccountSearchCompany(Inputs,Outputs); } catch(e){ trc(e.toString()); TheApplication().RaiseErrorText(e.toString()); } finally{ strCustomerType = null; } }

Account BS SCM
DuplicateAccountSearchCompany
/***************************************************************************** * Function: DuplicateAccountSearchCompany * Purpose : Issue 14309. Now duplicate search must only look for New,Customer * or Prospect customers. * And only New and Acive customers for SAs. * Scripting was too long for only one file and the process has been * split into two differents files, one for Companies and another * for persons. A new searchspec has been added in every query * This script is only for Companies. * Params : Inputs * Outputs *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2009-10-09 Javier Amor created *****************************************************************************/ function DuplicateAccountSearchCompany (Inputs, Outputs){ var BOAccount; var BCAccount; var strName; //CMA Company Name var strCommercialReg; var strGeoId; var strGeoNum; var strParentAccId; var strCustomerType; //Stores Person, CMA or SA var strZipCode; var strStreet; var strParCompIndexNum; var row; var doNextQuery = false; var strSearchSpec; //SCM 2009.10.09 TGDAMJA1.Issue 14309. var strSearchSpecSA; var strSearchSpec2; var strSearchSpecSA2; var BOAdd; var BCAdd; trc(""); try { BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BCAccount.ActivateField("Phonetic Search Name SCM"); BCAccount.ActivateField("Commercial Registry Number SCM"); BCAccount.ActivateField("Primary Account Postal Code SCM"); BCAccount.ActivateField("Primary Account City SCM"); BCAccount.ActivateField("Residence Description SCM"); BCAccount.ActivateField("Location Supplement SCM"); BCAccount.ActivateField("Grobsegment SCM"); BCAccount.ActivateField("Account Status"); BCAccount.ActivateField("Account Nr."); BCAccount.ActivateField("Calculated Duplicate Name SCM"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Location Id denormalized SCM"); BCAccount.ActivateField("Parent Grobsegment SCM"); //Issue 10827 BCAccount.ActivateField("Prepayment Flag SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); strName = Inputs.GetProperty("strName"); strCommercialReg = Inputs.GetProperty("strCommercialReg"); strGeoId = Inputs.GetProperty("strGeoId"); strGeoNum = Inputs.GetProperty("strGeoNum"); strParentAccId = Inputs.GetProperty("strParentAccId"); strCustomerType = Inputs.GetProperty("strCustomerType"); strZipCode = Inputs.GetProperty("strZipCode"); strStreet = Inputs.GetProperty("strStreet"); strParCompIndexNum = Inputs.GetProperty("strParCompIndexNum"); BOAdd = oApp.GetBusObject("Account"); BCAdd = BOAdd.GetBusComp("Account Address Ligth SCM"); //SCM 2009.10.09 TGDAMJA1.Issue 14309. Create the new search spec for CMAs and SAs.By doing this //here instead of in the setsearchspec command, lookupvalue is invoked only once instead of every time a query is done. strSearchSpec = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpecSA = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpec2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpecSA2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_ST

Account BS SCM
DuplicateAccountSearchCompany
/***************************************************************************** * Function: DuplicateAccountSearchCompany * Purpose : Issue 14309. Now duplicate search must only look for New,Customer * or Prospect customers. * And only New and Acive customers for SAs. * Scripting was too long for only one file and the process has been * split into two differents files, one for Companies and another * for persons. A new searchspec has been added in every query * This script is only for Companies. * Params : Inputs * Outputs *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2009-10-09 Javier Amor created *****************************************************************************/ function DuplicateAccountSearchCompany (Inputs, Outputs){ var BOAccount; var BCAccount; var strName; //CMA Company Name var strCommercialReg; var strGeoId; var strGeoNum; var strParentAccId; var strCustomerType; //Stores Person, CMA or SA var strZipCode; var strStreet; var strParCompIndexNum; var row; var doNextQuery = false; var strSearchSpec; //SCM 2009.10.09 TGDAMJA1.Issue 14309. var strSearchSpecSA; var strSearchSpec2; var strSearchSpecSA2; var BOAdd; var BCAdd; trc(""); try { BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BCAccount.ActivateField("Phonetic Search Name SCM"); BCAccount.ActivateField("Commercial Registry Number SCM"); BCAccount.ActivateField("Primary Account Postal Code SCM"); BCAccount.ActivateField("Primary Account City SCM"); BCAccount.ActivateField("Residence Description SCM"); BCAccount.ActivateField("Location Supplement SCM"); BCAccount.ActivateField("Grobsegment SCM"); BCAccount.ActivateField("Account Status"); BCAccount.ActivateField("Account Nr."); BCAccount.ActivateField("Calculated Duplicate Name SCM"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Location Id denormalized SCM"); BCAccount.ActivateField("Parent Grobsegment SCM"); //Issue 10827 BCAccount.ActivateField("Prepayment Flag SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); strName = Inputs.GetProperty("strName"); strCommercialReg = Inputs.GetProperty("strCommercialReg"); strGeoId = Inputs.GetProperty("strGeoId"); strGeoNum = Inputs.GetProperty("strGeoNum"); strParentAccId = Inputs.GetProperty("strParentAccId"); strCustomerType = Inputs.GetProperty("strCustomerType"); strZipCode = Inputs.GetProperty("strZipCode"); strStreet = Inputs.GetProperty("strStreet"); strParCompIndexNum = Inputs.GetProperty("strParCompIndexNum"); BOAdd = oApp.GetBusObject("Account"); BCAdd = BOAdd.GetBusComp("Account Address Ligth SCM"); //SCM 2009.10.09 TGDAMJA1.Issue 14309. Create the new search spec for CMAs and SAs.By doing this //here instead of in the setsearchspec command, lookupvalue is invoked only once instead of every time a query is done. strSearchSpec = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpecSA = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpec2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpecSA2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Active")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_ST

Account BS SCM
DuplicateAccountSearchPerson
/** ** Name: 09.10.2009 ** Created By: Javier Amor ** Description: Issue 14309. Now duplicate search must only look for New,Customer or Prospect ** Scripting was too long and the process has been split into two differents one for Companies other for persons ** This script is only for Persons. - Modifications - ** Changed By: Gema Torres (30.10.2009) ** Description: Due to Performance issue, the number of queries in algorithm has been reduced and BC 'Account Address Ligth SCM' used to perform queries on 'Location Id' or 'ZipCode' **/ function DuplicateAccountSearchPerson (Inputs, Outputs){ var BOAccount; var BCAccount; var strBirthDate; var strGeoId; var strGeoNum; var strParentAccId; var strFirstName; var strLastName; var strZipCode; var strStreet; var row; var doNextQuery = false; var strSearchSpec;//SCM 2009.10.09 TGDAMJA1.Issue 14309 var strSearchSpec2; var srLevelOfQuality = "2"; var BOAdd; var BCAdd; trc(""); try { BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BCAccount.ActivateField("Phonetic Search Name SCM"); BCAccount.ActivateField("Account Contact Birth Date"); BCAccount.ActivateField("Primary Account Postal Code SCM"); BCAccount.ActivateField("Primary Account City SCM"); BCAccount.ActivateField("Residence Description SCM"); BCAccount.ActivateField("Location Supplement SCM"); BCAccount.ActivateField("Grobsegment SCM"); BCAccount.ActivateField("Account Status"); BCAccount.ActivateField("Calculated Duplicate Name SCM"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Location Id denormalized SCM"); BCAccount.ActivateField("Account Nr."); BCAccount.ActivateField("Prepayment Flag SCM");//TGDGAAND 24.11.2009 Issue 17352, Avoid Prepaid Customer BCAccount.ActivateField("Account Contact Id # SCM"); //CR412 TGDTOGE3 26.07.2010 BCAccount.ActivateField("Account Contact Id Typ SCM"); //CR412 TGDTOGE3 26.07.2010 BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); strBirthDate = Inputs.GetProperty("strBirthDate"); strGeoId = Inputs.GetProperty("strGeoId"); strGeoNum = Inputs.GetProperty("strGeoNum"); strParentAccId = Inputs.GetProperty("strParentAccId"); strFirstName = Inputs.GetProperty("strFirstName"); strLastName = Inputs.GetProperty("strLastName"); strZipCode = Inputs.GetProperty("strZipCode"); strStreet = Inputs.GetProperty("strStreet"); BOAdd = oApp.GetBusObject("Account"); BCAdd = BOAdd.GetBusComp("Account Address Ligth SCM"); //SCM 2009.10.09 TGDAMJA1.Issue 14309. Create the new search spec for Persons.By doing this //here instead of in the setsearchspec command, lookupvalue is invoked only once instead of every time a query is done. strSearchSpec = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpec2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; srLevelOfQuality = oApp.utils.SCM_RetrieveACV("LevelOfDuplicateQuality"); //When a query finds matches then the rest of the queries do not take place. if (strGeoId == "Y"){ if (strBirthDate != "01/01/1900"){//Step1 BCAccount.SetSearchSpec("Id", " <> '" + strParentAccId + "'"); BCAccount.SetSearchSpec("Phonetic Search Name SCM", strLastName+"*"+strFirstName+"*"); //Issue 15409, TGDTOGE3 26.10.2009 change field 'Account Contact Birth Date SCM' which is multivaluated field to 'Account Contact Birth Date' joined BCAccount.SetSearchSpec("Account Contact Birth Date", strBirthDate); BCAccount.

Account BS SCM
DuplicateAccountSearchPerson
/** ** Name: 09.10.2009 ** Created By: Javier Amor ** Description: Issue 14309. Now duplicate search must only look for New,Customer or Prospect ** Scripting was too long and the process has been split into two differents one for Companies other for persons ** This script is only for Persons. - Modifications - ** Changed By: Gema Torres (30.10.2009) ** Description: Due to Performance issue, the number of queries in algorithm has been reduced and BC 'Account Address Ligth SCM' used to perform queries on 'Location Id' or 'ZipCode' **/ function DuplicateAccountSearchPerson (Inputs, Outputs){ var BOAccount; var BCAccount; var strBirthDate; var strGeoId; var strGeoNum; var strParentAccId; var strFirstName; var strLastName; var strZipCode; var strStreet; var row; var doNextQuery = false; var strSearchSpec;//SCM 2009.10.09 TGDAMJA1.Issue 14309 var strSearchSpec2; var srLevelOfQuality = "2"; var BOAdd; var BCAdd; trc(""); try { BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BCAccount.ActivateField("Phonetic Search Name SCM"); BCAccount.ActivateField("Account Contact Birth Date"); BCAccount.ActivateField("Primary Account Postal Code SCM"); BCAccount.ActivateField("Primary Account City SCM"); BCAccount.ActivateField("Residence Description SCM"); BCAccount.ActivateField("Location Supplement SCM"); BCAccount.ActivateField("Grobsegment SCM"); BCAccount.ActivateField("Account Status"); BCAccount.ActivateField("Calculated Duplicate Name SCM"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Location Id denormalized SCM"); BCAccount.ActivateField("Account Nr."); BCAccount.ActivateField("Prepayment Flag SCM");//TGDGAAND 24.11.2009 Issue 17352, Avoid Prepaid Customer BCAccount.ActivateField("Account Contact Id # SCM"); //CR412 TGDTOGE3 26.07.2010 BCAccount.ActivateField("Account Contact Id Typ SCM"); //CR412 TGDTOGE3 26.07.2010 BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); strBirthDate = Inputs.GetProperty("strBirthDate"); strGeoId = Inputs.GetProperty("strGeoId"); strGeoNum = Inputs.GetProperty("strGeoNum"); strParentAccId = Inputs.GetProperty("strParentAccId"); strFirstName = Inputs.GetProperty("strFirstName"); strLastName = Inputs.GetProperty("strLastName"); strZipCode = Inputs.GetProperty("strZipCode"); strStreet = Inputs.GetProperty("strStreet"); BOAdd = oApp.GetBusObject("Account"); BCAdd = BOAdd.GetBusComp("Account Address Ligth SCM"); //SCM 2009.10.09 TGDAMJA1.Issue 14309. Create the new search spec for Persons.By doing this //here instead of in the setsearchspec command, lookupvalue is invoked only once instead of every time a query is done. strSearchSpec = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; strSearchSpec2 = "'"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Prospect")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","Customer")+"' OR [Account Status SCM]='"+oApp.InvokeMethod("LookupValue","ACCOUNT_STATUS","New")+"'"; srLevelOfQuality = oApp.utils.SCM_RetrieveACV("LevelOfDuplicateQuality"); //When a query finds matches then the rest of the queries do not take place. if (strGeoId == "Y"){ if (strBirthDate != "01/01/1900"){//Step1 BCAccount.SetSearchSpec("Id", " <> '" + strParentAccId + "'"); BCAccount.SetSearchSpec("Phonetic Search Name SCM", strLastName+"*"+strFirstName+"*"); //Issue 15409, TGDTOGE3 26.10.2009 change field 'Account Contact Birth Date SCM' which is multivaluated field to 'Account Contact Birth Date' joined BCAccount.SetSearchSpec("Account Contact Birth Date", strBirthDate); BCAccount.

Account BS SCM
DuplicateCustomerCheck
function DuplicateCustomerCheck(Inputs, Outputs) { var oBOSource : BusObject; var oBCSource : BusComp; var oBOSearch : BusObject; var oBCSearch : BusComp; // var bsPhonetic : Service; // 2012-06-28; tgdstre0, defect # 55061 - obsolete // var psIn : PropertySet; // var psOut : PropertySet; var asQuery : Array; var iQueryMax : Number; var iQuery : Number; var iNotGeo : Number; // 2012-06-28; tgdstre0, defect # 55061 var bNotGeo : bool; // ... var bNotFound : bool; var sSearchId : chars; var sAccountId : chars; var sNameLast : chars; var sNameFirst : chars; var sStreet : chars; var sHouseNo : chars; var sZipCode : chars; var sCity : chars; var sBirthday : chars; var sReturnCode : chars; var sReturnText : chars; var sId : chars; var sNotGeo : chars; // ... var sQueryBase : chars; // 2012-09-24; tgdstre0; defect # 57792 try { oBCSource = null; sReturnCode = "N/A"; sReturnText = "undefined"; sSearchId = ""; sAccountId = ""; bNotFound = true; bNotGeo = false; iNotGeo = 5; sNotGeo = ""; // 2012-06-28; tgdstre0, defect # 55061 if (Inputs.PropertyExists("NotGeo")) { sNotGeo = Inputs.GetProperty("NotGeo"); if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'NotGeo' = '" + sNotGeo + "'"); if (sNotGeo == "Y") { bNotGeo = true; } } if (Inputs.PropertyExists("Quote Id")) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'Quote Id' found"); sSearchId = Inputs.GetProperty("Quote Id"); oBOSource = oApp.GetBusObject("Quote Lite SCM"); oBCSource = oBOSource.GetBusComp("Quote Lite SCM"); } else if (Inputs.PropertyExists("SR Id")) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'SR Id' found"); sSearchId = Inputs.GetProperty("SR Id"); oBOSource = oApp.GetBusObject("Service Request Query Light SCM"); oBCSource = oBOSource.GetBusComp("Service Request Query Light SCM"); } if (sSearchId == "") { sReturnCode = "NOK"; sReturnText = "Missing Input Quote/SR Id"; } else { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: sSearchId = '" + sSearchId + "'"); sReturnCode = "NOK"; sReturnText = "Account not found"; oBCSource.SetViewMode(AllView); oBCSource.ClearToQuery(); oBCSource.SetSearchSpec("Id", sSearchId); oBCSource.ExecuteQuery(ForwardOnly); if (oBCSource.FirstRecord()) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: found record"); sAccountId = oBCSource.GetFieldValue("Account Id"); } if (sAccountId.length > 0) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: sAccountId = '" + sAccountId + "'"); sReturnCode = "NOK"; sReturnText = "SourceAddress not found"; oBOSearch = oApp.GetBusObject("EAI Search Customer SCM"); oBCSearch = oBOSearch.GetBusComp("EAI Search Customer SCM"); oBCSearch.ActivateField("Contact Last Name"); oBCSearch.ActivateField("Contact First Name"); oBCSearch.ActivateField("Address Street"); oBCSearch.ActivateField("Address House Num"); oBCSearch.ActivateField("Address City"); oBCSearch.ActivateField("Address Zip Code"); oBCSearch.ActivateField("Contact Birth Date"); oBCSearch.SetViewMode(AllView); oBCSearch.ClearToQuery(); oBCSearch.SetSearchSpec("Customer Id", sAccountId); oBCSearch.ExecuteQuery(ForwardOnly); if (oBCSearch.FirstRecord()) { if (bIsTraceOn) oApp.Trace("Dupli

Account BS SCM
DuplicateCustomerCheck
function DuplicateCustomerCheck(Inputs, Outputs) { var oBOSource : BusObject; var oBCSource : BusComp; var oBOSearch : BusObject; var oBCSearch : BusComp; // var bsPhonetic : Service; // 2012-06-28; tgdstre0, defect # 55061 - obsolete // var psIn : PropertySet; // var psOut : PropertySet; var asQuery : Array; var iQueryMax : Number; var iQuery : Number; var iNotGeo : Number; // 2012-06-28; tgdstre0, defect # 55061 var bNotGeo : bool; // ... var bNotFound : bool; var sSearchId : chars; var sAccountId : chars; var sNameLast : chars; var sNameFirst : chars; var sStreet : chars; var sHouseNo : chars; var sZipCode : chars; var sCity : chars; var sBirthday : chars; var sReturnCode : chars; var sReturnText : chars; var sId : chars; var sNotGeo : chars; // ... var sQueryBase : chars; // 2012-09-24; tgdstre0; defect # 57792 try { oBCSource = null; sReturnCode = "N/A"; sReturnText = "undefined"; sSearchId = ""; sAccountId = ""; bNotFound = true; bNotGeo = false; iNotGeo = 5; sNotGeo = ""; // 2012-06-28; tgdstre0, defect # 55061 if (Inputs.PropertyExists("NotGeo")) { sNotGeo = Inputs.GetProperty("NotGeo"); if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'NotGeo' = '" + sNotGeo + "'"); if (sNotGeo == "Y") { bNotGeo = true; } } if (Inputs.PropertyExists("Quote Id")) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'Quote Id' found"); sSearchId = Inputs.GetProperty("Quote Id"); oBOSource = oApp.GetBusObject("Quote Lite SCM"); oBCSource = oBOSource.GetBusComp("Quote Lite SCM"); } else if (Inputs.PropertyExists("SR Id")) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: Property 'SR Id' found"); sSearchId = Inputs.GetProperty("SR Id"); oBOSource = oApp.GetBusObject("Service Request Query Light SCM"); oBCSource = oBOSource.GetBusComp("Service Request Query Light SCM"); } if (sSearchId == "") { sReturnCode = "NOK"; sReturnText = "Missing Input Quote/SR Id"; } else { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: sSearchId = '" + sSearchId + "'"); sReturnCode = "NOK"; sReturnText = "Account not found"; oBCSource.SetViewMode(AllView); oBCSource.ClearToQuery(); oBCSource.SetSearchSpec("Id", sSearchId); oBCSource.ExecuteQuery(ForwardOnly); if (oBCSource.FirstRecord()) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: found record"); sAccountId = oBCSource.GetFieldValue("Account Id"); } if (sAccountId.length > 0) { if (bIsTraceOn) oApp.Trace("DuplicateCustomerCheck: sAccountId = '" + sAccountId + "'"); sReturnCode = "NOK"; sReturnText = "SourceAddress not found"; oBOSearch = oApp.GetBusObject("EAI Search Customer SCM"); oBCSearch = oBOSearch.GetBusComp("EAI Search Customer SCM"); oBCSearch.ActivateField("Contact Last Name"); oBCSearch.ActivateField("Contact First Name"); oBCSearch.ActivateField("Address Street"); oBCSearch.ActivateField("Address House Num"); oBCSearch.ActivateField("Address City"); oBCSearch.ActivateField("Address Zip Code"); oBCSearch.ActivateField("Contact Birth Date"); oBCSearch.SetViewMode(AllView); oBCSearch.ClearToQuery(); oBCSearch.SetSearchSpec("Customer Id", sAccountId); oBCSearch.ExecuteQuery(ForwardOnly); if (oBCSearch.FirstRecord()) { if (bIsTraceOn) oApp.Trace("Dupli

Account BS SCM
GetAccountId
/******************************************************* ** Name: Get_Account_ID ** Created: 11.08.2008 ** Created By: Rosalyn Ramírez ** Description: Returns Account Id from SR Id. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetAccountId(Inputs, Outputs) { var BOSR; var BCSR; var strSRNumber; try { strSRNumber = Inputs.GetProperty("SRId"); //Get the SR Id. BOSR = TheApplication().GetBusObject("Account"); BCSR = BOSR.GetBusComp("Service Request"); BCSR.ClearToQuery(); BCSR.ActivateField("Asset Owner Account Id SCM"); BCSR.SetSearchSpec("SR Id",strSRNumber); BCSR.ExecuteQuery(ForwardOnly); if(BCSR.FirstRecord()) { Outputs.SetProperty("AccountId", BCSR.GetFieldValue("Account Id")); Outputs.SetProperty("AssetId", BCSR.GetFieldValue("Asset Id")); Outputs.SetProperty("OwnerAsset", BCSR.GetFieldValue("Asset Owner Account Id SCM")); } else { TheApplication().RaiseErrorText("Error: No string set as Output Parameter"); } } catch(e) { } finally { BCSR = null; BOSR = null; } }

Account BS SCM
GetAccountId
/******************************************************* ** Name: Get_Account_ID ** Created: 11.08.2008 ** Created By: Rosalyn Ramírez ** Description: Returns Account Id from SR Id. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetAccountId(Inputs, Outputs) { var BOSR; var BCSR; var strSRNumber; try { strSRNumber = Inputs.GetProperty("SRId"); //Get the SR Id. BOSR = TheApplication().GetBusObject("Account"); BCSR = BOSR.GetBusComp("Service Request"); BCSR.ClearToQuery(); BCSR.ActivateField("Asset Owner Account Id SCM"); BCSR.SetSearchSpec("SR Id",strSRNumber); BCSR.ExecuteQuery(ForwardOnly); if(BCSR.FirstRecord()) { Outputs.SetProperty("AccountId", BCSR.GetFieldValue("Account Id")); Outputs.SetProperty("AssetId", BCSR.GetFieldValue("Asset Id")); Outputs.SetProperty("OwnerAsset", BCSR.GetFieldValue("Asset Owner Account Id SCM")); } else { TheApplication().RaiseErrorText("Error: No string set as Output Parameter"); } } catch(e) { } finally { BCSR = null; BOSR = null; } }

Account BS SCM
GetAddressId
/******************************************************* ** Name: Get_Adress_ID ** Created: 19.08.2008 ** Created By: Rosalyn Ramírez ** Description: Returns Address Id and Normalized Fields. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetAddressId(Inputs, Outputs) { var strAccountId; var BOAccount; var BCAccntAddr; try { strAccountId = Inputs.GetProperty("AccountId"); BOAccount = TheApplication().GetBusObject("Account"); BCAccntAddr = BOAccount.GetBusComp("Account Address Usage SCM"); BCAccntAddr.ClearToQuery(); BCAccntAddr.ActivateField("Address Id SCM"); BCAccntAddr.ActivateField("Address Geovalidated Flag denormalized SCM"); BCAccntAddr.ActivateField("City denormalized SCM"); BCAccntAddr.ActivateField("Country denormalized SCM"); BCAccntAddr.ActivateField("Language Code GAIA denormalized SCM"); BCAccntAddr.ActivateField("Location Id denormalized SCM"); BCAccntAddr.ActivateField("Location Supplement denormalized SCM"); BCAccntAddr.ActivateField("PO Box denormalized SCM"); BCAccntAddr.ActivateField("Postal Code Extension denormalized SCM"); BCAccntAddr.ActivateField("Postal Code denormalized SCM"); BCAccntAddr.ActivateField("Residence Description denormalized SCM"); BCAccntAddr.ActivateField("Street Address denormalized SCM"); BCAccntAddr.ActivateField("Street Nr. denormalized SCM"); BCAccntAddr.ActivateField("Validation Status denormalized SCM"); BCAccntAddr.SetSearchSpec("Account Id SCM", strAccountId); BCAccntAddr.ExecuteQuery(ForwardOnly); Outputs.SetProperty("AddressId", BCAccntAddr.GetFieldValue("Address Id SCM")); Outputs.SetProperty("AddressGeo", BCAccntAddr.GetFieldValue("Address Geovalidated Flag denormalized SCM")); Outputs.SetProperty("City", BCAccntAddr.GetFieldValue("City denormalized SCM")); Outputs.SetProperty("Country", BCAccntAddr.GetFieldValue("Country denormalized SCM")); Outputs.SetProperty("LanguageCode", BCAccntAddr.GetFieldValue("Language Code GAIA denormalized SCM")); Outputs.SetProperty("LocationId", BCAccntAddr.GetFieldValue("Location Id denormalized SCM")); Outputs.SetProperty("LocationSu", BCAccntAddr.GetFieldValue("Location Supplement denormalized SCM")); Outputs.SetProperty("POBox", BCAccntAddr.GetFieldValue("PO Box denormalized SCM")); Outputs.SetProperty("PCodeExt", BCAccntAddr.GetFieldValue("Postal Code Extension denormalized SCM")); Outputs.SetProperty("PCode", BCAccntAddr.GetFieldValue("Postal Code denormalized SCM")); Outputs.SetProperty("Residence", BCAccntAddr.GetFieldValue("Residence Description denormalized SCM")); Outputs.SetProperty("Street", BCAccntAddr.GetFieldValue("Street Address denormalized SCM")); Outputs.SetProperty("StreetNr", BCAccntAddr.GetFieldValue("Street Nr. denormalized SCM")); Outputs.SetProperty("ValidationStatus", BCAccntAddr.GetFieldValue("Validation Status denormalized SCM")); } catch(e) { } finally { BCAccntAddr = null; BOAccount = null; } }

Account BS SCM
GetAddressId
/******************************************************* ** Name: Get_Adress_ID ** Created: 19.08.2008 ** Created By: Rosalyn Ramírez ** Description: Returns Address Id and Normalized Fields. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetAddressId(Inputs, Outputs) { var strAccountId; var BOAccount; var BCAccntAddr; try { strAccountId = Inputs.GetProperty("AccountId"); BOAccount = TheApplication().GetBusObject("Account"); BCAccntAddr = BOAccount.GetBusComp("Account Address Usage SCM"); BCAccntAddr.ClearToQuery(); BCAccntAddr.ActivateField("Address Id SCM"); BCAccntAddr.ActivateField("Address Geovalidated Flag denormalized SCM"); BCAccntAddr.ActivateField("City denormalized SCM"); BCAccntAddr.ActivateField("Country denormalized SCM"); BCAccntAddr.ActivateField("Language Code GAIA denormalized SCM"); BCAccntAddr.ActivateField("Location Id denormalized SCM"); BCAccntAddr.ActivateField("Location Supplement denormalized SCM"); BCAccntAddr.ActivateField("PO Box denormalized SCM"); BCAccntAddr.ActivateField("Postal Code Extension denormalized SCM"); BCAccntAddr.ActivateField("Postal Code denormalized SCM"); BCAccntAddr.ActivateField("Residence Description denormalized SCM"); BCAccntAddr.ActivateField("Street Address denormalized SCM"); BCAccntAddr.ActivateField("Street Nr. denormalized SCM"); BCAccntAddr.ActivateField("Validation Status denormalized SCM"); BCAccntAddr.SetSearchSpec("Account Id SCM", strAccountId); BCAccntAddr.ExecuteQuery(ForwardOnly); Outputs.SetProperty("AddressId", BCAccntAddr.GetFieldValue("Address Id SCM")); Outputs.SetProperty("AddressGeo", BCAccntAddr.GetFieldValue("Address Geovalidated Flag denormalized SCM")); Outputs.SetProperty("City", BCAccntAddr.GetFieldValue("City denormalized SCM")); Outputs.SetProperty("Country", BCAccntAddr.GetFieldValue("Country denormalized SCM")); Outputs.SetProperty("LanguageCode", BCAccntAddr.GetFieldValue("Language Code GAIA denormalized SCM")); Outputs.SetProperty("LocationId", BCAccntAddr.GetFieldValue("Location Id denormalized SCM")); Outputs.SetProperty("LocationSu", BCAccntAddr.GetFieldValue("Location Supplement denormalized SCM")); Outputs.SetProperty("POBox", BCAccntAddr.GetFieldValue("PO Box denormalized SCM")); Outputs.SetProperty("PCodeExt", BCAccntAddr.GetFieldValue("Postal Code Extension denormalized SCM")); Outputs.SetProperty("PCode", BCAccntAddr.GetFieldValue("Postal Code denormalized SCM")); Outputs.SetProperty("Residence", BCAccntAddr.GetFieldValue("Residence Description denormalized SCM")); Outputs.SetProperty("Street", BCAccntAddr.GetFieldValue("Street Address denormalized SCM")); Outputs.SetProperty("StreetNr", BCAccntAddr.GetFieldValue("Street Nr. denormalized SCM")); Outputs.SetProperty("ValidationStatus", BCAccntAddr.GetFieldValue("Validation Status denormalized SCM")); } catch(e) { } finally { BCAccntAddr = null; BOAccount = null; } }

Account BS SCM
GetDuplicateCustomers
/******************************************************* ** Name: GetDuplicateCustomers ** Created: 30.10.2009 ** Created By: Gema Torres ** Description: performance issue, BS instead of Siebel OPeration in wf Customer Validation SCM ** in orden to perform one query in Duplicate VBC instead of two queries because of SO ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetDuplicateCustomers(Inputs,Outputs) { /*var strAttribs; var BCDups; var BSDup; BSDup = TheApplication().GetService("Account BS SCM"); BSDup.InvokeMethod("DuplicateAccountSearch", strAttribs, BCDups); */ var BOAcc; var BCDup; try { BOAcc = oApp.ActiveBusObject(); BCDup = BOAcc.GetBusComp("Duplicate Customer Candidate VBC SCM"); BCDup.SetViewMode(AllView); BCDup.ClearToQuery(); BCDup.ExecuteQuery(ForwardOnly); if(BCDup.FirstRecord()) Outputs.SetProperty("Duplicate Customers", "3"); else Outputs.SetProperty("Duplicate Customers", "0"); } catch(e){ oApp.RaiseErrorText(e.toString()); } finally{ BCDup = null; BOAcc = null; } }

Account BS SCM
GetDuplicateCustomers
/******************************************************* ** Name: GetDuplicateCustomers ** Created: 30.10.2009 ** Created By: Gema Torres ** Description: performance issue, BS instead of Siebel OPeration in wf Customer Validation SCM ** in orden to perform one query in Duplicate VBC instead of two queries because of SO ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetDuplicateCustomers(Inputs,Outputs) { /*var strAttribs; var BCDups; var BSDup; BSDup = TheApplication().GetService("Account BS SCM"); BSDup.InvokeMethod("DuplicateAccountSearch", strAttribs, BCDups); */ var BOAcc; var BCDup; try { BOAcc = oApp.ActiveBusObject(); BCDup = BOAcc.GetBusComp("Duplicate Customer Candidate VBC SCM"); BCDup.SetViewMode(AllView); BCDup.ClearToQuery(); BCDup.ExecuteQuery(ForwardOnly); if(BCDup.FirstRecord()) Outputs.SetProperty("Duplicate Customers", "3"); else Outputs.SetProperty("Duplicate Customers", "0"); } catch(e){ oApp.RaiseErrorText(e.toString()); } finally{ BCDup = null; BOAcc = null; } }

Account BS SCM
GoToViewAccount
/******************************************************* ** Name: NameChange ** Created: 21.07.2008 ** Created By: Gomez Ayerbe, Javier ** Description: Creates the Change Name SR and navigates ** to the SR Toggle Account View SCM ** -------------------- Modifications --------------------- ** Version: ** Date: 19.01.2009 ** Changed By: Gema Torres ** Description: For Shop application if a Sr Contact In Shop exits open for the agent, it is reused and renamed to the one of change name ******************************************************/ function GoToViewAccount(Inputs, Outputs){ var BOServiceRequest; var BCServiceRequest; var BCAccount; var BCSRe; var AccountSearchSpec; var SRId; var svc; var Input; var Output; try { if(TheApplication().GetProfileAttr("ApplicationName") == "Siebel eChannel") //Shop Application { // Initializing the BO and BC BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCAccount = BOServiceRequest.GetBusComp("Account Lite SCM"); BCSRe = BOServiceRequest.GetBusComp("Service Request"); // Input Account Row Id AccountSearchSpec = Inputs.GetProperty("Row Id"); svc = TheApplication().GetService("Workflow Process Manager"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); BCSRe.ClearToQuery(); BCSRe.SetSearchSpec("Status", "Open"); //BCSRe.SetSearchSpec("Sub-Area", "Contact in Shop"); BCSRe.SetSearchSpec("Sub-Area", "Contact in Shop1");//TAASAAI2 02.12.2015 SO2676 - SR Tree reorganization BCSRe.SetSearchSpec("Account Id", AccountSearchSpec); BCSRe.SetSearchSpec("Created By Name", TheApplication().GetProfileAttr("Login Name")); BCSRe.ExecuteQuery(ForwardOnly); //SR 'Contact in Shop' exits, it has to be rehused if(BCSRe.FirstRecord()) { BCSRe.SetFieldValue("Area","Customer Data"); BCSRe.SetFieldValue("Sub-Area","Name change"); BCSRe.SetFieldValue("Info Consult CD Not GUI SCM","mutation"); SRId = BCSRe.GetFieldValue("Id"); BCSRe.WriteRecord(); //Search SR to refresh SR applet if(SRId != "") { BCSRe.ClearToQuery(); BCSRe.SetSearchSpec("Id", SRId); BCSRe.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } } else //New SR has to be created { // SR (Type: Customer Data; SubType: Change of Name; Detail: Mutation) creation Input.SetProperty("ProcessName", "Automatic SR Creation SCM"); //WF Create a SR automaticaaly and generate error if already exists one Input.SetProperty("Area", "Customer Data"); //Customer Data Input.SetProperty("Sub-Area", "Name change"); //Name Change Input.SetProperty("Detail", "mutation"); Input.SetProperty("Object Id",AccountSearchSpec); //To asociate the SR to the active client Input.SetProperty("Entity", "Customer"); svc.InvokeMethod("RunProcess", Input, Output); SRId = Output.GetProperty("Siebel Operation Object Id"); // Build the BO if(SRId != "") { // BC - Service Request BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } } //TheApplication().GotoView("SR Toggle Account View SCM", BOServiceRequest); //SCM 2010.08.25 TGDTOGE3 -- CR22419 --Change name now based on SR TheApplication().GotoView("SR To

Account BS SCM
GoToViewAccount
/******************************************************* ** Name: NameChange ** Created: 21.07.2008 ** Created By: Gomez Ayerbe, Javier ** Description: Creates the Change Name SR and navigates ** to the SR Toggle Account View SCM ** -------------------- Modifications --------------------- ** Version: ** Date: 19.01.2009 ** Changed By: Gema Torres ** Description: For Shop application if a Sr Contact In Shop exits open for the agent, it is reused and renamed to the one of change name ******************************************************/ function GoToViewAccount(Inputs, Outputs){ var BOServiceRequest; var BCServiceRequest; var BCAccount; var BCSRe; var AccountSearchSpec; var SRId; var svc; var Input; var Output; try { if(TheApplication().GetProfileAttr("ApplicationName") == "Siebel eChannel") //Shop Application { // Initializing the BO and BC BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCAccount = BOServiceRequest.GetBusComp("Account Lite SCM"); BCSRe = BOServiceRequest.GetBusComp("Service Request"); // Input Account Row Id AccountSearchSpec = Inputs.GetProperty("Row Id"); svc = TheApplication().GetService("Workflow Process Manager"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); BCSRe.ClearToQuery(); BCSRe.SetSearchSpec("Status", "Open"); //BCSRe.SetSearchSpec("Sub-Area", "Contact in Shop"); BCSRe.SetSearchSpec("Sub-Area", "Contact in Shop1");//TAASAAI2 02.12.2015 SO2676 - SR Tree reorganization BCSRe.SetSearchSpec("Account Id", AccountSearchSpec); BCSRe.SetSearchSpec("Created By Name", TheApplication().GetProfileAttr("Login Name")); BCSRe.ExecuteQuery(ForwardOnly); //SR 'Contact in Shop' exits, it has to be rehused if(BCSRe.FirstRecord()) { BCSRe.SetFieldValue("Area","Customer Data"); BCSRe.SetFieldValue("Sub-Area","Name change"); BCSRe.SetFieldValue("Info Consult CD Not GUI SCM","mutation"); SRId = BCSRe.GetFieldValue("Id"); BCSRe.WriteRecord(); //Search SR to refresh SR applet if(SRId != "") { BCSRe.ClearToQuery(); BCSRe.SetSearchSpec("Id", SRId); BCSRe.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } } else //New SR has to be created { // SR (Type: Customer Data; SubType: Change of Name; Detail: Mutation) creation Input.SetProperty("ProcessName", "Automatic SR Creation SCM"); //WF Create a SR automaticaaly and generate error if already exists one Input.SetProperty("Area", "Customer Data"); //Customer Data Input.SetProperty("Sub-Area", "Name change"); //Name Change Input.SetProperty("Detail", "mutation"); Input.SetProperty("Object Id",AccountSearchSpec); //To asociate the SR to the active client Input.SetProperty("Entity", "Customer"); svc.InvokeMethod("RunProcess", Input, Output); SRId = Output.GetProperty("Siebel Operation Object Id"); // Build the BO if(SRId != "") { // BC - Service Request BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } } //TheApplication().GotoView("SR Toggle Account View SCM", BOServiceRequest); //SCM 2010.08.25 TGDTOGE3 -- CR22419 --Change name now based on SR TheApplication().GotoView("SR To

Account BS SCM
GoToViewCreation
/******************************************************* ** Name: GoToViewCreation ** Created: 20.01.2009 ** Created By: Torres Campos, Gema ** Description: This script navigate to the Customer Creation View for Person Customers or Company Customers -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function GoToViewCreation (Inputs) { var BOAcc; var BCAcc; try { BOAcc = TheApplication().GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); //This query is to make the customer creation view empty. //Without this empty query the agent will see a customer until the browser script //is triggered. BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id", "nothing"); BCAcc.ExecuteQuery(ForwardBackward); // TheApplication().SetProfileAttr("CustomerCreation","Y"); TheApplication().SetProfileAttr("CustomerTypeToCreate",Inputs.GetProperty("CustomerType")); TheApplication().SetProfileAttr("SearchInCenterDone","N"); TheApplication().GotoView(Inputs.GetProperty("ViewName"), BOAcc); return (ContinueOperation); } catch(e){ //throw(e); TheApplication().RaiseErrorText(e.toString()); } finally { BOAcc = null; BCAcc = null; } }

Account BS SCM
GoToViewCreation
/******************************************************* ** Name: GoToViewCreation ** Created: 20.01.2009 ** Created By: Torres Campos, Gema ** Description: This script navigate to the Customer Creation View for Person Customers or Company Customers -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function GoToViewCreation (Inputs) { var BOAcc; var BCAcc; try { BOAcc = TheApplication().GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); //This query is to make the customer creation view empty. //Without this empty query the agent will see a customer until the browser script //is triggered. BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id", "nothing"); BCAcc.ExecuteQuery(ForwardBackward); // TheApplication().SetProfileAttr("CustomerCreation","Y"); TheApplication().SetProfileAttr("CustomerTypeToCreate",Inputs.GetProperty("CustomerType")); TheApplication().SetProfileAttr("SearchInCenterDone","N"); TheApplication().GotoView(Inputs.GetProperty("ViewName"), BOAcc); return (ContinueOperation); } catch(e){ //throw(e); TheApplication().RaiseErrorText(e.toString()); } finally { BOAcc = null; BCAcc = null; } }

Account BS SCM
GoToViewDuplicate
/******************************************************* ** Name: GoToViewDuplicate ** Created: 21.07.2008 ** Created By: Gomez Ayerbe, Javier ** Description: Navigates to the Duplicate Customer ** Candidate View SCM with the new customer selected ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GoToViewDuplicate(Inputs, Outputs){ var BOAccountActive; var BCAccountActive; var svc; var Input; var Output; try { BOAccountActive = TheApplication().ActiveBusObject(); BCAccountActive = BOAccountActive.GetBusComp("Account"); //BCAccountActive.WriteRecord(); svc = TheApplication().GetService("Workflow Process Manager"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); // Input.SetProperty("ProcessName", "Customer Validation SCM"); //Input.SetProperty("View", "Duplicate Customer Candidate VBC SCM"); svc.InvokeMethod("RunProcess", Input, Output); //var SRId = Output.GetProperty("Siebel Operation Object Id"); /*old // Initializing the BO and BC var BOAccountActive = TheApplication().ActiveBusObject(); var BCAccountActive = BOAccountActive.GetBusComp("Account"); BCAccountActive.WriteRecord(); var strAccId = BCAccountActive.GetFieldValue("Id"); //Get BO and BC Account var BOAccount = TheApplication().GetBusObject("Account"); var BCAccount = BOAccount.GetBusComp("Account"); //Query the Active Account to navigate BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",strAccId); BCAccount.ExecuteQuery(ForwardOnly); TheApplication().GotoView("Duplicate Customer Candidate View SCM", BOAccount); */ } catch(e) { TheApplication().RaiseErrorText(e); //TheApplication().RaiseErrorText("Exp: "); } finally { Output = null; Input = null; svc = null; BCAccountActive = null; BOAccountActive = null; //strAccId = null; } }

Account BS SCM
GoToViewDuplicate
/******************************************************* ** Name: GoToViewDuplicate ** Created: 21.07.2008 ** Created By: Gomez Ayerbe, Javier ** Description: Navigates to the Duplicate Customer ** Candidate View SCM with the new customer selected ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GoToViewDuplicate(Inputs, Outputs){ var BOAccountActive; var BCAccountActive; var svc; var Input; var Output; try { BOAccountActive = TheApplication().ActiveBusObject(); BCAccountActive = BOAccountActive.GetBusComp("Account"); //BCAccountActive.WriteRecord(); svc = TheApplication().GetService("Workflow Process Manager"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); // Input.SetProperty("ProcessName", "Customer Validation SCM"); //Input.SetProperty("View", "Duplicate Customer Candidate VBC SCM"); svc.InvokeMethod("RunProcess", Input, Output); //var SRId = Output.GetProperty("Siebel Operation Object Id"); /*old // Initializing the BO and BC var BOAccountActive = TheApplication().ActiveBusObject(); var BCAccountActive = BOAccountActive.GetBusComp("Account"); BCAccountActive.WriteRecord(); var strAccId = BCAccountActive.GetFieldValue("Id"); //Get BO and BC Account var BOAccount = TheApplication().GetBusObject("Account"); var BCAccount = BOAccount.GetBusComp("Account"); //Query the Active Account to navigate BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",strAccId); BCAccount.ExecuteQuery(ForwardOnly); TheApplication().GotoView("Duplicate Customer Candidate View SCM", BOAccount); */ } catch(e) { TheApplication().RaiseErrorText(e); //TheApplication().RaiseErrorText("Exp: "); } finally { Output = null; Input = null; svc = null; BCAccountActive = null; BOAccountActive = null; //strAccId = null; } }

Account BS SCM
InactivateAccount
/******************************************************* ** Name: InactivateAccount ** Created: 03.11.2008 ** Created By: Torres Campos, Gema ** Description: Creates the Inactivate SR, navigates ** to the SR Toggle Account View SCM and invokes the workflow "Inactivation Process Validation SCM" ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function InactivateAccount(Inputs, Outputs) { try { // Initializing the BO and BC var BOServiceRequest = TheApplication().GetBusObject("Service Request"); var BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); var BCAccount = BOServiceRequest.GetBusComp("Account Lite SCM"); // Input Account Row Id var AccountSearchSpec = Inputs.GetProperty("Row Id"); var svc = TheApplication().GetService("Workflow Process Manager"); var Input = TheApplication().NewPropertySet(); var Output = TheApplication().NewPropertySet(); // SR (Type: Customer Data; SubType: Change of Name; Detail: Mutation) creation Input.SetProperty("ProcessName", "Automatic SR Creation SCM"); //WF Create a SR automaticaaly and generate error if already exists one Input.SetProperty("Area", "Customer Data"); //Customer Data Input.SetProperty("Sub-Area", "Customer data maintenance"); Input.SetProperty("Detail", "Inactivate"); Input.SetProperty("Object Id", AccountSearchSpec); //To asociate the SR to the active client Input.SetProperty("Entity", "Customer"); svc.InvokeMethod("RunProcess", Input, Output); var SRId = Output.GetProperty("Siebel Operation Object Id"); // Build the BO if(SRId != "") { // BC - Service Request BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } //Invokes the workflow //Navigate TheApplication().GotoView("SR Toggle Account View SCM", BOServiceRequest); } catch(e) { TheApplication().RaiseErrorText(e.toString()); //TheApplication().RaiseErrorText("Exp: It was not possible to create the Serviec Request"); } finally { SRId = null; Input = null; Output = null; svc = null; AccountSearchSpec = null; BCAccount = null; BCServiceRequest = null; BOServiceRequest = null; } }

Account BS SCM
InactivateAccount
/******************************************************* ** Name: InactivateAccount ** Created: 03.11.2008 ** Created By: Torres Campos, Gema ** Description: Creates the Inactivate SR, navigates ** to the SR Toggle Account View SCM and invokes the workflow "Inactivation Process Validation SCM" ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function InactivateAccount(Inputs, Outputs) { try { // Initializing the BO and BC var BOServiceRequest = TheApplication().GetBusObject("Service Request"); var BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); var BCAccount = BOServiceRequest.GetBusComp("Account Lite SCM"); // Input Account Row Id var AccountSearchSpec = Inputs.GetProperty("Row Id"); var svc = TheApplication().GetService("Workflow Process Manager"); var Input = TheApplication().NewPropertySet(); var Output = TheApplication().NewPropertySet(); // SR (Type: Customer Data; SubType: Change of Name; Detail: Mutation) creation Input.SetProperty("ProcessName", "Automatic SR Creation SCM"); //WF Create a SR automaticaaly and generate error if already exists one Input.SetProperty("Area", "Customer Data"); //Customer Data Input.SetProperty("Sub-Area", "Customer data maintenance"); Input.SetProperty("Detail", "Inactivate"); Input.SetProperty("Object Id", AccountSearchSpec); //To asociate the SR to the active client Input.SetProperty("Entity", "Customer"); svc.InvokeMethod("RunProcess", Input, Output); var SRId = Output.GetProperty("Siebel Operation Object Id"); // Build the BO if(SRId != "") { // BC - Service Request BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); // BC - Account Lite BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountSearchSpec); BCAccount.ExecuteQuery(ForwardOnly); } //Invokes the workflow //Navigate TheApplication().GotoView("SR Toggle Account View SCM", BOServiceRequest); } catch(e) { TheApplication().RaiseErrorText(e.toString()); //TheApplication().RaiseErrorText("Exp: It was not possible to create the Serviec Request"); } finally { SRId = null; Input = null; Output = null; svc = null; AccountSearchSpec = null; BCAccount = null; BCServiceRequest = null; BOServiceRequest = null; } }

Account BS SCM
MaintainFGPAssets
function MaintainFGPAssets() { /***************************************************************************** * Function: MaintainFGPAssets * Purpose : Function to maintain FGP asset (service type = "Platform") of HQ SAs * * For a given customer A * -> "Check": check whether one or more active FGP asset(s) exist(s) * -> "Inactivate": inactive one or more active FGP asset(s) * -> "Transfer": move one or more FGP asset(s) to customer B * if it is not already active there => transfer, else => inactivate * * Params : 0 ¦ Action Code : Check, Inactivate or Transfer * 1 ¦ Source HQ SA : ROW_ID of source HQ SA * 2 ¦ Target HQ SA : ROW_ID of target HQ SA * 3 ¦ Outputs : PropertySet *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2014-05-30 TGDGEMAM Initial Version - DROP Aug14 *****************************************************************************/ var objBO, objBOTgt: BusObject; var objBCAccnt, objBCAsset, objBCTgtAccnt, objBCTgtAsset: BusComp; var isRecord, isOutput: bool; var strTgtCMAId, strError, strStatus: String; try { strStatus = "Ok"; // source HQ SA objBO = oApp.GetBusObject("Account"); objBCAccnt = objBO.GetBusComp("Account"); // target HQ SA objBOTgt = oApp.GetBusObject("Account"); objBCTgtAccnt = objBOTgt.GetBusComp("Account"); if (defined(arguments[3])) {isOutput = true;} else {isOutput = false;} if (arguments[0].toString() == "Transfer" && arguments[2].toString() == "") { strError = "Please set <Target HQ SA> as input parameter"; oApp.RaiseErrorText(strError); } if (arguments[0].toString() == "Transfer") // in case of "Transfer" retrieve the target CMA Id with (objBCTgtAccnt) { ActivateField("Calculated CMA Account Id SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", arguments[2]); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strTgtCMAId = GetFieldValue("Calculated CMA Account Id SCM"); objBCTgtAsset = objBOTgt.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); } else { strError = "Target CMA could not be found!"; oApp.RaiseErrorText(strError); } } with (objBCAccnt) { // move cursor on HQ SA SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", arguments[1]); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); } if (isRecord) { // if account was found execute the requested action objBCAsset = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (objBCAsset) { ActivateField("Service Type"); ActivateField("Status"); ActivateField("Owner Account Id"); // cma ActivateField("Service Account Id"); // hq sa ActivateField("Product Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Service Type", oApp.InvokeMethod("LookupValue","UT_SERVICE_TYPE","Platform")); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); } switch (arguments[0].toString()) { case "Check": // check whether active FGP assets exist if (isOutput) arguments[3].SetProperty("Return", false); while(isRecord) { if (objBCAsset.GetFieldValue("Status") == oApp.InvokeMethod("LookupValue","IMPL_PHASE","Active")) { if (isOutput) arguments[3].SetProperty("Return", true); return (true); } isRecord = objBCAsset.NextRecord(); } return (false); break; case "Inactivate": // inactivate all active FGP assets while(isRecord) { if (objBCAsset.GetFieldValue("Status") == oApp.InvokeMethod("LookupValue","IMPL_PHASE","Active")) { objBCAsset.SetFieldValue("Status", oApp.InvokeMethod("LookupValue","IMPL_PHASE","Inactive")); objBCAsset.WriteRecord(); } isRecord = objBCAsset.NextRecord(); } break; case "Transfer": //

Account BS SCM
MaintainFGPAssets
function MaintainFGPAssets() { /***************************************************************************** * Function: MaintainFGPAssets * Purpose : Function to maintain FGP asset (service type = "Platform") of HQ SAs * * For a given customer A * -> "Check": check whether one or more active FGP asset(s) exist(s) * -> "Inactivate": inactive one or more active FGP asset(s) * -> "Transfer": move one or more FGP asset(s) to customer B * if it is not already active there => transfer, else => inactivate * * Params : 0 ¦ Action Code : Check, Inactivate or Transfer * 1 ¦ Source HQ SA : ROW_ID of source HQ SA * 2 ¦ Target HQ SA : ROW_ID of target HQ SA * 3 ¦ Outputs : PropertySet *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2014-05-30 TGDGEMAM Initial Version - DROP Aug14 *****************************************************************************/ var objBO, objBOTgt: BusObject; var objBCAccnt, objBCAsset, objBCTgtAccnt, objBCTgtAsset: BusComp; var isRecord, isOutput: bool; var strTgtCMAId, strError, strStatus: String; try { strStatus = "Ok"; // source HQ SA objBO = oApp.GetBusObject("Account"); objBCAccnt = objBO.GetBusComp("Account"); // target HQ SA objBOTgt = oApp.GetBusObject("Account"); objBCTgtAccnt = objBOTgt.GetBusComp("Account"); if (defined(arguments[3])) {isOutput = true;} else {isOutput = false;} if (arguments[0].toString() == "Transfer" && arguments[2].toString() == "") { strError = "Please set <Target HQ SA> as input parameter"; oApp.RaiseErrorText(strError); } if (arguments[0].toString() == "Transfer") // in case of "Transfer" retrieve the target CMA Id with (objBCTgtAccnt) { ActivateField("Calculated CMA Account Id SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", arguments[2]); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strTgtCMAId = GetFieldValue("Calculated CMA Account Id SCM"); objBCTgtAsset = objBOTgt.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); } else { strError = "Target CMA could not be found!"; oApp.RaiseErrorText(strError); } } with (objBCAccnt) { // move cursor on HQ SA SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", arguments[1]); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); } if (isRecord) { // if account was found execute the requested action objBCAsset = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (objBCAsset) { ActivateField("Service Type"); ActivateField("Status"); ActivateField("Owner Account Id"); // cma ActivateField("Service Account Id"); // hq sa ActivateField("Product Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Service Type", oApp.InvokeMethod("LookupValue","UT_SERVICE_TYPE","Platform")); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); } switch (arguments[0].toString()) { case "Check": // check whether active FGP assets exist if (isOutput) arguments[3].SetProperty("Return", false); while(isRecord) { if (objBCAsset.GetFieldValue("Status") == oApp.InvokeMethod("LookupValue","IMPL_PHASE","Active")) { if (isOutput) arguments[3].SetProperty("Return", true); return (true); } isRecord = objBCAsset.NextRecord(); } return (false); break; case "Inactivate": // inactivate all active FGP assets while(isRecord) { if (objBCAsset.GetFieldValue("Status") == oApp.InvokeMethod("LookupValue","IMPL_PHASE","Active")) { objBCAsset.SetFieldValue("Status", oApp.InvokeMethod("LookupValue","IMPL_PHASE","Inactive")); objBCAsset.WriteRecord(); } isRecord = objBCAsset.NextRecord(); } break; case "Transfer": //

Account BS SCM
NoMatchDuplicate
function NoMatchDuplicate(Inputs,Outpus){ /******************************************************* ** Name: NoMatchDuplicate ** Created: 11.08.2008 ** Created By: TGDGOFR4 ** Description: The method creates a new SR (Quality Data) before ** a Customer "Forced Creation" is performed ******************************************************/ var BOActiveAccount:BusObject; var BCAccount:BusComp; var BOEmp:BusObject; var BCEmp:BusComp; var BCServiceRequest:BusComp; var strAccId:chars; try { //Get Active BO and Account BC from the context BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); strAccId = BCAccount.GetFieldValue("Id"); //Get Service Request BC from the context BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //Create a new SR BCServiceRequest.SetViewMode(AllView); BCServiceRequest.NewRecord(NewAfter); BCServiceRequest.SetFieldValue("Account Id", strAccId); BCServiceRequest.SetFieldValue("Area", "Change"); BCServiceRequest.SetFieldValue("Sub-Area", "Quality of data1"); BCServiceRequest.SetFieldValue("Info Consult CD Not GUI SCM", "resolving doublets"); //SCM 2009.10.20 TGDTOGE3 Issue 16678, SR must be asigned to 'NIT Data Quality Teambox' corresponding to Id '1-119JZT' in s_contact BOEmp = oApp.GetBusObject("Employee"); BCEmp = BOEmp.GetBusComp("Employee"); BCEmp.SetViewMode(AllView); BCEmp.ClearToQuery(); BCEmp.SetSearchSpec("Login Name","UMSEGMENTIERUNG_TEAM"); BCEmp.ExecuteQuery(ForwardOnly); if(BCEmp.FirstRecord()) BCServiceRequest.SetFieldValue("Owned By Id", BCEmp.GetFieldValue("Id")); BCServiceRequest.WriteRecord(); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Sub-Area", "New Customer"); BCServiceRequest.SetSearchSpec("Account Id", strAccId); BCServiceRequest.ExecuteQuery(ForwardOnly); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BCAccount = null; BOActiveAccount = null; BCEmp = null; BOEmp = null; strAccId = null; } }

Account BS SCM
NoMatchDuplicate
function NoMatchDuplicate(Inputs,Outpus){ /******************************************************* ** Name: NoMatchDuplicate ** Created: 11.08.2008 ** Created By: TGDGOFR4 ** Description: The method creates a new SR (Quality Data) before ** a Customer "Forced Creation" is performed ******************************************************/ var BOActiveAccount:BusObject; var BCAccount:BusComp; var BOEmp:BusObject; var BCEmp:BusComp; var BCServiceRequest:BusComp; var strAccId:chars; try { //Get Active BO and Account BC from the context BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); strAccId = BCAccount.GetFieldValue("Id"); //Get Service Request BC from the context BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //Create a new SR BCServiceRequest.SetViewMode(AllView); BCServiceRequest.NewRecord(NewAfter); BCServiceRequest.SetFieldValue("Account Id", strAccId); BCServiceRequest.SetFieldValue("Area", "Change"); BCServiceRequest.SetFieldValue("Sub-Area", "Quality of data1"); BCServiceRequest.SetFieldValue("Info Consult CD Not GUI SCM", "resolving doublets"); //SCM 2009.10.20 TGDTOGE3 Issue 16678, SR must be asigned to 'NIT Data Quality Teambox' corresponding to Id '1-119JZT' in s_contact BOEmp = oApp.GetBusObject("Employee"); BCEmp = BOEmp.GetBusComp("Employee"); BCEmp.SetViewMode(AllView); BCEmp.ClearToQuery(); BCEmp.SetSearchSpec("Login Name","UMSEGMENTIERUNG_TEAM"); BCEmp.ExecuteQuery(ForwardOnly); if(BCEmp.FirstRecord()) BCServiceRequest.SetFieldValue("Owned By Id", BCEmp.GetFieldValue("Id")); BCServiceRequest.WriteRecord(); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Sub-Area", "New Customer"); BCServiceRequest.SetSearchSpec("Account Id", strAccId); BCServiceRequest.ExecuteQuery(ForwardOnly); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BCAccount = null; BOActiveAccount = null; BCEmp = null; BOEmp = null; strAccId = null; } }

Account BS SCM
RefreshSAContracts
function RefreshSAContracts(strSAId) /***************************************************************************** * Function: RefreshSAContracts * Purpose : Function to refresh all contracts regarding changed CMA, * agreements and entitlements. Cleans up the entitlement * product relationship and fires repricing as well * Params : strSAId - a reference to a Service Account (Id) *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2013-06-25 TGDGEMAM created *****************************************************************************/ { var svc; var psInputs; var psOutputs; try { svc = oApp.GetService("Agreement BS SCM"); psInputs = oApp.NewPropertySet(); psInputs.SetProperty("Service Account Id", strSAId); psOutputs = oApp.NewPropertySet(); svc.InvokeMethod("RefreshAccountContracts", psInputs, psOutputs); if (psOutputs.GetProperty("Error Message") != "") oApp.RaiseErrorText("RefreshSAContracts - Error: '" + psOutputs.GetProperty("Error Message") + "'"); } catch(e) { oApp.RaiseErrorText(e.toString()); } finally { psInputs = null; psOutputs = null; svc = null; } }

Account BS SCM
RefreshSAContracts
function RefreshSAContracts(strSAId) /***************************************************************************** * Function: RefreshSAContracts * Purpose : Function to refresh all contracts regarding changed CMA, * agreements and entitlements. Cleans up the entitlement * product relationship and fires repricing as well * Params : strSAId - a reference to a Service Account (Id) *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ------------------------------------------------- * 2013-06-25 TGDGEMAM created *****************************************************************************/ { var svc; var psInputs; var psOutputs; try { svc = oApp.GetService("Agreement BS SCM"); psInputs = oApp.NewPropertySet(); psInputs.SetProperty("Service Account Id", strSAId); psOutputs = oApp.NewPropertySet(); svc.InvokeMethod("RefreshAccountContracts", psInputs, psOutputs); if (psOutputs.GetProperty("Error Message") != "") oApp.RaiseErrorText("RefreshSAContracts - Error: '" + psOutputs.GetProperty("Error Message") + "'"); } catch(e) { oApp.RaiseErrorText(e.toString()); } finally { psInputs = null; psOutputs = null; svc = null; } }

Account BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 14.07.2008 ** Created By: Javier Amor ** Description: ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch (MethodName) { case("UpdateCMA"): UpdateCMA(Inputs, Outputs); break; case("DuplicateAccountSearch"): DuplicateAccountSearch(Inputs, Outputs); //return (CancelOperation); break; case("DuplicateAccountSearchPerson"): DuplicateAccountSearchPerson(Inputs, Outputs); //return (CancelOperation); break; case("DuplicateAccountSearchCompany"): DuplicateAccountSearchCompany(Inputs, Outputs); //return (CancelOperation); break; case "DuplicateCustomerCheck": // 2012-01-11; tgdstre0; Quadrica DuplicateCustomerCheck(Inputs, Outputs); break; case("GoToViewAccount"): GoToViewAccount(Inputs, Outputs); break; case("GoToViewDuplicate"): GoToViewDuplicate(Inputs, Outputs); break; case("GoToViewCreation"): GoToViewCreation(Inputs); break; case("ChangeHQFlg"): ChangeHQFlg(); break; case ("GetAccountId"): GetAccountId(Inputs, Outputs); break; case ("GetAddressId"): GetAddressId(Inputs, Outputs); break; case ("NoMatchDuplicate"): NoMatchDuplicate(Inputs, Outputs); break; case ("ContactBelongsToCustomer"): ContactBelongsToCustomer(Inputs, Outputs); break; case ("CheckPrimarySA"): CheckPrimarySA(); break; case("DeleteActiveSR"): DeleteActiveSR(Inputs, Outputs); //return (CancelOperation); break; case("CreateSASR"): CreateSASR(Inputs,Outputs); break; case("ChangeInStructuring"): ChangeInStructuring(Inputs,Outputs); break; case("SkeyAssignation"): SkeyAssignation(Inputs,Outputs); break; /*SCM TGDTOGE3 2009.10.30 performance issue, BS instead of Siebel OPeration in wf Customer Validation SCM*/ case("GetDuplicateCustomers"): GetDuplicateCustomers(Inputs,Outputs); break; /*SCM TGDGAAND 2010.02.10 New method to set the processing flag */ case("SetProcessFlag"): SetProcessFlag(Inputs); break; /*SCM TGDTOGE3 27.07.2010 -- CR 415 -- New method to create automatically the HQ SA when the company CMA is created*/ case("CreateHQ"): CreateHQ(Inputs, Outputs); break; /*SCM TGDTOGE3 25.08.2010 -- Defect 22419 -- New method to update Name in Account and CMA Name SCM BCs after a Name change*/ case("UpdateAccountName"): UpdateAccountName(Inputs, Outputs); break; /* TGDHAKA8 01.09.2010 -- CR 342: All CBU support structure of a Billing profile is deleted*/ case("DeleteBillingProfileStructure"): DeleteBillingProfileStructure(Inputs); break; /* TGDHAKA8 03.09.2010 -- Project CDM: returns default values for Company Main Contact*/ case("getCompanyMainContactDefaults"): getCompanyMainContactDefaults(Inputs, Outputs); break; /* TGDGEMAM 30.05.2014 -- DROP Aug14: new method to handle FGP assets*/ case ("MaintainFGPAssets"): MaintainFGPAssets( Inputs.GetProperty("Action"), Inputs.GetProperty("Source HQ SA"), Inputs.GetProperty("Target HQ SA"), Outputs); break; default: break; } return (CancelOperation); } finally { oApp = null; } }

Account BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 14.07.2008 ** Created By: Javier Amor ** Description: ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch (MethodName) { case("UpdateCMA"): UpdateCMA(Inputs, Outputs); break; case("DuplicateAccountSearch"): DuplicateAccountSearch(Inputs, Outputs); //return (CancelOperation); break; case("DuplicateAccountSearchPerson"): DuplicateAccountSearchPerson(Inputs, Outputs); //return (CancelOperation); break; case("DuplicateAccountSearchCompany"): DuplicateAccountSearchCompany(Inputs, Outputs); //return (CancelOperation); break; case "DuplicateCustomerCheck": // 2012-01-11; tgdstre0; Quadrica DuplicateCustomerCheck(Inputs, Outputs); break; case("GoToViewAccount"): GoToViewAccount(Inputs, Outputs); break; case("GoToViewDuplicate"): GoToViewDuplicate(Inputs, Outputs); break; case("GoToViewCreation"): GoToViewCreation(Inputs); break; case("ChangeHQFlg"): ChangeHQFlg(); break; case ("GetAccountId"): GetAccountId(Inputs, Outputs); break; case ("GetAddressId"): GetAddressId(Inputs, Outputs); break; case ("NoMatchDuplicate"): NoMatchDuplicate(Inputs, Outputs); break; case ("ContactBelongsToCustomer"): ContactBelongsToCustomer(Inputs, Outputs); break; case ("CheckPrimarySA"): CheckPrimarySA(); break; case("DeleteActiveSR"): DeleteActiveSR(Inputs, Outputs); //return (CancelOperation); break; case("CreateSASR"): CreateSASR(Inputs,Outputs); break; case("ChangeInStructuring"): ChangeInStructuring(Inputs,Outputs); break; case("SkeyAssignation"): SkeyAssignation(Inputs,Outputs); break; /*SCM TGDTOGE3 2009.10.30 performance issue, BS instead of Siebel OPeration in wf Customer Validation SCM*/ case("GetDuplicateCustomers"): GetDuplicateCustomers(Inputs,Outputs); break; /*SCM TGDGAAND 2010.02.10 New method to set the processing flag */ case("SetProcessFlag"): SetProcessFlag(Inputs); break; /*SCM TGDTOGE3 27.07.2010 -- CR 415 -- New method to create automatically the HQ SA when the company CMA is created*/ case("CreateHQ"): CreateHQ(Inputs, Outputs); break; /*SCM TGDTOGE3 25.08.2010 -- Defect 22419 -- New method to update Name in Account and CMA Name SCM BCs after a Name change*/ case("UpdateAccountName"): UpdateAccountName(Inputs, Outputs); break; /* TGDHAKA8 01.09.2010 -- CR 342: All CBU support structure of a Billing profile is deleted*/ case("DeleteBillingProfileStructure"): DeleteBillingProfileStructure(Inputs); break; /* TGDHAKA8 03.09.2010 -- Project CDM: returns default values for Company Main Contact*/ case("getCompanyMainContactDefaults"): getCompanyMainContactDefaults(Inputs, Outputs); break; /* TGDGEMAM 30.05.2014 -- DROP Aug14: new method to handle FGP assets*/ case ("MaintainFGPAssets"): MaintainFGPAssets( Inputs.GetProperty("Action"), Inputs.GetProperty("Source HQ SA"), Inputs.GetProperty("Target HQ SA"), Outputs); break; default: break; } return (CancelOperation); } finally { oApp = null; } }

Account BS SCM
SetProcessFlag
/******************************************************* ** Name:noed: 04.11.2009 ** Created By: Angel Garcia ** Description: Function to Set the Process Flag to Y or N depending on the Action ** Y: When any action is preformed over the customer -> Set when the Service Request is Submitted ** N: Set to N when the Service Request is Closed -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetProcessFlag(Inputs) { var BOAccount; var BCAccount; var AccountId; var ProcessFlag=""; try { //AccountId = TheApplication().GetProfileAttr("ProcessAccountId"); //ProcessFlag = TheApplication().GetProfileAttr("SetProcessFlag"); /* Search Customer */ BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); BCAccount.ActivateField("Processing Flag SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",Inputs.GetProperty("CustomerId")); BCAccount.ExecuteQuery(ForwardBackward); /* Update Process Flag */ if (BCAccount.FirstRecord()) { BCAccount.SetFieldValue("Processing Flag SCM",Inputs.GetProperty("ProcessFlag")); BCAccount.WriteRecord(); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { AccountId = null; ProcessFlag = null; BCAccount = null; BOAccount = null; } }

Account BS SCM
SetProcessFlag
/******************************************************* ** Name:noed: 04.11.2009 ** Created By: Angel Garcia ** Description: Function to Set the Process Flag to Y or N depending on the Action ** Y: When any action is preformed over the customer -> Set when the Service Request is Submitted ** N: Set to N when the Service Request is Closed -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetProcessFlag(Inputs) { var BOAccount; var BCAccount; var AccountId; var ProcessFlag=""; try { //AccountId = TheApplication().GetProfileAttr("ProcessAccountId"); //ProcessFlag = TheApplication().GetProfileAttr("SetProcessFlag"); /* Search Customer */ BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); BCAccount.ActivateField("Processing Flag SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",Inputs.GetProperty("CustomerId")); BCAccount.ExecuteQuery(ForwardBackward); /* Update Process Flag */ if (BCAccount.FirstRecord()) { BCAccount.SetFieldValue("Processing Flag SCM",Inputs.GetProperty("ProcessFlag")); BCAccount.WriteRecord(); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { AccountId = null; ProcessFlag = null; BCAccount = null; BOAccount = null; } }

Account BS SCM
SkeyAssignation
/******************************************************* ** Name: SkeyAssignation ** Created: 19.11.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: This method is going to assign the Skey number ** to the active Customer (CMA) ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SkeyAssignation(Inputs,Outputs) { var BOActiveAccount; var BCAccount; var BOAccount; var BCSkey; var strSkeyId; var numSkey; var BCServReq; try { // Get the active BO and BC Account BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); // Get SR BC from the context BCServReq = BOActiveAccount.GetBusComp("Service Request"); // Create a new SR BCServReq.SetViewMode(AllView); BCServReq.NewRecord(NewAfter); BCServReq.SetFieldValue("Account Id", BCAccount.GetFieldValue("Id")); BCServReq.SetFieldValue("Area", "Customer Data"); BCServReq.SetFieldValue("Sub-Area", "Assign SKey"); BCServReq.SetFieldValue("Info Consult CD Not GUI SCM", "mutation"); BCServReq.WriteRecord(); // Generate the Skey number BOAccount = TheApplication().GetBusObject("Account"); BCSkey = BOAccount.GetBusComp("Account Skey Number SCM"); BCSkey.SetViewMode(AllView); BCSkey.NewRecord(NewAfter); BCSkey.SetFieldValue("Parent Account Id", BCAccount.GetFieldValue("Id")); BCSkey.WriteRecord(); strSkeyId = BCSkey.GetFieldValue("Id"); BCSkey.ClearToQuery(); BCSkey.SetSearchSpec("Id", strSkeyId); BCSkey.ExecuteQuery(ForwardOnly); numSkey = BCSkey.GetFieldValue("Skey Number SCM"); // Set the Skey Number field with the value from the oracle sequence BCAccount.SetFieldValue("Skey Number SCM", numSkey); BCAccount.WriteRecord(); // Returns the Skey number Outputs.SetProperty("Skey Number", numSkey); //Submit the SR /* BCServReq = BOAccount.GetBusComp("Service Request"); BCServReq.ClearToQuery(); BCServReq.SetSearchSpec("Account Id", BCAccount.GetFieldValue("Id")); BCServReq.SetSearchSpec("Sub-Area", "Assign SKey"); BCServReq.SetSearchSpec("Status", "Open"); BCServReq.ExecuteQuery(ForwardOnly); */ BCServReq.InvokeMethod("SubmitSR"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServReq = null; BCSkey = null; BOAccount = null; BCAccount = null; BOActiveAccount = null; } }

Account BS SCM
SkeyAssignation
/******************************************************* ** Name: SkeyAssignation ** Created: 19.11.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: This method is going to assign the Skey number ** to the active Customer (CMA) ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SkeyAssignation(Inputs,Outputs) { var BOActiveAccount; var BCAccount; var BOAccount; var BCSkey; var strSkeyId; var numSkey; var BCServReq; try { // Get the active BO and BC Account BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); // Get SR BC from the context BCServReq = BOActiveAccount.GetBusComp("Service Request"); // Create a new SR BCServReq.SetViewMode(AllView); BCServReq.NewRecord(NewAfter); BCServReq.SetFieldValue("Account Id", BCAccount.GetFieldValue("Id")); BCServReq.SetFieldValue("Area", "Customer Data"); BCServReq.SetFieldValue("Sub-Area", "Assign SKey"); BCServReq.SetFieldValue("Info Consult CD Not GUI SCM", "mutation"); BCServReq.WriteRecord(); // Generate the Skey number BOAccount = TheApplication().GetBusObject("Account"); BCSkey = BOAccount.GetBusComp("Account Skey Number SCM"); BCSkey.SetViewMode(AllView); BCSkey.NewRecord(NewAfter); BCSkey.SetFieldValue("Parent Account Id", BCAccount.GetFieldValue("Id")); BCSkey.WriteRecord(); strSkeyId = BCSkey.GetFieldValue("Id"); BCSkey.ClearToQuery(); BCSkey.SetSearchSpec("Id", strSkeyId); BCSkey.ExecuteQuery(ForwardOnly); numSkey = BCSkey.GetFieldValue("Skey Number SCM"); // Set the Skey Number field with the value from the oracle sequence BCAccount.SetFieldValue("Skey Number SCM", numSkey); BCAccount.WriteRecord(); // Returns the Skey number Outputs.SetProperty("Skey Number", numSkey); //Submit the SR /* BCServReq = BOAccount.GetBusComp("Service Request"); BCServReq.ClearToQuery(); BCServReq.SetSearchSpec("Account Id", BCAccount.GetFieldValue("Id")); BCServReq.SetSearchSpec("Sub-Area", "Assign SKey"); BCServReq.SetSearchSpec("Status", "Open"); BCServReq.ExecuteQuery(ForwardOnly); */ BCServReq.InvokeMethod("SubmitSR"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServReq = null; BCSkey = null; BOAccount = null; BCAccount = null; BOActiveAccount = null; } }

Account BS SCM
UpdateAccountName
/******************************************************* ** Name: UpdateAccountName ** Created: 25.08.2010 ** Created By: TGDTOGE3 ** Description: Defect 22419 -- New method to update Name in Account and CMA Name SCM BCs after a Name change ** Changed By: TGDHURO9 (Robert Hunziker) ** Changed: 11.04.2011 ** Description: Fix of Defect 35344 PROD: Name change on CMA(Company) Customer. SR goes to failed: ** - for a CMA name change use the names from BC "CMA Name SCM". ** - tab indent corrected ** Changed By: TGDHAKA8 (Karin Schädler) ** Changed: 25.08.2011 ** Description: CR670: ** - Adding handling for CMA name versions marked as to-be-deleted or to-be-inactivated ******************************************************/ function UpdateAccountName(Inputs, Outputs) { var strNameId; var BOAccount:BusObject; var BOSR; var BCName; var strAccId; var strSRId; var BCAccount:BusComp; var BCSR; var strName; var strName1; var strName2; var strSANameId; var strSALangCode; var strSALang; var isrecord; var BCAccountName; var strCMANameLang; var isRecord2; var oDate = new Date; var sTimestamp = ""; var dateCalc; var monthCalc; var BOAccountName; var BCAllNames; var NameLanguage; var pickAnyName:bool=false; var accountActiveName:bool=false; var accountNameLang=""; var accountNameId; var srNameLang=""; var srActiveName:bool=false; var srCompanyName=""; var srName1=""; var srName2=""; try { //Get Account Id strAccId = Inputs.GetProperty("AccountId"); trcVar("AccountId", strAccId); //Get SR Id strSRId = Inputs.GetProperty("SRId"); trcVar("SRId", strSRId); BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BOSR = oApp.GetBusObject("Service Request"); BCSR = BOSR.GetBusComp("Service Request"); //Query on Account BCAccount.ActivateField("Name 1 SCM"); BCAccount.ActivateField("Type"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Primary Name Id SCM"); BCAccount.ActivateField("Primary CMA Name Language Code SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", strAccId); BCAccount.ExecuteQuery(ForwardOnly); //Query on SR BCSR.ActivateField("Account Name SCM"); BCSR.ActivateField("Account Name 1 SCM"); BCSR.ActivateField("Account Name 2 SCM"); BCSR.ActivateField("Primary Name Id Aux SCM"); BCSR.ActivateField("SA Name Id Aux SCM"); BCSR.ActivateField("SA Company Index Language SCM"); BCSR.ActivateField("SA Company Index Language Code SCM"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", strSRId); BCSR.SetSearchSpec("Sub-Area", "Name change"); BCSR.ExecuteQuery(ForwardOnly); //Get SR values if(BCSR.FirstRecord()) { strName = BCSR.GetFieldValue("Account Name SCM"); strName1 = BCSR.GetFieldValue("Account Name 1 SCM"); strName2 = BCSR.GetFieldValue("Account Name 2 SCM"); strNameId = BCSR.GetFieldValue("Primary Name Id Aux SCM"); strSANameId = BCSR.GetFieldValue("SA Name Id Aux SCM"); if(strSANameId != "") { strSALang = BCSR.GetFieldValue("SA Company Index Language SCM"); strSALangCode = BCSR.GetFieldValue("SA Company Index Language Code SCM"); } trcVar("Account Name SCM", strName); trcVar("Account Name 1 SCM", strName1); trcVar("Account Name 2 SCM", strName2); trcVar("Primary Name Id Aux SCM", strNameId); trcVar("SA Name Id Aux SCM", strSANameId); // Get the Account associated to the SR if(BCAccount.FirstRecord()) { if (BCAccount.GetFieldValue("Type")==oApp.InvokeMethod("LookupValue", "ACCOUNT_TYPE", "Company")) { if(BCAccount.GetFieldValue("Sub Type SCM")==oApp.InvokeMethod("LookupValue", "ACCOUNT_SUB_TYPE_SCM", "CMA")) { // Get CMA language and current Primary Name Id accountNameLang = BCAccount.GetFieldValue("Primary CMA Name Language Code SCM");

Account BS SCM
UpdateAccountName
/******************************************************* ** Name: UpdateAccountName ** Created: 25.08.2010 ** Created By: TGDTOGE3 ** Description: Defect 22419 -- New method to update Name in Account and CMA Name SCM BCs after a Name change ** Changed By: TGDHURO9 (Robert Hunziker) ** Changed: 11.04.2011 ** Description: Fix of Defect 35344 PROD: Name change on CMA(Company) Customer. SR goes to failed: ** - for a CMA name change use the names from BC "CMA Name SCM". ** - tab indent corrected ** Changed By: TGDHAKA8 (Karin Schädler) ** Changed: 25.08.2011 ** Description: CR670: ** - Adding handling for CMA name versions marked as to-be-deleted or to-be-inactivated ******************************************************/ function UpdateAccountName(Inputs, Outputs) { var strNameId; var BOAccount:BusObject; var BOSR; var BCName; var strAccId; var strSRId; var BCAccount:BusComp; var BCSR; var strName; var strName1; var strName2; var strSANameId; var strSALangCode; var strSALang; var isrecord; var BCAccountName; var strCMANameLang; var isRecord2; var oDate = new Date; var sTimestamp = ""; var dateCalc; var monthCalc; var BOAccountName; var BCAllNames; var NameLanguage; var pickAnyName:bool=false; var accountActiveName:bool=false; var accountNameLang=""; var accountNameId; var srNameLang=""; var srActiveName:bool=false; var srCompanyName=""; var srName1=""; var srName2=""; try { //Get Account Id strAccId = Inputs.GetProperty("AccountId"); trcVar("AccountId", strAccId); //Get SR Id strSRId = Inputs.GetProperty("SRId"); trcVar("SRId", strSRId); BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Lite SCM"); BOSR = oApp.GetBusObject("Service Request"); BCSR = BOSR.GetBusComp("Service Request"); //Query on Account BCAccount.ActivateField("Name 1 SCM"); BCAccount.ActivateField("Type"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Primary Name Id SCM"); BCAccount.ActivateField("Primary CMA Name Language Code SCM"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", strAccId); BCAccount.ExecuteQuery(ForwardOnly); //Query on SR BCSR.ActivateField("Account Name SCM"); BCSR.ActivateField("Account Name 1 SCM"); BCSR.ActivateField("Account Name 2 SCM"); BCSR.ActivateField("Primary Name Id Aux SCM"); BCSR.ActivateField("SA Name Id Aux SCM"); BCSR.ActivateField("SA Company Index Language SCM"); BCSR.ActivateField("SA Company Index Language Code SCM"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", strSRId); BCSR.SetSearchSpec("Sub-Area", "Name change"); BCSR.ExecuteQuery(ForwardOnly); //Get SR values if(BCSR.FirstRecord()) { strName = BCSR.GetFieldValue("Account Name SCM"); strName1 = BCSR.GetFieldValue("Account Name 1 SCM"); strName2 = BCSR.GetFieldValue("Account Name 2 SCM"); strNameId = BCSR.GetFieldValue("Primary Name Id Aux SCM"); strSANameId = BCSR.GetFieldValue("SA Name Id Aux SCM"); if(strSANameId != "") { strSALang = BCSR.GetFieldValue("SA Company Index Language SCM"); strSALangCode = BCSR.GetFieldValue("SA Company Index Language Code SCM"); } trcVar("Account Name SCM", strName); trcVar("Account Name 1 SCM", strName1); trcVar("Account Name 2 SCM", strName2); trcVar("Primary Name Id Aux SCM", strNameId); trcVar("SA Name Id Aux SCM", strSANameId); // Get the Account associated to the SR if(BCAccount.FirstRecord()) { if (BCAccount.GetFieldValue("Type")==oApp.InvokeMethod("LookupValue", "ACCOUNT_TYPE", "Company")) { if(BCAccount.GetFieldValue("Sub Type SCM")==oApp.InvokeMethod("LookupValue", "ACCOUNT_SUB_TYPE_SCM", "CMA")) { // Get CMA language and current Primary Name Id accountNameLang = BCAccount.GetFieldValue("Primary CMA Name Language Code SCM");

Account BS SCM
UpdateCMA
/******************************************************* ** Name: UpdateCMA ** Created: 06.11.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: This method is going to carry out the process of updating the CMA to be removed from ** a Holding. The method will update the Parent Account Id field and the Master Account Id field with ** the adequate values. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function UpdateCMA(Inputs, Outputs){ var strSRId; var BOSR; var BCSR; var strAccId; var BCAccount; try { strSRId = Inputs.GetProperty("SRId"); BOSR = TheApplication().GetBusObject("Service Request"); BCSR = BOSR.GetBusComp("Service Request"); BCSR.ActivateField("Secondary Account Id SCM"); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", strSRId); BCSR.ExecuteQuery(ForwardOnly); // Get the customer associated to the SR strAccId = BCSR.GetFieldValue("Account Id"); // Look for the customer in the DB BCAccount = BOSR.GetBusComp("Account"); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", strAccId); BCAccount.ExecuteQuery(ForwardOnly); // Set the old Parent Account Id into the newly created SR BCSR.SetFieldValue("Secondary Account Id SCM", BCAccount.GetFieldValue("Parent Account Id")); BCSR.WriteRecord(); // Update the relationship fields in the customer BCAccount.SetFieldValue("Parent Account Id", ""); BCAccount.SetFieldValue("Master Account Id", strAccId); BCAccount.WriteRecord(); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAccount = null; strAccId = null; BCSR = null; BOSR = null; strSRId = null; } }

Account BS SCM
UpdateCMA
/******************************************************* ** Name: UpdateCMA ** Created: 06.11.2008 ** Created By: Gomez Ayerbe, F. Javier ** Description: This method is going to carry out the process of updating the CMA to be removed from ** a Holding. The method will update the Parent Account Id field and the Master Account Id field with ** the adequate values. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function UpdateCMA(Inputs, Outputs){ var strSRId; var BOSR; var BCSR; var strAccId; var BCAccount; try { strSRId = Inputs.GetProperty("SRId"); BOSR = TheApplication().GetBusObject("Service Request"); BCSR = BOSR.GetBusComp("Service Request"); BCSR.ActivateField("Secondary Account Id SCM"); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id", strSRId); BCSR.ExecuteQuery(ForwardOnly); // Get the customer associated to the SR strAccId = BCSR.GetFieldValue("Account Id"); // Look for the customer in the DB BCAccount = BOSR.GetBusComp("Account"); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", strAccId); BCAccount.ExecuteQuery(ForwardOnly); // Set the old Parent Account Id into the newly created SR BCSR.SetFieldValue("Secondary Account Id SCM", BCAccount.GetFieldValue("Parent Account Id")); BCSR.WriteRecord(); // Update the relationship fields in the customer BCAccount.SetFieldValue("Parent Account Id", ""); BCAccount.SetFieldValue("Master Account Id", strAccId); BCAccount.WriteRecord(); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAccount = null; strAccId = null; BCSR = null; BOSR = null; strSRId = null; } }

Account BS SCM
getCompanyMainContactDefaults
/******************************************************* ** Name: getCompanyMainContactDefaults ** Created: 03.09.2010 ** Created By: Karin Haack ** Description: Returns Default Values of Company Main Contact ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function getCompanyMainContactDefaults(Inputs,Outputs) { Outputs.SetProperty("Last Name", "K."); Outputs.SetProperty("First Name", "M."); Outputs.SetProperty("Birth Date", "01/01/1900"); Outputs.SetProperty("Nationality", TheApplication().InvokeMethod("LookupValue","COUNTRY","unknown")); Outputs.SetProperty("Type SCM", TheApplication().InvokeMethod("LookupValue","ACCT_CONTACT_TYPE_SCM","Contact Information")); Outputs.SetProperty("Letter Salutation SCM", TheApplication().InvokeMethod("LookupValue","MR_MS","Dear Customer")); Outputs.SetProperty("M/M", TheApplication().InvokeMethod("LookupValue","MR_MS","Unknown")); Outputs.SetProperty("Id Typ SCM", TheApplication().InvokeMethod("LookupValue","ID_TYPE_SCM","Unknown")); return(Outputs); }

Account BS SCM
getCompanyMainContactDefaults
/******************************************************* ** Name: getCompanyMainContactDefaults ** Created: 03.09.2010 ** Created By: Karin Haack ** Description: Returns Default Values of Company Main Contact ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function getCompanyMainContactDefaults(Inputs,Outputs) { Outputs.SetProperty("Last Name", "K."); Outputs.SetProperty("First Name", "M."); Outputs.SetProperty("Birth Date", "01/01/1900"); Outputs.SetProperty("Nationality", TheApplication().InvokeMethod("LookupValue","COUNTRY","unknown")); Outputs.SetProperty("Type SCM", TheApplication().InvokeMethod("LookupValue","ACCT_CONTACT_TYPE_SCM","Contact Information")); Outputs.SetProperty("Letter Salutation SCM", TheApplication().InvokeMethod("LookupValue","MR_MS","Dear Customer")); Outputs.SetProperty("M/M", TheApplication().InvokeMethod("LookupValue","MR_MS","Unknown")); Outputs.SetProperty("Id Typ SCM", TheApplication().InvokeMethod("LookupValue","ID_TYPE_SCM","Unknown")); return(Outputs); }

Account BS SCM
trc
/***************************************************************************** * Function: trc * Author : Robert Hunziker (TGDHURO9) * Purpose : Writes the given string to the log file * Params : s - the string to trace * Date : 2011-05-06 *----------------------------------------------------------------------------* * Update : *****************************************************************************/ function trc(s) { if (bIsTraceOn) { oApp.Trace(this.Name() + ": " + s); } }

Account BS SCM
trc
/***************************************************************************** * Function: trc * Author : Robert Hunziker (TGDHURO9) * Purpose : Writes the given string to the log file * Params : s - the string to trace * Date : 2011-05-06 *----------------------------------------------------------------------------* * Update : *****************************************************************************/ function trc(s) { if (bIsTraceOn) { oApp.Trace(this.Name() + ": " + s); } }

Account BS SCM
trcVar
/***************************************************************************** * Function: trcVar * Author : Robert Hunziker (TGDHURO9) * Purpose : Trace a variable into a logfile with its name and its value. * Date : 2011-05-06 *----------------------------------------------------------------------------* * Update : *****************************************************************************/ function trcVar(strVarName, strVar) { if (bIsTraceOn) { oApp.Trace(this.Name() + ": " + strVarName + "='" + strVar + "'"); } }

Account BS SCM
trcVar
/***************************************************************************** * Function: trcVar * Author : Robert Hunziker (TGDHURO9) * Purpose : Trace a variable into a logfile with its name and its value. * Date : 2011-05-06 *----------------------------------------------------------------------------* * Update : *****************************************************************************/ function trcVar(strVarName, strVar) { if (bIsTraceOn) { oApp.Trace(this.Name() + ": " + strVarName + "='" + strVar + "'"); } }

Account Contact VBC SCM
(declarations)
var oApp = TheApplication(); // TGDSCTHO, 20061116 enable tracing var bIsTraceOn = oApp.isTraceON; // TGDSCTHO, 20061116 enable tracing //Hardcodes var COMP = "Company"; //View names where the applet should be executed var OLI_VIEW = "Order Entry - Line Items View (Sales)"; var OLI_REIS_1 = "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM"; var OLI_REIS_2 = "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM"; var OLI_REIS_3 = "Sales Order-Browse Catalog Category Retention View SCM"; var QSUMVIEW = "Quote Item XA View AIP SCM";

Account Contact VBC SCM
(declarations)
var oApp = TheApplication(); // TGDSCTHO, 20061116 enable tracing var bIsTraceOn = oApp.isTraceON; // TGDSCTHO, 20061116 enable tracing //Hardcodes var COMP = "Company"; //View names where the applet should be executed var OLI_VIEW = "Order Entry - Line Items View (Sales)"; var OLI_REIS_1 = "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM"; var OLI_REIS_2 = "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM"; var OLI_REIS_3 = "Sales Order-Browse Catalog Category Retention View SCM"; var QSUMVIEW = "Quote Item XA View AIP SCM";

Account Contact VBC SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: Init ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Letter Salutation SCM", ""); Outputs.SetProperty("First Name SCM", ""); Outputs.SetProperty("Last Name SCM", ""); Outputs.SetProperty("Language Code SCM", ""); Outputs.SetProperty("Contact Middle Name", ""); Outputs.SetProperty("Contact M/F Calc for OLI SCM", ""); Outputs.SetProperty("Contact Id", ""); Outputs.SetProperty("Alt Email Addr", ""); Outputs.SetProperty("Account Id SCM", ""); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ } }

Account Contact VBC SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: Init ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Letter Salutation SCM", ""); Outputs.SetProperty("First Name SCM", ""); Outputs.SetProperty("Last Name SCM", ""); Outputs.SetProperty("Language Code SCM", ""); Outputs.SetProperty("Contact Middle Name", ""); Outputs.SetProperty("Contact M/F Calc for OLI SCM", ""); Outputs.SetProperty("Contact Id", ""); Outputs.SetProperty("Alt Email Addr", ""); Outputs.SetProperty("Account Id SCM", ""); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ } }

Account Contact VBC SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************************** ** Name: Query ** Created: 1.10.2009 ** Created By: Antonio Rodríguez Villanueva ** Description: Do the VBC Query ** *************************************************************************************************************** ** Modification: 01.03.2011 ** Modified By: TGDSEAI1 ** Description: Adapted script to work on Quote Context. Some clean up and modularization ***************************************************************************************************************/ //Variable Declarations var BOActive:BusObject; var BCActive:BusComp; var AccountId = ""; var strCompMainId = ""; try{ //Initialize the Account Id depending of the context BOActive = TheApplication().ActiveBusObject(); if(BOActive.Name() == "Order Entry (Sales)"){ BCActive = BOActive.GetBusComp("Order Entry - Line Items"); AccountId = BCActive.GetFieldValue("Account Id"); } else if(BOActive.Name() == "Quote"){ BCActive = BOActive.GetBusComp("Quote"); AccountId = BCActive.GetFieldValue("Account Id"); } //If Account Id in context keep with query if(AccountId != null && AccountId != ""){ //Account will be set as a contact when it is a company in the outpus strCompMainId = fGetAccountAsContact(AccountId, Outputs); fAddContacts(AccountId, strCompMainId, Outputs); } }//End Try catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BOActive = null; BCActive = null; AccountId = null; strCompMainId = null; } }

Account Contact VBC SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************************** ** Name: Query ** Created: 1.10.2009 ** Created By: Antonio Rodríguez Villanueva ** Description: Do the VBC Query ** *************************************************************************************************************** ** Modification: 01.03.2011 ** Modified By: TGDSEAI1 ** Description: Adapted script to work on Quote Context. Some clean up and modularization ***************************************************************************************************************/ //Variable Declarations var BOActive:BusObject; var BCActive:BusComp; var AccountId = ""; var strCompMainId = ""; try{ //Initialize the Account Id depending of the context BOActive = TheApplication().ActiveBusObject(); if(BOActive.Name() == "Order Entry (Sales)"){ BCActive = BOActive.GetBusComp("Order Entry - Line Items"); AccountId = BCActive.GetFieldValue("Account Id"); } else if(BOActive.Name() == "Quote"){ BCActive = BOActive.GetBusComp("Quote"); AccountId = BCActive.GetFieldValue("Account Id"); } //If Account Id in context keep with query if(AccountId != null && AccountId != ""){ //Account will be set as a contact when it is a company in the outpus strCompMainId = fGetAccountAsContact(AccountId, Outputs); fAddContacts(AccountId, strCompMainId, Outputs); } }//End Try catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BOActive = null; BCActive = null; AccountId = null; strCompMainId = null; } }

Account Contact VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 30.09.2009 ** Created By: TGDROANA ** Description: *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs, Outputs); break; default: break; } return (CancelOperation); }

Account Contact VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 30.09.2009 ** Created By: TGDROANA ** Description: *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs, Outputs); break; default: break; } return (CancelOperation); }

Account Contact VBC SCM
fActivateAccountFields
function fActivateAccountFields(BCAccount:BusComp){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateAccountFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Activate BC fields for query *****************************************************************/ BCAccount.ActivateField("Name"); BCAccount.ActivateField("CMA Company Name SCM"); BCAccount.ActivateField("Type"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Letter Salutation SCM"); BCAccount.ActivateField("Correspondence Language Code SCM"); BCAccount.ActivateField("Calculate Sub Type SCM"); //SCM 19.10.2010 TGDLOAL3: Company Main must not appear BCAccount.ActivateField("Primary Company Main Contact SCM"); }

Account Contact VBC SCM
fActivateAccountFields
function fActivateAccountFields(BCAccount:BusComp){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateAccountFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Activate BC fields for query *****************************************************************/ BCAccount.ActivateField("Name"); BCAccount.ActivateField("CMA Company Name SCM"); BCAccount.ActivateField("Type"); BCAccount.ActivateField("Sub Type SCM"); BCAccount.ActivateField("Letter Salutation SCM"); BCAccount.ActivateField("Correspondence Language Code SCM"); BCAccount.ActivateField("Calculate Sub Type SCM"); //SCM 19.10.2010 TGDLOAL3: Company Main must not appear BCAccount.ActivateField("Primary Company Main Contact SCM"); }

Account Contact VBC SCM
fActivateContactFields
function fActivateContactFields(BCContact:BusComp){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateContactFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Activate BC fields for query *****************************************************************/ BCContact.ActivateField("Contact First Name"); BCContact.ActivateField("Contact Last Name"); BCContact.ActivateField("Contact Correspondence Language Code SCM"); BCContact.ActivateField("Contact M/M"); BCContact.ActivateField("Contact Middle Name"); BCContact.ActivateField("Contact M/F Calc for OLI SCM"); BCContact.ActivateField("Contact Id"); BCContact.ActivateField("Alt Email Addr"); }

Account Contact VBC SCM
fActivateContactFields
function fActivateContactFields(BCContact:BusComp){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateContactFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Activate BC fields for query *****************************************************************/ BCContact.ActivateField("Contact First Name"); BCContact.ActivateField("Contact Last Name"); BCContact.ActivateField("Contact Correspondence Language Code SCM"); BCContact.ActivateField("Contact M/M"); BCContact.ActivateField("Contact Middle Name"); BCContact.ActivateField("Contact M/F Calc for OLI SCM"); BCContact.ActivateField("Contact Id"); BCContact.ActivateField("Alt Email Addr"); }

Account Contact VBC SCM
fAddContacts
function fAddContacts(AccountId, strCompMainId, Outputs){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fAddContacts ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Moved to a function for modularity. Do the query for contacts of customers and add them to the VBC Property *****************************************************************/ //Variable Declaration var BO:BusObject; var BCContact:BusComp; var BCCon:BusComp; var psRow:PropertySet; try{ //Initialize BO = TheApplication().GetBusObject("Account"); BCCon = BO.GetBusComp("Contact"); BCContact = BO.GetBusComp("Account Contact SCM"); //Do query in Account Contact SCM BC BCContact.SetViewMode(AllView); //Activate Fields fActivateContactFields(BCContact); BCContact.ClearToQuery(); //SCM 19.10.2010 TGDLOAL3: Company Main must not appear if(strCompMainId != "" && strCompMainId != null){ BCContact.SetSearchSpec("Contact Id", "<>'" + strCompMainId + "'"); } BCContact.SetSearchSpec("Accnt Id", AccountId); BCContact.SetSearchSpec("End Date SCM", "is NULL"); BCContact.ExecuteQuery(ForwardOnly); if(BCContact.FirstRecord()) { do { psRow = TheApplication().NewPropertySet(); psRow.SetProperty("First Name SCM", BCContact.GetFieldValue("Contact First Name")); psRow.SetProperty("Last Name SCM", BCContact.GetFieldValue("Contact Last Name")); psRow.SetProperty("Language Code SCM", BCContact.GetFieldValue("Contact Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCContact.GetFieldValue("Contact M/M")); psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("Contact Middle Name", BCContact.GetFieldValue("Contact Middle Name")); psRow.SetProperty("Contact M/F Calc for OLI SCM", BCContact.GetFieldValue("Contact M/F Calc for OLI SCM")); psRow.SetProperty("Contact Id", BCContact.GetFieldValue("Contact Id")); //SCM 29.09.2010 Project CDM: Data Model Change //field "Alt Email Addr" is no more in BC 'Account Contact SCM' it is in the BC 'Contact'-> query in Contact BCCon.ActivateField("Email Address"); BCCon.SetViewMode(AllView); BCCon.ClearToQuery(); BCCon.SetSearchSpec("Id", BCContact.GetFieldValue("Contact Id")); BCCon.ExecuteQuery(ForwardOnly); if(BCCon.FirstRecord()){ psRow.SetProperty("Alt Email Addr", BCCon.GetFieldValue("Email Address")); } Outputs.AddChild (psRow); }while(BCContact.NextRecord()) } //End If; }//End Try catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BO = null; BCContact = null; BCCon = null; psRow = null; } }

Account Contact VBC SCM
fAddContacts
function fAddContacts(AccountId, strCompMainId, Outputs){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fAddContacts ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Moved to a function for modularity. Do the query for contacts of customers and add them to the VBC Property *****************************************************************/ //Variable Declaration var BO:BusObject; var BCContact:BusComp; var BCCon:BusComp; var psRow:PropertySet; try{ //Initialize BO = TheApplication().GetBusObject("Account"); BCCon = BO.GetBusComp("Contact"); BCContact = BO.GetBusComp("Account Contact SCM"); //Do query in Account Contact SCM BC BCContact.SetViewMode(AllView); //Activate Fields fActivateContactFields(BCContact); BCContact.ClearToQuery(); //SCM 19.10.2010 TGDLOAL3: Company Main must not appear if(strCompMainId != "" && strCompMainId != null){ BCContact.SetSearchSpec("Contact Id", "<>'" + strCompMainId + "'"); } BCContact.SetSearchSpec("Accnt Id", AccountId); BCContact.SetSearchSpec("End Date SCM", "is NULL"); BCContact.ExecuteQuery(ForwardOnly); if(BCContact.FirstRecord()) { do { psRow = TheApplication().NewPropertySet(); psRow.SetProperty("First Name SCM", BCContact.GetFieldValue("Contact First Name")); psRow.SetProperty("Last Name SCM", BCContact.GetFieldValue("Contact Last Name")); psRow.SetProperty("Language Code SCM", BCContact.GetFieldValue("Contact Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCContact.GetFieldValue("Contact M/M")); psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("Contact Middle Name", BCContact.GetFieldValue("Contact Middle Name")); psRow.SetProperty("Contact M/F Calc for OLI SCM", BCContact.GetFieldValue("Contact M/F Calc for OLI SCM")); psRow.SetProperty("Contact Id", BCContact.GetFieldValue("Contact Id")); //SCM 29.09.2010 Project CDM: Data Model Change //field "Alt Email Addr" is no more in BC 'Account Contact SCM' it is in the BC 'Contact'-> query in Contact BCCon.ActivateField("Email Address"); BCCon.SetViewMode(AllView); BCCon.ClearToQuery(); BCCon.SetSearchSpec("Id", BCContact.GetFieldValue("Contact Id")); BCCon.ExecuteQuery(ForwardOnly); if(BCCon.FirstRecord()){ psRow.SetProperty("Alt Email Addr", BCCon.GetFieldValue("Email Address")); } Outputs.AddChild (psRow); }while(BCContact.NextRecord()) } //End If; }//End Try catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BO = null; BCContact = null; BCCon = null; psRow = null; } }

Account Contact VBC SCM
fGetAccountAsContact
function fGetAccountAsContact(AccountId, Outputs){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateAccountFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Moved to a function for modularity. Do the query for Company customers to take the Company Customer data as contact data *****************************************************************/ //Variable Declarations var BO:BusObject; var BCAccount:BusComp; var psRow:PropertySet; var strCompMainId = ""; try{ psRow = TheApplication().NewPropertySet(); BO = TheApplication().GetBusObject("Account"); BCAccount = BO.GetBusComp("Account"); BCAccount.SetViewMode(AllView); //Activate the fields fActivateAccountFields(BCAccount); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountId); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { //Check if it is a company if (BCAccount.GetFieldValue("Type") == COMP){ if (BCAccount.GetFieldValue("Calculate Sub Type SCM") == "Y"){ psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("First Name SCM", ""); psRow.SetProperty("Last Name SCM", BCAccount.GetFieldValue("Name")); psRow.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCAccount.GetFieldValue("Title SCM")); Outputs.AddChild(psRow); } else{ //CMA psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("First Name SCM", ""); psRow.SetProperty("Last Name SCM", BCAccount.GetFieldValue("CMA Company Name SCM")); psRow.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCAccount.GetFieldValue("Title SCM")); Outputs.AddChild(psRow); }//end if subtype //SCM 19.10.2010 TGDLOAL3: Company Main must not appear strCompMainId = BCAccount.GetFieldValue("Primary Company Main Contact SCM"); } //End if type }//End First Record // TGDDERO7, 31.05.2011, move return statement behind finally statement // return (strCompMainId); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BO = null; BCAccount = null; psRow = null; // TGDDERO7, 31.05.2011, do not destroy // strCompMainId = null; } // TGDDERO7, 31.05.2011, move return statement behind finally statement return (strCompMainId); }

Account Contact VBC SCM
fGetAccountAsContact
function fGetAccountAsContact(AccountId, Outputs){ /***************************************************************** ** Bussiness Service: Account Contact VBC SCM ** Function: fActivateAccountFields ** Created: 01.03.2011 ** Created By: TGDSEAI1 ** Description: Moved to a function for modularity. Do the query for Company customers to take the Company Customer data as contact data *****************************************************************/ //Variable Declarations var BO:BusObject; var BCAccount:BusComp; var psRow:PropertySet; var strCompMainId = ""; try{ psRow = TheApplication().NewPropertySet(); BO = TheApplication().GetBusObject("Account"); BCAccount = BO.GetBusComp("Account"); BCAccount.SetViewMode(AllView); //Activate the fields fActivateAccountFields(BCAccount); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id", AccountId); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { //Check if it is a company if (BCAccount.GetFieldValue("Type") == COMP){ if (BCAccount.GetFieldValue("Calculate Sub Type SCM") == "Y"){ psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("First Name SCM", ""); psRow.SetProperty("Last Name SCM", BCAccount.GetFieldValue("Name")); psRow.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCAccount.GetFieldValue("Title SCM")); Outputs.AddChild(psRow); } else{ //CMA psRow.SetProperty("Account Id SCM", AccountId); psRow.SetProperty("First Name SCM", ""); psRow.SetProperty("Last Name SCM", BCAccount.GetFieldValue("CMA Company Name SCM")); psRow.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Correspondence Language Code SCM")); psRow.SetProperty("Letter Salutation SCM", BCAccount.GetFieldValue("Title SCM")); Outputs.AddChild(psRow); }//end if subtype //SCM 19.10.2010 TGDLOAL3: Company Main must not appear strCompMainId = BCAccount.GetFieldValue("Primary Company Main Contact SCM"); } //End if type }//End First Record // TGDDERO7, 31.05.2011, move return statement behind finally statement // return (strCompMainId); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } finally{ //Variable destruction BO = null; BCAccount = null; psRow = null; // TGDDERO7, 31.05.2011, do not destroy // strCompMainId = null; } // TGDDERO7, 31.05.2011, move return statement behind finally statement return (strCompMainId); }

Account Interface Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // CREATOR : CAROLINE M. // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // CREATOR : CAROLINE M. // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // CREATOR : CAROLINE M. // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { // // Declare variables to hold the Oracle Primary Integration Component and // The Siebel Primary Integration Component // var OracleCustomerIntComp, SiebelAccountIntComp; // //Get the primary integration component from the Oracle Integration Object // OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { // // Declare variables to hold the Oracle Primary Integration Component and // The Siebel Primary Integration Component // var OracleCustomerIntComp, SiebelAccountIntComp; // //Get the primary integration component from the Oracle Integration Object // OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { // // Declare variables to hold the Oracle Primary Integration Component and // The Siebel Primary Integration Component // var OracleCustomerIntComp, SiebelAccountIntComp; // //Get the primary integration component from the Oracle Integration Object // OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Interface Maps - Siebel Inbound
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Interface Maps - Siebel Inbound
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Interface Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 12/28/2000 // // DESCRIPTION // Javascript maps from Oracle Operating Unit to Siebel Organization // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Interface Maps - Siebel Inbound (Oracle11i)
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { var OracleCustomerIntComp, SiebelAccountIntComp; OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound (Oracle11i)
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { var OracleCustomerIntComp, SiebelAccountIntComp; OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound (Oracle11i)
CopyIntegrationObjectData
function CopyIntegrationObjectData (OracleIntObject, SiebelIntObject) { var OracleCustomerIntComp, SiebelAccountIntComp; OracleCustomerIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS_INTERFACE_ALL"); if (OracleCustomerIntComp.Exists ()) { // CUSTOMER INTERFACE SiebelAccountIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomerIntComp.NextRecord ()) { SiebelAccountIntComp.NewRecord (); SiebelAccountIntComp.SetCopySource (OracleCustomerIntComp); SiebelAccountIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_CUSTOMER_REF"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Status Code", "Error on Oracle Import"); SiebelAccountIntComp.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccountIntComp.CopyFieldValue ("EAI Sync Error Text","INTERFACE_STATUS"); } } else { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT,RA_CUSTOMERS_INTERFACE_ALL,Account - Get Oracle Customer Import Status (Oracle)")); } }

Account Interface Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Interface Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Interface Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Interface Maps - Siebel Inbound (Oracle11i)
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle11i Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Interface Maps - Siebel Inbound (Oracle11i)
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle11i Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Interface Maps - Siebel Inbound (Oracle11i)
UpsertSiebelAccount
function UpsertSiebelAccount (InputMsg, OutputMsg) { // // Declare a variable to hold the Siebel Integration Object. // var SiebelIntObject; // // Declare a variable to hold the Oracle Integration Object // var OracleIntObject; // // Get the Oracle Integration Object from the Input message // OracleIntObject = InputMsg.GetIntObj("Account - Get Oracle11i Customer Import Status (Oracle)"); // // Check the validity of the Oracle Integration Object. // if (OracleIntObject.Exists ()) { // // Create a new Siebel Integration Object on the Output Message. // SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer Import Status (Siebel)"); // // Navigate through all the available instances in the Integration Object // while (OracleIntObject.NextInstance ()) { // // Create a new instance in the Oracle Integration Object // SiebelIntObject.NewInstance (); // // CopyFields is a user defined function which is written to copy all // the fields from the source to the target. // CopyIntegrationObjectData (OracleIntObject, SiebelIntObject); } } } ///~ End of CreateSiebelProduct function.

Account Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps to Siebel Account from Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps to Siebel Account from Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps to Siebel Account from Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var SiebelPrimIntComp, OraclePrimIntComp, OraclePhoneIntComp; var AccountStatusVM = EAIGetValueMap ("Oracle Account Status", "Siebel Inbound", "Active"); var CountryVM = EAIGetValueMap ("Oracle Country", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap ("Oracle Account Phone", "Siebel Inbound", "Main Phone Number"); var AddressPhoneVM = EAIGetValueMap ("Oracle Address Phone", "Siebel Inbound", "Phone Number"); var ContactPhoneVM = EAIGetValueMap ("Oracle Contact Phone", "Siebel Inbound", "Alternate Phone #"); var FreightVM = EAIGetValueMap ("Oracle Freight", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var ContactVM = EAIGetValueMap("Oracle Contact Title", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM = EAIGetValueMap("Oracle Account Category", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); OraclePrimIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS"); // // ACCOUNTS // if (OraclePrimIntComp.Exists ()) { SiebelPrimIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OraclePrimIntComp.NextRecord ()) { // Process delete operation if(ProcessDelete(OraclePrimIntComp)) continue; SiebelPrimIntComp.NewRecord (); var OracleAcctPhIntComp = OraclePrimIntComp.GetIntComp ("RA_PHONES"); SiebelPrimIntComp.SetCopySource (OraclePrimIntComp); // Set the opcode for this component SetOperationCode(SiebelPrimIntComp, OraclePrimIntComp); SiebelPrimIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelPrimIntComp.CopyFieldValue ("Name", "CUSTOMER_NAME"); SiebelPrimIntComp.CopyFieldValue ("CSN", "CUSTOMER_NUMBER"); SiebelPrimIntComp.SetFieldValue("EAI Sync Status Code", "Sync from Back Office"); SiebelPrimIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelPrimIntComp.SetFieldValue("EAI Sync Error Text",""); SiebelPrimIntComp.CopyFieldValue ("GSA Flag", "GSA_INDICATOR"); SiebelPrimIntComp.CopyFieldValue ("Home Page", "URL"); SiebelPrimIntComp.CopyFieldValue ("Price List Integration Id", "PRICE_LIST_ID"); SiebelPrimIntComp.SetFieldValue ("Freight Terms", FreightVM.Translate( OraclePrimIntComp.GetFieldValue ("FREIGHT_TERM"))); SiebelPrimIntComp.SetFieldValue ("Type", AccountCategoryVM.Translate ( OraclePrimIntComp.GetFieldValue ("CUSTOMER_CATEGORY_CODE"))); SiebelPrimIntComp.SetFieldValue ("Account Status", AccountStatusVM.Translate ( OraclePrimIntComp.GetFieldValue ("STATUS"))); // // ACCOUNT SYNONYM // var customerNamePhonetic = OraclePrimIntComp.GetFieldValue("CUSTOMER_NAME_PHONETIC").substring(0, 49); if(customerNamePhonetic != "") { // Create a new child integration component in the Siebel from // Primary integration Component var SiebelAccSynIntComp = SiebelPrimIntComp.CreateIntComp ("Account_Account Synonym"); SiebelAccSynIntComp.NewRecord (); SetOperationCode(SiebelAccSynIntComp, OraclePrimIntComp); SiebelAccSynIntComp.SetFieldValue ("Synonym", customerNamePhonetic); } // ACCOUNT SYNONYM // // ACCOUNT PHONES // if (OracleAcctPhIntComp.Exists ()) { while (OracleAcctPhIntComp.NextRecord ()) { var OraclePhStatus = OracleAcctPhIntComp.GetFieldValue ("STATUS"); var OraclePhPrimFlg = OracleAcctPhIntComp.GetFieldValue ("PRIMARY_FLAG"); var OraclePhAddr = OracleAcctPhIntComp.GetFieldValue ("ADDRESS_ID"); var OraclePhContact = OracleAcctPhIntComp.GetFieldValue ("CONTACT_ID"); // CR: 12-9X2JRV if (OraclePhStatus == "A" && OraclePhAddr == "" && OraclePhContact == "") TransformPhone (OracleAcctPhIntComp, SiebelPrimIntComp, AccountPhoneVM); } } // END ACCOUNT PHONES // // ADDRESSES // var OracleAddressIntComp = OraclePrimIntComp.GetIntComp ("RA_

Account Maps - Siebel Inbound
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var SiebelPrimIntComp, OraclePrimIntComp, OraclePhoneIntComp; var AccountStatusVM = EAIGetValueMap ("Oracle Account Status", "Siebel Inbound", "Active"); var CountryVM = EAIGetValueMap ("Oracle Country", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap ("Oracle Account Phone", "Siebel Inbound", "Main Phone Number"); var AddressPhoneVM = EAIGetValueMap ("Oracle Address Phone", "Siebel Inbound", "Phone Number"); var ContactPhoneVM = EAIGetValueMap ("Oracle Contact Phone", "Siebel Inbound", "Alternate Phone #"); var FreightVM = EAIGetValueMap ("Oracle Freight", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var ContactVM = EAIGetValueMap("Oracle Contact Title", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM = EAIGetValueMap("Oracle Account Category", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); OraclePrimIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS"); // // ACCOUNTS // if (OraclePrimIntComp.Exists ()) { SiebelPrimIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OraclePrimIntComp.NextRecord ()) { // Process delete operation if(ProcessDelete(OraclePrimIntComp)) continue; SiebelPrimIntComp.NewRecord (); var OracleAcctPhIntComp = OraclePrimIntComp.GetIntComp ("RA_PHONES"); SiebelPrimIntComp.SetCopySource (OraclePrimIntComp); // Set the opcode for this component SetOperationCode(SiebelPrimIntComp, OraclePrimIntComp); SiebelPrimIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelPrimIntComp.CopyFieldValue ("Name", "CUSTOMER_NAME"); SiebelPrimIntComp.CopyFieldValue ("CSN", "CUSTOMER_NUMBER"); SiebelPrimIntComp.SetFieldValue("EAI Sync Status Code", "Sync from Back Office"); SiebelPrimIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelPrimIntComp.SetFieldValue("EAI Sync Error Text",""); SiebelPrimIntComp.CopyFieldValue ("GSA Flag", "GSA_INDICATOR"); SiebelPrimIntComp.CopyFieldValue ("Home Page", "URL"); SiebelPrimIntComp.CopyFieldValue ("Price List Integration Id", "PRICE_LIST_ID"); SiebelPrimIntComp.SetFieldValue ("Freight Terms", FreightVM.Translate( OraclePrimIntComp.GetFieldValue ("FREIGHT_TERM"))); SiebelPrimIntComp.SetFieldValue ("Type", AccountCategoryVM.Translate ( OraclePrimIntComp.GetFieldValue ("CUSTOMER_CATEGORY_CODE"))); SiebelPrimIntComp.SetFieldValue ("Account Status", AccountStatusVM.Translate ( OraclePrimIntComp.GetFieldValue ("STATUS"))); // // ACCOUNT SYNONYM // var customerNamePhonetic = OraclePrimIntComp.GetFieldValue("CUSTOMER_NAME_PHONETIC").substring(0, 49); if(customerNamePhonetic != "") { // Create a new child integration component in the Siebel from // Primary integration Component var SiebelAccSynIntComp = SiebelPrimIntComp.CreateIntComp ("Account_Account Synonym"); SiebelAccSynIntComp.NewRecord (); SetOperationCode(SiebelAccSynIntComp, OraclePrimIntComp); SiebelAccSynIntComp.SetFieldValue ("Synonym", customerNamePhonetic); } // ACCOUNT SYNONYM // // ACCOUNT PHONES // if (OracleAcctPhIntComp.Exists ()) { while (OracleAcctPhIntComp.NextRecord ()) { var OraclePhStatus = OracleAcctPhIntComp.GetFieldValue ("STATUS"); var OraclePhPrimFlg = OracleAcctPhIntComp.GetFieldValue ("PRIMARY_FLAG"); var OraclePhAddr = OracleAcctPhIntComp.GetFieldValue ("ADDRESS_ID"); var OraclePhContact = OracleAcctPhIntComp.GetFieldValue ("CONTACT_ID"); // CR: 12-9X2JRV if (OraclePhStatus == "A" && OraclePhAddr == "" && OraclePhContact == "") TransformPhone (OracleAcctPhIntComp, SiebelPrimIntComp, AccountPhoneVM); } } // END ACCOUNT PHONES // // ADDRESSES // var OracleAddressIntComp = OraclePrimIntComp.GetIntComp ("RA_

Account Maps - Siebel Inbound
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var SiebelPrimIntComp, OraclePrimIntComp, OraclePhoneIntComp; var AccountStatusVM = EAIGetValueMap ("Oracle Account Status", "Siebel Inbound", "Active"); var CountryVM = EAIGetValueMap ("Oracle Country", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap ("Oracle Account Phone", "Siebel Inbound", "Main Phone Number"); var AddressPhoneVM = EAIGetValueMap ("Oracle Address Phone", "Siebel Inbound", "Phone Number"); var ContactPhoneVM = EAIGetValueMap ("Oracle Contact Phone", "Siebel Inbound", "Alternate Phone #"); var FreightVM = EAIGetValueMap ("Oracle Freight", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var ContactVM = EAIGetValueMap("Oracle Contact Title", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM = EAIGetValueMap("Oracle Account Category", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError); OraclePrimIntComp = OracleIntObject.GetPrimaryIntComp ("RA_CUSTOMERS"); // // ACCOUNTS // if (OraclePrimIntComp.Exists ()) { SiebelPrimIntComp = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OraclePrimIntComp.NextRecord ()) { // Process delete operation if(ProcessDelete(OraclePrimIntComp)) continue; SiebelPrimIntComp.NewRecord (); var OracleAcctPhIntComp = OraclePrimIntComp.GetIntComp ("RA_PHONES"); SiebelPrimIntComp.SetCopySource (OraclePrimIntComp); // Set the opcode for this component SetOperationCode(SiebelPrimIntComp, OraclePrimIntComp); SiebelPrimIntComp.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelPrimIntComp.CopyFieldValue ("Name", "CUSTOMER_NAME"); SiebelPrimIntComp.CopyFieldValue ("CSN", "CUSTOMER_NUMBER"); SiebelPrimIntComp.SetFieldValue("EAI Sync Status Code", "Sync from Back Office"); SiebelPrimIntComp.SetFieldValue("EAI Sync Date", Timestamp()); SiebelPrimIntComp.SetFieldValue("EAI Sync Error Text",""); SiebelPrimIntComp.CopyFieldValue ("GSA Flag", "GSA_INDICATOR"); SiebelPrimIntComp.CopyFieldValue ("Home Page", "URL"); SiebelPrimIntComp.CopyFieldValue ("Price List Integration Id", "PRICE_LIST_ID"); SiebelPrimIntComp.SetFieldValue ("Freight Terms", FreightVM.Translate( OraclePrimIntComp.GetFieldValue ("FREIGHT_TERM"))); SiebelPrimIntComp.SetFieldValue ("Type", AccountCategoryVM.Translate ( OraclePrimIntComp.GetFieldValue ("CUSTOMER_CATEGORY_CODE"))); SiebelPrimIntComp.SetFieldValue ("Account Status", AccountStatusVM.Translate ( OraclePrimIntComp.GetFieldValue ("STATUS"))); // // ACCOUNT SYNONYM // var customerNamePhonetic = OraclePrimIntComp.GetFieldValue("CUSTOMER_NAME_PHONETIC").substring(0, 49); if(customerNamePhonetic != "") { // Create a new child integration component in the Siebel from // Primary integration Component var SiebelAccSynIntComp = SiebelPrimIntComp.CreateIntComp ("Account_Account Synonym"); SiebelAccSynIntComp.NewRecord (); SetOperationCode(SiebelAccSynIntComp, OraclePrimIntComp); SiebelAccSynIntComp.SetFieldValue ("Synonym", customerNamePhonetic); } // ACCOUNT SYNONYM // // ACCOUNT PHONES // if (OracleAcctPhIntComp.Exists ()) { while (OracleAcctPhIntComp.NextRecord ()) { var OraclePhStatus = OracleAcctPhIntComp.GetFieldValue ("STATUS"); var OraclePhPrimFlg = OracleAcctPhIntComp.GetFieldValue ("PRIMARY_FLAG"); var OraclePhAddr = OracleAcctPhIntComp.GetFieldValue ("ADDRESS_ID"); var OraclePhContact = OracleAcctPhIntComp.GetFieldValue ("CONTACT_ID"); // CR: 12-9X2JRV if (OraclePhStatus == "A" && OraclePhAddr == "" && OraclePhContact == "") TransformPhone (OracleAcctPhIntComp, SiebelPrimIntComp, AccountPhoneVM); } } // END ACCOUNT PHONES // // ADDRESSES // var OracleAddressIntComp = OraclePrimIntComp.GetIntComp ("RA_

Account Maps - Siebel Inbound
ProcessDelete
function ProcessDelete(OracleComp) { // If not a delete return false. // If delete (X or D) perform delete through COM interface. X indicates that // there should be a D at a lower level. // // For Accounts we expect deletes at SIE_CUSTOMER_PROFILE_AMOUNT only. // X RA_CUSTOMERS // D SIE_CUSTOMER_PROFILE_AMOUNT // // Phone Deletes are treated specially // We need to first figure out whether it's a Customer Phone, // Address Phone or a Contact Phone. var opCode; var childComp; opCode = OracleComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete of Discount not supported. EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_DELETION,RA_CUSTOMERS")); } else if (opCode == "X") { // Expect delete within account childComp = OracleComp.GetIntComp("SIE_CUSTOMER_PROFILE_AMOUNT"); if(childComp.Exists() && childComp.NextRecord()) { opCode = childComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete Credit Profile var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp("Account Credit Profile"); BComp.SetViewMode(3); BComp.ClearToQuery(); BComp.SetSearchSpec("Credit Control Area Code", childComp.GetFieldValue("CUSTOMER_PROFILE_AMOUNT_ID")); BComp.ExecuteQuery(); BComp.FirstRecord(); BComp.DeleteRecord(); BComp.WriteRecord(); return true; } else EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_SYSOP,"+opCode+",SIE_CUSTOMER_PROFILE_AMOUNT")); } else { //Phone delete processing childComp = OracleComp.GetIntComp("RA_PHONES"); if(!childComp.Exists() || !childComp.NextRecord()) { childComp = OracleComp.GetIntComp("RA_ADDRESSES_ALL"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES2"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES2, RA_CUSTOMERS")); } } else { //see if it's a contact phone childComp = OracleComp.GetIntComp("RA_CONTACTS"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES3"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES3, RA_CUSTOMERS")); } } }//end of contact phone check }//either address or contact phone opCode = childComp.GetFieldValue("SysOp"); //We still need to check what kind of phone it is //as the receiver may return an incorrect hierarchy //The parent comp is put in this column var SiebelBusComp; var ValueMapName; var TableName; //Get the parent type. var BusCompType = childComp.GetFieldValue("ROOT_TBL_PRI_KEY2"); if(BusCompType == 1) { SiebelBusComp = "Account"; ValueMapName = "Oracle Account Phone"; TableName = "RA_PHONE"; } else if(BusCompType == 2) { SiebelBusComp = "Business Address"; ValueMapName = "Oracle Address Phone"; TableName = "RA_PHONE2"; } else if(BusCompType == 3) { SiebelBusComp = "Contact"; ValueMapName = "Oracle Contact Phone"; TableName = "RA_PHONE3"; } else { /*Add this message EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_PHONE, "+BusCompType+""));*/ } if(opCode == "D") { var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp(SiebelBusComp); BComp.SetViewMode(3); BComp.ClearToQuery(); //assume that the receiver sets this from the //error message column. The phone type is put in this column. var AccountPhoneVM = EAIGetValueMap(ValueMapName, "Siebel Inbound"); //Get the Phone Type which is put in the //Error Message column of the notification tbl var type = childComp.GetFieldValue("ERROR_MESSAGE"); var SiebelColName = AccountPhoneVM.T

Account Maps - Siebel Inbound
ProcessDelete
function ProcessDelete(OracleComp) { // If not a delete return false. // If delete (X or D) perform delete through COM interface. X indicates that // there should be a D at a lower level. // // For Accounts we expect deletes at SIE_CUSTOMER_PROFILE_AMOUNT only. // X RA_CUSTOMERS // D SIE_CUSTOMER_PROFILE_AMOUNT // // Phone Deletes are treated specially // We need to first figure out whether it's a Customer Phone, // Address Phone or a Contact Phone. var opCode; var childComp; opCode = OracleComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete of Discount not supported. EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_DELETION,RA_CUSTOMERS")); } else if (opCode == "X") { // Expect delete within account childComp = OracleComp.GetIntComp("SIE_CUSTOMER_PROFILE_AMOUNT"); if(childComp.Exists() && childComp.NextRecord()) { opCode = childComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete Credit Profile var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp("Account Credit Profile"); BComp.SetViewMode(3); BComp.ClearToQuery(); BComp.SetSearchSpec("Credit Control Area Code", childComp.GetFieldValue("CUSTOMER_PROFILE_AMOUNT_ID")); BComp.ExecuteQuery(); BComp.FirstRecord(); BComp.DeleteRecord(); BComp.WriteRecord(); return true; } else EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_SYSOP,"+opCode+",SIE_CUSTOMER_PROFILE_AMOUNT")); } else { //Phone delete processing childComp = OracleComp.GetIntComp("RA_PHONES"); if(!childComp.Exists() || !childComp.NextRecord()) { childComp = OracleComp.GetIntComp("RA_ADDRESSES_ALL"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES2"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES2, RA_CUSTOMERS")); } } else { //see if it's a contact phone childComp = OracleComp.GetIntComp("RA_CONTACTS"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES3"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES3, RA_CUSTOMERS")); } } }//end of contact phone check }//either address or contact phone opCode = childComp.GetFieldValue("SysOp"); //We still need to check what kind of phone it is //as the receiver may return an incorrect hierarchy //The parent comp is put in this column var SiebelBusComp; var ValueMapName; var TableName; //Get the parent type. var BusCompType = childComp.GetFieldValue("ROOT_TBL_PRI_KEY2"); if(BusCompType == 1) { SiebelBusComp = "Account"; ValueMapName = "Oracle Account Phone"; TableName = "RA_PHONE"; } else if(BusCompType == 2) { SiebelBusComp = "Business Address"; ValueMapName = "Oracle Address Phone"; TableName = "RA_PHONE2"; } else if(BusCompType == 3) { SiebelBusComp = "Contact"; ValueMapName = "Oracle Contact Phone"; TableName = "RA_PHONE3"; } else { /*Add this message EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_PHONE, "+BusCompType+""));*/ } if(opCode == "D") { var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp(SiebelBusComp); BComp.SetViewMode(3); BComp.ClearToQuery(); //assume that the receiver sets this from the //error message column. The phone type is put in this column. var AccountPhoneVM = EAIGetValueMap(ValueMapName, "Siebel Inbound"); //Get the Phone Type which is put in the //Error Message column of the notification tbl var type = childComp.GetFieldValue("ERROR_MESSAGE"); var SiebelColName = AccountPhoneVM.T

Account Maps - Siebel Inbound
ProcessDelete
function ProcessDelete(OracleComp) { // If not a delete return false. // If delete (X or D) perform delete through COM interface. X indicates that // there should be a D at a lower level. // // For Accounts we expect deletes at SIE_CUSTOMER_PROFILE_AMOUNT only. // X RA_CUSTOMERS // D SIE_CUSTOMER_PROFILE_AMOUNT // // Phone Deletes are treated specially // We need to first figure out whether it's a Customer Phone, // Address Phone or a Contact Phone. var opCode; var childComp; opCode = OracleComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete of Discount not supported. EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_DELETION,RA_CUSTOMERS")); } else if (opCode == "X") { // Expect delete within account childComp = OracleComp.GetIntComp("SIE_CUSTOMER_PROFILE_AMOUNT"); if(childComp.Exists() && childComp.NextRecord()) { opCode = childComp.GetFieldValue("SysOp"); if (opCode == "D") { // Delete Credit Profile var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp("Account Credit Profile"); BComp.SetViewMode(3); BComp.ClearToQuery(); BComp.SetSearchSpec("Credit Control Area Code", childComp.GetFieldValue("CUSTOMER_PROFILE_AMOUNT_ID")); BComp.ExecuteQuery(); BComp.FirstRecord(); BComp.DeleteRecord(); BComp.WriteRecord(); return true; } else EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_SYSOP,"+opCode+",SIE_CUSTOMER_PROFILE_AMOUNT")); } else { //Phone delete processing childComp = OracleComp.GetIntComp("RA_PHONES"); if(!childComp.Exists() || !childComp.NextRecord()) { childComp = OracleComp.GetIntComp("RA_ADDRESSES_ALL"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES2"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES2, RA_CUSTOMERS")); } } else { //see if it's a contact phone childComp = OracleComp.GetIntComp("RA_CONTACTS"); if(childComp.Exists() && childComp.NextRecord()) { childComp = childComp.GetIntComp("RA_PHONES3"); if(!childComp.Exists() || !childComp.NextRecord()) { EAIRaiseError(TranslateMessage( "ORA_MSG_MISSING_COMPONENT, RA_PHONES3, RA_CUSTOMERS")); } } }//end of contact phone check }//either address or contact phone opCode = childComp.GetFieldValue("SysOp"); //We still need to check what kind of phone it is //as the receiver may return an incorrect hierarchy //The parent comp is put in this column var SiebelBusComp; var ValueMapName; var TableName; //Get the parent type. var BusCompType = childComp.GetFieldValue("ROOT_TBL_PRI_KEY2"); if(BusCompType == 1) { SiebelBusComp = "Account"; ValueMapName = "Oracle Account Phone"; TableName = "RA_PHONE"; } else if(BusCompType == 2) { SiebelBusComp = "Business Address"; ValueMapName = "Oracle Address Phone"; TableName = "RA_PHONE2"; } else if(BusCompType == 3) { SiebelBusComp = "Contact"; ValueMapName = "Oracle Contact Phone"; TableName = "RA_PHONE3"; } else { /*Add this message EAIRaiseError(TranslateMessage( "ORA_MSG_INVALID_PHONE, "+BusCompType+""));*/ } if(opCode == "D") { var BusObject = TheApplication().GetBusObject("Account"); var BComp = BusObject.GetBusComp(SiebelBusComp); BComp.SetViewMode(3); BComp.ClearToQuery(); //assume that the receiver sets this from the //error message column. The phone type is put in this column. var AccountPhoneVM = EAIGetValueMap(ValueMapName, "Siebel Inbound"); //Get the Phone Type which is put in the //Error Message column of the notification tbl var type = childComp.GetFieldValue("ERROR_MESSAGE"); var SiebelColName = AccountPhoneVM.T

Account Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound
SetOperationCode
/** * Sets the operation code for this Siebel integration component */ function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound
SetOperationCode
/** * Sets the operation code for this Siebel integration component */ function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound
SetOperationCode
/** * Sets the operation code for this Siebel integration component */ function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { var OracleIntObject, SiebelIntObject; OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle Customer (Oracle)"); SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get/Put Oracle Customer (Siebel)"); while (OracleIntObject.NextInstance ()) { SiebelIntObject.NewInstance (); CopyFields (OracleIntObject, SiebelIntObject); } }

Account Maps - Siebel Inbound
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { var OracleIntObject, SiebelIntObject; OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle Customer (Oracle)"); SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get/Put Oracle Customer (Siebel)"); while (OracleIntObject.NextInstance ()) { SiebelIntObject.NewInstance (); CopyFields (OracleIntObject, SiebelIntObject); } }

Account Maps - Siebel Inbound
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { var OracleIntObject, SiebelIntObject; OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle Customer (Oracle)"); SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get/Put Oracle Customer (Siebel)"); while (OracleIntObject.NextInstance ()) { SiebelIntObject.NewInstance (); CopyFields (OracleIntObject, SiebelIntObject); } }

Account Maps - Siebel Inbound
TransformPhone
function TransformPhone (OraclePhoneIntComp, SiebelIntComp, PhoneValueMap) { // Declare a variable to hold the Phone type. var PhoneType, SiebelPhoneField; // Get the Phone_Type field from Oracle. PhoneType = OraclePhoneIntComp.GetFieldValue("PHONE_TYPE"); // Use the value map to lookup the Phone field in the Siebel Integration Object. SiebelPhoneField = PhoneValueMap.Translate(PhoneType); if(SiebelPhoneField == "") { // Exception: Missing phone type EAIRaiseError (TranslateMessage( "ORA_MSG_MISSING_VALUE_MAPPING,"+PhoneType+",Oracle Account Phone")); } SiebelIntComp.SetFieldValue (SiebelPhoneField, OraclePhoneIntComp.GetFieldValue ("PHONE_NUMBER")); }

Account Maps - Siebel Inbound
TransformPhone
function TransformPhone (OraclePhoneIntComp, SiebelIntComp, PhoneValueMap) { // Declare a variable to hold the Phone type. var PhoneType, SiebelPhoneField; // Get the Phone_Type field from Oracle. PhoneType = OraclePhoneIntComp.GetFieldValue("PHONE_TYPE"); // Use the value map to lookup the Phone field in the Siebel Integration Object. SiebelPhoneField = PhoneValueMap.Translate(PhoneType); if(SiebelPhoneField == "") { // Exception: Missing phone type EAIRaiseError (TranslateMessage( "ORA_MSG_MISSING_VALUE_MAPPING,"+PhoneType+",Oracle Account Phone")); } SiebelIntComp.SetFieldValue (SiebelPhoneField, OraclePhoneIntComp.GetFieldValue ("PHONE_NUMBER")); }

Account Maps - Siebel Inbound
TransformPhone
function TransformPhone (OraclePhoneIntComp, SiebelIntComp, PhoneValueMap) { // Declare a variable to hold the Phone type. var PhoneType, SiebelPhoneField; // Get the Phone_Type field from Oracle. PhoneType = OraclePhoneIntComp.GetFieldValue("PHONE_TYPE"); // Use the value map to lookup the Phone field in the Siebel Integration Object. SiebelPhoneField = PhoneValueMap.Translate(PhoneType); if(SiebelPhoneField == "") { // Exception: Missing phone type EAIRaiseError (TranslateMessage( "ORA_MSG_MISSING_VALUE_MAPPING,"+PhoneType+",Oracle Account Phone")); } SiebelIntComp.SetFieldValue (SiebelPhoneField, OraclePhoneIntComp.GetFieldValue ("PHONE_NUMBER")); }

Account Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Inbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created by Richard Exley - November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Inbound (Oracle11i)
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var OracleCustomer, SiebelAccount; OracleCustomer = OracleIntObject.GetPrimaryIntComp ("HZ_CUST_ACCOUNTS"); if (OracleCustomer.Exists ()) { SiebelAccount = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomer.NextRecord ()) { // // ACCOUNTS // SiebelAccount.NewRecord (); SiebelAccount.SetCopySource (OracleCustomer); SetOperationCode(SiebelAccount, OracleCustomer); SiebelAccount.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelAccount.SetFieldValue ("EAI Sync Status Code", "Sync from Back Office"); SiebelAccount.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccount.SetFieldValue ("EAI Sync Error Text",""); SiebelAccount.CopyFieldValue ("CSN", "ACCOUNT_NUMBER"); // // CONTACTS // var OracleCustContacts = OracleCustomer.GetIntComp ("SIE_CONTACTS_V"); if (OracleCustContacts.Exists ()) { var SiebelAccountContacts = SiebelAccount.CreateIntComp ("Contact"); while (OracleCustContacts.NextRecord ()) { SiebelAccountContacts.NewRecord (); SiebelAccountContacts.SetCopySource (OracleCustContacts); SetOperationCode(SiebelAccountContacts, OracleCustContacts); // For all the contacts passed from Oracle to Siebel // make the current account as the contact's primary account SiebelAccountContacts.SetFieldValue("Account Integration Id", OracleCustomer.GetFieldValue("ORIG_SYSTEM_REFERENCE")); SiebelAccountContacts.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } // // ADDRESSES // var OracleCustSites = OracleCustomer.GetIntComp ("SIE_ADDRESSES_V"); if (OracleCustSites.Exists ()) { var SiebelAccountAddresses = SiebelAccount.CreateIntComp ("Business Address"); while (OracleCustSites.NextRecord ()) { SiebelAccountAddresses.NewRecord (); SiebelAccountAddresses.SetCopySource (OracleCustSites); SetOperationCode(SiebelAccountAddresses, OracleCustSites); SiebelAccountAddresses.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } } ///~ while(OracleAccount.NextRecord()) } ///~ if(OracleAccount.Exists()) else { EAIRaiseError (TranslateMessage ( "ORA_MSG_MISSING_COMPONENT,HZ_CUST_ACCOUNTS,Account - Get Oracle11i Customer (Oracle)")); } }

Account Maps - Siebel Inbound (Oracle11i)
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var OracleCustomer, SiebelAccount; OracleCustomer = OracleIntObject.GetPrimaryIntComp ("HZ_CUST_ACCOUNTS"); if (OracleCustomer.Exists ()) { SiebelAccount = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomer.NextRecord ()) { // // ACCOUNTS // SiebelAccount.NewRecord (); SiebelAccount.SetCopySource (OracleCustomer); SetOperationCode(SiebelAccount, OracleCustomer); SiebelAccount.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelAccount.SetFieldValue ("EAI Sync Status Code", "Sync from Back Office"); SiebelAccount.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccount.SetFieldValue ("EAI Sync Error Text",""); SiebelAccount.CopyFieldValue ("CSN", "ACCOUNT_NUMBER"); // // CONTACTS // var OracleCustContacts = OracleCustomer.GetIntComp ("SIE_CONTACTS_V"); if (OracleCustContacts.Exists ()) { var SiebelAccountContacts = SiebelAccount.CreateIntComp ("Contact"); while (OracleCustContacts.NextRecord ()) { SiebelAccountContacts.NewRecord (); SiebelAccountContacts.SetCopySource (OracleCustContacts); SetOperationCode(SiebelAccountContacts, OracleCustContacts); // For all the contacts passed from Oracle to Siebel // make the current account as the contact's primary account SiebelAccountContacts.SetFieldValue("Account Integration Id", OracleCustomer.GetFieldValue("ORIG_SYSTEM_REFERENCE")); SiebelAccountContacts.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } // // ADDRESSES // var OracleCustSites = OracleCustomer.GetIntComp ("SIE_ADDRESSES_V"); if (OracleCustSites.Exists ()) { var SiebelAccountAddresses = SiebelAccount.CreateIntComp ("Business Address"); while (OracleCustSites.NextRecord ()) { SiebelAccountAddresses.NewRecord (); SiebelAccountAddresses.SetCopySource (OracleCustSites); SetOperationCode(SiebelAccountAddresses, OracleCustSites); SiebelAccountAddresses.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } } ///~ while(OracleAccount.NextRecord()) } ///~ if(OracleAccount.Exists()) else { EAIRaiseError (TranslateMessage ( "ORA_MSG_MISSING_COMPONENT,HZ_CUST_ACCOUNTS,Account - Get Oracle11i Customer (Oracle)")); } }

Account Maps - Siebel Inbound (Oracle11i)
CopyFields
function CopyFields (OracleIntObject, SiebelIntObject) { var OracleCustomer, SiebelAccount; OracleCustomer = OracleIntObject.GetPrimaryIntComp ("HZ_CUST_ACCOUNTS"); if (OracleCustomer.Exists ()) { SiebelAccount = SiebelIntObject.CreatePrimaryIntComp ("Account"); while (OracleCustomer.NextRecord ()) { // // ACCOUNTS // SiebelAccount.NewRecord (); SiebelAccount.SetCopySource (OracleCustomer); SetOperationCode(SiebelAccount, OracleCustomer); SiebelAccount.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); SiebelAccount.SetFieldValue ("EAI Sync Status Code", "Sync from Back Office"); SiebelAccount.SetFieldValue ("EAI Sync Date", Timestamp()); SiebelAccount.SetFieldValue ("EAI Sync Error Text",""); SiebelAccount.CopyFieldValue ("CSN", "ACCOUNT_NUMBER"); // // CONTACTS // var OracleCustContacts = OracleCustomer.GetIntComp ("SIE_CONTACTS_V"); if (OracleCustContacts.Exists ()) { var SiebelAccountContacts = SiebelAccount.CreateIntComp ("Contact"); while (OracleCustContacts.NextRecord ()) { SiebelAccountContacts.NewRecord (); SiebelAccountContacts.SetCopySource (OracleCustContacts); SetOperationCode(SiebelAccountContacts, OracleCustContacts); // For all the contacts passed from Oracle to Siebel // make the current account as the contact's primary account SiebelAccountContacts.SetFieldValue("Account Integration Id", OracleCustomer.GetFieldValue("ORIG_SYSTEM_REFERENCE")); SiebelAccountContacts.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } // // ADDRESSES // var OracleCustSites = OracleCustomer.GetIntComp ("SIE_ADDRESSES_V"); if (OracleCustSites.Exists ()) { var SiebelAccountAddresses = SiebelAccount.CreateIntComp ("Business Address"); while (OracleCustSites.NextRecord ()) { SiebelAccountAddresses.NewRecord (); SiebelAccountAddresses.SetCopySource (OracleCustSites); SetOperationCode(SiebelAccountAddresses, OracleCustSites); SiebelAccountAddresses.CopyFieldValue ("Integration Id", "ORIG_SYSTEM_REFERENCE"); } } } ///~ while(OracleAccount.NextRecord()) } ///~ if(OracleAccount.Exists()) else { EAIRaiseError (TranslateMessage ( "ORA_MSG_MISSING_COMPONENT,HZ_CUST_ACCOUNTS,Account - Get Oracle11i Customer (Oracle)")); } }

Account Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Inbound (Oracle11i)
SetOperationCode
function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound (Oracle11i)
SetOperationCode
function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound (Oracle11i)
SetOperationCode
function SetOperationCode(SiebelIntComp, OracleIntComp) { var opCode = OracleIntComp.GetFieldValue ("SysOp"); if(opCode == "D") SiebelIntComp.SetFieldValue ("operation", "delete"); else SiebelIntComp.SetFieldValue ("operation", "upsert"); }

Account Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Inbound (Oracle11i)
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { // Declare a variable to hold the Oracle Integration Object var OracleIntObject; // Declare a variable to hold the Siebel Integration Object. var SiebelIntObject; // Get the Oracle Integration Object from the Input message OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle11i Customer (Oracle)"); // Check the validity of the Oracle Integration Object. if (OracleIntObject.Exists ()) { // Go ahead and create a new Siebel Integration Object on the Output Message. SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer (Siebel)"); // Navigate through all the available instances in the Integration Object while (OracleIntObject.NextInstance ()) { // Create a new instance in the Siebel Integration Object SiebelIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (OracleIntObject, SiebelIntObject); } } ///~ if (OracleIntObject.Exists ()) else { //Raise an exception saying that the Oracle Integration Object was not found in // the Input message EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get Oracle11i Customer (Oracle)")); } ///~ else } ///~ End of TransformOracleCustomer function.

Account Maps - Siebel Inbound (Oracle11i)
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { // Declare a variable to hold the Oracle Integration Object var OracleIntObject; // Declare a variable to hold the Siebel Integration Object. var SiebelIntObject; // Get the Oracle Integration Object from the Input message OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle11i Customer (Oracle)"); // Check the validity of the Oracle Integration Object. if (OracleIntObject.Exists ()) { // Go ahead and create a new Siebel Integration Object on the Output Message. SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer (Siebel)"); // Navigate through all the available instances in the Integration Object while (OracleIntObject.NextInstance ()) { // Create a new instance in the Siebel Integration Object SiebelIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (OracleIntObject, SiebelIntObject); } } ///~ if (OracleIntObject.Exists ()) else { //Raise an exception saying that the Oracle Integration Object was not found in // the Input message EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get Oracle11i Customer (Oracle)")); } ///~ else } ///~ End of TransformOracleCustomer function.

Account Maps - Siebel Inbound (Oracle11i)
TransformOracleCustomer
function TransformOracleCustomer (InputMsg, OutputMsg) { // Declare a variable to hold the Oracle Integration Object var OracleIntObject; // Declare a variable to hold the Siebel Integration Object. var SiebelIntObject; // Get the Oracle Integration Object from the Input message OracleIntObject = InputMsg.GetIntObj ("Account - Get Oracle11i Customer (Oracle)"); // Check the validity of the Oracle Integration Object. if (OracleIntObject.Exists ()) { // Go ahead and create a new Siebel Integration Object on the Output Message. SiebelIntObject = OutputMsg.CreateIntObj ("Account - Get Oracle11i Customer (Siebel)"); // Navigate through all the available instances in the Integration Object while (OracleIntObject.NextInstance ()) { // Create a new instance in the Siebel Integration Object SiebelIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (OracleIntObject, SiebelIntObject); } } ///~ if (OracleIntObject.Exists ()) else { //Raise an exception saying that the Oracle Integration Object was not found in // the Input message EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get Oracle11i Customer (Oracle)")); } ///~ else } ///~ End of TransformOracleCustomer function.

Account Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Inbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps from Siebel Account to Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps from Siebel Account to Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // DESCRIPTION // Javascript maps from Siebel Account to Oracle Customer // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound
AccountLoopBack
// Set Integration Id for new accounts, contacts or addresses created in Siebel function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Get/Put Oracle Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); AccCompOut.SetFieldValue ("EAI Sync Date", Timestamp()); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } }

Account Maps - Siebel Outbound
AccountLoopBack
// Set Integration Id for new accounts, contacts or addresses created in Siebel function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Get/Put Oracle Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); AccCompOut.SetFieldValue ("EAI Sync Date", Timestamp()); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } }

Account Maps - Siebel Outbound
AccountLoopBack
// Set Integration Id for new accounts, contacts or addresses created in Siebel function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Get/Put Oracle Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); AccCompOut.SetFieldValue ("EAI Sync Date", Timestamp()); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } }

Account Maps - Siebel Outbound
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY, NULL")); } }

Account Maps - Siebel Outbound
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY, NULL")); } }

Account Maps - Siebel Outbound
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY, NULL")); } }

Account Maps - Siebel Outbound
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber,

Account Maps - Siebel Outbound
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber,

Account Maps - Siebel Outbound
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber,

Account Maps - Siebel Outbound
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "Default"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Get/Put Oracle Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Get/Put Oracle Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound
TimeStamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound
TimeStamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound
TimeStamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound (Oracle11i)
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001, Siebel Systems, Inc., All rights reserved. // // LAST UPDATED : 01/03/2001 // // DESCRIPTION // Javascript maps from Oracle11i Customer to Siebel Account // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

Account Maps - Siebel Outbound (Oracle11i)
AccountLoopBack
function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } }

Account Maps - Siebel Outbound (Oracle11i)
AccountLoopBack
function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } }

Account Maps - Siebel Outbound (Oracle11i)
AccountLoopBack
function AccountLoopBack(InputMsg, OutputMsg) { var SiebelObjectIn, SiebelObjectOut; var AccCompIn, AccCompOut, AddrCompIn, AddrCompOut, ConCompIn, ConCompOut; var AccSharedID, AccIntegId, AddrSharedID, AddrIntegId, ConSharedID, ConIntegId; /* Check the validation message */ var ValidationMessage = InputMsg.GetArgument("Validation Message"); if (ValidationMessage != "") { EAIRaiseError(TranslateMessage(ValidationMessage)); } SiebelObjectIn = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); if (SiebelObjectIn.Exists ()) { SiebelObjectOut = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Siebel)"); while (SiebelObjectIn.NextInstance ()) { SiebelObjectOut.NewInstance (); AccCompIn = SiebelObjectIn.GetPrimaryIntComp ("Account"); // // ACCOUNT // if (AccCompIn.Exists ()) { AccCompOut = SiebelObjectOut.CreatePrimaryIntComp("Account"); while (AccCompIn.NextRecord ()) { AccCompOut.SetCopySource (AccCompIn); AccCompOut.NewRecord (); AccCompOut.CopyFieldValue("Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Date", Timestamp()); AccIntegId = AccCompIn.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccCompOut.CopyFieldValue("Integration Id", "Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Creating in Back Office"); } else { // Existing Account AccCompOut.CopyFieldValue("Integration Id", "Integration Id"); AccCompOut.SetFieldValue("EAI Sync Status Code", "Sync To Back Office"); } AccCompOut.SetFieldValue ("EAI Sync Error Text",""); // // ACCOUNT ADDRESSES // var AddrCompIn = AccCompIn.GetIntComp ("Business Address"); if (AddrCompIn.Exists()) { AddrCompOut = AccCompOut.CreateIntComp("Business Address"); while (AddrCompIn.NextRecord()) { AddrCompOut.SetCopySource (AddrCompIn); AddrCompOut.NewRecord(); AddrCompOut.CopyFieldValue("Id", "Id"); AddrIntegId = AddrCompIn.GetFieldValue( "Integration Id"); if (AddrIntegId == "" || AddrIntegId == null) { // New Address AddrCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Address AddrCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT ADDRESSES // // ACCOUNT CONTACTS // var ConCompIn = AccCompIn.GetIntComp ("Contact"); if (ConCompIn.Exists()) { ConCompOut = AccCompOut.CreateIntComp("Contact"); while (ConCompIn.NextRecord()) { ConCompOut.SetCopySource (ConCompIn); ConCompOut.NewRecord(); ConCompOut.CopyFieldValue("Id", "Id"); ConIntegId = ConCompIn.GetFieldValue( "Integration Id"); if (ConIntegId == "" || ConIntegId == null) { // New Contact ConCompOut.CopyFieldValue("Integration Id", "Id"); } else { // Existing Contact ConCompOut.CopyFieldValue("Integration Id", "Integration Id"); } } } // END ACCOUNT CONTACTS } } // END ACCOUNT } } else { EAIRaiseError (TranslateMessage ( "ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } }

Account Maps - Siebel Outbound (Oracle11i)
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY,NULL")); } }

Account Maps - Siebel Outbound (Oracle11i)
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY,NULL")); } }

Account Maps - Siebel Outbound (Oracle11i)
CopyAddressInfo
function CopyAddressInfo (OracleCustComp, SiebelAddressIntComp, CountryVM, AddrSharedID) { OracleCustComp.SetCopySource (SiebelAddressIntComp); OracleCustComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleCustComp.CopyFieldValue ("ADDRESS1", "Street Address"); OracleCustComp.CopyFieldValue ("ADDRESS2", "Street Address 2"); OracleCustComp.CopyFieldValue ("CITY", "City"); OracleCustComp.CopyFieldValue ("STATE", "State"); OracleCustComp.CopyFieldValue ("PROVINCE", "Province"); OracleCustComp.CopyFieldValue ("COUNTY", "County"); OracleCustComp.CopyFieldValue ("POSTAL_CODE", "Postal Code"); OracleCustComp.CopyFieldValue ("ORG_ID", "Organization Integration Id"); var CountryVal = SiebelAddressIntComp.GetFieldValue("Country"); if ( CountryVal != "" ) { OracleCustComp.SetFieldValue ("COUNTRY", CountryVM.Translate ( SiebelAddressIntComp.GetFieldValue ("Country"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_COUNTRY,NULL")); } }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactInfo
function CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID) { OracleContactIntComp.NewRecord(); OracleContactIntComp.SetCopySource (SiebelContactIntComp); OracleContactIntComp.SetFieldValue ("operation", "upsert"); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleContactIntComp.SetFieldValue ("ORIG_SYSTEM_TELEPHONE_REF", ""); OracleContactIntComp.SetFieldValue ("INSERT_UPDATE_FLAG",ContactInsUpdFlag); OracleContactIntComp.SetFieldValue ("CONTACT_TITLE", ContactTitleVM.Translate (SiebelContactIntComp.GetFieldValue ("M/M"))); OracleContactIntComp.SetFieldValue ("CONTACT_JOB_TITLE", SiebelContactIntComp.GetFieldValue("Job Title").substring(0,49)); OracleContactIntComp.CopyFieldValue ("CONTACT_LAST_NAME", "Last Name"); OracleContactIntComp.SetFieldValue ("CONTACT_FIRST_NAME", SiebelContactIntComp.GetFieldValue("First Name").substring(0,39)); OracleContactIntComp.CopyFieldValue ("SEX_CODE","M/F"); OracleContactIntComp.CopyFieldValue ("EMAIL_ADDRESS", "Email Address"); OracleContactIntComp.CopyFieldValue ("MAIL_STOP", "Mail Stop"); OracleContactIntComp.SetFieldValue ("ORG_ID", ""); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("CREATION_DATE", SiebelContactIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue ("LAST_UPDATE_DATE", SiebelContactIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound (Oracle11i)
CopyContactPhoneInfo
function CopyContactPhoneInfo(SiebelAccountIntComp, SiebelAddressIntComp, SiebelContactIntComp,OracleContactIntComp, ContactInsUpdFlag, ContactTitleVM, ContactPhoneVM, AccSharedID, ConSharedID) { var PhoneFields = new Array("Cellular Phone #", "Fax Phone #", "Home Phone #", "Work Phone #", "Alternate Phone #", "Assistant Phone #"); var PhoneNumber, PhoneType; for ( var i = 0; i < PhoneFields.length; i++ ) { PhoneNumber = SiebelContactIntComp.GetFieldValue (PhoneFields[i]).substring(0,24); if (PhoneNumber != "") { // Fetch the Phone Type from Contact VM PhoneType = ContactPhoneVM.Translate(PhoneFields[i]); // Copy the Contact details first CopyContactInfo(OracleContactIntComp, SiebelAccountIntComp, SiebelContactIntComp, ContactInsUpdFlag, ContactTitleVM, AccSharedID, ConSharedID); // Copy the Phone details CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, ContactInsUpdFlag, PhoneNumber, AccSharedID, "", ConSharedID); } } }

Account Maps - Siebel Outbound (Oracle11i)
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.SetFieldValue ("CREATED_BY", "-1"); OracleCustomerComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.SetFieldValue ("CREATED_BY", "-1"); OracleCustomerComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopyCustomerInfo
function CopyCustomerInfo(OracleCustomerComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID) { OracleCustomerComp.SetCopySource (SiebelAccountIntComp); OracleCustomerComp.SetFieldValue ("operation", "upsert"); OracleCustomerComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleCustomerComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", ""); OracleCustomerComp.SetFieldValue ("SITE_USE_CODE", ""); OracleCustomerComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleCustomerComp.SetFieldValue ("CUSTOMER_NAME", SiebelAccountIntComp.GetFieldValue("Name").substring(0,49)); OracleCustomerComp.SetFieldValue ("CUSTOMER_TYPE", CusType); OracleCustomerComp.CopyFieldValue ("URL", "Home Page"); var CustomerTypeVal = SiebelAccountIntComp.GetFieldValue ("Type"); if ( CustomerTypeVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_CATEGORY_CODE", AccountCategoryVM.Translate (SiebelAccountIntComp.GetFieldValue ("Type"))); } else { EAIRaiseError(TranslateMessage("ORA_MSG_INVALID_CUST_CATEGORY, NULL")); } var CustomerStatusVal = SiebelAccountIntComp.GetFieldValue ("Account Status"); if ( CustomerStatusVal != "") { OracleCustomerComp.SetFieldValue ("CUSTOMER_STATUS", AccountStatusVM.Translate ( SiebelAccountIntComp.GetFieldValue ("Account Status"))); } else { EAIRaiseError(TranslateMessage ("ORA_MSG_INVALID_CUST_STATUS, null")); } OracleCustomerComp.SetFieldValue ("CREATED_BY", "-1"); OracleCustomerComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleCustomerComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleCustomerComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle11i Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle11i Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle11i Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle11i Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle11i Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle11i Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle11i Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag

Account Maps - Siebel Outbound (Oracle11i)
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle11i Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle11i Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle11i Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle11i Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle11i Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle11i Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle11i Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag

Account Maps - Siebel Outbound (Oracle11i)
CopyFields
function CopyFields (SiebelIntObject, OracleIntObject, OutputMsg) { // Declare variables to hold the Primary Integration Components var SiebelAccountIntComp, OracleCustomerIntComp; // Variables to hold the Oracle Contact and Oracle Profile integration Components. var OracleContactIntComp, OracleProfileIntComp; // Declare Shared ID's and misc. variables var AccSharedID, AccIntegId, InsertUpdateFlag, AddrSharedID, AddrIntegId, AddrInsUpdFlag, AddressCount, ConSharedID, ConIntegId, ContactInsUpdFlag, PhoneNumber, PhoneType, PhoneField; // Customer Type should either External("E") or Internal("I") at oracle side var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; // Open the EAI Value Map for Account here. var CountryVM = EAIGetValueMap("Oracle11i Country", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountStatusVM = EAIGetValueMap("Oracle11i Account Status", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountPhoneVM = EAIGetValueMap("Oracle11i Account Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AddressPhoneVM = EAIGetValueMap("Oracle11i Address Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactPhoneVM = EAIGetValueMap("Oracle11i Contact Phone", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var AccountCategoryVM= EAIGetValueMap("Oracle11i Account Category", "Siebel Outbound", EAIValueMap_NoEntry_RaiseError); var ContactTitleVM = EAIGetValueMap("Oracle11i Contact Title", "Siebel Outbound"); //Get the primary integration component from the Siebel Integration Object SiebelAccountIntComp = SiebelIntObject.GetPrimaryIntComp ("Account"); // If the Primary Integration Component is valid, then go ahead with the copying process // Else raise an error message. if (SiebelAccountIntComp.Exists ()) { // Create the Oracle Integration Components OracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); // Navigate through all the available records in the Siebel primary integration component while (SiebelAccountIntComp.NextRecord ()) { // Create a new record in the Oracle Primary Integration Object OracleCustomerIntComp.NewRecord (); OracleContactIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CONTACT_PHONES_INT_ALL"); OracleProfileIntComp = OracleCustomerIntComp.CreateIntComp("SIE_CUSTOMER_PROFILES_INT_ALL"); // // ACCOUNT // AccIntegId = SiebelAccountIntComp.GetFieldValue("Integration Id"); if (AccIntegId == "" || AccIntegId == null) { // New Account AccSharedID = SiebelAccountIntComp.GetFieldValue("Id"); InsertUpdateFlag = "I"; } else { // Existing Account AccSharedID = AccIntegId; InsertUpdateFlag = "U"; } OutputMsg.SetArgument("ObjectIntegrationId", AccSharedID); // set values in SIE_CUSTOMERS_INTERFACE_ALL CopyCustomerInfo(OracleCustomerIntComp, SiebelAccountIntComp, InsertUpdateFlag, CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); // set values in SIE_CUSTOMER_PROFILES_INT_ALL // Inserting a profile class for the Account in SIE_CUSTOMER_PROFILES_INT_ALL if (InsertUpdateFlag == "I") { OracleProfileIntComp.NewRecord(); CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, ""); } // Set the copy source to SiebelAccountIntComp OracleContactIntComp.SetCopySource (SiebelAccountIntComp); PhoneField = "Main Phone Number"; PhoneNumber = SiebelAccountIntComp.GetFieldValue(PhoneField).substring(0,24); if (PhoneNumber != "") { OracleContactIntComp.NewRecord(); PhoneType = AccountPhoneVM.Translate(PhoneField); // Call the function CopyPhoneInfo to copy the common fields. CopyPhoneInfo (OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag

Account Maps - Siebel Outbound (Oracle11i)
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyPhoneInfo
function CopyPhoneInfo(OracleContactIntComp, SiebelAccountIntComp, PhoneType, InsertUpdateFlag, PhoneNumber, AccSharedID, AddrSharedID, ConSharedID) { OracleContactIntComp.SetFieldValue("operation", "upsert"); OracleContactIntComp.SetFieldValue("TELEPHONE", PhoneNumber); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_CONTACT_REF", ConSharedID); OracleContactIntComp.SetFieldValue("ORIG_SYSTEM_TELEPHONE_REF", AccSharedID+":"+AddrSharedID+":"+ConSharedID+":"+PhoneType); OracleContactIntComp.SetFieldValue("TELEPHONE_TYPE", PhoneType); OracleContactIntComp.SetFieldValue("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleContactIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleContactIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleContactIntComp.SetFieldValue("CREATION_DATE", SiebelAccountIntComp.GetFieldValue ("Created")); OracleContactIntComp.SetFieldValue("LAST_UPDATE_DATE", SiebelAccountIntComp.GetFieldValue ("Updated")); }

Account Maps - Siebel Outbound (Oracle11i)
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleProfileIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleProfileIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopyProfileInfo
function CopyProfileInfo (OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, InsertUpdateFlag, AccSharedID, AddrSharedID) { OracleProfileIntComp.SetCopySource(SiebelAccountIntComp); OracleProfileIntComp.SetFieldValue ("operation", "upsert"); OracleProfileIntComp.SetFieldValue ("CUSTOMER_PROFILE_CLASS_NAME", ProfileClass); OracleProfileIntComp.SetFieldValue ("CREDIT_HOLD", CreditHold); OracleProfileIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", InsertUpdateFlag); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_CUSTOMER_REF", AccSharedID); OracleProfileIntComp.SetFieldValue ("ORIG_SYSTEM_ADDRESS_REF", AddrSharedID); OracleProfileIntComp.CopyFieldValue ("ORG_ID", "Account Organization Integration Id"); OracleProfileIntComp.SetFieldValue ("CREATED_BY", "-1"); OracleProfileIntComp.SetFieldValue ("LAST_UPDATED_BY", "-1"); OracleProfileIntComp.CopyFieldValue ("CREATION_DATE", "Created"); OracleProfileIntComp.CopyFieldValue ("LAST_UPDATE_DATE", "Updated"); }

Account Maps - Siebel Outbound (Oracle11i)
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound (Oracle11i)
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound (Oracle11i)
CopySiteUseInfo
function CopySiteUseInfo (OracleCustomerIntComp, OracleProfileIntComp, SiebelAccountIntComp, SiebelAddressIntComp, AccountStatusVM, CountryVM, AccountCategoryVM, InsertUpdateFlag, OracleIntObject, AccSharedID, AddrSharedID) { var AddrSharedID; var SiteUseList = new Array(); var PrimarySiteUseList = new Array(); var SiteUseCount = 0; var NewOracleCustomerIntComp; // Get the Address & Address Integration Id var AddrId = SiebelAddressIntComp.GetFieldValue ("Id"); var AddrIntId = SiebelAddressIntComp.GetFieldValue ("Integration Id"); var BillToSiteUse = null, ShipToSiteUse = null, GeneralSiteUse = null; var CusType = "R"; var ProfileClass = "DEFAULT"; var CreditHold = "N"; if (AddrIntId == "" || AddrIntId == null) { // New Address AddrSharedID = AddrId; } else { // Existing Address so nothing to do // (We don't support changing site uses) return; } if (SiebelAddressIntComp.GetFieldValue ("Bill Address Flag") == "Y") { SiteUseList[SiteUseCount] = "BILL_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Bill To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Ship Address Flag") == "Y") { SiteUseList[SiteUseCount] = "SHIP_TO"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Ship To Address Id")) ? "Y" : "N" } if (SiebelAddressIntComp.GetFieldValue ("Main Address Flag") == "Y") { SiteUseList[SiteUseCount] = "GENERAL"; PrimarySiteUseList[SiteUseCount++] = (AddrId == SiebelAccountIntComp.GetFieldValue ("Primary Address Id")) ? "Y" : "N" } for ( var i = 0; i < SiteUseList.length; i++ ) { if (SiteUseList[i] == "BILL_TO") { // Create new profile for BILL_TO OracleProfileIntComp.NewRecord(); // Copy the Address Id from the Address Integration Component CopyProfileInfo ( OracleProfileIntComp, SiebelAccountIntComp, ProfileClass, CreditHold, "I", AccSharedID, AddrSharedID); } if (i > 0) { // Need new customer interface record OracleIntObject.NewInstance (); NewOracleCustomerIntComp = OracleIntObject.CreatePrimaryIntComp("SIE_CUSTOMERS_INTERFACE_ALL"); NewOracleCustomerIntComp.NewRecord (); CopyCustomerInfo(NewOracleCustomerIntComp, SiebelAccountIntComp, "I", CusType, AccountCategoryVM, AccountStatusVM, AccSharedID); CopyAddressInfo (NewOracleCustomerIntComp, SiebelAddressIntComp, CountryVM, AddrSharedID); NewOracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); NewOracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } else { // Use existing customer interface record OracleCustomerIntComp.SetFieldValue ("SITE_USE_CODE", SiteUseList[i]); OracleCustomerIntComp.SetFieldValue ("INSERT_UPDATE_FLAG", "I"); OracleCustomerIntComp.SetFieldValue ("PRIMARY_SITE_USE_FLAG", PrimarySiteUseList[i]); } } }

Account Maps - Siebel Outbound (Oracle11i)
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound (Oracle11i)
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound (Oracle11i)
CreateSiebelCustomer
// Map Siebel Account to Oracle Customer // Returns argument "ObjectIntegrationId" function CreateSiebelCustomer(InputMsg, OutputMsg) { var SiebelIntObject, OracleIntObject; OutputMsg.SetArgument("ObjectIntegrationId", ""); SiebelIntObject = InputMsg.GetIntObj("Account - Put Oracle11i Customer (Siebel)"); // Check the validity of the Siebel Integration Object. if (SiebelIntObject.Exists ()) { // Go ahead and create a new Oracle Integration Object on the Output Message. OracleIntObject = OutputMsg.CreateIntObj("Account - Put Oracle11i Customer (Oracle)"); // Navigate through all the available instances in the Integration Object while (SiebelIntObject.NextInstance ()) { // Create a new instance in the Oracle Integration Object OracleIntObject.NewInstance (); // CopyFields is again a user defined function which is written to copy all // the fields from the source to the target. CopyFields (SiebelIntObject, OracleIntObject, OutputMsg); } ///~ while(SiebelIntObject.NextInstance()) } ///~ if(SiebelIntObject.Exists()) else { // Raise an exception saying that the Siebel Integration Object was not found in // the Input message. Actually we don't have to do this because, the workflow // system itself will inform the user with an Error message. EAIRaiseError (TranslateMessage ("ORA_MSG_EMPTY,Account - Put Oracle11i Customer (Siebel)")); } ///~ else } ///~ End of CreateSiebelAccount function.

Account Maps - Siebel Outbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound (Oracle11i)
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

Account Maps - Siebel Outbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound (Oracle11i)
Timestamp
/** ** User-defined function that returns System Date/Time ** in the format understandable by Siebel adapter **/ function Timestamp() { var d = Date.fromSystem(Clib.time()); // Return date in the format MM/DD/YYYY HH:MM:SS return Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", d.getMonth()+1, d.getDate(), d.getFullYear(), d.getHours(), d.getMinutes(), d.getSeconds()); }

Account Maps - Siebel Outbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Maps - Siebel Outbound (Oracle11i)
TranslateMessage
function TranslateMessage(Message) { // Function to perform message language translation and parameterization. // // Created in November 2000 // // Message is a string of comma separate tokens and parameters. // Tokens begin with <prefix>. // The tokens represent language independent LOV codes of type // <LOVType> which in turn map to translated // parameterized message texts. If the input message does not start with // ORA_MSG the message is returned untranslated. A message can have // up to nine parameters, %1,%2,...,%9. An example from the Oracle Connector: // // Message: // ORA_MSG_MISSING_CONTACT,A. K. Parker,ORA_MSG_INVALID_STATUS,Re-opened,A. K. Parker // Parameterized text: // ORA_MSG_MISSING_CONTACT="Contact for account %1 is missing." // ORA_MSG_INVALID_STATUS="%1 is an invalid status for %2." // Result: // "Contact for account A. K. Parker is missing. Re-opened is an invalid status for A. K. Parker." // // Warning!!! The comma is the delimiter so commas in the parameters will // cause undesirable results and so steps should be taken to avoid them. // // Note: LOV Display values are limited to 30 characters and so in some cases // you may need to combine two tokens to get the behavior you require. var prefix = "ORA_MSG"; var LOVType = "ORACLE_CONNECTOR_MESSAGE"; if (Message.substring(0,7) != prefix) // Don't translate return (Message); var pieces = Message.split(','); var tokeni=0; var i=1; var oMessage=""; while (tokeni < pieces.length) { i=tokeni + 1; // Lookup error token in LOV table to get translated error text var LOVText = TheApplication().InvokeMethod ( "LookupValue", LOVType, pieces[tokeni]); if (LOVText == "") { // No token in LOV table so append untranslated token and parameters oMessage=oMessage+pieces[tokeni]+" "; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; oMessage=oMessage+pieces[i]+" "; i++; } } else { // Read parameters var params = new Array("","","","","","","","",""); var paramsi = 0; while(i < pieces.length) { if (pieces[i].substring(0,7) == prefix) break; params[paramsi]=pieces[i]; paramsi++; i++; } // Insert parameters into message and append to output // Split LOVText to find parameter place holders %1,%2,... var msgpieces=LOVText.split("%"); var mpi; oMessage = oMessage + msgpieces[0]; for (mpi = 1; mpi < msgpieces.length; mpi++) { paramsi = msgpieces[mpi].substring(0,1); if ((Clib.isdigit(paramsi)) && (paramsi > 0)) // Parameter place holder so append parameter and rest of message piece oMessage = oMessage + params[paramsi-1] + msgpieces[mpi].substring(1); else // Not a parameter place holder so just append % and piece oMessage = oMessage + "%" + msgpieces[mpi]; } oMessage = oMessage + " "; } // Set token to next piece tokeni=i; } return (oMessage); }

Account Utilities BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Account Utilities BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Account Utilities BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 07.07.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen NESA 2 ** Description: CBM Script clean-up ******************************************************/ var intRetVal = CancelOperation; try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if(bIsTraceOn)oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName: " + MethodName); switch (MethodName) { case "LookupMessage": fLookupMessage(Inputs, Outputs); break; case "strBirthDate": strBirthDate(Inputs, Outputs); break; case "strBirthDateCM": strBirthDateCM(Inputs, Outputs); break; case "strBirthDateProspect": strBirthDateProspect(Inputs, Outputs); break; case "strCustomerInteraction": strCustomerInteraction(Inputs, Outputs); break; case "strCustomerInteractionFlag": strCustomerInteractionFlag(Inputs, Outputs); break; case "strCustomerInteractionActual": strCustomerInteractionActual(Inputs, Outputs); break; case "strLastSRContact": strLastSRContact(Inputs, Outputs); break; default: break; } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); throw(e); } finally{ oApp = null; bIsTraceOn = null; } return(intRetVal); }

Account Utilities BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 07.07.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen NESA 2 ** Description: CBM Script clean-up ******************************************************/ var intRetVal = CancelOperation; try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if(bIsTraceOn)oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName: " + MethodName); switch (MethodName) { case "LookupMessage": fLookupMessage(Inputs, Outputs); break; case "strBirthDate": strBirthDate(Inputs, Outputs); break; case "strBirthDateCM": strBirthDateCM(Inputs, Outputs); break; case "strBirthDateProspect": strBirthDateProspect(Inputs, Outputs); break; //TAANIAL2 20161228 WP-1240 These 3 Interaction Data collection methods are now call internally from "strCustomerInteractionData" method /*case "strCustomerInteraction": strCustomerInteraction(Inputs, Outputs); break; case "strCustomerInteractionFlag": strCustomerInteractionFlag(Inputs, Outputs); break; case "strCustomerInteractionActual": strCustomerInteractionActual(Inputs, Outputs); break;*/ case "strLastSRContact": strLastSRContact(Inputs, Outputs); break; case "strCustomerInteractionData"://TAANIAL2 20161219 WP-1240 New Wrapper Method to collect Interaction Data strCustomerInteractionData(Inputs, Outputs); break; default: break; } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); throw(e); } finally{ oApp = null; bIsTraceOn = null; } return(intRetVal); }

Account Utilities BS SCM
fLookupMessage
function fLookupMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 07.07.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen NESA 2 ** Description: CBM Script clean-up ******************************************************/ var key:chars = ""; var category:chars = ""; var arg1:chars = ""; var translMsg:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Start"); if(Inputs.PropertyExists("Key")){ key = Inputs.GetProperty("Key"); Inputs.RemoveProperty("Key"); } else{ oApp.RaiseErrorText("Required Input Argument Key is null"); } if (Inputs.PropertyExists("Category")){ category = Inputs.GetProperty("Category"); Inputs.RemoveProperty("Category"); } else{ oApp.RaiseErrorText("Required Input Argument Category is null"); } if (Inputs.PropertyExists("Debug")){ Inputs.RemoveProperty("Debug"); } arg1 = Inputs.GetProperty("Arg1"); if ((arg1!= "") && (arg1!=null)){ translMsg = oApp.LookupMessage(category, key, arg1); } else{ oApp.RaiseErrorText("Input Argument Arg1 is null"); } oApp.RaiseErrorText("Error: " + translMsg); } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Error: " + e.message); throw(e); } finally{ } }

Account Utilities BS SCM
fLookupMessage
function fLookupMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: Service_PreInvokeMethod ** Created: 07.07.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen NESA 2 ** Description: CBM Script clean-up ******************************************************/ var key:chars = ""; var category:chars = ""; var arg1:chars = ""; var translMsg:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Start"); if(Inputs.PropertyExists("Key")){ key = Inputs.GetProperty("Key"); Inputs.RemoveProperty("Key"); } else{ oApp.RaiseErrorText("Required Input Argument Key is null"); } if (Inputs.PropertyExists("Category")){ category = Inputs.GetProperty("Category"); Inputs.RemoveProperty("Category"); } else{ oApp.RaiseErrorText("Required Input Argument Category is null"); } if (Inputs.PropertyExists("Debug")){ Inputs.RemoveProperty("Debug"); } arg1 = Inputs.GetProperty("Arg1"); if ((arg1!= "") && (arg1!=null)){ translMsg = oApp.LookupMessage(category, key, arg1); } else{ oApp.RaiseErrorText("Input Argument Arg1 is null"); } oApp.RaiseErrorText("Error: " + translMsg); } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Error: " + e.message); throw(e); } finally{ } }

Account Utilities BS SCM
strBirthDate
function strBirthDate(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the current customer context to return a string // including formatted date, age & birthday flag // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO: BusObject; var oBC: BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Account"); if(oBC.GetFieldValue("Account Contact Birth Date SCM") != ""){ with(oBC) { dBirthday = new Date(GetFieldValue("Account Contact Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else { strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if (dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDate strReturn: " + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDate Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strBirthDate
function strBirthDate(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the current customer context to return a string // including formatted date, age & birthday flag // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO: BusObject; var oBC: BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".fLookupMessage Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Account"); if(oBC.GetFieldValue("Account Contact Birth Date SCM") != ""){ with(oBC) { dBirthday = new Date(GetFieldValue("Account Contact Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else { strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if (dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDate strReturn: " + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDate Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strBirthDateCM
function strBirthDateCM(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the current customer (campaign member) // context to return a string including formatted date, age & birthday flag // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss // Modified: Christoph Reitermann 20.03.2014 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Dialog UI SCM"); if (oBC.GetFieldValue("Contact Birth Date SCM") != ""){ with (oBC){ dBirthday = new Date(GetFieldValue("Contact Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else{ strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if (dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM strReturn: " + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strBirthDateCM
function strBirthDateCM(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the current customer (campaign member) // context to return a string including formatted date, age & birthday flag // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss // Modified: Christoph Reitermann 20.03.2014 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Dialog UI SCM"); if (oBC.GetFieldValue("Contact Birth Date SCM") != ""){ with (oBC){ dBirthday = new Date(GetFieldValue("Contact Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else{ strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if (dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM strReturn: " + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateCM Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strBirthDateProspect
function strBirthDateProspect(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the Prospect in Dialog context // to return a string including formatted date, age & birthday flag. // Copied from strBirthDate and adapted for Prospect // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // The strings are to be splitted later using calculated fields for // performance resons // Date: April, 15th 2014 // Author: Lucas Requiao //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Dialog UI SCM"); if (oBC.GetFieldValue("Prospect Birth Date SCM") != ""){ with (oBC) { dBirthday = new Date(GetFieldValue("Prospect Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else{ strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if(dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect strReturn:" + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strBirthDateProspect
function strBirthDateProspect(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks Birthdate of the Prospect in Dialog context // to return a string including formatted date, age & birthday flag. // Copied from strBirthDate and adapted for Prospect // Input: psInputs PropertySet: // -> none // Output: Outputs PropertySet: // -> Value: <1>04.12.1979 Age 34<2>Y<3> // The strings are to be splitted later using calculated fields for // performance resons // Date: April, 15th 2014 // Author: Lucas Requiao //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var dBirthday:Date; var dToday:Date; var strHappyBD:chars = ""; var strReturn:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var strAge:chars = ""; var strAgeLabel:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect Start"); oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Dialog UI SCM"); if (oBC.GetFieldValue("Prospect Birth Date SCM") != ""){ with (oBC) { dBirthday = new Date(GetFieldValue("Prospect Birth Date SCM")); dToday = new Date(); strReturn = ""; // do you have birthday today? if (dBirthday.getMonth() == dToday.getMonth() && dBirthday.getDate() == dToday.getDate()) { strHappyBD = "Y"; } else{ strHappyBD = "N"; } // how old are you? if (dBirthday.getMonth() * 100 + dBirthday.getDate() <= dToday.getMonth() * 100 + dToday.getDate()) { strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear()); } else{ strAge = "" + (dToday.getFullYear() - dBirthday.getFullYear() - 1); } // 2-digit day needed if (dBirthday.getDate()<10) { strDD = "0" + dBirthday.getDate(); } else { strDD = "" + dBirthday.getDate(); } // 2-digit month needed if(dBirthday.getMonth()+1<10) { strMM = "0" + (dBirthday.getMonth()+1); } else { strMM = "" + (dBirthday.getMonth()+1); } // store year string strYYYY = "" + dBirthday.getFullYear(); // concatenate result strReturn += "<1>"; strAgeLabel = oApp.LookupMessage("User Defined Errors","Translation: Age"); // possible to change date format here switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; case "ITA": strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; default: strReturn += strDD + "." + strMM + "." + strYYYY + ", " + strAgeLabel + " " + strAge; break; } strReturn += "<2>"; strReturn += strHappyBD; strReturn += "<3>"; if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect strReturn:" + strReturn); Outputs.SetProperty("Value", strReturn); } } } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".strBirthDateProspect Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; dBirthday = null; dToday = null; } }

Account Utilities BS SCM
strCustomerInteraction
function strCustomerInteraction(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks customer interactions in RICO DB using a given EBC. // Returns string including Sender information, timestamp & // a flag indicating there have been interaction in a defined // timeframe // Input: psInputs PropertySet: -> Nr.: 48198119 // Output: Outputs PropertySet: -> Value: <1>Teddybär, 28.11.2013<2>Y<3>// // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss // Change Log // 2014-01-21 TGDGEMAM fixed defect #78978 - no interaction icon displayed - unhandled exception // 2015-06-09 TGDGEMAM fixed defect #110715 - nothing shown for source "NEV" // 2015-10-14 TAADAPE2 fixed defect #114755 - performance issue. Add a black list and just execute RICO query in case the customer type is Person //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var oSvc:Service; var psIn:PropertySet; var psOut:PropertySet; var dDate:Date; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; var strInter:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var sCustomerType:chars = ""; var sExcludedCustomers:chars = ""; var splittedCustomers; var iFound:Number = 0; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction Start"); // BC: Account.[Account Nr.] strAccnt = Inputs.GetProperty("Nr"); // TAADAPE2 14.10.2015 - Defect #114755 // read admin code value for "RICO Last KuCe Login Excluded Customers" psIn = oApp.NewPropertySet(); psIn.SetProperty("Code", "RICO Last KuCe Login Excluded Customers") psOut = oApp.NewPropertySet(); oSvc = oApp.GetService("Admin Code Value SCM"); oSvc.InvokeMethod("Retrieve", psIn, psOut); sExcludedCustomers = psOut.GetProperty("Value"); splittedCustomers = sExcludedCustomers.split(","); for(var i=0; i<splittedCustomers.length && iFound == 0; i++) { if (splittedCustomers[i] == strAccnt) { iFound = 1; } } if (iFound == 0) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction Executing Query in RICO DB"); oBO = oApp.GetBusObject("Customer Interaction History SCM"); oBC = oBO.GetBusComp("Customer Interaction History SCM"); with (oBC) { strSearch = "[Contact Object Number SCM]='" + strAccnt + "' AND " + "([Interaction External Reference App Id SCM]='SAM' OR [Interaction External Reference App Id SCM]='NEV') AND " + "[Media Type SCM]='Selfcare' AND " + "[Context Type SCM]='CustomerLogin'"; // TGDGEMAM 20140226: changed due to defect # 80887 SetViewMode(AllView); ActivateField("Contact Object Number SCM"); // CONTACT_OBJECT_ID ("1111") ActivateField("Interaction External Reference App Id SCM"); // EXT_REF_APPID ("SAM") ActivateField("Media Type SCM"); // MEDIA_TYPE ("Selfcare") ActivateField("Context Type SCM"); // CONTEXT_TYPE ("CustomerLogin") ActivateField("Date Time SCM"); ActivateField("Sender Info SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { dDate = new Date(GetFieldValue("Date Time SCM")); strDD = "" + dDate.getDate(); strMM = "" + (dDate.getMonth() +1); strYYYY = "" + dDate.getFullYear(); strInter = GetFieldValue("Sender Info SCM"); } } // concatenate result if (strInter != "" && strInter != null){ strReturn += strInter + ", "; // possible to change date format here if(oBC.GetFieldValue("Date Time SCM") != ""){ switch (oApp.InvokeMethod("Language")) { case "DEU": strReturn += strDD + "." + strMM + "." + strYYYY; break; case "FRA": strReturn += strDD + "." + strMM + "." + strYYYY; break; case "ITA":

Account Utilities BS SCM
strCustomerInteraction
function strCustomerInteraction(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks customer interactions in RICO DB using a given EBC. // Returns string including Sender information, timestamp & // a flag indicating there have been interaction in a defined // timeframe // Input: psInputs PropertySet: -> Nr.: 48198119 // Output: Outputs PropertySet: -> Value: <1>Teddybär, 28.11.2013<2>Y<3>// // The strings are to be splitted later using calculated fields for // performance resons // Date: December, 4th 2013 // Author: Mario Geiss // Change Log // 2014-01-21 TGDGEMAM fixed defect #78978 - no interaction icon displayed - unhandled exception // 2015-06-09 TGDGEMAM fixed defect #110715 - nothing shown for source "NEV" // 2015-10-14 TAADAPE2 fixed defect #114755 - performance issue. Add a black list and just execute RICO query in case the customer type is Person // 2016-11-16 TAANIAL2 Rel Mar'17 WP-1240: Replaced the query on RICO EBCs with the INES VBCs //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var oSvc:Service; var psIn:PropertySet; var psOut:PropertySet; var dDate:Date; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; var strInter:chars = ""; var strDD:chars = ""; var strMM:chars = ""; var strYYYY:chars = ""; var sCustomerType:chars = ""; var sExcludedCustomers:chars = ""; var splittedCustomers; var iFound:Number = 0; var strLang:chars = "";//TAANIAL2; 20161116; WP-1240 try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction Start"); // BC: Account.[Account Nr.] strAccnt = Inputs.GetProperty("Nr"); strLang = oApp.InvokeMethod("Language");//TAANIAL2; 20161116; WP-1240 // TAADAPE2 14.10.2015 - Defect #114755 // read admin code value for "RICO Last KuCe Login Excluded Customers" psIn = oApp.NewPropertySet(); psIn.SetProperty("Code", "RICO Last KuCe Login Excluded Customers") psOut = oApp.NewPropertySet(); oSvc = oApp.GetService("Admin Code Value SCM"); oSvc.InvokeMethod("Retrieve", psIn, psOut); sExcludedCustomers = psOut.GetProperty("Value"); splittedCustomers = sExcludedCustomers.split(","); for(var i=0; i<splittedCustomers.length && iFound == 0; i++) { if (splittedCustomers[i] == strAccnt) { iFound = 1; } } if (iFound == 0) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction Executing Query in RICO DB"); oBO = oApp.GetBusObject("Customer Interaction History SCM"); //oBC = oBO.GetBusComp("Customer Interaction History SCM"); oBC = oBO.GetBusComp("EAI Extract Channel Contact Data VBC SCM");//TAANIAL2; 20161116; WP-1240 with (oBC) { //TAANIAL2; 20161116; WP-1240; No more needed due to new INES VBCs /*strSearch = "[Contact Object Number SCM]='" + strAccnt + "' AND " + "([Interaction External Reference App Id SCM]='SAM' OR [Interaction External Reference App Id SCM]='NEV') AND " + "[Media Type SCM]='Selfcare' AND " + "[Context Type SCM]='CustomerLogin'"; // TGDGEMAM 20140226: changed due to defect # 80887*/ strSearch = "[SC UseCase] = 'KuCeBI' AND " + "[SC Customer Id]='" + strAccnt + "' AND " + "[SC Language]='" + strLang + "' AND " + "[SC Application]='SAM' AND " + "[SC Media Type]='Selfcare' AND " + "[SC Context Type]='CustomerLogin' AND " + "[SC Party Id]='account' AND " + "[SC Limit]='1'"; //TAANIAL2; 20161116; WP-1240 SetViewMode(AllView); ActivateField("Creation DateTime"); //ActivateField("Agent"); SenderInfo.Other xml tag will contain Agent info ActivateField("Sender Info"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()){ dDate = new Date(GetFieldValue("Creation DateTime")); strDD = "" + dDate.getDate(); strMM = "" + (dDate.getMonth() +1); strYYYY = "" + dDate.

Account Utilities BS SCM
strCustomerInteractionActual
function strCustomerInteractionActual(Inputs, Outputs){ /************************************************************************************************************** ** BS: Account Utilities BS SCM ** Function: strCustomerInteractionActual ** Created: 09.12.2014 ** Created By: Christoph Reitermann, TGDRECHA ** Description: Looks for customer interactions in RICO DB using a given actual Interaction Id ** which is available in the session as Profile Attribute "sSysFpInteractionId". ** Inputs: - ** Outputs: Outputs PropertySet: Gives the values out of three fields as a concatenated value. ** Change Log ** Date By Description ** 26.03.15 Chr.Reitermann Due to WP-669 Footprint 2.0 the Interaction Id provided in the attached call data ** will not be customer interaction id, but the process interaction id. ** Changed logic to point to new BC. ** 23.05.15 Pedro Ferreira Added changes to avoid full table scan queries and the string to be returned ** by this function according to defect 109551 ** 18.11.16 Ali Akbar Nidham Rel Mar'17 WP-1240: Replaced the query on RICO EBCs with the INES VBCs **************************************************************************************************************/ //Declarations var oBO:BusObject; var oBC:BusComp; var psOut:PropertySet = null; var sReturn:chars = ""; var sSearch:chars = ""; var sAccnt:chars = ""; var sInteractionId:chars = ""; var sInteractionDomain:chars = ""; var sInteractionType:chars = ""; var sProcessOutcome:chars = ""; var sInteractionDetail:chars = ""; var sAdditionalInfo:chars = ""; var sLang:chars = ""; //TAANIAL2; 20161118; WP-1240 try { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionActual Start"); // BC: Account.[Account Nr.] sAccnt = Inputs.GetProperty("Nr"); sInteractionId = oApp.GetProfileAttr("sSysFpInteractionId"); // get actual Interaction Id sLang = oApp.InvokeMethod("Language");//TAANIAL2; 20161118; WP-1240 // if condition to avoid full table scan queries on a primary key for a null value if (sInteractionId != null && sInteractionId != ""){ oBO = oApp.GetBusObject("Customer Interaction History SCM"); //WP-669: oBC = oBO.GetBusComp("Customer Interaction History SCM"); //oBC = oBO.GetBusComp("Process Interaction SCM"); oBC = oBO.GetBusComp("EAI Extract Business Process Data VBC SCM"); //TAANIAL2; 20161118; WP-1240 with (oBC) { //WP-669: sSearch = "[Contact Object Number SCM]='" + sAccnt + "' AND [Interaction Id SCM]='" + sInteractionId + "'"; // TAADAPE2 18.05.2016 Due to defect #8825 the condition should be changed to use the Overall Process Id instead of // the Sequence Number in the Process Interaction table //sSearch = "[PI Parent Object Id SCM]='" + sAccnt + "' AND [PI Id SCM]='" + sInteractionId + "'"; //sSearch = "[PI Parent Object Id SCM]='" + sAccnt + "' AND [Overall Process Id SCM]='" + sInteractionId + "'"; //TAANIAL2; 20161118; WP-1240; New Search Spec with the new VBC and fields //TAANIAL2 20170201 Defect 1990 Removed Customer ID (SCN) from the Search Spec as we are already passing CTI Interaction Id sSearch = "[SC UseCase] = 'LastCTIPI' AND " + "[SC Interaction ID] = '" + sInteractionId + "' AND " + "[SC Language]='" + sLang + "' AND " + "[SC Party Id]='system' AND " + "[SC Limit]='1'"; SetViewMode(AllView); ActivateField("Outcome"); ActivateField("Context Type"); ClearToQuery(); SetSearchExpr(sSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { sInteractionType = oBC.GetFieldValue("Context Type"); sProcessOutcome = oBC.GetFieldValue("Outcome"); } } //TAANIAL2; 20161118; WP-1240; This field is not required for INES Response // Fix for defect 109551 /*if (sInteractionDomain != "") { sReturn += sInteractionDomain + "<1>"; }*/ if (sInteractionType != "") { sReturn += sInteractionType + "; "; //TAACOCA1 23.07.2015 Changed comm

Account Utilities BS SCM
strCustomerInteractionActual
function strCustomerInteractionActual(Inputs, Outputs){ /************************************************************************************************************** ** BS: Account Utilities BS SCM ** Function: strCustomerInteractionActual ** Created: 09.12.2014 ** Created By: Christoph Reitermann, TGDRECHA ** Description: Looks for customer interactions in RICO DB using a given actual Interaction Id ** which is available in the session as Profile Attribute "sSysFpInteractionId". ** Inputs: - ** Outputs: Outputs PropertySet: Gives the values out of three fields as a concatenated value. ** Change Log ** Date By Description ** 26.03.15 Chr.Reitermann Due to WP-669 Footprint 2.0 the Interaction Id provided in the attached call data ** will not be customer interaction id, but the process interaction id. ** Changed logic to point to new BC. ** 23.05.15 Pedro Ferreira Added changes to avoid full table scan queries and the string to be returned ** by this function according to defect 109551 **************************************************************************************************************/ //Declarations var oBO:BusObject; var oBC:BusComp; var psOut:PropertySet = null; var sReturn:chars = ""; var sSearch:chars = ""; var sAccnt:chars = ""; var sInteractionId:chars = ""; var sInteractionDomain:chars = ""; var sInteractionType:chars = ""; var sProcessOutcome:chars = ""; var sInteractionDetail:chars = ""; var sAdditionalInfo:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionActual Start"); // BC: Account.[Account Nr.] sAccnt = Inputs.GetProperty("Nr"); sInteractionId = oApp.GetProfileAttr("sSysFpInteractionId"); // get actual Interaction Id // if condition to avoid full table scan queries on a primary key for a null value if (sInteractionId != null && sInteractionId != ""){ oBO = oApp.GetBusObject("Customer Interaction History SCM"); //WP-669: oBC = oBO.GetBusComp("Customer Interaction History SCM"); oBC = oBO.GetBusComp("Process Interaction SCM"); with (oBC) { //WP-669: sSearch = "[Contact Object Number SCM]='" + sAccnt + "' AND [Interaction Id SCM]='" + sInteractionId + "'"; // TAADAPE2 18.05.2016 Due to defect #8825 the condition should be changed to use the Overall Process Id instead of // the Sequence Number in the Process Interaction table //sSearch = "[PI Parent Object Id SCM]='" + sAccnt + "' AND [PI Id SCM]='" + sInteractionId + "'"; sSearch = "[PI Parent Object Id SCM]='" + sAccnt + "' AND [Overall Process Id SCM]='" + sInteractionId + "'"; SetViewMode(AllView); ActivateField("PI Interaction Domain GUI SCM"); ActivateField("PI Interaction Type GUI SCM"); ActivateField("PI Process Outcome GUI SCM"); ActivateField("PI Interaction Detail GUI SCM"); ActivateField("PI Additional Process Interaction Information SCM"); ClearToQuery(); SetSearchExpr(sSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { sInteractionDomain = oBC.GetFieldValue("PI Interaction Domain GUI SCM"); sInteractionType = oBC.GetFieldValue("PI Interaction Type GUI SCM"); sProcessOutcome = oBC.GetFieldValue("PI Process Outcome GUI SCM"); sInteractionDetail = oBC.GetFieldValue("PI Interaction Detail GUI SCM"); sAdditionalInfo = oBC.GetFieldValue("PI Additional Process Interaction Information SCM"); } } // Fix for defect 109551 if (sInteractionDomain != "") { sReturn += sInteractionDomain + "<1>"; } if (sInteractionType != "") { sReturn += sInteractionType + "; "; //TAACOCA1 23.07.2015 Changed comma by semi-colon as per SO 2644 } /* TGDGEMAM 2016-03-15 (May16) WP 1052 => Stay Connected - Assurance Stories if (sInteractionDetail != "") { //TAACOCA1 08.07.2015 Switched order with Outcome for Sammel SO 2644 #9 sReturn += sInteractionDetail + "; "; } */ if (sProcessOutcome != "") {

Account Utilities BS SCM
strCustomerInteractionData
/************************************************************************************************** * Function: strCustomerInteractionData * * Author : Ali Akbar Nidham (TAANIAL2) * * Purpose : Rel Mar'17: WP-1240 INES, Phase 3 : New Wrapper Method to collect the Interaction Data* * (Last Interaction Indicator, Last KuCe Login & Interaction Details) * * Date : 2016-12-19 * *-------------------------------------------------------------------------------------------------* * Update : YYYY-MM-DD - LOGIN - A short description about the changes. * **************************************************************************************************/ function strCustomerInteractionData(Inputs, Outputs) { var psIn:PropertySet; var psOut:PropertySet; var sAccNum:chars = ""; var sUseCase:chars = ""; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData Start"); sAccNum = Inputs.GetProperty("Nr"); sUseCase = Inputs.GetProperty("UseCase"); if(sAccNum != "" && sAccNum != null) { psIn = oApp.NewPropertySet(); psIn.SetProperty("Nr", sAccNum) psOut = oApp.NewPropertySet(); switch(sUseCase) { case "Person": //Get Last Interaction Indicator if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Last Interaction Indicator"); strCustomerInteractionFlag(psIn, psOut); Outputs.SetProperty("IntFlag", psOut.GetProperty("Value")); //Get Last KuCe Login if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Last KuCeLogin"); strCustomerInteraction(psIn, psOut); Outputs.SetProperty("KuceLogin", psOut.GetProperty("Value")); //Get Latest Interaction Detail if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Latest Interaction Detail"); strCustomerInteractionActual(psIn, psOut); Outputs.SetProperty("IntDetail", psOut.GetProperty("Value")); break; case "SA": //Get Last Interaction Indicator if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Last Interaction Indicator"); strCustomerInteractionFlag(psIn, psOut); Outputs.SetProperty("IntFlag", psOut.GetProperty("Value")); //Get Latest Interaction Detail if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Latest Interaction Detail"); strCustomerInteractionActual(psIn, psOut); Outputs.SetProperty("IntDetail", psOut.GetProperty("Value")); break; case "CMA": //Get Last Interaction Indicator if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetching Last Interaction Indicator"); strCustomerInteractionFlag(psIn, psOut); Outputs.SetProperty("IntFlag", psOut.GetProperty("Value")); default: break; } if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData fetched all Data"); } } catch(e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionData Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { psIn = null; psOut = null; } }

Account Utilities BS SCM
strCustomerInteractionFlag
function strCustomerInteractionFlag(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks customer interactions in RICO DB using a given EBC. // Returns flag indicating there have been interaction in a defined // timeframe // Input: psInputs PropertySet: -> Nr.: 48198119 // Output: Outputs PropertySet: -> Value: <1>Teddybär, 28.11.2013<2>Y<3>// // Date: October, 16th 2015 // Author: Pedro Ferreira // Change Log // 2015-10-16 TAADAPE2 fixed defect #114755 - performance issue. The Last KuCe Login and the Customer Interaction Flag had to be separated. // 2016-11-17 TAANIAL2 Rel Mar'17 WP-1240: Replaced the query on RICO EBCs by calling the new EAI Wrapper WF for Last Interaction Indicator //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ //var oBO:BusObject; //var oBC:BusComp; var oSvc:Service; var oWFBS:Service; //TAANIAL2; 20161123; WP-1240 var oDtBS:Service; //TAANIAL2; 20161214; WP-1240 var psIn:PropertySet; var psOut:PropertySet; var iTimeFrame: Number; var iCtimeFrame:Number; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; var strInterFlg:chars = "N"; var psWFIn:PropertySet; //TAANIAL2; 20161123; WP-1240 var psWFOut:PropertySet; //TAANIAL2; 20161123; WP-1240 var CurrentDate:Date; //TAANIAL2; 20161213; WP-1240 var FromDate:Date; //TAANIAL2; 20161214; WP-1240 var sFromDate:chars; //TAANIAL2; 20161214; WP-1240 var DpsIn:PropertySet; //TAANIAL2; 20161214; WP-1240 var DpsOut:PropertySet; //TAANIAL2; 20161214; WP-1240 try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionFlag Start"); // BC: Account.[Account Nr.] strAccnt = Inputs.GetProperty("Nr"); // read admin code value for "RICO Recent Interactions Timeframe" psIn = oApp.NewPropertySet(); psIn.SetProperty("Code", "RICO Recent Interactions Timeframe") psOut = oApp.NewPropertySet(); oSvc = oApp.GetService("Admin Code Value SCM"); oSvc.InvokeMethod("Retrieve", psIn, psOut); if (psOut.GetProperty("Value") != "") { iTimeFrame = 1 * psOut.GetProperty("Value"); } else{ iTimeFrame = 7; } //TAANIAL2; 20161214; WP-1240; Calculate From Date to get last interaction oDtBS = oApp.GetService("EAI Interface Utilities AIP SCM"); iCtimeFrame = -iTimeFrame;//Needs to be a negative integer for date calculation CurrentDate = new Date(); DpsIn = oApp.NewPropertySet(); DpsIn.SetProperty("DateIn", CurrentDate); DpsIn.SetProperty("Amount", iCtimeFrame); DpsIn.SetProperty("UoM", "Days"); DpsOut = oApp.NewPropertySet(); oDtBS.InvokeMethod("DateCalc", DpsIn, DpsOut); FromDate = new Date(DpsOut.GetProperty("DateOut")); sFromDate = Clib.rsprintf("%02d/%02d/%04d",FromDate.getMonth()+1, FromDate.getDate(), FromDate.getFullYear()); //TAANIAL2; 20161123; WP-1240; EBC Queries replaced by call to EAI WF /*oBO = oApp.GetBusObject("Customer Interaction History SCM"); oBC = oBO.GetBusComp("EAI Extract Channel Contact Data VBC SCM"); with (oBC) { strSearch = "[Contact Object Number SCM]='" + strAccnt + "' AND [Date Time SCM] >= Today() - " + iTimeFrame; SetViewMode(AllView); ActivateField("Contact Object Number SCM"); // CONTACT_OBJECT_ID ("1111") ActivateField("Date Time SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strInterFlg = "Y"; } }*/ //TAANIAL2; 20161123; WP-1240; Getting the Last Interactions from EAI WF //strSearch = "[SC Customer Id]='" + strAccnt + "' AND [SC From Date] = Today() - " + iTimeFrame + " AND [SC Limit] = '1'" ; psWFIn = oApp.NewPropertySet(); psWFIn.SetProperty("ProcessName", "EAI Extract Business Interaction Data Indicator SCM"); psWFIn.SetProperty("SC Customer Id", strAccnt); psWFIn.SetProperty("SC From Date", sFromDate); psWFIn.SetProperty("SC Limit", "1"); psWFIn.SetProperty("SC UseCase", "LastInteractionIndicator"); psWF

Account Utilities BS SCM
strCustomerInteractionFlag
function strCustomerInteractionFlag(Inputs:PropertySet, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks customer interactions in RICO DB using a given EBC. // Returns flag indicating there have been interaction in a defined // timeframe // Input: psInputs PropertySet: -> Nr.: 48198119 // Output: Outputs PropertySet: -> Value: <1>Teddybär, 28.11.2013<2>Y<3>// // Date: October, 16th 2015 // Author: Pedro Ferreira // Change Log // 2015-10-16 TAADAPE2 fixed defect #114755 - performance issue. The Last KuCe Login and the Customer Interaction Flag had to be separated. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var oSvc:Service; var psIn:PropertySet; var psOut:PropertySet; var iTimeFrame: Number; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; var strInterFlg:chars = "N"; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteractionFlag Start"); // BC: Account.[Account Nr.] strAccnt = Inputs.GetProperty("Nr"); // read admin code value for "RICO Recent Interactions Timeframe" psIn = oApp.NewPropertySet(); psIn.SetProperty("Code", "RICO Recent Interactions Timeframe") psOut = oApp.NewPropertySet(); oSvc = oApp.GetService("Admin Code Value SCM"); oSvc.InvokeMethod("Retrieve", psIn, psOut); if (psOut.GetProperty("Value") != "") { iTimeFrame = 1 * psOut.GetProperty("Value"); } else{ iTimeFrame = 7; } oBO = oApp.GetBusObject("Customer Interaction History SCM"); oBC = oBO.GetBusComp("Customer Interaction History SCM"); with (oBC) { strSearch = "[Contact Object Number SCM]='" + strAccnt + "' AND [Date Time SCM] >= Today() - " + iTimeFrame; SetViewMode(AllView); ActivateField("Contact Object Number SCM"); // CONTACT_OBJECT_ID ("1111") ActivateField("Date Time SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strInterFlg = "Y"; } } if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction strReturn: " +strReturn); Outputs.SetProperty("Value", strInterFlg); } catch (e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strCustomerInteraction Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; oSvc = null; psIn = null; psOut = null; } }

Account Utilities BS SCM
strLastSRContact
function strLastSRContact(Inputs, Outputs) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks SRs of a customer to find the last SR having // content in the last owner field. Returns string including // Last Owner Full Name + Team information // // Input: psInputs PropertySet: // -> Id: 1-12345 // Output: Outputs PropertySet: // -> Value: Schmocker Beat, Amadeus AG // // Date: December, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; try { // BC: Account.[Id] if(bIsTraceOn)oApp.Trace(this.Name() + ".strLastSRContact Start"); strAccnt = Inputs.GetProperty("Id"); oBO = oApp.GetBusObject("Service Request Query Light SCM"); oBC = oBO.GetBusComp("Service Request Query Light Last Owner SCM"); with (oBC) { strSearch = "[Template Flag] <> 'Y' AND [Account Id]='" + strAccnt + "'"; SetViewMode(AllView); ActivateField("Account Id"); ActivateField("Last Owner Full Name SCM"); ActivateField("Last Owner Last Name SCM"); ActivateField("Last Owner First Name SCM"); ActivateField("Last Owner Team SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); strReturn = ""; if (FirstRecord()) { strReturn += GetFieldValue("Last Owner Last Name SCM"); strReturn += " "; strReturn += GetFieldValue("Last Owner First Name SCM"); strReturn += ", "; strReturn += GetFieldValue("Last Owner Team SCM"); } } Outputs.SetProperty("Value", strReturn); } catch (e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strLastSRContact Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; } }

Account Utilities BS SCM
strLastSRContact
function strLastSRContact(Inputs, Outputs) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks SRs of a customer to find the last SR having // content in the last owner field. Returns string including // Last Owner Full Name + Team information // // Input: psInputs PropertySet: // -> Id: 1-12345 // Output: Outputs PropertySet: // -> Value: Schmocker Beat, Amadeus AG // // Date: December, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO:BusObject; var oBC:BusComp; var strReturn:chars = ""; var strSearch:chars = ""; var strAccnt:chars = ""; try { // BC: Account.[Id] if(bIsTraceOn)oApp.Trace(this.Name() + ".strLastSRContact Start"); strAccnt = Inputs.GetProperty("Id"); oBO = oApp.GetBusObject("Service Request Query Light SCM"); oBC = oBO.GetBusComp("Service Request Query Light Last Owner SCM"); with (oBC) { strSearch = "[Template Flag] <> 'Y' AND [Account Id]='" + strAccnt + "'"; SetViewMode(AllView); ActivateField("Account Id"); ActivateField("Last Owner Full Name SCM"); ActivateField("Last Owner Last Name SCM"); ActivateField("Last Owner First Name SCM"); ActivateField("Last Owner Team SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); strReturn = ""; if (FirstRecord()) { strReturn += GetFieldValue("Last Owner Last Name SCM"); strReturn += " "; strReturn += GetFieldValue("Last Owner First Name SCM"); strReturn += ", "; strReturn += GetFieldValue("Last Owner Team SCM"); } } Outputs.SetProperty("Value", strReturn); } catch (e) { if(bIsTraceOn)oApp.Trace(this.Name() + ".strLastSRContact Error: " + e.message); Outputs.SetProperty("Error Message", e.toString()); } finally { oBC = null; oBO = null; } }

Activate Service Request SCM
(declarations)
//Global variable var bIsTraceOn = TheApplication().isTraceON;

Activate Service Request SCM
(declarations)
//Global variable var bIsTraceOn = TheApplication().isTraceON;

Activate Service Request SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************* ** Name: ProcessServiceRequestId ** Created: 30.07.2008 ** Created By: Sergio Nistal ** Description: This method looks for current Service Request status and creates a Profile Attribute if SR is not closed or completed. ** -------------------- Modifications --------------------- ** Description: Modification to focus on the asset, code clean-up ** Author: TGDSEAI1 Aingeru Sabando ** Date: 14.03.2012 ******************************************************/ //Initialize variables var intRetVal = CancelOperation; if(bIsTraceOn) TheApplication().Trace(this.Name() + ".Service_PreInvokeMethod Method: " + MethodName); try{ switch(MethodName) { case "ProcessServiceRequestId": fProcessServiceRequestId(Inputs); break; default: throw("ERR_UNKNOWN_METHOD", "Unknown Error: " + MethodName); break; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); throw(e); } return (intRetVal); }

Activate Service Request SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************* ** Name: ProcessServiceRequestId ** Created: 30.07.2008 ** Created By: Sergio Nistal ** Description: This method looks for current Service Request status and creates a Profile Attribute if SR is not closed or completed. ** -------------------- Modifications --------------------- ** Description: Modification to focus on the asset, code clean-up ** Author: TGDSEAI1 Aingeru Sabando ** Date: 14.03.2012 ******************************************************/ //Initialize variables var intRetVal = CancelOperation; if(bIsTraceOn) TheApplication().Trace(this.Name() + ".Service_PreInvokeMethod Method: " + MethodName); try{ switch(MethodName) { case "ProcessServiceRequestId": fProcessServiceRequestId(Inputs); break; default: throw("ERR_UNKNOWN_METHOD", "Unknown Error: " + MethodName); break; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); throw(e); } return (intRetVal); }

Activate Service Request SCM
fProcessServiceRequestId
function fProcessServiceRequestId(Inputs){ /******************************************************* ** Name: fProcessServiceRequestId ** Created: 15.03.2012 ** Created By: Aingeru Sabando, TGDSEAI1 ** Description: This method looks for current Service Request status and creates a Profile Attribute if SR is not closed or completed then it calls navigation ** to the customer entry view and focusing in the Asset. changed previous logic ** Update: 24.09.2013 Cgristoph Reitermann; added Switch for different BO ** Update: 14.04.2015 Aingeru Sabando; Call throught he BC Method instead of the BS ******************************************************/ //Variable declaration var objBoSR:BusObject; var objBCSR:BusComp; var strBOActive:chars = ""; var strTranslateError = ""; var strSRId = ""; var strStatus = ""; try{ //Get Input SR Id strSRId = Inputs.GetProperty("SR Id"); if (strSRId != null && strSRId != ""){ //Search for Service Request existence objBoSR = TheApplication().ActiveBusObject(); //GetBusObject("Service Request"); if(objBoSR != null) strBOActive = objBoSR.Name(); switch (strBOActive){ case "Dialog BO SCM": objBCSR = objBoSR.GetBusComp("Service Request BO SCM"); break; default: objBCSR = objBoSR.GetBusComp("Service Request"); break; } objBCSR.SetViewMode(AllView); objBCSR.ActivateField("Account Number"); objBCSR.ClearToQuery(); objBCSR.SetSearchSpec("SR Id", strSRId); objBCSR.ExecuteQuery(ForwardOnly); if(objBCSR.FirstRecord()){ // Check Service Request Status if SR in final status rise error strStatus = objBCSR.GetFieldValue("Status"); if (strStatus != "Closed" && strStatus != "Cancelled"){ //Set Dynamic Profile Attribute TheApplication().SetProfileAttr("SRDynProfAttrib", strSRId); objBCSR.InvokeMethod("GoToContractView"); }//End Status else{ strTranslateError = TheApplication().LookupMessage("User Defined Errors","SR: No Activate SR Closed or Cancelled", "DUMMY"); TheApplication().RaiseErrorText(strTranslateError + "\n"); } }//End FirstRecord else{ //No SR Found TheApplication().RaiseError("X_SR_DOES_NOT_EXIST_SCM"); } }//End strSRId else{ //No input parameter provided TheApplication().RaiseErrorText("It is impossible to create a Profile Attribute if there is no SR Id"+ "\n"); } } catch(e){ //Error Handling if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fProcessServiceRequestId " + e.message); throw(e); } finally{ //Variable destruction objBCSR = null; objBoSR = null; strTranslateError = null; strSRId = null; strStatus = null } }

Activate Service Request SCM
fProcessServiceRequestId
function fProcessServiceRequestId(Inputs){ /******************************************************* ** Name: fProcessServiceRequestId ** Created: 15.03.2012 ** Created By: Aingeru Sabando, TGDSEAI1 ** Description: This method looks for current Service Request status and creates a Profile Attribute if SR is not closed or completed then it calls navigation ** to the customer entry view and focusing in the Asset. changed previous logic ** Update: 24.09.2013 Cgristoph Reitermann; added Switch for different BO ** Update: 14.04.2015 Aingeru Sabando; Call throught he BC Method instead of the BS ******************************************************/ //Variable declaration var objBoSR:BusObject; var objBCSR:BusComp; var strBOActive:chars = ""; var strTranslateError = ""; var strSRId = ""; var strStatus = ""; try{ //Get Input SR Id strSRId = Inputs.GetProperty("SR Id"); if (strSRId != null && strSRId != ""){ //Search for Service Request existence objBoSR = TheApplication().ActiveBusObject(); //GetBusObject("Service Request"); if(objBoSR != null) strBOActive = objBoSR.Name(); switch (strBOActive){ case "Dialog BO SCM": objBCSR = objBoSR.GetBusComp("Service Request BO SCM"); break; default: objBCSR = objBoSR.GetBusComp("Service Request"); break; } objBCSR.SetViewMode(AllView); objBCSR.ActivateField("Account Number"); objBCSR.ClearToQuery(); objBCSR.SetSearchSpec("SR Id", strSRId); objBCSR.ExecuteQuery(ForwardOnly); if(objBCSR.FirstRecord()){ // Check Service Request Status if SR in final status rise error strStatus = objBCSR.GetFieldValue("Status"); if (strStatus != "Closed" && strStatus != "Cancelled"){ //Set Dynamic Profile Attribute TheApplication().SetProfileAttr("SRDynProfAttrib", strSRId); objBCSR.InvokeMethod("GoToContractView"); }//End Status else{ strTranslateError = TheApplication().LookupMessage("User Defined Errors","SR: No Activate SR Closed or Cancelled", "DUMMY"); TheApplication().RaiseErrorText(strTranslateError + "\n"); } }//End FirstRecord else{ //No SR Found TheApplication().RaiseError("X_SR_DOES_NOT_EXIST_SCM"); } }//End strSRId else{ //No input parameter provided TheApplication().RaiseErrorText("It is impossible to create a Profile Attribute if there is no SR Id"+ "\n"); } } catch(e){ //Error Handling if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fProcessServiceRequestId " + e.message); throw(e); } finally{ //Variable destruction objBCSR = null; objBoSR = null; strTranslateError = null; strSRId = null; strStatus = null } }

Actuate Sync Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var intReturn = ContinueOperation; switch(MethodName){ case "SyncToActuate": SyncToActuate(Inputs, Outputs); intReturn = CancelOperation; break; default: } return (intReturn); }

Actuate Sync Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var intReturn = ContinueOperation; switch(MethodName){ case "SyncToActuate": SyncToActuate(Inputs, Outputs); intReturn = CancelOperation; break; default: } return (intReturn); }

Actuate Sync Service
SyncToActuate
function SyncToActuate(Inputs, Outputs) { try{ var bsReport = TheApplication().GetService("Report Business Service"); var psIn = TheApplication().NewPropertySet(); var psOut = TheApplication().NewPropertySet(); psIn.SetProperty("AcAdminLogin", Inputs.GetProperty("AcAdminLogin")); psIn.SetProperty("AcAdminPassword", Inputs.GetProperty("AcAdminPassword")); psIn.SetProperty("UserID", Inputs.GetProperty("UserID")); bsReport.InvokeMethod("SyncOne", psIn, psOut); } catch(e){ if(e.toString().indexOf("successfully") > 1){ Outputs.SetProperty("Status", "OK"); Outputs.SetProperty("Errortext", e.toString()); } else{ Outputs.SetProperty("Status", "NOK"); Outputs.SetProperty("Errortext", e.toString()); } } finally{ psOut = null; psIn = null; bsReport = null; } }

Actuate Sync Service
SyncToActuate
function SyncToActuate(Inputs, Outputs) { try{ var bsReport = TheApplication().GetService("Report Business Service"); var psIn = TheApplication().NewPropertySet(); var psOut = TheApplication().NewPropertySet(); psIn.SetProperty("AcAdminLogin", Inputs.GetProperty("AcAdminLogin")); psIn.SetProperty("AcAdminPassword", Inputs.GetProperty("AcAdminPassword")); psIn.SetProperty("UserID", Inputs.GetProperty("UserID")); bsReport.InvokeMethod("SyncOne", psIn, psOut); } catch(e){ if(e.toString().indexOf("successfully") > 1){ Outputs.SetProperty("Status", "OK"); Outputs.SetProperty("Errortext", e.toString()); } else{ Outputs.SetProperty("Status", "NOK"); Outputs.SetProperty("Errortext", e.toString()); } } finally{ psOut = null; psIn = null; bsReport = null; } }

Add Order Template SCM
(declarations)
var cOK = "OK"; var cNOTOK = "Not OK"; var cREQPARA = "Required Parameter missing"; var cORDERNOTFOUND = "Order not found"; var cTEMPLATENOTFOUND = "Order template not found"; var gCNOId = ""; // 25.09.06 - TGDSTRE0 var oApp; var bIsTraceOn;

Add Order Template SCM
(declarations)
var cOK = "OK"; var cNOTOK = "Not OK"; var cREQPARA = "Required Parameter missing"; var cORDERNOTFOUND = "Order not found"; var cTEMPLATENOTFOUND = "Order template not found"; var gCNOId = ""; // 25.09.06 - TGDSTRE0 var oApp; var bIsTraceOn;

Add Order Template SCM
AddOrderItemsAndAttributes
function AddOrderItemsAndAttributes(&oBCTemplateItem, &oBCOrderHeader, &oBCOrderLineItem, &oBCTemplateXA, &oBCOrderXA, psListOfOLIWithProducts, cRefRootAssetIntegrationId, cRefAssetIntegrationId, cRefProductId, cRefProductName, sVertragsendeSCM, sVertragsendenewSCM, sVertragszusatzdauerSCM, sRefAdjustedListPrice, cOrganizationReferenceOrderItem, sReferredProductActivationDateSCM, sReferredBaseOfferMSISDNSCM, sAssetId, sCommitmentId, sDiscount,sCommissioningType,sModeaType,sModeaProdType,sIMEI) { var psMapping; var bIsRecord; var cProductId; var iQuantity; var cOrderTemplateItemId; var cOrderItemId; var cParentOrderItem; var cAttrName; var cAttrDataType; var cAttrValue; var cAttrActionCode; var cAttrId; // 24.10.2006 - TGDSTRE0 var sLangXA = ""; // ************************* START MODIFICATION ************************* // TGDSTRE0, 04.10.2006: Bugfixing Pricing var bNewRecord = false; // ************************* END MODIFICATION ************************* var cReturn; var cServiceType; var oBCPick; // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Bugfixing manual Pricing var cAdjListPrice; var cNetPrice; var cNRCTotal; // ************************* END MODIFICATION ************************* // ************************* START MODIFICATION ************************* // TGDDERO5, 03.10.2006: Setting Order Date or Entry Date // depending on Template Item.Product Due Date Calc SCM var dtOrderDate = oBCOrderHeader.GetFieldValue("Order Date"); var dtErfassungsdatumSCM = oBCOrderHeader.GetFieldValue("Erfassungsdatum SCM"); var sProdDueDateCalc = ""; var cOrderDateLOV = oApp.InvokeMethod ("LookupValue", "DUEDATE_SCM", "Order Date"); var cEntryDateLOV = oApp.InvokeMethod ("LookupValue", "DUEDATE_SCM", "Entry Date"); // ************************* END MODIFICATION ************************* try { cReturn = cOK; psMapping = oApp.NewPropertySet(); //Look for Order Template Items //It is possible to process all Order Template Item because the are order by line number oBCTemplateItem.SetViewMode(AllView); oBCTemplateItem.ClearToQuery(); // 12.12.2006 - TGDSTRE0 - no ForwardOnly ! oBCTemplateItem.ExecuteQuery(); bIsRecord = oBCTemplateItem.FirstRecord(); //Add Order Template Item while (bIsRecord) { //Determine Order Template Item Information cParentOrderItem = oBCTemplateItem.GetFieldValue("Parent Quote Item Id"); cOrderTemplateItemId = oBCTemplateItem.GetFieldValue("Id"); cProductId = oBCTemplateItem.GetFieldValue("Product Id"); iQuantity = oBCTemplateItem.GetFieldValue("Quantity Requested"); // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Price information from Template Administration - authorized by TGDSTDE5 cAdjListPrice = 1 * oBCTemplateItem.GetFieldValue("Adjusted List Price"); cNetPrice = 1 * oBCTemplateItem.GetFieldValue("Net Price"); cNRCTotal = 1 * oBCTemplateItem.GetFieldValue("NRC CxTotal"); // ************************* END MODIFICATION ************************* //Create new order line item and copy information oBCOrderLineItem.NewRecord(NewAfter); cOrderItemId = oBCOrderLineItem.GetFieldValue("Id"); // ************************* START MODIFICATION ************************* // TGDSTRE0, 04.10.2006: Bugfixing Pricing bNewRecord = true; // ************************* END MODIFICATION ************************* if (cParentOrderItem != null && cParentOrderItem != "") { oBCOrderLineItem.SetFieldValue("Parent Order Item Id", psMapping.GetProperty(cParentOrderItem)); // 2006-09-21 TGDSTRE0 - for Jan oBCOrderLineItem.SetFieldValue("Root Order Item Id", psMapping.GetProperty(cParentOrderItem)); } // 07.11.2006 TGDSTRE0 - Product Pick --> // oBCOrderLineItem.SetFieldValue("Product Id", cProductId); oBCPick = oBCOrderLineItem.GetPicklistBusCom

Add Order Template SCM
AddOrderItemsAndAttributes
function AddOrderItemsAndAttributes(&oBCTemplateItem, &oBCOrderHeader, &oBCOrderLineItem, &oBCTemplateXA, &oBCOrderXA, psListOfOLIWithProducts, cRefRootAssetIntegrationId, cRefAssetIntegrationId, cRefProductId, cRefProductName, sVertragsendeSCM, sVertragsendenewSCM, sVertragszusatzdauerSCM, sRefAdjustedListPrice, cOrganizationReferenceOrderItem, sReferredProductActivationDateSCM, sReferredBaseOfferMSISDNSCM, sAssetId, sCommitmentId, sDiscount,sCommissioningType,sModeaType,sModeaProdType,sIMEI) { var psMapping; var bIsRecord; var cProductId; var iQuantity; var cOrderTemplateItemId; var cOrderItemId; var cParentOrderItem; var cAttrName; var cAttrDataType; var cAttrValue; var cAttrActionCode; var cAttrId; // 24.10.2006 - TGDSTRE0 var sLangXA = ""; // ************************* START MODIFICATION ************************* // TGDSTRE0, 04.10.2006: Bugfixing Pricing var bNewRecord = false; // ************************* END MODIFICATION ************************* var cReturn; var cServiceType; var oBCPick; // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Bugfixing manual Pricing var cAdjListPrice; var cNetPrice; var cNRCTotal; // ************************* END MODIFICATION ************************* // ************************* START MODIFICATION ************************* // TGDDERO5, 03.10.2006: Setting Order Date or Entry Date // depending on Template Item.Product Due Date Calc SCM var dtOrderDate = oBCOrderHeader.GetFieldValue("Order Date"); var dtErfassungsdatumSCM = oBCOrderHeader.GetFieldValue("Erfassungsdatum SCM"); var sProdDueDateCalc = ""; var cOrderDateLOV = oApp.InvokeMethod ("LookupValue", "DUEDATE_SCM", "Order Date"); var cEntryDateLOV = oApp.InvokeMethod ("LookupValue", "DUEDATE_SCM", "Entry Date"); // ************************* END MODIFICATION ************************* try { cReturn = cOK; psMapping = oApp.NewPropertySet(); //Look for Order Template Items //It is possible to process all Order Template Item because the are order by line number oBCTemplateItem.SetViewMode(AllView); oBCTemplateItem.ClearToQuery(); // 12.12.2006 - TGDSTRE0 - no ForwardOnly ! oBCTemplateItem.ExecuteQuery(); bIsRecord = oBCTemplateItem.FirstRecord(); //Add Order Template Item while (bIsRecord) { //Determine Order Template Item Information cParentOrderItem = oBCTemplateItem.GetFieldValue("Parent Quote Item Id"); cOrderTemplateItemId = oBCTemplateItem.GetFieldValue("Id"); cProductId = oBCTemplateItem.GetFieldValue("Product Id"); iQuantity = oBCTemplateItem.GetFieldValue("Quantity Requested"); // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Price information from Template Administration - authorized by TGDSTDE5 cAdjListPrice = 1 * oBCTemplateItem.GetFieldValue("Adjusted List Price"); cNetPrice = 1 * oBCTemplateItem.GetFieldValue("Net Price"); cNRCTotal = 1 * oBCTemplateItem.GetFieldValue("NRC CxTotal"); // ************************* END MODIFICATION ************************* //Create new order line item and copy information oBCOrderLineItem.NewRecord(NewAfter); cOrderItemId = oBCOrderLineItem.GetFieldValue("Id"); // ************************* START MODIFICATION ************************* // TGDSTRE0, 04.10.2006: Bugfixing Pricing bNewRecord = true; // ************************* END MODIFICATION ************************* if (cParentOrderItem != null && cParentOrderItem != "") { oBCOrderLineItem.SetFieldValue("Parent Order Item Id", psMapping.GetProperty(cParentOrderItem)); // 2006-09-21 TGDSTRE0 - for Jan oBCOrderLineItem.SetFieldValue("Root Order Item Id", psMapping.GetProperty(cParentOrderItem)); } // 07.11.2006 TGDSTRE0 - Product Pick --> // oBCOrderLineItem.SetFieldValue("Product Id", cProductId); oBCPick = oBCOrderLineItem.GetPicklistBusCom

Add Order Template SCM
AddOrderTemplate
function AddOrderTemplate(psInputs, psOutputs) { var cOrderId; var cOrderTemplateId = ""; var cRefRootAssetIntegrationId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefAssetIntegrationId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefProductId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefProductName; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var sVertragsendeSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragsendenewSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragsendecalcSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragszusatzdauerSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sRefAdjustedListPrice; // SCM: enhance commitment functionality: BEPPI2, TGDSCTHO 20060605 created var sReferredBaseOfferMSISDNSCM; // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created var sReferredProductActivationDateSCM; // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created var sCommitmentId; // SCM: Penalty Information; BEPPI2, TGDSCTHO, 20060720 created var sAssetId; var cOrganizationReferenceOrderItem; // SCM: Enable Commitment: BEPPI2, TGDSTRE0: 20060629 var oBOOrder = null; var oBCOrderHeader = null; var oBCOrderLineItem = null; var oBCOrderXA = null; var oBOTemplate = null; var oBCTemplateHeader = null; var oBCTemplateItem = null; var oBCTemplateXA = null; var bOrderFound=false; var bOrderTemplateFound=false; var cReturn; var psListOfOLIWithProducts = null; try { cReturn = cOK; //Get Order Id and Order Template Id cOrderId = psInputs.GetProperty("OrderId"); if (psInputs.PropertyExists("OrderTemplateId")) { cOrderTemplateId = psInputs.GetProperty("OrderTemplateId"); } else { if (psInputs.PropertyExists("OrderTemplateName")) { cReturn = DetermineTemplateId(psInputs.GetProperty("OrderTemplateName"), cOrderTemplateId); } } if (cReturn == cOK) { cRefRootAssetIntegrationId = psInputs.GetProperty("Ref Root Asset Integration Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefAssetIntegrationId = psInputs.GetProperty("Ref Asset Integration Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefProductId = psInputs.GetProperty("Ref Product Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefProductName = psInputs.GetProperty("Ref Product Name"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 sVertragsendeSCM = psInputs.GetProperty("Vertragsende SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sVertragsendenewSCM = psInputs.GetProperty("Vertragsende new SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sVertragszusatzdauerSCM = psInputs.GetProperty("Vertragszusatzdauer SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sReferredBaseOfferMSISDNSCM = psInputs.GetProperty("Referred Base Offer MSISDN SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created sReferredProductActivationDateSCM = psInputs.GetProperty("Referred Product Activation Date SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created sRefAdjustedListPrice = psInputs.GetProperty("Ref Adjusted List Price"); // SCM: enhance commitment functionality: BEPPI2, TGDSCTHO 20060605 created sAssetId = psInputs.GetProperty("Asset Id"); // TGDSCTHO 20060710 created sCommitmentId = psInputs.GetProperty("Commitment Id"); // TGDSCTHO 20060720 created //new fields from retention var sDiscount = psInputs.GetProperty("Discount"); var sCommissioningType = psInputs.GetProperty("CommissioningType"); var sModeaType = psInputs.GetProperty("ModeaType"); var sModeaProdType = psInputs.GetProperty("ModeaProdType"); //TGDMAPE5 21.06.2007 added var sIMEI = psInputs.GetProperty("IMEI SCS"); cOrganizationReferenceOrderItem = psInputs.GetPrope

Add Order Template SCM
AddOrderTemplate
function AddOrderTemplate(psInputs, psOutputs) { var cOrderId; var cOrderTemplateId = ""; var cRefRootAssetIntegrationId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefAssetIntegrationId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefProductId; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var cRefProductName; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 var sVertragsendeSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragsendenewSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragsendecalcSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sVertragszusatzdauerSCM; // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 var sRefAdjustedListPrice; // SCM: enhance commitment functionality: BEPPI2, TGDSCTHO 20060605 created var sReferredBaseOfferMSISDNSCM; // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created var sReferredProductActivationDateSCM; // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created var sCommitmentId; // SCM: Penalty Information; BEPPI2, TGDSCTHO, 20060720 created var sAssetId; var cOrganizationReferenceOrderItem; // SCM: Enable Commitment: BEPPI2, TGDSTRE0: 20060629 var oBOOrder = null; var oBCOrderHeader = null; var oBCOrderLineItem = null; var oBCOrderXA = null; var oBOTemplate = null; var oBCTemplateHeader = null; var oBCTemplateItem = null; var oBCTemplateXA = null; var bOrderFound=false; var bOrderTemplateFound=false; var cReturn; var psListOfOLIWithProducts = null; try { cReturn = cOK; //Get Order Id and Order Template Id cOrderId = psInputs.GetProperty("OrderId"); if (psInputs.PropertyExists("OrderTemplateId")) { cOrderTemplateId = psInputs.GetProperty("OrderTemplateId"); } else { if (psInputs.PropertyExists("OrderTemplateName")) { cReturn = DetermineTemplateId(psInputs.GetProperty("OrderTemplateName"), cOrderTemplateId); } } if (cReturn == cOK) { cRefRootAssetIntegrationId = psInputs.GetProperty("Ref Root Asset Integration Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefAssetIntegrationId = psInputs.GetProperty("Ref Asset Integration Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefProductId = psInputs.GetProperty("Ref Product Id"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 cRefProductName = psInputs.GetProperty("Ref Product Name"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 sVertragsendeSCM = psInputs.GetProperty("Vertragsende SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sVertragsendenewSCM = psInputs.GetProperty("Vertragsende new SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sVertragszusatzdauerSCM = psInputs.GetProperty("Vertragszusatzdauer SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 sReferredBaseOfferMSISDNSCM = psInputs.GetProperty("Referred Base Offer MSISDN SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created sReferredProductActivationDateSCM = psInputs.GetProperty("Referred Product Activation Date SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created sRefAdjustedListPrice = psInputs.GetProperty("Ref Adjusted List Price"); // SCM: enhance commitment functionality: BEPPI2, TGDSCTHO 20060605 created sAssetId = psInputs.GetProperty("Asset Id"); // TGDSCTHO 20060710 created sCommitmentId = psInputs.GetProperty("Commitment Id"); // TGDSCTHO 20060720 created //new fields from retention var sDiscount = psInputs.GetProperty("Discount"); var sCommissioningType = psInputs.GetProperty("CommissioningType"); var sModeaType = psInputs.GetProperty("ModeaType"); var sModeaProdType = psInputs.GetProperty("ModeaProdType"); //TGDMAPE5 21.06.2007 added var sIMEI = psInputs.GetProperty("IMEI SCS"); cOrganizationReferenceOrderItem = psInputs.GetPrope

Add Order Template SCM
DeleteDefaultCNO
function DeleteDefaultCNO(Inputs, Outputs) { if (bIsTraceOn) oApp.Trace("DeleteDefaultCNO() - start"); var sOrderId = Inputs.GetProperty("Order Header Id"); if (bIsTraceOn) oApp.Trace("Order Header Id = " + sOrderId); try { var oBOOrderItem = oApp.GetBusObject("Order Item"); var oBCOLI = oBOOrderItem.GetBusComp("Order Entry - Line Items"); var sSRId = ""; oBCOLI.ActivateField("Default CNO SCM"); oBCOLI.SetViewMode(AllView); oBCOLI.ClearToQuery(); oBCOLI.SetSearchExpr("[Order Header Id]='" + sOrderId + "' AND [Default CNO SCM]='Y'"); oBCOLI.ExecuteQuery(ForwardOnly); var sIdOld = ""; var sId = ""; while (isRecord(oBCOLI)) { sId = oBCOLI.GetFieldValue("Id"); sSRId = oBCOLI.GetFieldValue("Service Request Id"); if (sId == sIdOld) { break; } else { oBCOLI.DeleteRecord(); } } } finally { oBCOLI = null; oBOOrderItem = null; } if (sSRId != "") { try { var oBOSR = oApp.GetBusObject("Service Request"); var oBCSR = oBOSR.GetBusComp("Service Request"); oBCSR.ActivateField("CNO Used SCM"); oBCSR.SetViewMode(AllView); oBCSR.ClearToQuery(); oBCSR.SetSearchSpec("Id", sSRId); oBCSR.ExecuteQuery(ForwardOnly); if (isRecord(oBCSR)) { oBCSR.SetFieldValue("CNO Used SCM", "N"); oBCSR.WriteRecord(); } } catch(e) { oApp.Trace("ERROR: " + e.toString()); } finally { oBCSR = null; oBOSR = null; } } if (bIsTraceOn) oApp.Trace("DeleteDefaultCNO() - ende"); }

Add Order Template SCM
DeleteDefaultCNO
function DeleteDefaultCNO(Inputs, Outputs) { if (bIsTraceOn) oApp.Trace("DeleteDefaultCNO() - start"); var sOrderId = Inputs.GetProperty("Order Header Id"); if (bIsTraceOn) oApp.Trace("Order Header Id = " + sOrderId); try { var oBOOrderItem = oApp.GetBusObject("Order Item"); var oBCOLI = oBOOrderItem.GetBusComp("Order Entry - Line Items"); var sSRId = ""; oBCOLI.ActivateField("Default CNO SCM"); oBCOLI.SetViewMode(AllView); oBCOLI.ClearToQuery(); oBCOLI.SetSearchExpr("[Order Header Id]='" + sOrderId + "' AND [Default CNO SCM]='Y'"); oBCOLI.ExecuteQuery(ForwardOnly); var sIdOld = ""; var sId = ""; while (isRecord(oBCOLI)) { sId = oBCOLI.GetFieldValue("Id"); sSRId = oBCOLI.GetFieldValue("Service Request Id"); if (sId == sIdOld) { break; } else { oBCOLI.DeleteRecord(); } } } finally { oBCOLI = null; oBOOrderItem = null; } if (sSRId != "") { try { var oBOSR = oApp.GetBusObject("Service Request"); var oBCSR = oBOSR.GetBusComp("Service Request"); oBCSR.ActivateField("CNO Used SCM"); oBCSR.SetViewMode(AllView); oBCSR.ClearToQuery(); oBCSR.SetSearchSpec("Id", sSRId); oBCSR.ExecuteQuery(ForwardOnly); if (isRecord(oBCSR)) { oBCSR.SetFieldValue("CNO Used SCM", "N"); oBCSR.WriteRecord(); } } catch(e) { oApp.Trace("ERROR: " + e.toString()); } finally { oBCSR = null; oBOSR = null; } } if (bIsTraceOn) oApp.Trace("DeleteDefaultCNO() - ende"); }

Add Order Template SCM
DetermineTemplateId
function DetermineTemplateId(cTemplateName, &cTemplateId) { var oBOTemplate; var oBCTemplateHeader; var cTemplateId; var cReturn; try { cReturn = cOK; if (cTemplateName != null && cTemplateName != "") { oBOTemplate = oApp.GetBusObject("Template"); oBCTemplateHeader = oBOTemplate.GetBusComp("Template Header"); oBCTemplateHeader.ActivateField("Name"); oBCTemplateHeader.SetViewMode(AllView); oBCTemplateHeader.ClearToQuery(); oBCTemplateHeader.SetSearchSpec("Name", cTemplateName); oBCTemplateHeader.ExecuteQuery(); if (oBCTemplateHeader.FirstRecord()) { cTemplateId = oBCTemplateHeader.GetFieldValue("Id"); } else { cReturn = cTEMPLATENOTFOUND; throw(cReturn); } } } catch(e) { oApp.Trace("DetermineTemplateId() : " + e.toString()); if (cReturn == cOK) { cReturn == cNOTOK; } throw(e); } finally { oBCTemplateHeader = null; oBOTemplate = null; } return(cReturn); }

Add Order Template SCM
DetermineTemplateId
function DetermineTemplateId(cTemplateName, &cTemplateId) { var oBOTemplate; var oBCTemplateHeader; var cTemplateId; var cReturn; try { cReturn = cOK; if (cTemplateName != null && cTemplateName != "") { oBOTemplate = oApp.GetBusObject("Template"); oBCTemplateHeader = oBOTemplate.GetBusComp("Template Header"); oBCTemplateHeader.ActivateField("Name"); oBCTemplateHeader.SetViewMode(AllView); oBCTemplateHeader.ClearToQuery(); oBCTemplateHeader.SetSearchSpec("Name", cTemplateName); oBCTemplateHeader.ExecuteQuery(); if (oBCTemplateHeader.FirstRecord()) { cTemplateId = oBCTemplateHeader.GetFieldValue("Id"); } else { cReturn = cTEMPLATENOTFOUND; throw(cReturn); } } } catch(e) { oApp.Trace("DetermineTemplateId() : " + e.toString()); if (cReturn == cOK) { cReturn == cNOTOK; } throw(e); } finally { oBCTemplateHeader = null; oBOTemplate = null; } return(cReturn); }

Add Order Template SCM
InstantiateOrderBO
function InstantiateOrderBO(&oBOOrder, &oBCOrderHeader, &oBCOrderLineItem, &oBCOrderXA, cOrderId) { var bOrderFound = false; // BusSvc "Add Order Template SCM" must be extended // a) function InstantiateOrderBO try { // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Performance Tuning - authorized by TGDSTDE5 // oBOOrder = oApp.GetBusObject("Order Entry (Sales)"); // oBCOrderHeader = oBOOrder.GetBusComp("Order Entry - Orders"); // oBCOrderLineItem = oBOOrder.GetBusComp("Order Entry - Line Items"); // oBCOrderXA = oBOOrder.GetBusComp("Order Item XA"); // Change to MACD-BCs leads to about 2.5sec increasing performance oBOOrder = oApp.GetBusObject("MACD Performance Order"); oBCOrderHeader = oBOOrder.GetBusComp("MACD Order Entry - Orders"); oBCOrderLineItem = oBOOrder.GetBusComp("MACD Order Entry - Line Items"); oBCOrderXA = oBOOrder.GetBusComp("MACD Order Item XA"); // ************************* END MODIFICATION ************************* oBCOrderHeader.ActivateField("Order Number"); oBCOrderHeader.ActivateField("Account Id"); oBCOrderHeader.ActivateField("Service Request Id"); oBCOrderHeader.ActivateField("Order Date"); oBCOrderHeader.ActivateField("Erfassungsdatum SCM"); oBCOrderLineItem.ActivateField("Outline Number"); oBCOrderLineItem.ActivateField("Product Id"); oBCOrderLineItem.ActivateField("MSISDN SCM"); oBCOrderLineItem.ActivateField("Extended Quantity"); oBCOrderLineItem.ActivateField("Part Number"); oBCOrderLineItem.ActivateField("Order Id"); oBCOrderLineItem.ActivateField("Parent Order Item Id"); oBCOrderLineItem.ActivateField("Ref Root Asset Integration Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Asset Integration Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Product Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Product Name SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Organization Reference Order Item"); // SCM: Enable Commitment: BEPPI2, TGDSTRE0: 20060629 oBCOrderLineItem.ActivateField("Vertragsende SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Vertragsende new SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Vertragszusatzdauer SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Ref Adjusted List Price"); // SCM: Enable enhanced Commitment: BEPPI2, TGDSCTHO: 20060605 created oBCOrderLineItem.ActivateField("Referred Product Activation Date SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created oBCOrderLineItem.ActivateField("Referred Base Offer MSISDN SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created oBCOrderLineItem.ActivateField("Asset Id"); // TGDSCTHO, 20060710 created oBCOrderLineItem.ActivateField("Commitment Id SCM"); // TGDSCTHO, 20060720 created oBCOrderLineItem.ActivateField("Default CNO SCM"); // TGDSTRE0; 2006-10-10; VBN // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Setting of prices manually - authorized by TGDSTDE5 oBCOrderLineItem.ActivateField("Adjusted List Price"); oBCOrderLineItem.ActivateField("Net Price"); oBCOrderLineItem.ActivateField("NRC CxTotal"); // ************************* END MODIFICATION ************************* oBCOrderXA.ActivateField("Name"); oBCOrderXA.ActivateField("Value"); oBCOrderXA.ActivateField("Action Code"); oBCOrderXA.ActivateField("Data Type"); oBCOrderXA.ActivateField("Object Id"); oBCOrderXA.ActivateField("Display Name"); oBCOrderXA.ActivateField("Attribute Id"); oBCOrderXA.ActivateField("Date Value"); oBCOrderXA.ActivateField

Add Order Template SCM
InstantiateOrderBO
function InstantiateOrderBO(&oBOOrder, &oBCOrderHeader, &oBCOrderLineItem, &oBCOrderXA, cOrderId) { var bOrderFound = false; // BusSvc "Add Order Template SCM" must be extended // a) function InstantiateOrderBO try { // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Performance Tuning - authorized by TGDSTDE5 // oBOOrder = oApp.GetBusObject("Order Entry (Sales)"); // oBCOrderHeader = oBOOrder.GetBusComp("Order Entry - Orders"); // oBCOrderLineItem = oBOOrder.GetBusComp("Order Entry - Line Items"); // oBCOrderXA = oBOOrder.GetBusComp("Order Item XA"); // Change to MACD-BCs leads to about 2.5sec increasing performance oBOOrder = oApp.GetBusObject("MACD Performance Order"); oBCOrderHeader = oBOOrder.GetBusComp("MACD Order Entry - Orders"); oBCOrderLineItem = oBOOrder.GetBusComp("MACD Order Entry - Line Items"); oBCOrderXA = oBOOrder.GetBusComp("MACD Order Item XA"); // ************************* END MODIFICATION ************************* oBCOrderHeader.ActivateField("Order Number"); oBCOrderHeader.ActivateField("Account Id"); oBCOrderHeader.ActivateField("Service Request Id"); oBCOrderHeader.ActivateField("Order Date"); oBCOrderHeader.ActivateField("Erfassungsdatum SCM"); oBCOrderLineItem.ActivateField("Outline Number"); oBCOrderLineItem.ActivateField("Product Id"); oBCOrderLineItem.ActivateField("MSISDN SCM"); oBCOrderLineItem.ActivateField("Extended Quantity"); oBCOrderLineItem.ActivateField("Part Number"); oBCOrderLineItem.ActivateField("Order Id"); oBCOrderLineItem.ActivateField("Parent Order Item Id"); oBCOrderLineItem.ActivateField("Ref Root Asset Integration Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Asset Integration Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Product Id SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Ref Product Name SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060522 oBCOrderLineItem.ActivateField("Organization Reference Order Item"); // SCM: Enable Commitment: BEPPI2, TGDSTRE0: 20060629 oBCOrderLineItem.ActivateField("Vertragsende SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Vertragsende new SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Vertragszusatzdauer SCM"); // SCM: Enable Commitment: BEPPI2, TGDSCTHO: 20060524 oBCOrderLineItem.ActivateField("Ref Adjusted List Price"); // SCM: Enable enhanced Commitment: BEPPI2, TGDSCTHO: 20060605 created oBCOrderLineItem.ActivateField("Referred Product Activation Date SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created oBCOrderLineItem.ActivateField("Referred Base Offer MSISDN SCM"); // SCM: Commissioning; BEPPI2, TGDSCTHO, 20060629 created oBCOrderLineItem.ActivateField("Asset Id"); // TGDSCTHO, 20060710 created oBCOrderLineItem.ActivateField("Commitment Id SCM"); // TGDSCTHO, 20060720 created oBCOrderLineItem.ActivateField("Default CNO SCM"); // TGDSTRE0; 2006-10-10; VBN // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: Setting of prices manually - authorized by TGDSTDE5 oBCOrderLineItem.ActivateField("Adjusted List Price"); oBCOrderLineItem.ActivateField("Net Price"); oBCOrderLineItem.ActivateField("NRC CxTotal"); // ************************* END MODIFICATION ************************* oBCOrderXA.ActivateField("Name"); oBCOrderXA.ActivateField("Value"); oBCOrderXA.ActivateField("Action Code"); oBCOrderXA.ActivateField("Data Type"); oBCOrderXA.ActivateField("Object Id"); oBCOrderXA.ActivateField("Display Name"); oBCOrderXA.ActivateField("Attribute Id"); oBCOrderXA.ActivateField("Date Value"); oBCOrderXA.ActivateField

Add Order Template SCM
InstantiateOrderTemplateBO
function InstantiateOrderTemplateBO(&oBOTemplate, &oBCTemplateHeader, &oBCTemplateItem, &oBCTemplateXA, cOrderTemplateId) { var bOrderTemplateFound=false; try { oBOTemplate = oApp.GetBusObject("Template"); oBCTemplateHeader = oBOTemplate.GetBusComp("Template Header"); oBCTemplateItem = oBOTemplate.GetBusComp("Template Item"); oBCTemplateXA = oBOTemplate.GetBusComp("Template Item XA"); oBCTemplateHeader.ActivateField("Name"); oBCTemplateItem.ActivateField("Outline Number"); oBCTemplateItem.ActivateField("Product Id"); oBCTemplateItem.ActivateField("Unit of Measure"); oBCTemplateItem.ActivateField("Quantity Requested"); oBCTemplateItem.ActivateField("Quote Id"); oBCTemplateItem.ActivateField("Parent Quote Item Id"); oBCTemplateItem.ActivateField("Product Service Type SCM"); oBCTemplateItem.ActivateField("Product Due Date Calc SCM"); oBCTemplateItem.ActivateField("Pre Processed Flag SCM"); // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: manual Pricing - authorized by TGDSTDE5 oBCTemplateItem.ActivateField("Adjusted List Price"); oBCTemplateItem.ActivateField("Net Price"); oBCTemplateItem.ActivateField("NRC CxTotal"); // ************************* END MODIFICATION ************************* oBCTemplateXA.ActivateField("Display Name"); oBCTemplateXA.ActivateField("Name"); oBCTemplateXA.ActivateField("Data Type"); oBCTemplateXA.ActivateField("Action Code"); oBCTemplateXA.ActivateField("Value"); oBCTemplateXA.ActivateField("Object Id"); oBCTemplateXA.ActivateField("Attribute Id"); oBCTemplateXA.ActivateField("Date Value"); oBCTemplateXA.ActivateField("Numeric Value"); oBCTemplateXA.ActivateField("Text Value"); oBCTemplateHeader.SetViewMode(AllView); oBCTemplateHeader.ClearToQuery(); oBCTemplateHeader.SetSearchSpec("Id", cOrderTemplateId); // 12.12.2006 - TGDSTRE0 - no ForwardOnly ! oBCTemplateHeader.ExecuteQuery(); if (oBCTemplateHeader.FirstRecord()) { bOrderTemplateFound = true; } } catch(e) { oApp.Trace("InstantiateOrderTemplateBO() : " + e.toString()); throw(e); } return(bOrderTemplateFound); }

Add Order Template SCM
InstantiateOrderTemplateBO
function InstantiateOrderTemplateBO(&oBOTemplate, &oBCTemplateHeader, &oBCTemplateItem, &oBCTemplateXA, cOrderTemplateId) { var bOrderTemplateFound=false; try { oBOTemplate = oApp.GetBusObject("Template"); oBCTemplateHeader = oBOTemplate.GetBusComp("Template Header"); oBCTemplateItem = oBOTemplate.GetBusComp("Template Item"); oBCTemplateXA = oBOTemplate.GetBusComp("Template Item XA"); oBCTemplateHeader.ActivateField("Name"); oBCTemplateItem.ActivateField("Outline Number"); oBCTemplateItem.ActivateField("Product Id"); oBCTemplateItem.ActivateField("Unit of Measure"); oBCTemplateItem.ActivateField("Quantity Requested"); oBCTemplateItem.ActivateField("Quote Id"); oBCTemplateItem.ActivateField("Parent Quote Item Id"); oBCTemplateItem.ActivateField("Product Service Type SCM"); oBCTemplateItem.ActivateField("Product Due Date Calc SCM"); oBCTemplateItem.ActivateField("Pre Processed Flag SCM"); // ************************* START MODIFICATION ************************* // TGDGEMAx, 28.11.2006: manual Pricing - authorized by TGDSTDE5 oBCTemplateItem.ActivateField("Adjusted List Price"); oBCTemplateItem.ActivateField("Net Price"); oBCTemplateItem.ActivateField("NRC CxTotal"); // ************************* END MODIFICATION ************************* oBCTemplateXA.ActivateField("Display Name"); oBCTemplateXA.ActivateField("Name"); oBCTemplateXA.ActivateField("Data Type"); oBCTemplateXA.ActivateField("Action Code"); oBCTemplateXA.ActivateField("Value"); oBCTemplateXA.ActivateField("Object Id"); oBCTemplateXA.ActivateField("Attribute Id"); oBCTemplateXA.ActivateField("Date Value"); oBCTemplateXA.ActivateField("Numeric Value"); oBCTemplateXA.ActivateField("Text Value"); oBCTemplateHeader.SetViewMode(AllView); oBCTemplateHeader.ClearToQuery(); oBCTemplateHeader.SetSearchSpec("Id", cOrderTemplateId); // 12.12.2006 - TGDSTRE0 - no ForwardOnly ! oBCTemplateHeader.ExecuteQuery(); if (oBCTemplateHeader.FirstRecord()) { bOrderTemplateFound = true; } } catch(e) { oApp.Trace("InstantiateOrderTemplateBO() : " + e.toString()); throw(e); } return(bOrderTemplateFound); }

Add Order Template SCM
MergeOrder
function MergeOrder(Inputs, Outputs) { if (bIsTraceOn) oApp.Trace("MergeOrder - start"); if (bIsTraceOn) oApp.Trace("GetChildCount = " + Inputs.GetChildCount()); if (Inputs.GetChildCount() == 2) { var psOrder = Inputs.GetChild(0); var psHeader = null; var psLineItems = Inputs.GetChild(1); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(0) = " + psOrder.GetType()); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(1) = " + psLineItems.GetType()); if (psOrder.GetType() != "SiebelMessage") { if (bIsTraceOn) oApp.Trace("MergeOrder - exchange Childs"); var psTemp = psOrder; psOrder = psLineItems; psLineItems = psTemp; psTemp = null; if (bIsTraceOn) oApp.Trace("MergeOrder - Child(0) = " + psOrder.GetType()); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(1) = " + psLineItems.GetType()); } try { // psOrder.SetType("SiebelMessage"); // psLineItems.SetType("ListOfLine Item"); psHeader = psOrder.GetChild(0).GetChild(0); psHeader.RemoveChild(0); psHeader.AddChild(psLineItems); Outputs.AddChild(psOrder); } catch(e) { oApp.Trace("MergeOrder(): " + e.toString()); } finally { psLineItems = null; psHeader = null; psOrder = null; } } if (bIsTraceOn) oApp.Trace("MergeOrder - ende"); }

Add Order Template SCM
MergeOrder
function MergeOrder(Inputs, Outputs) { if (bIsTraceOn) oApp.Trace("MergeOrder - start"); if (bIsTraceOn) oApp.Trace("GetChildCount = " + Inputs.GetChildCount()); if (Inputs.GetChildCount() == 2) { var psOrder = Inputs.GetChild(0); var psHeader = null; var psLineItems = Inputs.GetChild(1); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(0) = " + psOrder.GetType()); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(1) = " + psLineItems.GetType()); if (psOrder.GetType() != "SiebelMessage") { if (bIsTraceOn) oApp.Trace("MergeOrder - exchange Childs"); var psTemp = psOrder; psOrder = psLineItems; psLineItems = psTemp; psTemp = null; if (bIsTraceOn) oApp.Trace("MergeOrder - Child(0) = " + psOrder.GetType()); if (bIsTraceOn) oApp.Trace("MergeOrder - Child(1) = " + psLineItems.GetType()); } try { // psOrder.SetType("SiebelMessage"); // psLineItems.SetType("ListOfLine Item"); psHeader = psOrder.GetChild(0).GetChild(0); psHeader.RemoveChild(0); psHeader.AddChild(psLineItems); Outputs.AddChild(psOrder); } catch(e) { oApp.Trace("MergeOrder(): " + e.toString()); } finally { psLineItems = null; psHeader = null; psOrder = null; } } if (bIsTraceOn) oApp.Trace("MergeOrder - ende"); }

Add Order Template SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; var iReturn = ContinueOperation; var cReturn; // if (bIsTraceOn) WritePS(Inputs); try { cReturn = cOK; switch (MethodName) { case "Add Order Template": iReturn = CancelOperation; AddOrderTemplate(Inputs, Outputs); Outputs.SetProperty("CNO Id", gCNOId); // 25.09.06 - TGDSTRE0 oApp.SetProfileAttr("DefCNO-Id", gCNOId); break; case "Delete DefaultCNO": iReturn = CancelOperation; DeleteDefaultCNO(Inputs, Outputs); break; case "MergeOrder": iReturn = CancelOperation; MergeOrder(Inputs, Outputs); break; } } catch(e) { if (cReturn == cOK) { cReturn == cNOTOK; } oApp.Trace("Service_PreInvokeMethod: " + e.toString()); oApp.RaiseErrorText(e.toString()); } finally { Outputs.SetProperty("Return Value", cReturn); oApp = null; } return (iReturn); }

Add Order Template SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; var iReturn = ContinueOperation; var cReturn; // if (bIsTraceOn) WritePS(Inputs); try { cReturn = cOK; switch (MethodName) { case "Add Order Template": iReturn = CancelOperation; AddOrderTemplate(Inputs, Outputs); Outputs.SetProperty("CNO Id", gCNOId); // 25.09.06 - TGDSTRE0 oApp.SetProfileAttr("DefCNO-Id", gCNOId); break; case "Delete DefaultCNO": iReturn = CancelOperation; DeleteDefaultCNO(Inputs, Outputs); break; case "MergeOrder": iReturn = CancelOperation; MergeOrder(Inputs, Outputs); break; } } catch(e) { if (cReturn == cOK) { cReturn == cNOTOK; } oApp.Trace("Service_PreInvokeMethod: " + e.toString()); oApp.RaiseErrorText(e.toString()); } finally { Outputs.SetProperty("Return Value", cReturn); oApp = null; } return (iReturn); }

Add Order Template SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Add Order Template SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Add Order Template SCM
isRecord
function isRecord(oBC) { var bBack = true; try { var sId = oBC.GetFieldValue("Id"); } catch(e) { bBack = false; } return (bBack); }

Add Order Template SCM
isRecord
function isRecord(oBC) { var bBack = true; try { var sId = oBC.GetFieldValue("Id"); } catch(e) { bBack = false; } return (bBack); }

Address BS SCM
(declarations)
var oApp:Application; var isTraceON;

Address BS SCM
(declarations)
var oApp:Application; var isTraceON;

Address BS SCM
CancelActivities
/******************************************************* ** Name: CancelActivities ** Created: 02.12.2008 ** Created By: Javier Amor ** Description: This method looks if there are opened activities for a Service Request and if exists, they ** are set to Closed, because a Service Request with Opened activities cannot be submitted. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CancelActivities(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOAccount; var BCAction; var strSRId; try{ //Get the id of the SR where the activities are linked to. strSRId = Inputs.GetProperty("SRId"); BOAccount = TheApplication().GetBusObject("Account"); BCAction = BOAccount.GetBusComp("Action"); //Query for opened activities linked to the SR BCAction.SetViewMode(AllView); BCAction.ClearToQuery(); BCAction.SetSearchSpec("Activity SR Id",strSRId); BCAction.SetSearchSpec("Status",TheApplication().InvokeMethod("LookupValue","EVENT_STATUS","Open")); BCAction.SetSearchSpec("Type", "Address Validation Failed"); BCAction.ExecuteQuery(ForwardOnly); //If exists, they are closed if(BCAction.FirstRecord()) { BCAction.SetFieldValue("Status", TheApplication().InvokeMethod("LookupValue","EVENT_STATUS","Done")); BCAction.WriteRecord(); BCAction.NextRecord(); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strSRId = null; BCAction = null; BOAccount = null; } }

Address BS SCM
CancelActivities
/******************************************************* ** Name: CancelActivities ** Created: 02.12.2008 ** Created By: Javier Amor ** Description: This method looks if there are opened activities for a Service Request and if exists, they ** are set to Closed, because a Service Request with Opened activities cannot be submitted. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CancelActivities(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOAccount; var BCAction; var strSRId; try{ //Get the id of the SR where the activities are linked to. strSRId = Inputs.GetProperty("SRId"); BOAccount = TheApplication().GetBusObject("Account"); BCAction = BOAccount.GetBusComp("Action"); //Query for opened activities linked to the SR BCAction.SetViewMode(AllView); BCAction.ClearToQuery(); BCAction.SetSearchSpec("Activity SR Id",strSRId); BCAction.SetSearchSpec("Status",TheApplication().InvokeMethod("LookupValue","EVENT_STATUS","Open")); BCAction.SetSearchSpec("Type", "Address Validation Failed"); BCAction.ExecuteQuery(ForwardOnly); //If exists, they are closed if(BCAction.FirstRecord()) { BCAction.SetFieldValue("Status", TheApplication().InvokeMethod("LookupValue","EVENT_STATUS","Done")); BCAction.WriteRecord(); BCAction.NextRecord(); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strSRId = null; BCAction = null; BOAccount = null; } }

Address BS SCM
CheckFloorAppartment
/******************************************************* ** Name: CheckFloorAppartment ** Created: 15.02.2010 ** Created By: TGDDOPA1 ** Description: This method checks if floor and appartment has only numbers. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CheckFloorAppartment(Inputs,&Outputs) { var strFloor= Inputs.GetProperty("Floor"); var strAppart = Inputs.GetProperty("Appart"); var sF; var sA; try { if (strFloor != null && strFloor != "") { sF = isNaN(strFloor); //Issue 19095 TGDBEJA6 09.04.2010 Avoid decimal number// //if(strFloor.length > 2 || sF == true) if(strFloor.length > 2 || sF == true || Clib.strrchr(strFloor, ".") != null) { // TheApplication().RaiseError("X_INVALID_FLOOR_LENGTH_SCM"); Outputs.SetProperty("Error", "TRUE"); return Outputs; } } if (strAppart != null && strAppart != "") { sA= isNaN(strAppart); //Issue 19095 TGDBEJA6 09.04.2010 Avoid decimal number// //if(strAppart.length > 4 || sA == true) if(strAppart.length > 4 || sA == true || Clib.strrchr(strAppart, ".") != null) { // TheApplication().RaiseError("X_INVALID_APPART_LENGTH_SCM"); Outputs.SetProperty("Error", "TRUE"); return Outputs; } } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { sF = null; sA = null; strFloor = null; strAppart= null; } }

Address BS SCM
CheckFloorAppartment
/******************************************************* ** Name: CheckFloorAppartment ** Created: 15.02.2010 ** Created By: TGDDOPA1 ** Description: This method checks if floor and appartment has only numbers. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CheckFloorAppartment(Inputs,&Outputs) { var strFloor= Inputs.GetProperty("Floor"); var strAppart = Inputs.GetProperty("Appart"); var sF; var sA; try { if (strFloor != null && strFloor != "") { sF = isNaN(strFloor); //Issue 19095 TGDBEJA6 09.04.2010 Avoid decimal number// //if(strFloor.length > 2 || sF == true) if(strFloor.length > 2 || sF == true || Clib.strrchr(strFloor, ".") != null) { // TheApplication().RaiseError("X_INVALID_FLOOR_LENGTH_SCM"); Outputs.SetProperty("Error", "TRUE"); return Outputs; } } if (strAppart != null && strAppart != "") { sA= isNaN(strAppart); //Issue 19095 TGDBEJA6 09.04.2010 Avoid decimal number// //if(strAppart.length > 4 || sA == true) if(strAppart.length > 4 || sA == true || Clib.strrchr(strAppart, ".") != null) { // TheApplication().RaiseError("X_INVALID_APPART_LENGTH_SCM"); Outputs.SetProperty("Error", "TRUE"); return Outputs; } } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { sF = null; sA = null; strFloor = null; strAppart= null; } }

Address BS SCM
CheckOverlappingDates
/******************************************************* ** Name: CheckOverlapping ** Created: 05.11.2008 ** Created By: Javier Amor ** Description: This method checks the overlapping of an address just before is saved with the others related to ** the same account and entity. This overlapping compares the address which is trying to be saved to another ** of the same role, with status Initial or Scheduled, related to the same entity (Account,BP or Contract). ** This method is the exactly the same script which is in the PreWriteRecord of the Address SCM Business Component ** but modified to the new three BC for addresses. This method is not invoked for addresses with role Default. ** Any script which is no longer necessary has been removed. ** Some fields are different from a BC to another so depending on the entity some operations are performed in ** different way. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 07.05.2009 ** Changed By: Javier Amor ** Description: Improved script to allow End Dates empty.It is not possible to convert an empty date to ** a date format.Most of old scripting has been removed and changed to a similar algorithm ** but including when end date is null. ** ** Modification 21.09.2010 tgdlabr1 Added LookupMessage X_ADDRESS_NEEDS_START_DATE_SCM ** Modification 01.12.2010 tzhstal2 New check for Addresses with same role and same start date (Defect 31915) ** Modification 04.04.2011 tzhstal2 Check for Addresses with same role and same start date changed to take into account just scheduled addresses (Defect 31915) ******************************************************/ function CheckOverlappingDates(Inputs,Outputs) { var bo; var bcAddressSCM = ""; var datStartDate; var datEndDate = ""; var datOldStartDate; var datOldEndDate; var strOldStatus; var strOldStartDate; var strOldEndDate; var intReturn; var strId; var strAddressStatus; var strAddressType; var strAccountId; var strStartDate; var strEndDate; var blIsAddressSCMRecord; var iCheck; var strEntity; var strParentId; var bcAccount; var isDefault=false; var objBOSR: BusObject; var objBCSR: BusComp; var strSAAddressId = ""; try{ // if (isTraceON) oApp.Trace("Business Service:Address BS SCM. Method Invoked:CheckOverlappingDates"); //get input parameter entity strEntity = Inputs.GetProperty("Entity"); strAddressType = Inputs.GetProperty("Address Role"); strId = Inputs.GetProperty("Address Id"); strAddressStatus = Inputs.GetProperty("Address Status"); strStartDate = Inputs.GetProperty("Start Date"); strEndDate = Inputs.GetProperty("End Date"); strParentId = Inputs.GetProperty("Parent Id"); strAccountId = Inputs.GetProperty("Account Id"); //SCM 2009.07.02 TGDAMJA1. Only active, scheduled and initial addresses must be checked. if(strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Initial") || strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Scheduled") || strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Active")) { //Validation: Start date cannot be null if(strStartDate == "") { if (isTraceON) oApp.Trace("Address BS SCM: CheckOverlappingDates --> Error: Start Date is null"); oApp.RaiseError("X_ADDRESS_NEEDS_START_DATE_SCM"); } datStartDate = new Date(strStartDate); datStartDate.setHours(0,0,0,0); Clib.strftime(strStartDate, "%m/%d/%Y", datStartDate); // Check if startdate is greater than enddate if(strEndDate != "") { datEndDate = new Date(strEndDate); datEndDate.setHours(0,0,0,0); //SCM 2009.02.06 TGDAMJA1. Changed to make possible to inactivate address the same day they were //created. Necessary for GAIA to update fields. //if(datStartDate.getTime() >= datEndDate.getTime()) if(datStartDate.getTime() > datEndDate.getTime()) { if (isTraceON) oApp.Trace("Address B

Address BS SCM
CheckOverlappingDates
/******************************************************* ** Name: CheckOverlapping ** Created: 05.11.2008 ** Created By: Javier Amor ** Description: This method checks the overlapping of an address just before is saved with the others related to ** the same account and entity. This overlapping compares the address which is trying to be saved to another ** of the same role, with status Initial or Scheduled, related to the same entity (Account,BP or Contract). ** This method is the exactly the same script which is in the PreWriteRecord of the Address SCM Business Component ** but modified to the new three BC for addresses. This method is not invoked for addresses with role Default. ** Any script which is no longer necessary has been removed. ** Some fields are different from a BC to another so depending on the entity some operations are performed in ** different way. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 07.05.2009 ** Changed By: Javier Amor ** Description: Improved script to allow End Dates empty.It is not possible to convert an empty date to ** a date format.Most of old scripting has been removed and changed to a similar algorithm ** but including when end date is null. ** ** Modification 21.09.2010 tgdlabr1 Added LookupMessage X_ADDRESS_NEEDS_START_DATE_SCM ** Modification 01.12.2010 tzhstal2 New check for Addresses with same role and same start date (Defect 31915) ** Modification 04.04.2011 tzhstal2 Check for Addresses with same role and same start date changed to take into account just scheduled addresses (Defect 31915) ******************************************************/ function CheckOverlappingDates(Inputs,Outputs) { var bo; var bcAddressSCM = ""; var datStartDate; var datEndDate = ""; var datOldStartDate; var datOldEndDate; var strOldStatus; var strOldStartDate; var strOldEndDate; var intReturn; var strId; var strAddressStatus; var strAddressType; var strAccountId; var strStartDate; var strEndDate; var blIsAddressSCMRecord; var iCheck; var strEntity; var strParentId; var bcAccount; var isDefault=false; var objBOSR: BusObject; var objBCSR: BusComp; var strSAAddressId = ""; try{ // if (isTraceON) oApp.Trace("Business Service:Address BS SCM. Method Invoked:CheckOverlappingDates"); //get input parameter entity strEntity = Inputs.GetProperty("Entity"); strAddressType = Inputs.GetProperty("Address Role"); strId = Inputs.GetProperty("Address Id"); strAddressStatus = Inputs.GetProperty("Address Status"); strStartDate = Inputs.GetProperty("Start Date"); strEndDate = Inputs.GetProperty("End Date"); strParentId = Inputs.GetProperty("Parent Id"); strAccountId = Inputs.GetProperty("Account Id"); //SCM 2009.07.02 TGDAMJA1. Only active, scheduled and initial addresses must be checked. if(strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Initial") || strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Scheduled") || strAddressStatus == TheApplication().InvokeMethod("LookupValue","ACCT_ADD_TYPE","Active")) { //Validation: Start date cannot be null if(strStartDate == "") { if (isTraceON) oApp.Trace("Address BS SCM: CheckOverlappingDates --> Error: Start Date is null"); oApp.RaiseError("X_ADDRESS_NEEDS_START_DATE_SCM"); } datStartDate = new Date(strStartDate); datStartDate.setHours(0,0,0,0); Clib.strftime(strStartDate, "%m/%d/%Y", datStartDate); // Check if startdate is greater than enddate if(strEndDate != "") { datEndDate = new Date(strEndDate); datEndDate.setHours(0,0,0,0); //SCM 2009.02.06 TGDAMJA1. Changed to make possible to inactivate address the same day they were //created. Necessary for GAIA to update fields. //if(datStartDate.getTime() >= datEndDate.getTime()) if(datStartDate.getTime() > datEndDate.getTime()) { if (isTraceON) oApp.Trace("Address B

Address BS SCM
CountRelatedAddresses
/******************************************************* ** Name: CountRelatedAddresses ** Created: 04.02.2011 ** Created By: Alejandro Strickler ** Description: This method gets the count of addresses in the usage (intermediate) address tables related to a specific basic address in S_ADDR_PER ******************************************************/ function CountRelatedAddresses(Inputs,Outputs) { var bo:BusObject; var bcAddressUsage:BusComp; var totalRelatedAddresses = 0; var arrBcAddressUsage:Array = new Array(); var strAddressId; //Initialize array with bc names arrBcAddressUsage[0] = "Contract Address Usage Light SCM"; arrBcAddressUsage[1] = "Billing Profile Address Usage Light SCM"; arrBcAddressUsage[2] = "Account Address Usage Find SCM"; arrBcAddressUsage[3] = "Location Address Usage AIP SCM"; try { //get input parameter entity strAddressId = Inputs.GetProperty("Address Id"); bo = TheApplication().GetBusObject("Normalization BO SCM"); for (var i = 0 ; i < arrBcAddressUsage.length; i++) { bcAddressUsage = bo.GetBusComp(arrBcAddressUsage[i]); // Query for Account Usage addresses related to the given Address Id bcAddressUsage.SetViewMode(AllView); bcAddressUsage.ClearToQuery(); bcAddressUsage.SetSearchSpec("Address Id SCM", strAddressId); bcAddressUsage.ExecuteQuery(ForwardOnly); // oApp.Trace("BS:Address BS SCM.CountRelatedAddresses - BC: " + arrBcAddressUsage[i] + ", RecordCount: " + bcAddressUsage.CountRecords() + ", with Address Id:" + strAddressId); totalRelatedAddresses += bcAddressUsage.CountRecords(); } } catch (e) { totalRelatedAddresses = -1; TheApplication().RaiseErrorText(e.toString()); } finally { Outputs.SetProperty("RelatedRecordCount", totalRelatedAddresses); arrBcAddressUsage = null; bcAddressUsage = null; bo = null; } }

Address BS SCM
CountRelatedAddresses
/******************************************************* ** Name: CountRelatedAddresses ** Created: 04.02.2011 ** Created By: Alejandro Strickler ** Description: This method gets the count of addresses in the usage (intermediate) address tables related to a specific basic address in S_ADDR_PER ******************************************************/ function CountRelatedAddresses(Inputs,Outputs) { var bo:BusObject; var bcAddressUsage:BusComp; var totalRelatedAddresses = 0; var arrBcAddressUsage:Array = new Array(); var strAddressId; //Initialize array with bc names arrBcAddressUsage[0] = "Contract Address Usage Light SCM"; arrBcAddressUsage[1] = "Billing Profile Address Usage Light SCM"; arrBcAddressUsage[2] = "Account Address Usage Find SCM"; arrBcAddressUsage[3] = "Location Address Usage AIP SCM"; try { //get input parameter entity strAddressId = Inputs.GetProperty("Address Id"); bo = TheApplication().GetBusObject("Normalization BO SCM"); for (var i = 0 ; i < arrBcAddressUsage.length; i++) { bcAddressUsage = bo.GetBusComp(arrBcAddressUsage[i]); // Query for Account Usage addresses related to the given Address Id bcAddressUsage.SetViewMode(AllView); bcAddressUsage.ClearToQuery(); bcAddressUsage.SetSearchSpec("Address Id SCM", strAddressId); bcAddressUsage.ExecuteQuery(ForwardOnly); // oApp.Trace("BS:Address BS SCM.CountRelatedAddresses - BC: " + arrBcAddressUsage[i] + ", RecordCount: " + bcAddressUsage.CountRecords() + ", with Address Id:" + strAddressId); totalRelatedAddresses += bcAddressUsage.CountRecords(); } } catch (e) { totalRelatedAddresses = -1; TheApplication().RaiseErrorText(e.toString()); } finally { Outputs.SetProperty("RelatedRecordCount", totalRelatedAddresses); arrBcAddressUsage = null; bcAddressUsage = null; bo = null; } }

Address BS SCM
GenerateSearchAddresses
function GenerateSearchAddresses() { var boAddress:BusObject; var bcAddress:BusComp; var strResult:String = ""; var strSearch:String = ""; var searchCity:String = ""; var searchStreet:String = ""; var searchHousename:String = ""; var searchRegion:String = ""; var inPs:PropertySet; var outPs:PropertySet; var outPs2:PropertySet; var nextOk = true; var forward = true; var move = true; try { boAddress = oApp.GetBusObject("Account Address SCM"); bcAddress = boAddress.GetBusComp("Account Address SCM"); // bcAddress.ActivateField("City SCM"); bcAddress.ActivateField("Street Address SCM"); bcAddress.ActivateField("Search Street SCM"); bcAddress.ActivateField("Search Full Street SCM"); // bcAddress.ActivateField("Location Supplement SCM"); // bcAddress.SetSearchExpr("[Search City SCM] = ''"); // bcAddress.ActivateField("Residence Description SCM"); bcAddress.SetViewMode(AllView); bcAddress.ClearToQuery(); bcAddress.ExecuteQuery(ForwardBackward); // TheApplication().Trace("GenerateSearchAddresses -> Records found: " + bcAddress.CountRecords()); do { if (bcAddress.GetFieldValue("Search Street SCM") == "" || bcAddress.GetFieldValue("Search Full Street SCM") == "") { inPs = TheApplication().NewPropertySet(); outPs = TheApplication().NewPropertySet(); outPs2 = TheApplication().NewPropertySet(); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("City SCM")); // NormalizeSearchString(inPs, outPs); // searchCity = outPs.GetProperty("NormalizedString"); inPs.SetProperty("InStr", bcAddress.GetFieldValue("Street Address SCM")); NormalizeSearchString(inPs, outPs); searchStreet = outPs.GetProperty("NormalizedString"); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("Residence Description SCM")); // NormalizeSearchString(inPs, outPs); // searchHousename = outPs.GetProperty("NormalizedString"); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("Location Supplement SCM")); // NormalizeSearchString(inPs, outPs); // searchRegion = outPs.GetProperty("NormalizedString"); // bcAddress.SetFieldValue("Search City SCM", searchCity); bcAddress.SetFieldValue("Search Street SCM", searchStreet); // bcAddress.SetFieldValue("Search Region SCM", searchRegion); // bcAddress.SetFieldValue("Search Residence Description SCM", searchHousename); // TheApplication().Trace("GenerateSearchAddresses -> Record before Write: " + bcAddress.GetFieldValue("Id")); NormalizeFullSearchString(inPs, outPs2); searchStreet = outPs2.GetProperty("NormalizedString"); bcAddress.SetFieldValue("Search Full Street SCM", searchStreet); bcAddress.WriteRecord(); } try { if (forward) { nextOk = bcAddress.NextRecord(); } else { move = bcAddress.PreviousRecord(); } } catch (e) { if (forward) { bcAddress.LastRecord(); forward = false; } else { move = false; } } } while (move); } catch (e) { throw(e); } finally { inPs = null; outPs = null; outPs2 = null; bcAddress = null; boAddress = null; } }

Address BS SCM
GenerateSearchAddresses
function GenerateSearchAddresses() { var boAddress:BusObject; var bcAddress:BusComp; var strResult:String = ""; var strSearch:String = ""; var searchCity:String = ""; var searchStreet:String = ""; var searchHousename:String = ""; var searchRegion:String = ""; var inPs:PropertySet; var outPs:PropertySet; var outPs2:PropertySet; var nextOk = true; var forward = true; var move = true; try { boAddress = oApp.GetBusObject("Account Address SCM"); bcAddress = boAddress.GetBusComp("Account Address SCM"); // bcAddress.ActivateField("City SCM"); bcAddress.ActivateField("Street Address SCM"); bcAddress.ActivateField("Search Street SCM"); bcAddress.ActivateField("Search Full Street SCM"); // bcAddress.ActivateField("Location Supplement SCM"); // bcAddress.SetSearchExpr("[Search City SCM] = ''"); // bcAddress.ActivateField("Residence Description SCM"); bcAddress.SetViewMode(AllView); bcAddress.ClearToQuery(); bcAddress.ExecuteQuery(ForwardBackward); // TheApplication().Trace("GenerateSearchAddresses -> Records found: " + bcAddress.CountRecords()); do { if (bcAddress.GetFieldValue("Search Street SCM") == "" || bcAddress.GetFieldValue("Search Full Street SCM") == "") { inPs = TheApplication().NewPropertySet(); outPs = TheApplication().NewPropertySet(); outPs2 = TheApplication().NewPropertySet(); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("City SCM")); // NormalizeSearchString(inPs, outPs); // searchCity = outPs.GetProperty("NormalizedString"); inPs.SetProperty("InStr", bcAddress.GetFieldValue("Street Address SCM")); NormalizeSearchString(inPs, outPs); searchStreet = outPs.GetProperty("NormalizedString"); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("Residence Description SCM")); // NormalizeSearchString(inPs, outPs); // searchHousename = outPs.GetProperty("NormalizedString"); // inPs.SetProperty("InStr", bcAddress.GetFieldValue("Location Supplement SCM")); // NormalizeSearchString(inPs, outPs); // searchRegion = outPs.GetProperty("NormalizedString"); // bcAddress.SetFieldValue("Search City SCM", searchCity); bcAddress.SetFieldValue("Search Street SCM", searchStreet); // bcAddress.SetFieldValue("Search Region SCM", searchRegion); // bcAddress.SetFieldValue("Search Residence Description SCM", searchHousename); // TheApplication().Trace("GenerateSearchAddresses -> Record before Write: " + bcAddress.GetFieldValue("Id")); NormalizeFullSearchString(inPs, outPs2); searchStreet = outPs2.GetProperty("NormalizedString"); bcAddress.SetFieldValue("Search Full Street SCM", searchStreet); bcAddress.WriteRecord(); } try { if (forward) { nextOk = bcAddress.NextRecord(); } else { move = bcAddress.PreviousRecord(); } } catch (e) { if (forward) { bcAddress.LastRecord(); forward = false; } else { move = false; } } } while (move); } catch (e) { throw(e); } finally { inPs = null; outPs = null; outPs2 = null; bcAddress = null; boAddress = null; } }

Address BS SCM
LoadAddressData
/******************************************************* ** Name: LoadAddressData ** Created: 24.03.2011 ** Created By: Alejandro Strickler ** Description: This method moves address information from a BC to an Property Set that will be used as result in the calling Method -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function LoadAddressData(bcAddress:BusComp, addressRecord:PropertySet) { try { if (bcAddress != null && addressRecord != null) { addressRecord.SetType("Address"); addressRecord.SetProperty("City denormalized SCM", bcAddress.GetFieldValue("City SCM")); addressRecord.SetProperty("Street Address denormalized SCM", bcAddress.GetFieldValue("Street Address SCM")); addressRecord.SetProperty("Country denormalized SCM", bcAddress.GetFieldValue("Country Lic SCM")); addressRecord.SetProperty("Language Code GAIA denormalized SCM", bcAddress.GetFieldValue("Language Code SCM")); addressRecord.SetProperty("Location Supplement denormalized SCM", bcAddress.GetFieldValue("Location Supplement SCM")); addressRecord.SetProperty("PO Box denormalized SCM", bcAddress.GetFieldValue("PO Box SCM")); addressRecord.SetProperty("Postal Code denormalized SCM", bcAddress.GetFieldValue("Postal Code SCM")); addressRecord.SetProperty("Postal Code Extension denormalized SCM", bcAddress.GetFieldValue("Postal Code Extension SCM")); addressRecord.SetProperty("Residence Description denormalized SCM", bcAddress.GetFieldValue("Residence Description SCM")); addressRecord.SetProperty("Street Nr. denormalized SCM", bcAddress.GetFieldValue("Street Number SCM")); addressRecord.SetProperty("Location Id denormalized SCM", bcAddress.GetFieldValue("Location Id SCM")); addressRecord.SetProperty("Integration Id denormalized SCM", bcAddress.GetFieldValue("Address Name")); addressRecord.SetProperty("Street Id denormalized SCM", bcAddress.GetFieldValue("Street Id SCM")); addressRecord.SetProperty("Validation Status denormalized SCM", bcAddress.GetFieldValue("Validation Status SCM")); addressRecord.SetProperty("Supplier Code denormalized SCM", bcAddress.GetFieldValue("Supplier Code SCM")); addressRecord.SetProperty("Gaia Master Timestamp denormalized SCM", bcAddress.GetFieldValue("Gaia Master Timestamp SCM")); } } catch (e) { trc("LoadAddressData ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
LoadAddressData
/******************************************************* ** Name: LoadAddressData ** Created: 24.03.2011 ** Created By: Alejandro Strickler ** Description: This method moves address information from a BC to an Property Set that will be used as result in the calling Method -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function LoadAddressData(bcAddress:BusComp, addressRecord:PropertySet) { try { if (bcAddress != null && addressRecord != null) { addressRecord.SetType("Address"); addressRecord.SetProperty("City denormalized SCM", bcAddress.GetFieldValue("City SCM")); addressRecord.SetProperty("Street Address denormalized SCM", bcAddress.GetFieldValue("Street Address SCM")); addressRecord.SetProperty("Country denormalized SCM", bcAddress.GetFieldValue("Country Lic SCM")); addressRecord.SetProperty("Language Code GAIA denormalized SCM", bcAddress.GetFieldValue("Language Code SCM")); addressRecord.SetProperty("Location Supplement denormalized SCM", bcAddress.GetFieldValue("Location Supplement SCM")); addressRecord.SetProperty("PO Box denormalized SCM", bcAddress.GetFieldValue("PO Box SCM")); addressRecord.SetProperty("Postal Code denormalized SCM", bcAddress.GetFieldValue("Postal Code SCM")); addressRecord.SetProperty("Postal Code Extension denormalized SCM", bcAddress.GetFieldValue("Postal Code Extension SCM")); addressRecord.SetProperty("Residence Description denormalized SCM", bcAddress.GetFieldValue("Residence Description SCM")); addressRecord.SetProperty("Street Nr. denormalized SCM", bcAddress.GetFieldValue("Street Number SCM")); addressRecord.SetProperty("Location Id denormalized SCM", bcAddress.GetFieldValue("Location Id SCM")); addressRecord.SetProperty("Integration Id denormalized SCM", bcAddress.GetFieldValue("Address Name")); addressRecord.SetProperty("Street Id denormalized SCM", bcAddress.GetFieldValue("Street Id SCM")); addressRecord.SetProperty("Validation Status denormalized SCM", bcAddress.GetFieldValue("Validation Status SCM")); addressRecord.SetProperty("Supplier Code denormalized SCM", bcAddress.GetFieldValue("Supplier Code SCM")); addressRecord.SetProperty("Gaia Master Timestamp denormalized SCM", bcAddress.GetFieldValue("Gaia Master Timestamp SCM")); } } catch (e) { trc("LoadAddressData ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
NormalizeFullSearchString
/******************************************************* ** Name: NormalizeSearchString ** Created: 15.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeFullSearchString(Inputs, Outputs) { var inStr:String = ""; var newStr:String = ""; var language:String = ""; try { inStr = Inputs.GetProperty("InStr"); if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = NormalizeSearchChars(inStr); } } catch (e) { newStr = ""; throw(e); } Outputs.SetProperty("NormalizedString",newStr); }

Address BS SCM
NormalizeFullSearchString
/******************************************************* ** Name: NormalizeSearchString ** Created: 15.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeFullSearchString(Inputs, Outputs) { var inStr:String = ""; var newStr:String = ""; var language:String = ""; try { inStr = Inputs.GetProperty("InStr"); if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = NormalizeSearchChars(inStr); } } catch (e) { newStr = ""; throw(e); } Outputs.SetProperty("NormalizedString",newStr); }

Address BS SCM
NormalizeSearchChars
/******************************************************* ** Name: NormalizeSearchChars ** Created: 16.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of character rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** ** New rules working in this Script (not present in the SQL Version: ** ñ ==> N ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchChars(inStr:String) { var newStr:String = ""; if (isTraceON) oApp.Trace("NormalizeSearchChars-> Enter with : " + inStr); try { if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = inStr.replace(/À|Á|Ã|Â|Å|Æ|à|á|â|ã|å|æ/g, "A"); newStr = newStr.replace(/Ä|ä/g, "AE"); newStr = newStr.replace(/Ç|ç/g, "C"); newStr = newStr.replace(/È|É|Ê|Ë|è|é|ê|ë/g, "E"); newStr = newStr.replace(/Ì|Í|Î|Ï|ì|í|î|ï|Ý|ý|ÿ|Y|j|y|J/g, "I"); newStr = newStr.replace(/Ò|Ó|Ô|Õ|ò|ó|ô|õ/g, "O"); newStr = newStr.replace(/Ö|ö/g, "OE"); newStr = newStr.replace(/Ù|Ú|Û|Ü|ù|ú|û|ü/g, "U"); newStr = newStr.replace(/Ñ|ñ/g, "N"); newStr = newStr.replace(/ß/g, "SS"); // newStr = newStr.replace(/\*/g, "%"); newStr = newStr.replace(/£|"|'|[.]|-|,|;|:|_|!|?|=|+/g, ""); newStr = newStr.replace(/\^|&|{|}|\(|\)|\[|\]/g, ""); newStr = newStr.replace(/°|§|\$|#|@|¦|\|©|´|`|ª|¶|¼|¤|º|¨/g, ""); newStr = newStr.replace(/\~|°|\/|\\|¢|\|/g, ""); newStr = newStr.replace(/[ ]+/g, ""); newStr = newStr.toUpperCase(); if (isTraceON) oApp.Trace("NormalizeSearchChars-> All ok :" + newStr); } } catch (e) { newStr = ""; throw(e); } return(newStr); }

Address BS SCM
NormalizeSearchChars
/******************************************************* ** Name: NormalizeSearchChars ** Created: 16.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of character rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** ** New rules working in this Script (not present in the SQL Version: ** ñ ==> N ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchChars(inStr:String) { var newStr:String = ""; if (isTraceON) oApp.Trace("NormalizeSearchChars-> Enter with : " + inStr); try { if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = inStr.replace(/À|Á|Ã|Â|Å|Æ|à|á|â|ã|å|æ/g, "A"); newStr = newStr.replace(/Ä|ä/g, "AE"); newStr = newStr.replace(/Ç|ç/g, "C"); newStr = newStr.replace(/È|É|Ê|Ë|è|é|ê|ë/g, "E"); newStr = newStr.replace(/Ì|Í|Î|Ï|ì|í|î|ï|Ý|ý|ÿ|Y|j|y|J/g, "I"); newStr = newStr.replace(/Ò|Ó|Ô|Õ|ò|ó|ô|õ/g, "O"); newStr = newStr.replace(/Ö|ö/g, "OE"); newStr = newStr.replace(/Ù|Ú|Û|Ü|ù|ú|û|ü/g, "U"); newStr = newStr.replace(/Ñ|ñ/g, "N"); newStr = newStr.replace(/ß/g, "SS"); // newStr = newStr.replace(/\*/g, "%"); newStr = newStr.replace(/£|"|'|[.]|-|,|;|:|_|!|?|=|+/g, ""); newStr = newStr.replace(/\^|&|{|}|\(|\)|\[|\]/g, ""); newStr = newStr.replace(/°|§|\$|#|@|¦|\|©|´|`|ª|¶|¼|¤|º|¨/g, ""); newStr = newStr.replace(/\~|°|\/|\\|¢|\|/g, ""); newStr = newStr.replace(/[ ]+/g, ""); newStr = newStr.toUpperCase(); if (isTraceON) oApp.Trace("NormalizeSearchChars-> All ok :" + newStr); } } catch (e) { newStr = ""; throw(e); } return(newStr); }

Address BS SCM
NormalizeSearchString
/******************************************************* ** Name: NormalizeSearchString ** Created: 15.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchString(Inputs, Outputs) { var inStr:String = ""; var newStr:String = ""; var language:String = ""; try { inStr = Inputs.GetProperty("InStr"); if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = NormalizeSearchWords(inStr); newStr = NormalizeSearchChars(newStr); } } catch (e) { newStr = ""; throw(e); } Outputs.SetProperty("NormalizedString",newStr); }

Address BS SCM
NormalizeSearchString
/******************************************************* ** Name: NormalizeSearchString ** Created: 15.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of rules to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchString(Inputs, Outputs) { var inStr:String = ""; var newStr:String = ""; var language:String = ""; try { inStr = Inputs.GetProperty("InStr"); if (inStr == null || inStr.length == 0) { newStr = ""; } else { newStr = NormalizeSearchWords(inStr); newStr = NormalizeSearchChars(newStr); } } catch (e) { newStr = ""; throw(e); } Outputs.SetProperty("NormalizedString",newStr); }

Address BS SCM
NormalizeSearchWords
/******************************************************* ** Name: NormalizeSearchWords ** Created: 16.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of word rules (based on table CX_SPECIALWORDS to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchWords(inStr:String) { var strOutput:String = ""; var strInput:String = ""; var boSpecialWords:BusObject; var bcSpecialWords:BusComp; var strResult:String = ""; var strSearch:String = ""; var arrWords:Array; var searchLen = 0; var matchFound = false; var posBl = -1; var posSep = -1; var posSWB = -1; var c; if (isTraceON) oApp.Trace("NormalizeSearchWords-> Enter with : " + inStr); try { // Create needed bo and bc for accessing the mapping table "special words" boSpecialWords = oApp.GetBusObject("Address Special Word SCM"); bcSpecialWords = boSpecialWords.GetBusComp("Address Special Word SCM"); if (inStr == null || inStr.length == 0 || inStr == "*") { strResult = ""; } else { strResult = TrimAll(inStr); if (strResult.indexOf("*") == -1) { strSearch = strResult.toUpperCase(); bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Input SCM] = \"" + strSearch + "\" AND [Letter Style SCM] = '0'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { strResult = ""; } } if (strResult.length > 0) { // Search former words as special words taking even smaller group of words, supposing the last word will never be found // If a word combination could be recognized as sepcial word, remove ti from the original string // Former special words have letter style = 0 if (strResult.indexOf(" ") > 0 || strResult.indexOf("'") > 0 || strResult.indexOf("*")) { posSep = strResult.length - 1; while (posSep > 0 && !matchFound) { c = strResult.charAt(posSep); if (c == " " || c == "'" || c == "*") { if (c == " " || c == "*") strSearch = TrimAll(strResult.substring(0, posSep)).toUpperCase(); else if (c == "'") strSearch = TrimAll(strResult.substring(0, posSep+1)).toUpperCase(); // Search special words bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Input SCM] = \"" + strSearch + "\" AND [Letter Style SCM] = '0'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { strInput = bcSpecialWords.GetFieldValue("Input SCM"); posSWB = inStr.toUpperCase().indexOf(strSearch); if (posSWB >= 0) { strResult = inStr.substring(0, posSWB) + inStr.substring(posSWB + strSearch.length, inStr.length); matchFound = true; } } } posSep--; } } // Try to found a special word that matches the tail of the original string, If so, remove this tail // Tail special words have letter style = 1 matchFound = false; bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Letter Style SCM] = '1'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { do { strInput = bcSpecialWords.GetFieldValue("Input SCM"); strSearch = strResult.substring(strResult.length - strInput.length, strResult.length); // TGDHAKA8 2011-05-10: Search with Uppercase strSearch = strSearch.toUpperCase(); if (strInput.localeCompare(strSearch) == 0) { strRes

Address BS SCM
NormalizeSearchWords
/******************************************************* ** Name: NormalizeSearchWords ** Created: 16.03.2011 ** Created By: Alejandro Strickler (Based on a PL-SQL script from Fattah Shahin ) ** Description: This method applies a group of word rules (based on table CX_SPECIALWORDS to a given input string, ** to generate a normalized version of the string than can be used for accurate searches ** ** ** ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function NormalizeSearchWords(inStr:String) { var strOutput:String = ""; var strInput:String = ""; var boSpecialWords:BusObject; var bcSpecialWords:BusComp; var strResult:String = ""; var strSearch:String = ""; var arrWords:Array; var searchLen = 0; var matchFound = false; var posBl = -1; var posSep = -1; var posSWB = -1; var c; if (isTraceON) oApp.Trace("NormalizeSearchWords-> Enter with : " + inStr); try { // Create needed bo and bc for accessing the mapping table "special words" boSpecialWords = oApp.GetBusObject("Address Special Word SCM"); bcSpecialWords = boSpecialWords.GetBusComp("Address Special Word SCM"); if (inStr == null || inStr.length == 0 || inStr == "*") { strResult = ""; } else { strResult = TrimAll(inStr); if (strResult.indexOf("*") == -1) { strSearch = strResult.toUpperCase(); bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Input SCM] = \"" + strSearch + "\" AND [Letter Style SCM] = '0'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { strResult = ""; } } if (strResult.length > 0) { // Search former words as special words taking even smaller group of words, supposing the last word will never be found // If a word combination could be recognized as sepcial word, remove ti from the original string // Former special words have letter style = 0 if (strResult.indexOf(" ") > 0 || strResult.indexOf("'") > 0 || strResult.indexOf("*")) { posSep = strResult.length - 1; while (posSep > 0 && !matchFound) { c = strResult.charAt(posSep); if (c == " " || c == "'" || c == "*") { if (c == " " || c == "*") strSearch = TrimAll(strResult.substring(0, posSep)).toUpperCase(); else if (c == "'") strSearch = TrimAll(strResult.substring(0, posSep+1)).toUpperCase(); // Search special words bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Input SCM] = \"" + strSearch + "\" AND [Letter Style SCM] = '0'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { strInput = bcSpecialWords.GetFieldValue("Input SCM"); posSWB = inStr.toUpperCase().indexOf(strSearch); if (posSWB >= 0) { strResult = inStr.substring(0, posSWB) + inStr.substring(posSWB + strSearch.length, inStr.length); matchFound = true; } } } posSep--; } } // Try to found a special word that matches the tail of the original string, If so, remove this tail // Tail special words have letter style = 1 matchFound = false; bcSpecialWords.SetViewMode(AllView); bcSpecialWords.ClearToQuery(); bcSpecialWords.SetSearchExpr("[Letter Style SCM] = '1'"); bcSpecialWords.ExecuteQuery(ForwardOnly); if (bcSpecialWords.FirstRecord()) { do { strInput = bcSpecialWords.GetFieldValue("Input SCM"); strSearch = strResult.substring(strResult.length - strInput.length, strResult.length); // TGDHAKA8 2011-05-10: Search with Uppercase strSearch = strSearch.toUpperCase(); if (strInput.localeCompare(strSearch) == 0) { strRes

Address BS SCM
PrepareAddressPreview
/******************************************************* ** Name: PrepareAddressPreview ** Created: 28.02.2011 ** Created By: Furrer Bruno ** Description: Prepare the addresses in letter/envelope format. ** ** -------------------- Modifications --------------------- ** 29.07.2011 tgdfubr2 Blank sign eliminate when the Alt. First Name is missing(Defect 39103) ** 18.01.2012 tgdfubr2 Delete Address Supplement when the title is already empty and the address contains 7 lines(Defect 47497) ** 14.08.2012 tgdhuro9 SO 1185 Use Customer Name x SCM instead of Parent Name x SCM ** 06.12.2012 tgdfubr2 SO 1195 Eliminate the title in the address preview ******************************************************/ function PrepareAddressPreview(Inputs,Outputs) { var BOAccount; var BCAddressUsage = ""; var BCAccount; var BOLOV; var BCLOV; var strAccountId; var strAddressId; var strAddress; var strRelevantLanguage = ""; var strWork; var strLine; var strResultAddress; var filled; var k; var j; var x; var strType; var strAccountContactLastName; var strParentName2; var strName2; var strRelTypeCode; var strProfLastName; var strProfNameAdditive; var strCOName; var strAttentionOf; var strAddrSuppl; var strAddrTypeCode; var strStreetAddr; var strStreetNr; var strResidenceDesc; var strLocSuppl; var strPOBox; var strCountry; var strPostalCode; var strCity; var strLookupAddrType; var strLookupAccType; var strLookupAccSubType; var strAccSubType; try{ strLine = new Array(); //Get Input parameters strAccountId = Inputs.GetProperty("AccountId"); strAddressId = Inputs.GetProperty("AddressId"); strAddress = Inputs.GetProperty("Address"); trc("PrepareAddressPreview --> Inputparameter 1: "+strAccountId); trc("PrepareAddressPreview --> Inputparameter 2: "+strAddressId); trc("PrepareAddressPreview --> Inputparameter 3: "+strAddress); BOAccount = oApp.ActiveBusObject(); BCAccount = BOAccount.GetBusComp("Account"); //Get BusinessComponent for Address, Billing or Contract switch(strAddress) { case "Account": BCAddressUsage = BOAccount.GetBusComp("Account Address Usage SCM"); break; case "Billing": BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage SCM"); break; case "Contract": BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage SCM"); break; default: break; } if (isTraceON) { PrepareAddressPreview2(BCAccount, BCAddressUsage); } strType = BCAccount.GetFieldValue("Type"); strAccountContactLastName = BCAccount.GetFieldValue("Account Contact Last Name"); // 14.08.2012 tgdhuro9 //strParentName2 = BCAccount.GetFieldValue("Parent Name 2 SCM"); strParentName2 = BCAccount.GetFieldValue("Customer Name 2 SCM"); strName2 = BCAccount.GetFieldValue("Name 2 SCM"); strRelTypeCode = BCAddressUsage.GetFieldValue("Address Relation Type SCM"); strProfLastName = BCAddressUsage.GetFieldValue("Professional Last Name SCM"); strProfNameAdditive = BCAddressUsage.GetFieldValue("Professional Name Additive SCM"); strCOName = BCAddressUsage.GetFieldValue("CO Name SCM"); strAttentionOf = BCAddressUsage.GetFieldValue("Attention Of SCM"); strAddrSuppl = BCAddressUsage.GetFieldValue("Address Supplement SCM"); strAddrTypeCode = BCAddressUsage.GetFieldValue("Address Type Code denormalized SCM"); strStreetAddr = BCAddressUsage.GetFieldValue("Street Address denormalized SCM"); // 2012-09-12 TGDHURO9 Defect 54168 PO box addresses contraining street numbers strStreetNr = "" // to satisfy compiler if (strAddress == "Billing") { strStreetNr = BCAddressUsage.GetFieldValue("Street Number denormalized SCM"); } else { strStreetNr = BCAddressUsage.GetFieldValue("Street Nr. denormalized SCM"); } strResidenceDesc = BCAddressUsage.GetFieldValue("Residence Description denormalized SCM"); strLocSuppl = BCAddressUsage.GetFieldValue("Location Supplement denormalized SCM"); strPOBox = BCAddressUsage.GetFieldValue("PO Box denormalized SCM"); strCountry = BCAdd

Address BS SCM
PrepareAddressPreview
/******************************************************* ** Name: PrepareAddressPreview ** Created: 28.02.2011 ** Created By: Furrer Bruno ** Description: Prepare the addresses in letter/envelope format. ** ** -------------------- Modifications --------------------- ** 29.07.2011 tgdfubr2 Blank sign eliminate when the Alt. First Name is missing(Defect 39103) ** 18.01.2012 tgdfubr2 Delete Address Supplement when the title is already empty and the address contains 7 lines(Defect 47497) ** 14.08.2012 tgdhuro9 SO 1185 Use Customer Name x SCM instead of Parent Name x SCM ** 06.12.2012 tgdfubr2 SO 1195 Eliminate the title in the address preview ******************************************************/ function PrepareAddressPreview(Inputs,Outputs) { var BOAccount; var BCAddressUsage = ""; var BCAccount; var BOLOV; var BCLOV; var strAccountId; var strAddressId; var strAddress; var strRelevantLanguage = ""; var strWork; var strLine; var strResultAddress; var filled; var k; var j; var x; var strType; var strAccountContactLastName; var strParentName2; var strName2; var strRelTypeCode; var strProfLastName; var strProfNameAdditive; var strCOName; var strAttentionOf; var strAddrSuppl; var strAddrTypeCode; var strStreetAddr; var strStreetNr; var strResidenceDesc; var strLocSuppl; var strPOBox; var strCountry; var strPostalCode; var strCity; var strLookupAddrType; var strLookupAccType; var strLookupAccSubType; var strAccSubType; try{ strLine = new Array(); //Get Input parameters strAccountId = Inputs.GetProperty("AccountId"); strAddressId = Inputs.GetProperty("AddressId"); strAddress = Inputs.GetProperty("Address"); trc("PrepareAddressPreview --> Inputparameter 1: "+strAccountId); trc("PrepareAddressPreview --> Inputparameter 2: "+strAddressId); trc("PrepareAddressPreview --> Inputparameter 3: "+strAddress); BOAccount = oApp.ActiveBusObject(); BCAccount = BOAccount.GetBusComp("Account"); //Get BusinessComponent for Address, Billing or Contract switch(strAddress) { case "Account": BCAddressUsage = BOAccount.GetBusComp("Account Address Usage SCM"); break; case "Billing": BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage SCM"); break; case "Contract": BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage SCM"); break; default: break; } if (isTraceON) { PrepareAddressPreview2(BCAccount, BCAddressUsage); } strType = BCAccount.GetFieldValue("Type"); strAccountContactLastName = BCAccount.GetFieldValue("Account Contact Last Name"); // 14.08.2012 tgdhuro9 //strParentName2 = BCAccount.GetFieldValue("Parent Name 2 SCM"); strParentName2 = BCAccount.GetFieldValue("Customer Name 2 SCM"); strName2 = BCAccount.GetFieldValue("Name 2 SCM"); strRelTypeCode = BCAddressUsage.GetFieldValue("Address Relation Type SCM"); strProfLastName = BCAddressUsage.GetFieldValue("Professional Last Name SCM"); strProfNameAdditive = BCAddressUsage.GetFieldValue("Professional Name Additive SCM"); strCOName = BCAddressUsage.GetFieldValue("CO Name SCM"); strAttentionOf = BCAddressUsage.GetFieldValue("Attention Of SCM"); strAddrSuppl = BCAddressUsage.GetFieldValue("Address Supplement SCM"); strAddrTypeCode = BCAddressUsage.GetFieldValue("Address Type Code denormalized SCM"); strStreetAddr = BCAddressUsage.GetFieldValue("Street Address denormalized SCM"); // 2012-09-12 TGDHURO9 Defect 54168 PO box addresses contraining street numbers strStreetNr = "" // to satisfy compiler if (strAddress == "Billing") { strStreetNr = BCAddressUsage.GetFieldValue("Street Number denormalized SCM"); } else { strStreetNr = BCAddressUsage.GetFieldValue("Street Nr. denormalized SCM"); } strResidenceDesc = BCAddressUsage.GetFieldValue("Residence Description denormalized SCM"); strLocSuppl = BCAddressUsage.GetFieldValue("Location Supplement denormalized SCM"); strPOBox = BCAddressUsage.GetFieldValue("PO Box denormalized SCM"); strCountry = BCAdd

Address BS SCM
PrepareAddressPreview2
function PrepareAddressPreview2(bcAccount, bcAddressUsage) { try { trc("PrepareAddressPreview2"); trc2(bcAccount, "Type"); trc2(bcAccount, "Account Contact Last Name"); trc2(bcAccount, "Name 2 SCM"); trc2(bcAccount, "Account Contact M/M"); trc2(bcAccount, "Correspondence Language Code SCM"); trc2(bcAccount, "Account Contact First Name"); trc2(bcAccount, "Name 1 SCM"); trc2(bcAddressUsage, "Address Relation Type SCM"); trc2(bcAddressUsage, "Professional Last Name SCM"); trc2(bcAddressUsage, "Professional Name Additive SCM"); trc2(bcAddressUsage, "CO Name SCM"); trc2(bcAddressUsage, "Attention Of SCM"); trc2(bcAddressUsage, "Address Supplement SCM"); trc2(bcAddressUsage, "Address Type Code denormalized SCM"); trc2(bcAddressUsage, "Street Address denormalized SCM"); // 2012-09-12 TGDHURO9 Defect 54168 PO box addresses contraining street numbers if (bcAddressUsage.Name() == "Billing Profile Address Usage SCM") { trc2(bcAddressUsage, "Street Number denormalized SCM"); } else { trc2(bcAddressUsage, "Street Nr. denormalized SCM"); } trc2(bcAddressUsage, "Residence Description denormalized SCM"); trc2(bcAddressUsage, "Location Supplement denormalized SCM"); trc2(bcAddressUsage, "PO Box denormalized SCM"); trc2(bcAddressUsage, "Country denormalized SCM"); trc2(bcAddressUsage, "Postal Code denormalized SCM"); trc2(bcAddressUsage, "City denormalized SCM"); //trc2(bcAddressUsage, "Customer Sub Type SCM"); trc2(bcAccount, "Sub Type SCM"); trc2(bcAddressUsage, "Title SCM"); trc2(bcAddressUsage, "Language Account SCM"); trc2(bcAddressUsage, "Language Account LIC SCM"); trc2(bcAddressUsage, "Professional First Name SCM"); // trc2(bcAccount, "Company Name 1 SCM"); // trc2(bcAccount, "Company Name 2 SCM"); } catch (e) { //oApp.RaiseErrorText(e.toString()); } }

Address BS SCM
PrepareAddressPreview2
function PrepareAddressPreview2(bcAccount, bcAddressUsage) { try { trc("PrepareAddressPreview2"); trc2(bcAccount, "Type"); trc2(bcAccount, "Account Contact Last Name"); trc2(bcAccount, "Name 2 SCM"); trc2(bcAccount, "Account Contact M/M"); trc2(bcAccount, "Correspondence Language Code SCM"); trc2(bcAccount, "Account Contact First Name"); trc2(bcAccount, "Name 1 SCM"); trc2(bcAddressUsage, "Address Relation Type SCM"); trc2(bcAddressUsage, "Professional Last Name SCM"); trc2(bcAddressUsage, "Professional Name Additive SCM"); trc2(bcAddressUsage, "CO Name SCM"); trc2(bcAddressUsage, "Attention Of SCM"); trc2(bcAddressUsage, "Address Supplement SCM"); trc2(bcAddressUsage, "Address Type Code denormalized SCM"); trc2(bcAddressUsage, "Street Address denormalized SCM"); // 2012-09-12 TGDHURO9 Defect 54168 PO box addresses contraining street numbers if (bcAddressUsage.Name() == "Billing Profile Address Usage SCM") { trc2(bcAddressUsage, "Street Number denormalized SCM"); } else { trc2(bcAddressUsage, "Street Nr. denormalized SCM"); } trc2(bcAddressUsage, "Residence Description denormalized SCM"); trc2(bcAddressUsage, "Location Supplement denormalized SCM"); trc2(bcAddressUsage, "PO Box denormalized SCM"); trc2(bcAddressUsage, "Country denormalized SCM"); trc2(bcAddressUsage, "Postal Code denormalized SCM"); trc2(bcAddressUsage, "City denormalized SCM"); //trc2(bcAddressUsage, "Customer Sub Type SCM"); trc2(bcAccount, "Sub Type SCM"); trc2(bcAddressUsage, "Title SCM"); trc2(bcAddressUsage, "Language Account SCM"); trc2(bcAddressUsage, "Language Account LIC SCM"); trc2(bcAddressUsage, "Professional First Name SCM"); // trc2(bcAccount, "Company Name 1 SCM"); // trc2(bcAccount, "Company Name 2 SCM"); } catch (e) { //oApp.RaiseErrorText(e.toString()); } }

Address BS SCM
PrepareContactAddressPreview
/************************************************************************************************** * Function: PrepareContactAddressPreview * * Author : Ali Akbar Nidham (TAANIAL2) * * Purpose : Rel Nov'16: WP-1056 ORCA/OTTO: New Method to query and provide the Address Preview * * (Letter/Envelope format) for the Contact Address (Contact's Account Address) * * Date : 2016-07-18 * *-------------------------------------------------------------------------------------------------* * Update : YYYY-MM-DD - LOGIN - A short description about the changes. * **************************************************************************************************/ function PrepareContactAddressPreview(Inputs, Outputs) { var BOAccount; var BCAddressUsage = ""; var BCAccount; var BOLOV; var BCLOV; var strAccountId; var strAddressId; var strAddress; var strRelevantLanguage = ""; var strWork; var strLine; var strResultAddress; var filled; var k; var j; var x; var strType = ""; var strAccountContactLastName = ""; var strAccountContactFirstName = ""; var strParentName2 = ""; var strName2 = ""; var strRelTypeCode = ""; var strProfLastName = ""; var strProfFirstName = ""; var strProfNameAdditive = ""; var strCOName = ""; var strAttentionOf = ""; var strAddrSuppl = ""; var strAddrTypeCode = ""; var strStreetAddr = ""; var strStreetNr = ""; var strResidenceDesc = ""; var strLocSuppl = ""; var strPOBox = ""; var strCountry = ""; var strPostalCode = ""; var strCity = ""; var strLookupAddrType; var strLookupAccType; var strLookupAccSubType; var strAccSubType = ""; try { strLine = new Array(); //Get Input parameters strAccountId = Inputs.GetProperty("AccountId"); strAddressId = Inputs.GetProperty("AddressId"); strAddress = Inputs.GetProperty("Address"); BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); strLookupAddrType = oApp.InvokeMethod("LookupValue","ADDR_TYPE","Default"); strLookupAccType = oApp.InvokeMethod("LookupValue","ACCOUNT_TYPE","Person"); strLookupAccSubType = oApp.InvokeMethod("LookupValue","ACCOUNT_SUB_TYPE_SCM","CMA"); switch(strAddress) { case "Contact": //BCAddressUsage = BOAccount.GetBusComp("Account Address Usage SCM"); BCAddressUsage = BOAccount.GetBusComp("Contact Address Usage Pick SCM"); break; default: break; } with(BCAccount) { ClearToQuery(); SetViewMode(AllView); ActivateField("Customer Name 2 SCM"); ActivateField("Name 2 SCM"); SetSearchSpec("Id",strAccountId); ExecuteQuery(ForwardOnly); if(FirstRecord()) { strType = GetFieldValue("Type"); strAccountContactFirstName = GetFieldValue("Account Contact First Name"); strAccountContactLastName = GetFieldValue("Account Contact Last Name"); strParentName2 = GetFieldValue("Customer Name 2 SCM"); strName2 = GetFieldValue("Name 2 SCM"); strAccSubType = GetFieldValue("Sub Type SCM"); } } with(BCAddressUsage) { ClearToQuery(); SetViewMode(AllView); ActivateField("CO Name SCM"); ActivateField("Address Supplement SCM"); //ActivateField("Street Nr. denormalized SCM"); ActivateField("Street Number denormalized SCM"); ActivateField("Address Relation Type SCM"); ActivateField("Professional First Name SCM"); ActivateField("Professional Last Name SCM"); ActivateField("Professional Name Additive SCM"); ActivateField("CO Name SCM"); ActivateField("Attention Of SCM"); ActivateField("Address Type Code denormalized SCM"); ActivateField("Residence Description denormalized SCM"); ActivateField("Location Supplement denormalized SCM"); ActivateField("PO Box denormalized SCM"); ActivateField("Country denormalized SCM"); ActivateField("Postal Code denormalized SCM"); Ac

Address BS SCM
PrepareOutputforGaiaRecall
function PrepareOutputforGaiaRecall(Inputs, Outputs){ try { Outputs.SetProperty("City denormalized SCM", Inputs.GetProperty("CitySCM")); Outputs.SetProperty("Street Address denormalized SCM", Inputs.GetProperty("StreetAddressSCM")); Outputs.SetProperty("Country denormalized SCM", Inputs.GetProperty("CountrySCM")); Outputs.SetProperty("Location Supplement denormalized SCM", Inputs.GetProperty("LocationSuplementSCM")); Outputs.SetProperty("PO Box denormalized SCM", Inputs.GetProperty("PoBOXSCM")); Outputs.SetProperty("Postal Code denormalized SCM", Inputs.GetProperty("PostalCodeSCM")); Outputs.SetProperty("Postal Code Extension denormalized SCM", Inputs.GetProperty("zipCodeExtension")); Outputs.SetProperty("Residence Description denormalized SCM", Inputs.GetProperty("ResidenceDescriptionSCM")); Outputs.SetProperty("Street Nr. denormalized SCM", Inputs.GetProperty("StreetNrSCM")); Outputs.SetProperty("Street Id denormalized SCM", ""); Outputs.SetProperty("Validation Status denormalized SCM", ""); Outputs.SetProperty("Language Code GAIA denormalized SCM",""); Outputs.SetProperty("Supplier Code denormalized SCM", ""); Outputs.SetProperty("Gaia Master Timestamp SCM", ""); Outputs.SetProperty("Location Id denormalized SCM", ""); Outputs.SetProperty("Integration Id denormalized SCM", ""); Outputs.SetProperty("Error Code",""); Outputs.SetProperty("Error Message",""); } catch (e) { trc("PrepareOutputforGaiaRecall ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
PrepareOutputforGaiaRecall
function PrepareOutputforGaiaRecall(Inputs, Outputs){ try { Outputs.SetProperty("City denormalized SCM", Inputs.GetProperty("CitySCM")); Outputs.SetProperty("Street Address denormalized SCM", Inputs.GetProperty("StreetAddressSCM")); Outputs.SetProperty("Country denormalized SCM", Inputs.GetProperty("CountrySCM")); Outputs.SetProperty("Location Supplement denormalized SCM", Inputs.GetProperty("LocationSuplementSCM")); Outputs.SetProperty("PO Box denormalized SCM", Inputs.GetProperty("PoBOXSCM")); Outputs.SetProperty("Postal Code denormalized SCM", Inputs.GetProperty("PostalCodeSCM")); Outputs.SetProperty("Postal Code Extension denormalized SCM", Inputs.GetProperty("zipCodeExtension")); Outputs.SetProperty("Residence Description denormalized SCM", Inputs.GetProperty("ResidenceDescriptionSCM")); Outputs.SetProperty("Street Nr. denormalized SCM", Inputs.GetProperty("StreetNrSCM")); Outputs.SetProperty("Street Id denormalized SCM", ""); Outputs.SetProperty("Validation Status denormalized SCM", ""); Outputs.SetProperty("Language Code GAIA denormalized SCM",""); Outputs.SetProperty("Supplier Code denormalized SCM", ""); Outputs.SetProperty("Gaia Master Timestamp SCM", ""); Outputs.SetProperty("Location Id denormalized SCM", ""); Outputs.SetProperty("Integration Id denormalized SCM", ""); Outputs.SetProperty("Error Code",""); Outputs.SetProperty("Error Message",""); } catch (e) { trc("PrepareOutputforGaiaRecall ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
SearchAddress
/***************************************************************************** * Function: SearchAddress * Purpose : This method implements a search over the S_ADDR_PER table (BC * Account Address SCM) based on the SearchAddress logic in Gaia. * Params : *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-03-23 TZHSTAL2 Created * 2012-02-15 TGDHURO9 Defect 44443 FUF: 'ValidateAddress' call with multiple result shows a wrong reccord in Siebel * 2012-07-23 TGDHURO9 Defect 55197 PROD: Validate Address does not consider the Zip Code Ext *****************************************************************************/ function SearchAddress(Inputs, Outputs) { var errorCode = 0; var reasonCode = 0; var boAddress:BusObject; var bcAddress:BusComp; var ins:PropertySet; var outs:PropertySet; var normalizedCity:String; var normalizedRegion:String; var normalizedStreet:String; var normalizedFullStreet:String; var normalizedHouseName:String; var city:String = Inputs.GetProperty("CitySCM");; var street:String = TrimAll(Inputs.GetProperty("StreetAddressSCM")); var country:String = Inputs.GetProperty("CountrySCM"); var language:String = Inputs.GetProperty("Language"); var region:String = Inputs.GetProperty("LocationSuplementSCM"); var poBox:String = Inputs.GetProperty("PoBOXSCM"); var postalCode:String = Inputs.GetProperty("PostalCodeSCM"); var postalCodeExtension:String = Inputs.GetProperty("zipCodeExtension"); var houseName:String = Inputs.GetProperty("ResidenceDescriptionSCM"); var streetNr:String = TrimAll(Inputs.GetProperty("StreetNrSCM")); var apartmentNr:String = Inputs.GetProperty("apartmentNumber"); var floorNr:String = Inputs.GetProperty("floorNumber"); var addressTypeCode:String = Inputs.GetProperty("AddressTypeCode"); var searchExpr:String = ""; var errorReason:String = ""; var recordCount = 0; var MAX_RECORDS = 200; var recordsFound:PropertySet; var allRecordsFound:PropertySet; var addressRecord:PropertySet=oApp.NewPropertySet(); var gaiaError:PropertySet; var tempAddress:PropertySet; var helpString = ""; var bilingualAddress:bool=false; var bilingualAddrname:Array=new Array; var newAddrNames:Array; var validValue; var regionCityQuery:bool=false; try { boAddress = oApp.GetBusObject("Account Address SCM"); bcAddress = boAddress.GetBusComp("Account Address SCM"); Outputs.SetProperty("Error Code", "0"); Outputs.SetProperty("Error Reason", "0"); // City or zipcode should exist if ((city == null || city.length == 0) && (postalCode == null || postalCode.length == 0) && (region == null || region.length == 0)) { errorCode = 2; errorReason = "E102002"; } // Street Nr. must be valid if (!streetNumberIsValid(streetNr)) { errorCode = 2; errorReason = "E101006"; } // Country must be filled if ((country == null || country.length == 0)) { errorCode = 2; errorReason = "E100037"; } // Po Box must be valid validValue = new RegExp('^[0-9\*]*$'); if (addressTypeCode == oApp.InvokeMethod("LookupValue","ADDRESS_TYPE_CODE_SCM","PO Box Address") && poBox.length > 0 && ! validValue.test(poBox)) { errorCode = 2; errorReason = "E101008"; } if (errorCode == 0) { searchExpr = "[Verified Flag SCM]='Y' AND [To Be Deleted Flag SCM]='N' AND [Address Type SCM]='" + addressTypeCode + "'"; if (postalCode != null && postalCode.length > 0) { if (postalCode.indexOf("*") > 0) { errorCode = 2; errorReason = "E103004"; } else { validValue = new RegExp('^[0-9]{4,6}$'); if ( ! validValue.test(postalCode) && (country=="Switzerland" || country=="Germany" || country=="Liechtenstein")) { errorCode = 2; errorReason = "E101003"; } else { searchExpr += " AND [Postal Code SCM] LIKE '" + postalCode + "*'"; if (country=="Switzerland" && oApp.GetProfileAttr("Bilingual Zipc

Address BS SCM
SearchAddress
/***************************************************************************** * Function: SearchAddress * Purpose : This method implements a search over the S_ADDR_PER table (BC * Account Address SCM) based on the SearchAddress logic in Gaia. * Params : *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-03-23 TZHSTAL2 Created * 2012-02-15 TGDHURO9 Defect 44443 FUF: 'ValidateAddress' call with multiple result shows a wrong reccord in Siebel * 2012-07-23 TGDHURO9 Defect 55197 PROD: Validate Address does not consider the Zip Code Ext *****************************************************************************/ function SearchAddress(Inputs, Outputs) { var errorCode = 0; var reasonCode = 0; var boAddress:BusObject; var bcAddress:BusComp; var ins:PropertySet; var outs:PropertySet; var normalizedCity:String; var normalizedRegion:String; var normalizedStreet:String; var normalizedFullStreet:String; var normalizedHouseName:String; var city:String = Inputs.GetProperty("CitySCM");; var street:String = TrimAll(Inputs.GetProperty("StreetAddressSCM")); var country:String = Inputs.GetProperty("CountrySCM"); var language:String = Inputs.GetProperty("Language"); var region:String = Inputs.GetProperty("LocationSuplementSCM"); var poBox:String = Inputs.GetProperty("PoBOXSCM"); var postalCode:String = Inputs.GetProperty("PostalCodeSCM"); var postalCodeExtension:String = Inputs.GetProperty("zipCodeExtension"); var houseName:String = Inputs.GetProperty("ResidenceDescriptionSCM"); var streetNr:String = TrimAll(Inputs.GetProperty("StreetNrSCM")); var apartmentNr:String = Inputs.GetProperty("apartmentNumber"); var floorNr:String = Inputs.GetProperty("floorNumber"); var addressTypeCode:String = Inputs.GetProperty("AddressTypeCode"); var searchExpr:String = ""; var errorReason:String = ""; var recordCount = 0; var MAX_RECORDS = 200; var recordsFound:PropertySet; var allRecordsFound:PropertySet; var addressRecord:PropertySet=oApp.NewPropertySet(); var gaiaError:PropertySet; var tempAddress:PropertySet; var helpString = ""; var bilingualAddress:bool=false; var bilingualAddrname:Array=new Array; var newAddrNames:Array; var validValue; var regionCityQuery:bool=false; try { boAddress = oApp.GetBusObject("Account Address SCM"); bcAddress = boAddress.GetBusComp("Account Address SCM"); Outputs.SetProperty("Error Code", "0"); Outputs.SetProperty("Error Reason", "0"); // City or zipcode should exist if ((city == null || city.length == 0) && (postalCode == null || postalCode.length == 0) && (region == null || region.length == 0)) { errorCode = 2; errorReason = "E102002"; } // Street Nr. must be valid if (!streetNumberIsValid(streetNr)) { errorCode = 2; errorReason = "E101006"; } // Country must be filled if ((country == null || country.length == 0)) { errorCode = 2; errorReason = "E100037"; } // Po Box must be valid validValue = new RegExp('^[0-9\*]*$'); if (addressTypeCode == oApp.InvokeMethod("LookupValue","ADDRESS_TYPE_CODE_SCM","PO Box Address") && poBox.length > 0 && ! validValue.test(poBox)) { errorCode = 2; errorReason = "E101008"; } if (errorCode == 0) { searchExpr = "[Verified Flag SCM]='Y' AND [To Be Deleted Flag SCM]='N' AND [Address Type SCM]='" + addressTypeCode + "'"; if (postalCode != null && postalCode.length > 0) { if (postalCode.indexOf("*") > 0) { errorCode = 2; errorReason = "E103004"; } else { validValue = new RegExp('^[0-9]{4,6}$'); if ( ! validValue.test(postalCode) && (country=="Switzerland" || country=="Germany" || country=="Liechtenstein")) { errorCode = 2; errorReason = "E101003"; } else { searchExpr += " AND [Postal Code SCM] LIKE '" + postalCode + "*'"; if (country=="Switzerland" && oApp.GetProfileAttr("Bilingual Zipc

Address BS SCM
Search_S_ADDR_PER_Record
/******************************************************* ** Name: Search_S_ADDR_PER_Record ** Created: 06.09.2011 ** Created By: Karin Schädler ** Description: This method searches for an address in S_ADDR_PER. If BSCS sends address with spec char ' in street, WF Query step does not work. ** This method works using \" masking in scripting. Method is used in WF "Normalization Address Storage SCM" ******************************************************/ function Search_S_ADDR_PER_Record(Inputs, Outputs) { var BOAddress; var BCAddress; var searchExpr; var street; var city; var resDesc; var postalCodeExt = ""; var locSupp; try { BOAddress = oApp.GetBusObject("Normalization BO SCM"); BCAddress = BOAddress.GetBusComp("Account Address SCM"); BCAddress.SetViewMode(AllView); BCAddress.ClearToQuery(); searchExpr = "[Postal Code SCM]='" + Inputs.GetProperty("PostalCode") + "'"; city = Inputs.GetProperty("City"); searchExpr = searchExpr + " AND [City SCM]=\"" + city + "\""; street = Inputs.GetProperty("Street"); searchExpr = searchExpr +" AND [Street Address SCM]=\"" + street + "\""; searchExpr = searchExpr +" AND [Country SCM]='" + Inputs.GetProperty("Country") + "'"; searchExpr = searchExpr +" AND [PO Box SCM]='" + Inputs.GetProperty("POBox") + "'"; searchExpr = searchExpr +" AND [Street Number SCM]='" + Inputs.GetProperty("StreetNumber") + "'"; resDesc = Inputs.GetProperty("ResidenceDescription"); searchExpr = searchExpr +" AND [Residence Description SCM]=\"" + resDesc + "\""; locSupp = Inputs.GetProperty("LocationSupplement"); searchExpr = searchExpr +" AND [Location Supplement SCM]=\"" + locSupp + "\""; searchExpr = searchExpr +" AND [To Be Deleted Flag SCM]='" + Inputs.GetProperty("ToBeDeletedFlag") + "'"; //begin Defect 63558 searchExpr = searchExpr +" AND ([Verified Flag SCM]='N' OR [Validation Status SCM]<>'4' OR [Validation Status SCM] IS NULL OR ([Country Lic SCM]<>'Switzerland' AND [Country Lic SCM]<>'Liechtenstein'))"; //end Defect 63558 postalCodeExt = Inputs.GetProperty("PostalCodeExtension"); if (postalCodeExt == "" || postalCodeExt == null) { searchExpr = searchExpr +" AND ([Postal Code Extension SCM]='00' OR [Postal Code Extension SCM] IS NULL)"; } else { searchExpr = searchExpr +" AND [Postal Code Extension SCM]='" + Inputs.GetProperty("PostalCodeExtension") + "'"; } if (isTraceON) oApp.Trace("Search_S_ADDR_PER_Record ==> searchExpr = "+searchExpr); BCAddress.SetSearchExpr(searchExpr); BCAddress.SetSortSpec("Verified Flag SCM(DESCENDING)"); BCAddress.ExecuteQuery(ForwardOnly); if (BCAddress.FirstRecord()) { Outputs.SetProperty("Records Found","1"); Outputs.SetProperty("Address Id", BCAddress.GetFieldValue("Id")); if (isTraceON) oApp.Trace("Search_S_ADDR_PER_Record ==> Address found = "+BCAddress.GetFieldValue("Id")); } else { Outputs.SetProperty("Records Found","0"); } } catch (e) { throw(e); } finally { BCAddress = null; BOAddress = null; } }

Address BS SCM
Search_S_ADDR_PER_Record
/******************************************************* ** Name: Search_S_ADDR_PER_Record ** Created: 06.09.2011 ** Created By: Karin Schädler ** Description: This method searches for an address in S_ADDR_PER. If BSCS sends address with spec char ' in street, WF Query step does not work. ** This method works using \" masking in scripting. Method is used in WF "Normalization Address Storage SCM" ******************************************************/ function Search_S_ADDR_PER_Record(Inputs, Outputs) { var BOAddress; var BCAddress; var searchExpr; var street; var city; var resDesc; var postalCodeExt = ""; var locSupp; try { BOAddress = oApp.GetBusObject("Normalization BO SCM"); BCAddress = BOAddress.GetBusComp("Account Address SCM"); BCAddress.SetViewMode(AllView); BCAddress.ClearToQuery(); searchExpr = "[Postal Code SCM]='" + Inputs.GetProperty("PostalCode") + "'"; city = Inputs.GetProperty("City"); searchExpr = searchExpr + " AND [City SCM]=\"" + city + "\""; street = Inputs.GetProperty("Street"); searchExpr = searchExpr +" AND [Street Address SCM]=\"" + street + "\""; searchExpr = searchExpr +" AND [Country SCM]='" + Inputs.GetProperty("Country") + "'"; searchExpr = searchExpr +" AND [PO Box SCM]='" + Inputs.GetProperty("POBox") + "'"; searchExpr = searchExpr +" AND [Street Number SCM]='" + Inputs.GetProperty("StreetNumber") + "'"; resDesc = Inputs.GetProperty("ResidenceDescription"); searchExpr = searchExpr +" AND [Residence Description SCM]=\"" + resDesc + "\""; locSupp = Inputs.GetProperty("LocationSupplement"); searchExpr = searchExpr +" AND [Location Supplement SCM]=\"" + locSupp + "\""; searchExpr = searchExpr +" AND [To Be Deleted Flag SCM]='" + Inputs.GetProperty("ToBeDeletedFlag") + "'"; //begin Defect 63558 searchExpr = searchExpr +" AND ([Verified Flag SCM]='N' OR [Validation Status SCM]<>'4' OR [Validation Status SCM] IS NULL OR ([Country Lic SCM]<>'Switzerland' AND [Country Lic SCM]<>'Liechtenstein'))"; //end Defect 63558 postalCodeExt = Inputs.GetProperty("PostalCodeExtension"); if (postalCodeExt == "" || postalCodeExt == null) { searchExpr = searchExpr +" AND ([Postal Code Extension SCM]='00' OR [Postal Code Extension SCM] IS NULL)"; } else { searchExpr = searchExpr +" AND [Postal Code Extension SCM]='" + Inputs.GetProperty("PostalCodeExtension") + "'"; } if (isTraceON) oApp.Trace("Search_S_ADDR_PER_Record ==> searchExpr = "+searchExpr); BCAddress.SetSearchExpr(searchExpr); BCAddress.SetSortSpec("Verified Flag SCM(DESCENDING)"); BCAddress.ExecuteQuery(ForwardOnly); if (BCAddress.FirstRecord()) { Outputs.SetProperty("Records Found","1"); Outputs.SetProperty("Address Id", BCAddress.GetFieldValue("Id")); if (isTraceON) oApp.Trace("Search_S_ADDR_PER_Record ==> Address found = "+BCAddress.GetFieldValue("Id")); } else { Outputs.SetProperty("Records Found","0"); } } catch (e) { throw(e); } finally { BCAddress = null; BOAddress = null; } }

Address BS SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

Address BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs, ViewName) { try { oApp = TheApplication(); isTraceON = oApp.isTraceON; switch (MethodName) { case("CheckOverlappingDates"): // TGDHAKA8 01.10.2012: No overlapping Dates check in case of EAI Address Update by Gaia if (oApp.GetProfileAttr("EAI_UpdateAddressSynchronization_OverlappingCheck") == "N") { if (isTraceON) oApp.Trace("Business Service:Address BS SCM. No Method CheckOverlappingDates invoked"); } else { CheckOverlappingDates(Inputs,Outputs); } break; case("CancelActivities"): CancelActivities(Inputs,Outputs); break; //TGDDOPA1. 09.02.2010. Issue 19714 case("SubmitAddressMutationSR"): SubmitAddressMutationSR(Inputs,Outputs); break; //TGDDOPA1. 15.02.2010. Issue case("CheckFloorAppartment"): CheckFloorAppartment(Inputs,Outputs); break; //01.03.2011 TGDFUBR2 for CR521 case "PrepareAddressPreview": PrepareAddressPreview(Inputs,Outputs); break; case("CountRelatedAddresses"): CountRelatedAddresses(Inputs,Outputs); break; case("NormalizeSearchString"): NormalizeSearchString(Inputs,Outputs); break; case("SearchAddress"): SearchAddress(Inputs,Outputs); break; case("GenerateSearchAddresses"): GenerateSearchAddresses(Inputs,Outputs); break; case("NormalizeFullSearchString"): NormalizeFullSearchString(Inputs,Outputs); break; // TGDHAKA8 2011-09-06 Added for defect 39080 case("Search_S_ADDR_PER_Record"): Search_S_ADDR_PER_Record(Inputs,Outputs); break; default: break; } }//End try catch(e){ trc("Error: " + e.message); throw(e); } finally{ oApp = null; } return (CancelOperation); }

Address BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs, ViewName) { try { oApp = TheApplication(); isTraceON = oApp.isTraceON; switch (MethodName) { case("CheckOverlappingDates"): // TGDHAKA8 01.10.2012: No overlapping Dates check in case of EAI Address Update by Gaia if (oApp.GetProfileAttr("EAI_UpdateAddressSynchronization_OverlappingCheck") == "N") { if (isTraceON) oApp.Trace("Business Service:Address BS SCM. No Method CheckOverlappingDates invoked"); } else { CheckOverlappingDates(Inputs,Outputs); } break; case("CancelActivities"): CancelActivities(Inputs,Outputs); break; //TGDDOPA1. 09.02.2010. Issue 19714 case("SubmitAddressMutationSR"): SubmitAddressMutationSR(Inputs,Outputs); break; //TGDDOPA1. 15.02.2010. Issue case("CheckFloorAppartment"): CheckFloorAppartment(Inputs,Outputs); break; //01.03.2011 TGDFUBR2 for CR521 case "PrepareAddressPreview": PrepareAddressPreview(Inputs,Outputs); break; //TAANIAL2; 20160718; WP-1056 ORCA/OTTO case "PrepareContactAddressPreview": PrepareContactAddressPreview(Inputs, Outputs); break; case("CountRelatedAddresses"): CountRelatedAddresses(Inputs,Outputs); break; case("NormalizeSearchString"): NormalizeSearchString(Inputs,Outputs); break; case("SearchAddress"): SearchAddress(Inputs,Outputs); break; case("GenerateSearchAddresses"): GenerateSearchAddresses(Inputs,Outputs); break; case("NormalizeFullSearchString"): NormalizeFullSearchString(Inputs,Outputs); break; // TGDHAKA8 2011-09-06 Added for defect 39080 case("Search_S_ADDR_PER_Record"): Search_S_ADDR_PER_Record(Inputs,Outputs); break; default: break; } }//End try catch(e){ trc("Error: " + e.message); throw(e); } finally{ oApp = null; } return (CancelOperation); }

Address BS SCM
SubmitAddressMutationSR
/******************************************************* ** Name: submitAddressMutationSR ** Created: 08.02.2010 ** Created By: TGDDOPA1 ** Description: This method submit SR in caso of Address change with a CNO.Issue 19714 -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitAddressMutationSR(Inputs, &Outputs) { // if (isTraceON) oApp.Trace ("Submit Address Mutation."); var oBO = ""; var oBCBP = ""; var oBCAccountAddress = ""; var oBCAddress = ""; var strAccountId = Inputs.GetProperty("Account Id"); var strBpAddressId = Inputs.GetProperty("BP Address Id"); var strAccountAddressId = Inputs.GetProperty("Account Address Id"); var strContractAddressId = Inputs.GetProperty("Contract Address Id"); var bs = TheApplication().GetService("Workflow Process Manager"); var inPS = TheApplication().NewPropertySet(); var outPS = TheApplication().NewPropertySet(); try { TheApplication().SetProfileAttr("CNOOrder", "Y"); oBO = oApp.GetBusObject("Address Usage SCM"); //Get necesary data from Account Address to invoke wf Address Workflow SCM if (strAccountAddressId != null && strAccountAddressId != "") { oBCAccountAddress = oBO.GetBusComp("Account Address Usage SCM"); with (oBCAccountAddress) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", strAccountAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("Address_Usage_Id",GetFieldValue("Id")); inPS.SetProperty("Address Status",GetFieldValue("Address Status SCM")); inPS.SetProperty("Address Role",GetFieldValue("Address Relation Type SCM")); inPS.SetProperty("GeoFlag",GetFieldValue("Address Geovalidated Flag denormalized SCM")); inPS.SetProperty("Account Id",strAccountId); inPS.SetProperty("Address Parent Id",strAccountId); inPS.SetProperty("BC Name","Account"); inPS.SetProperty("CNO Order","Y"); bs.InvokeMethod("RunProcess", inPS, outPS); } } } //Get necesary data from Contract Address to invoke wf Address Workflow SCM else if(strContractAddressId != null && strContractAddressId != "") { oBCAddress = oBO.GetBusComp("Contract Address Usage SCM"); with (oBCAddress) { SetViewMode(AllView); ClearToQuery(); ActivateField("Parent Asset Id"); SetSearchSpec("Id", strContractAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("End Date",GetFieldValue("End Date SCM")); inPS.SetProperty("Address Status",GetFieldValue("Address Status SCM")); inPS.SetProperty("Address Parent Id",GetFieldValue("Parent Asset Id")); inPS.SetProperty("Address Role",GetFieldValue("Address Relation Type GUI SCM")); inPS.SetProperty("Account Id",strAccountId); inPS.SetProperty("GeoFlag",GetFieldValue("Address Geovalidated Flag denormalized SCM")); inPS.SetProperty("Address_Usage_Id",GetFieldValue("Id")); inPS.SetProperty("BC Name","Contract"); inPS.SetProperty("CNO Order","Y"); bs.InvokeMethod("RunProcess", inPS, outPS); } } } //Get necesary data from Billing Profile Address to invoke wf Address Workflow SCM else if(strBpAddressId != null && strBpAddressId != "") { oBCAddress = oBO.GetBusComp("Billing Profile Address Usage SCM"); with (oBCAddress) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", strBpAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("End Date",GetFieldValue("End Date SCM")); inPS.Set

Address BS SCM
SubmitAddressMutationSR
/******************************************************* ** Name: submitAddressMutationSR ** Created: 08.02.2010 ** Created By: TGDDOPA1 ** Description: This method submit SR in caso of Address change with a CNO.Issue 19714 -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitAddressMutationSR(Inputs, &Outputs) { // if (isTraceON) oApp.Trace ("Submit Address Mutation."); var oBO = ""; var oBCBP = ""; var oBCAccountAddress = ""; var oBCAddress = ""; var strAccountId = Inputs.GetProperty("Account Id"); var strBpAddressId = Inputs.GetProperty("BP Address Id"); var strAccountAddressId = Inputs.GetProperty("Account Address Id"); var strContractAddressId = Inputs.GetProperty("Contract Address Id"); var bs = TheApplication().GetService("Workflow Process Manager"); var inPS = TheApplication().NewPropertySet(); var outPS = TheApplication().NewPropertySet(); try { TheApplication().SetProfileAttr("CNOOrder", "Y"); oBO = oApp.GetBusObject("Address Usage SCM"); //Get necesary data from Account Address to invoke wf Address Workflow SCM if (strAccountAddressId != null && strAccountAddressId != "") { oBCAccountAddress = oBO.GetBusComp("Account Address Usage SCM"); with (oBCAccountAddress) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", strAccountAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("Address_Usage_Id",GetFieldValue("Id")); inPS.SetProperty("Address Status",GetFieldValue("Address Status SCM")); inPS.SetProperty("Address Role",GetFieldValue("Address Relation Type SCM")); inPS.SetProperty("GeoFlag",GetFieldValue("Address Geovalidated Flag denormalized SCM")); inPS.SetProperty("Account Id",strAccountId); inPS.SetProperty("Address Parent Id",strAccountId); inPS.SetProperty("BC Name","Account"); inPS.SetProperty("CNO Order","Y"); bs.InvokeMethod("RunProcess", inPS, outPS); } } } //Get necesary data from Contract Address to invoke wf Address Workflow SCM else if(strContractAddressId != null && strContractAddressId != "") { oBCAddress = oBO.GetBusComp("Contract Address Usage SCM"); with (oBCAddress) { SetViewMode(AllView); ClearToQuery(); ActivateField("Parent Asset Id"); SetSearchSpec("Id", strContractAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("End Date",GetFieldValue("End Date SCM")); inPS.SetProperty("Address Status",GetFieldValue("Address Status SCM")); inPS.SetProperty("Address Parent Id",GetFieldValue("Parent Asset Id")); inPS.SetProperty("Address Role",GetFieldValue("Address Relation Type GUI SCM")); inPS.SetProperty("Account Id",strAccountId); inPS.SetProperty("GeoFlag",GetFieldValue("Address Geovalidated Flag denormalized SCM")); inPS.SetProperty("Address_Usage_Id",GetFieldValue("Id")); inPS.SetProperty("BC Name","Contract"); inPS.SetProperty("CNO Order","Y"); bs.InvokeMethod("RunProcess", inPS, outPS); } } } //Get necesary data from Billing Profile Address to invoke wf Address Workflow SCM else if(strBpAddressId != null && strBpAddressId != "") { oBCAddress = oBO.GetBusComp("Billing Profile Address Usage SCM"); with (oBCAddress) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", strBpAddressId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { inPS.SetProperty("ProcessName","Address Workflow SCM"); inPS.SetProperty("End Date",GetFieldValue("End Date SCM")); inPS.Set

Address BS SCM
TrimAll
/******************************************************* ** Name: TrimAll ** Created: 15.03.2011 ** Created By: Alejandro Strickler ** Description: This method removes all leadsing an trailing blangs from a given string -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function TrimAll(sString) { if (sString != null) { while (sString.substring(0,1) == ' ') { sString = sString.substring(1, sString.length); } while (sString.substring(sString.length-1, sString.length) == ' ') { sString = sString.substring(0,sString.length-1); } } return sString; }

Address BS SCM
TrimAll
/******************************************************* ** Name: TrimAll ** Created: 15.03.2011 ** Created By: Alejandro Strickler ** Description: This method removes all leadsing an trailing blangs from a given string -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function TrimAll(sString) { if (sString != null) { while (sString.substring(0,1) == ' ') { sString = sString.substring(1, sString.length); } while (sString.substring(sString.length-1, sString.length) == ' ') { sString = sString.substring(0,sString.length-1); } } return sString; }

Address BS SCM
getBilingualAddresses
/******************************************************* ** Name: getBilingualAddresses ** Created: 17.05.2011 ** Created By: Karin ** Description: This method returns bilingual address names for requerying -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function getBilingualAddresses(AddrNames:Array,&newAddrNames:Array) { var addrName:String; var lastChar:String; var locId:String; var newAddrName:String = ""; var addrNameExists:bool=false; try { for (var x = 0; x < AddrNames.length; x++) { addrName = AddrNames[x]; lastChar = addrName.charAt(addrName.length - 1); locId = addrName.substring(0,addrName.length - 1); if (lastChar == "1"){ newAddrName = locId + "2"; } if (lastChar == "2"){ newAddrName = locId + "1"; } if (newAddrName != ""){ var i = 0; while (i < AddrNames.length && !addrNameExists){ if (AddrNames[i]==newAddrName){ addrNameExists=true; } i++; } if (!addrNameExists) { newAddrNames[x]=newAddrName; } newAddrName=""; } } } catch (e) { trc("getBilingualAddresses ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
getBilingualAddresses
/******************************************************* ** Name: getBilingualAddresses ** Created: 17.05.2011 ** Created By: Karin ** Description: This method returns bilingual address names for requerying -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function getBilingualAddresses(AddrNames:Array,&newAddrNames:Array) { var addrName:String; var lastChar:String; var locId:String; var newAddrName:String = ""; var addrNameExists:bool=false; try { for (var x = 0; x < AddrNames.length; x++) { addrName = AddrNames[x]; lastChar = addrName.charAt(addrName.length - 1); locId = addrName.substring(0,addrName.length - 1); if (lastChar == "1"){ newAddrName = locId + "2"; } if (lastChar == "2"){ newAddrName = locId + "1"; } if (newAddrName != ""){ var i = 0; while (i < AddrNames.length && !addrNameExists){ if (AddrNames[i]==newAddrName){ addrNameExists=true; } i++; } if (!addrNameExists) { newAddrNames[x]=newAddrName; } newAddrName=""; } } } catch (e) { trc("getBilingualAddresses ==> Exception: " + e.errCode + ", " + e.message + " --- " + e.errText); throw(e) } }

Address BS SCM
streetNumberIsValid
/******************************************************* ** Name: streetNumberIsValid ** Created: 23.03.2011 ** Created By: Alejandro Strickler ** Description: -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function streetNumberIsValid(strNumber:String) { // defect 56751: vars not longer needed /*var INITIAL_STATE = 0; var NUM_STATE = 1; var ALPHA_STATE = 2; var MAX_DIGIT_COUNT = 4; var MAX_ALHPA_COUNT = 12; var state = INITIAL_STATE; */ var isValid:bool = true; var sValidNum = '^[0-9]{5}'; var reValidNum = new RegExp(sValidNum); /* var digitCount = 0; var alphaCount = 0; var c; */ try { // defect 56751: house number can have max 12 chars, and mx 4 leading digits if (strNumber.length > 12 || reValidNum.test(strNumber)) { isValid = false; } /*if (strNumber != null || strNumber.length > 0) { for (var i = 0; i < strNumber.length && isValid; i++) { c = strNumber.charAt(i); if (Clib.isalpha(c)) { if (state == INITIAL_STATE) { isValid = false; } else { alphaCount++; if (state == NUM_STATE) { state = ALPHA_STATE; } } } else if (Clib.isdigit(c)) { if (state == ALPHA_STATE) { isValid = false; } else { digitCount++; if (state == INITIAL_STATE) { state = NUM_STATE; } } } else { isValid = false; } } if (alphaCount > MAX_ALHPA_COUNT || digitCount > MAX_DIGIT_COUNT) { isValid = false; } }*/ } catch (e) { isValid = false; } return isValid; }

Address BS SCM
streetNumberIsValid
/******************************************************* ** Name: streetNumberIsValid ** Created: 23.03.2011 ** Created By: Alejandro Strickler ** Description: -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function streetNumberIsValid(strNumber:String) { // defect 56751: vars not longer needed /*var INITIAL_STATE = 0; var NUM_STATE = 1; var ALPHA_STATE = 2; var MAX_DIGIT_COUNT = 4; var MAX_ALHPA_COUNT = 12; var state = INITIAL_STATE; */ var isValid:bool = true; var sValidNum = '^[0-9]{5}'; var reValidNum = new RegExp(sValidNum); /* var digitCount = 0; var alphaCount = 0; var c; */ try { // defect 56751: house number can have max 12 chars, and mx 4 leading digits if (strNumber.length > 12 || reValidNum.test(strNumber)) { isValid = false; } /*if (strNumber != null || strNumber.length > 0) { for (var i = 0; i < strNumber.length && isValid; i++) { c = strNumber.charAt(i); if (Clib.isalpha(c)) { if (state == INITIAL_STATE) { isValid = false; } else { alphaCount++; if (state == NUM_STATE) { state = ALPHA_STATE; } } } else if (Clib.isdigit(c)) { if (state == ALPHA_STATE) { isValid = false; } else { digitCount++; if (state == INITIAL_STATE) { state = NUM_STATE; } } } else { isValid = false; } } if (alphaCount > MAX_ALHPA_COUNT || digitCount > MAX_DIGIT_COUNT) { isValid = false; } }*/ } catch (e) { isValid = false; } return isValid; }

Address BS SCM
trc
/***************************************************************************** * Function: trc * Purpose : Writes the given string to the log file * Params : s - the string to trace *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2012-02-15 tgdhuro9 created *****************************************************************************/ function trc(s) { if (isTraceON) { oApp.Trace(this.Name() + ": " + s); } }

Address BS SCM
trc
/***************************************************************************** * Function: trc * Purpose : Writes the given string to the log file * Params : s - the string to trace *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2012-02-15 tgdhuro9 created *****************************************************************************/ function trc(s) { if (isTraceON) { oApp.Trace(this.Name() + ": " + s); } }

Address BS SCM
trc2
function trc2(bc, fieldName) { trc(fieldName + "='" + bc.GetFieldValue(fieldName) + "'"); }

Address BS SCM
trc2
function trc2(bc, fieldName) { trc(fieldName + "='" + bc.GetFieldValue(fieldName) + "'"); }

Address BS SCM
trcAddressRecord
function trcAddressRecord(addressRecord:PropertySet) { trc("Found: City denormalized SCM: " + addressRecord.GetProperty("City denormalized SCM")); trc("Found: Street Address denormalized SCM: " + addressRecord.GetProperty("Street Address denormalized SCM")); trc("Found: Country denormalized SCM: " + addressRecord.GetProperty("Country denormalized SCM")); trc("Found: Location Supplement denormalized SCM: " + addressRecord.GetProperty("Location Supplement denormalized SCM")); trc("Found: PO Box denormalized SCM: " + addressRecord.GetProperty("PO Box denormalized SCM")); trc("Found: Postal Code denormalized SCM: " + addressRecord.GetProperty("Postal Code denormalized SCM")); trc("Found: Residence Description denormalized SCM: " + addressRecord.GetProperty("Residence Description denormalized SCM")); trc("Found: Location Id denormalized SCM: " + addressRecord.GetProperty("Location Id denormalized SCM")); trc("Found: Integration Id denormalized SCM: " + addressRecord.GetProperty("Integration Id denormalized SCM")); trc("Found: Supplier Code denormalized SCM: " + addressRecord.GetProperty("Supplier Code denormalized SCM")); trc("Found: Gaia Master Timestamp denormalized SCM: " + addressRecord.GetProperty("Gaia Master Timestamp denormalized SCM")); }

Address BS SCM
trcAddressRecord
function trcAddressRecord(addressRecord:PropertySet) { trc("Found: City denormalized SCM: " + addressRecord.GetProperty("City denormalized SCM")); trc("Found: Street Address denormalized SCM: " + addressRecord.GetProperty("Street Address denormalized SCM")); trc("Found: Country denormalized SCM: " + addressRecord.GetProperty("Country denormalized SCM")); trc("Found: Location Supplement denormalized SCM: " + addressRecord.GetProperty("Location Supplement denormalized SCM")); trc("Found: PO Box denormalized SCM: " + addressRecord.GetProperty("PO Box denormalized SCM")); trc("Found: Postal Code denormalized SCM: " + addressRecord.GetProperty("Postal Code denormalized SCM")); trc("Found: Residence Description denormalized SCM: " + addressRecord.GetProperty("Residence Description denormalized SCM")); trc("Found: Location Id denormalized SCM: " + addressRecord.GetProperty("Location Id denormalized SCM")); trc("Found: Integration Id denormalized SCM: " + addressRecord.GetProperty("Integration Id denormalized SCM")); trc("Found: Supplier Code denormalized SCM: " + addressRecord.GetProperty("Supplier Code denormalized SCM")); trc("Found: Gaia Master Timestamp denormalized SCM: " + addressRecord.GetProperty("Gaia Master Timestamp denormalized SCM")); }

Admin Code Value SCM
Retrieve
function Retrieve(Inputs, Outputs) { /***************************************************************** ** Name: Retrieve ** Created: xx.xx.200x ** Created By: ** Description: ** ** ------------------------ Modifications ------------------------ ** Date: 22.07.2003 ** Changed By: Jacob Aranya ** Description: Code Review ** ------------------------ ------------- ------------------------ ** Date: 05.07.2011 ** Changed By: Rouven Degen, TGDDERO7 ** Description: Performance enhancements through object caching ** ------------------------ ------------- ------------------------ ** Date: xx.yy.201x ** Changed By: ** Description: *****************************************************************/ var strValue; var strCode; // TGDDERO7,05.07.2011: var boAdmin; var bcAdmin; try { strValue = ""; strCode = Inputs.GetProperty("Code"); // TGDDERO7,05.07.2011: boAdmin = TheApplication().GetBusObject("Admin Code Value SCM"); // TGDDERO7,05.07.2011: bcAdmin = boAdmin.GetBusComp("Admin Code/Value SCM"); bcAdmin = TheApplication().utils.SCM_GetCachedACVBC(); bcAdmin.ClearToQuery(); // oracle config review - 29.1 // bcAdmin.ActivateField("Code SCM"); // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Value SCM"); // fields already active bcAdmin.SetSearchSpec("Code SCM", strCode); //bcAdmin.ExecuteQuery(ForwardOnly); // TGDDERO7,05.07.2011: bcAdmin.ExecuteQuery(ForwardBackward); //OneCRM SCM R1 10-09-2009 TGDALAI1 bcAdmin.ExecuteQuery(ForwardOnly); if (bcAdmin.FirstRecord()) { strValue = bcAdmin.GetFieldValue("Value SCM"); } else { throw {Code: "ERR_NO_ADMIN_CODE", P1: strCode} } } catch (e) { var strErrorRet = "Problems while invoking BS 'Admin Code Value SCM'.\n"; strErrorRet += "Please contact your Administrator.\n"; strErrorRet += e.toString(); throw (strErrorRet); } finally { bcAdmin = null; // TGDDERO7,05.07.2011: boAdmin = null; Outputs.SetProperty("Value", strValue); } }

Admin Code Value SCM
Retrieve
function Retrieve(Inputs, Outputs) { /***************************************************************** ** Name: Retrieve ** Created: xx.xx.200x ** Created By: ** Description: ** ** ------------------------ Modifications ------------------------ ** Date: 22.07.2003 ** Changed By: Jacob Aranya ** Description: Code Review ** ------------------------ ------------- ------------------------ ** Date: 05.07.2011 ** Changed By: Rouven Degen, TGDDERO7 ** Description: Performance enhancements through object caching ** ------------------------ ------------- ------------------------ ** Date: xx.yy.201x ** Changed By: ** Description: *****************************************************************/ var strValue; var strCode; // TGDDERO7,05.07.2011: var boAdmin; var bcAdmin; try { strValue = ""; strCode = Inputs.GetProperty("Code"); // TGDDERO7,05.07.2011: boAdmin = TheApplication().GetBusObject("Admin Code Value SCM"); // TGDDERO7,05.07.2011: bcAdmin = boAdmin.GetBusComp("Admin Code/Value SCM"); bcAdmin = TheApplication().utils.SCM_GetCachedACVBC(); bcAdmin.ClearToQuery(); // oracle config review - 29.1 // bcAdmin.ActivateField("Code SCM"); // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Value SCM"); // fields already active bcAdmin.SetSearchSpec("Code SCM", strCode); //bcAdmin.ExecuteQuery(ForwardOnly); // TGDDERO7,05.07.2011: bcAdmin.ExecuteQuery(ForwardBackward); //OneCRM SCM R1 10-09-2009 TGDALAI1 bcAdmin.ExecuteQuery(ForwardOnly); if (bcAdmin.FirstRecord()) { strValue = bcAdmin.GetFieldValue("Value SCM"); } else { throw {Code: "ERR_NO_ADMIN_CODE", P1: strCode} } } catch (e) { var strErrorRet = "Problems while invoking BS 'Admin Code Value SCM'.\n"; strErrorRet += "Please contact your Administrator.\n"; strErrorRet += e.toString(); throw (strErrorRet); } finally { bcAdmin = null; // TGDDERO7,05.07.2011: boAdmin = null; Outputs.SetProperty("Value", strValue); } }

Admin Code Value SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Name: Service_PreInvokeMethod ** Created: xx.xx.200x ** Created By: ** Description: ** ** ------------------------ Modifications ------------------------ ** Date: 22.07.2003 ** Changed By: Jacob Aranya ** Description: Code Review ** Date: ** Changed By: ** Description: ***************************************************************** ** Modified: 09.11.2010 TGDSEAI1: Defect 30965 New function Add Date *****************************************************************/ var strErrCode; var strErrMessage; strErrCode = 0; strErrMessage = ""; try { switch (MethodName) { case "Retrieve": Retrieve(Inputs, Outputs); break; case "Update": Update(Inputs, Outputs); break; case "AddDate": strAddDate(Inputs,Outputs); break; default: throw {Code: "ERR_UNKNOWN_METHOD", P1: MethodName}; break; } } catch (e) { if (e.Code) { switch (e.Code) { case "ERR_UNKNOWN_METHOD": strErrCode = 1010; strErrMessage = "Unknown Method: " + e.P1; break; case "ERR_NO_ADMIN_CODE": strErrCode = 1020; strErrMessage = "Unknown Admin Code: " + e.P1; break; default: strErrCode = 1998; strErrMessage = "Unknown Error: " + e.Code; } } else { strErrCode = 1999; strErrMessage = e.toString; } } finally { Outputs.SetProperty("Error Code SCM", strErrCode); Outputs.SetProperty("Error Message SCM", strErrMessage); return (CancelOperation); } }

Admin Code Value SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Name: Service_PreInvokeMethod ** Created: xx.xx.200x ** Created By: ** Description: ** ** ------------------------ Modifications ------------------------ ** Date: 22.07.2003 ** Changed By: Jacob Aranya ** Description: Code Review ** Date: ** Changed By: ** Description: ***************************************************************** ** Modified: 09.11.2010 TGDSEAI1: Defect 30965 New function Add Date *****************************************************************/ var strErrCode; var strErrMessage; strErrCode = 0; strErrMessage = ""; try { switch (MethodName) { case "Retrieve": Retrieve(Inputs, Outputs); break; case "Update": Update(Inputs, Outputs); break; case "AddDate": strAddDate(Inputs,Outputs); break; default: throw {Code: "ERR_UNKNOWN_METHOD", P1: MethodName}; break; } } catch (e) { if (e.Code) { switch (e.Code) { case "ERR_UNKNOWN_METHOD": strErrCode = 1010; strErrMessage = "Unknown Method: " + e.P1; break; case "ERR_NO_ADMIN_CODE": strErrCode = 1020; strErrMessage = "Unknown Admin Code: " + e.P1; break; default: strErrCode = 1998; strErrMessage = "Unknown Error: " + e.Code; } } else { strErrCode = 1999; strErrMessage = e.toString; } } finally { Outputs.SetProperty("Error Code SCM", strErrCode); Outputs.SetProperty("Error Message SCM", strErrMessage); return (CancelOperation); } }

Admin Code Value SCM
Update
function Update(Inputs, Outputs) { /***************************************************************** ** Name: Update ** Created: 12.06.2007 ** Created By: Norbert Kuemin (TZHKUNO1) ** Description: Change Admin Code Value ** ** ------------------------ Modifications ------------------------ ** Date: 05.07.2011 ** Changed By: Rouven Degen, TGDDERO7 ** Description: Performance enhancements through object caching ** ------------------------ ------------- ------------------------ ** Date: xx.xx.200x ** Changed By: ** Description: *****************************************************************/ var strValue; var strCode; // TGDDERO7,05.07.2011: var boAdmin; var bcAdmin; try { strCode = Inputs.GetProperty("Code"); strValue = Inputs.GetProperty("Value"); // TGDDERO7,05.07.2011: boAdmin = TheApplication().GetBusObject("Admin Code Value SCM"); // TGDDERO7,05.07.2011: bcAdmin = boAdmin.GetBusComp("Admin Code/Value SCM"); bcAdmin = TheApplication().utils.SCM_GetCachedACVBC(); bcAdmin.ClearToQuery(); // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Code SCM"); // fields already active // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Value SCM"); // fields already active bcAdmin.SetSearchSpec("Code SCM", strCode); bcAdmin.ExecuteQuery(ForwardOnly); if (bcAdmin.FirstRecord()) { bcAdmin.SetFieldValue("Value SCM",strValue); bcAdmin.WriteRecord(); } else { throw {Code: "ERR_NO_ADMIN_CODE", P1: strCode} } } catch (e) { var strErrorRet = "Problems while invoking BS 'Admin Code Value SCM'.\n"; strErrorRet += "Please contact your Administrator.\n"; strErrorRet += e.toString(); throw (strErrorRet); } finally { bcAdmin = null; // TGDDERO7,05.07.2011: boAdmin = null; } }

Admin Code Value SCM
Update
function Update(Inputs, Outputs) { /***************************************************************** ** Name: Update ** Created: 12.06.2007 ** Created By: Norbert Kuemin (TZHKUNO1) ** Description: Change Admin Code Value ** ** ------------------------ Modifications ------------------------ ** Date: 05.07.2011 ** Changed By: Rouven Degen, TGDDERO7 ** Description: Performance enhancements through object caching ** ------------------------ ------------- ------------------------ ** Date: xx.xx.200x ** Changed By: ** Description: *****************************************************************/ var strValue; var strCode; // TGDDERO7,05.07.2011: var boAdmin; var bcAdmin; try { strCode = Inputs.GetProperty("Code"); strValue = Inputs.GetProperty("Value"); // TGDDERO7,05.07.2011: boAdmin = TheApplication().GetBusObject("Admin Code Value SCM"); // TGDDERO7,05.07.2011: bcAdmin = boAdmin.GetBusComp("Admin Code/Value SCM"); bcAdmin = TheApplication().utils.SCM_GetCachedACVBC(); bcAdmin.ClearToQuery(); // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Code SCM"); // fields already active // TGDDERO7,05.07.2011: bcAdmin.ActivateField("Value SCM"); // fields already active bcAdmin.SetSearchSpec("Code SCM", strCode); bcAdmin.ExecuteQuery(ForwardOnly); if (bcAdmin.FirstRecord()) { bcAdmin.SetFieldValue("Value SCM",strValue); bcAdmin.WriteRecord(); } else { throw {Code: "ERR_NO_ADMIN_CODE", P1: strCode} } } catch (e) { var strErrorRet = "Problems while invoking BS 'Admin Code Value SCM'.\n"; strErrorRet += "Please contact your Administrator.\n"; strErrorRet += e.toString(); throw (strErrorRet); } finally { bcAdmin = null; // TGDDERO7,05.07.2011: boAdmin = null; } }

Admin Code Value SCM
strAddDate
function strAddDate(Inputs:PropertySet,Outputs:PropertySet){ /***************************************************************** ** Bussiness Service : Admin Code Value SCM ** Function : ** Created : 09.08.2010 ** Created By : TGDSEAI1 ** Description : Defect 30965, return a date sum or subtract of the current date with an admin code value ** Input : Add: True, False; Value true to sum false to subtraction ** AdminCode: Name of the admin code to add ** Output : NewDate: *****************************************************************/ //Variable declarations var intHrToSum; var strNewDate; var dDate:Date; var dNewDate:Date; var psOutputs:PropertySet; var strAdd; try{ //Initialize variable psOutputs = TheApplication().NewPropertySet(); strAdd = Inputs.GetProperty("Add"); //Convert into date object dDate = Date.fromSystem(Clib.time()); this.InvokeMethod("Retrieve", Inputs, psOutputs); intHrToSum = psOutputs.GetProperty("Value"); //check operation if(strAdd == "false") { //Substraction must be done intHrToSum = 0 - intHrToSum; } //Convert date into milliseconds to add arithmetic in milliseconds dNewDate = new Date(dDate.getTime() + (intHrToSum * 60 * 60 * 1000)); //format as yyyyMMddHHmm strNewDate = Clib.rsprintf("%04d%02d%02d%02d%02d", dNewDate.getFullYear(), dNewDate.getMonth()+1, dNewDate.getDate(),dNewDate.getHours(),dNewDate.getMinutes()); Outputs.SetProperty("NewDate",strNewDate); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + "AddDate method. Error: " + e.message); throw(e); } finally{ //Variable destruction psOutputs = null; dDate = null; dNewDate = null; intHrToSum = null; strNewDate = null; strAdd = null; } }

Admin Code Value SCM
strAddDate
function strAddDate(Inputs:PropertySet,Outputs:PropertySet){ /***************************************************************** ** Bussiness Service : Admin Code Value SCM ** Function : ** Created : 09.08.2010 ** Created By : TGDSEAI1 ** Description : Defect 30965, return a date sum or subtract of the current date with an admin code value ** Input : Add: True, False; Value true to sum false to subtraction ** AdminCode: Name of the admin code to add ** Output : NewDate: *****************************************************************/ //Variable declarations var intHrToSum; var strNewDate; var dDate:Date; var dNewDate:Date; var psOutputs:PropertySet; var strAdd; try{ //Initialize variable psOutputs = TheApplication().NewPropertySet(); strAdd = Inputs.GetProperty("Add"); //Convert into date object dDate = Date.fromSystem(Clib.time()); this.InvokeMethod("Retrieve", Inputs, psOutputs); intHrToSum = psOutputs.GetProperty("Value"); //check operation if(strAdd == "false") { //Substraction must be done intHrToSum = 0 - intHrToSum; } //Convert date into milliseconds to add arithmetic in milliseconds dNewDate = new Date(dDate.getTime() + (intHrToSum * 60 * 60 * 1000)); //format as yyyyMMddHHmm strNewDate = Clib.rsprintf("%04d%02d%02d%02d%02d", dNewDate.getFullYear(), dNewDate.getMonth()+1, dNewDate.getDate(),dNewDate.getHours(),dNewDate.getMinutes()); Outputs.SetProperty("NewDate",strNewDate); } catch(e){ if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + "AddDate method. Error: " + e.message); throw(e); } finally{ //Variable destruction psOutputs = null; dDate = null; dNewDate = null; intHrToSum = null; strNewDate = null; strAdd = null; } }

Adoption Mapping Load Service SCM
(declarations)
var oApp; var bIsTraceOn = true; var sLogFile = "C:\\Log.txt"; var boolLog = false; var boolLogFileExists;

Adoption Mapping Load Service SCM
(declarations)
var oApp; var bIsTraceOn = true; var sLogFile = "C:\\Log.txt"; var boolLog = false; var boolLogFileExists;

Adoption Mapping Load Service SCM
CheckAttributeIfExisting
function CheckAttributeIfExisting(sAttributeNameInternal, sAttributeType) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CheckAttributeIfExisting: // This method will do a check if the given attribute name is existing in the Siebel Attribute Definition // Input: sAttributeNameInternal // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CheckAttributeIfExisting: Start"); var boAttribute = oApp.GetBusObject("Admin ISS Product Definition"); var bcAttribute = boAttribute.GetBusComp("ISS Release Prod Attributes Admin BusComp"); var boRepository = oApp.GetBusObject("Repository Details"); var bcRepository = boRepository.GetBusComp("Repository Repository"); var bcRepositoryBusComp = boRepository.GetBusComp("Repository Business Component"); var bcRepositoryField = boRepository.GetBusComp("Repository Field"); var boolIsExisting = false; var iReposId = null; var iId = null; var sBCName = null; if(sAttributeType == "OLI") sBCName = "Quote Item"; else if(sAttributeType == "OH") sBCName = "Quote"; Write2Log("CheckAttributeIfExisting start"); if(sAttributeType == "OLI" || sAttributeType == "OH") { Write2Log("Repository start"); bcRepository.ClearToQuery(); bcRepository.SetViewMode(AllView); bcRepository.ActivateField("Name"); bcRepository.SetSearchSpec("Name", "Siebel Repository"); bcRepository.ExecuteQuery(ForwardBackward); if(bcRepository.FirstRecord()) { iReposId = bcRepository.GetFieldValue("Id"); Write2Log("RepositoryBC start"); bcRepositoryBusComp.ClearToQuery(); bcRepositoryBusComp.SetViewMode(AllView); bcRepositoryBusComp.ActivateField("Name"); bcRepositoryBusComp.ActivateField("Repository Id"); bcRepositoryBusComp.SetSearchSpec("Repository Id", iReposId); bcRepositoryBusComp.SetSearchSpec("Name", sBCName); bcRepositoryBusComp.ExecuteQuery(ForwardBackward); if(bcRepositoryBusComp.FirstRecord()) { iId = bcRepositoryBusComp.GetFieldValue("Id"); Write2Log("Quote Item BC found with Id: " + iId); bcRepositoryField.ClearToQuery(); bcRepositoryField.SetViewMode(AllView); bcRepositoryField.ActivateField("Name"); bcRepositoryField.ActivateField("Parent Id"); bcRepositoryField.ActivateField("Repository Id"); bcRepositoryBusComp.SetSearchSpec("Repository Id", iReposId); bcRepositoryField.SetSearchSpec("Name", sAttributeNameInternal); bcRepositoryField.SetSearchSpec("Parent Id", iId); bcRepositoryField.ExecuteQuery(ForwardBackward); if(bcRepositoryField.FirstRecord()) { boolIsExisting = true; Write2Log("Field " + sAttributeNameInternal + " is existing in BC " + sBCName); } else Write2Log("ADOPTION_MAPPING_ERROR: Field " + sAttributeNameInternal + " is not a field on Quote Item."); } else Write2Log("ERROR: BC Quote Item cannot be found in actual Siebel Repository"); } else Write2Log("ERROR: Siebel repository cannot be found"); } else if(sAttributeType == "XA") { bcAttribute.ClearToQuery(); bcAttribute.SetViewMode(AllView); bcAttribute.ActivateField("Name"); bcAttribute.SetSearchSpec("Name", "'" +sAttributeNameInternal+ "'"); bcAttribute.ExecuteQuery(ForwardOnly); if(bcAttribute.FirstRecord()) { boolIsExisting = true; } } else { if(sAttributeType != "" && sAttributeType != null) Write2Log("ADOPTION_MAPPING_ERROR: Attribute Type is not defined: " + sAttributeType); } if(boolIsExisting) Write2Log("Attribute existing" + sAttributeNameInternal); else Write2Log("ADOPTION_MAPPING_ERROR: Attribute

Adoption Mapping Load Service SCM
CheckAttributeIfExisting
function CheckAttributeIfExisting(sAttributeNameInternal, sAttributeType) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CheckAttributeIfExisting: // This method will do a check if the given attribute name is existing in the Siebel Attribute Definition // Input: sAttributeNameInternal // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CheckAttributeIfExisting: Start"); var boAttribute = oApp.GetBusObject("Admin ISS Product Definition"); var bcAttribute = boAttribute.GetBusComp("ISS Release Prod Attributes Admin BusComp"); var boRepository = oApp.GetBusObject("Repository Details"); var bcRepository = boRepository.GetBusComp("Repository Repository"); var bcRepositoryBusComp = boRepository.GetBusComp("Repository Business Component"); var bcRepositoryField = boRepository.GetBusComp("Repository Field"); var boolIsExisting = false; var iReposId = null; var iId = null; var sBCName = null; if(sAttributeType == "OLI") sBCName = "Quote Item"; else if(sAttributeType == "OH") sBCName = "Quote"; Write2Log("CheckAttributeIfExisting start"); if(sAttributeType == "OLI" || sAttributeType == "OH") { Write2Log("Repository start"); bcRepository.ClearToQuery(); bcRepository.SetViewMode(AllView); bcRepository.ActivateField("Name"); bcRepository.SetSearchSpec("Name", "Siebel Repository"); bcRepository.ExecuteQuery(ForwardBackward); if(bcRepository.FirstRecord()) { iReposId = bcRepository.GetFieldValue("Id"); Write2Log("RepositoryBC start"); bcRepositoryBusComp.ClearToQuery(); bcRepositoryBusComp.SetViewMode(AllView); bcRepositoryBusComp.ActivateField("Name"); bcRepositoryBusComp.ActivateField("Repository Id"); bcRepositoryBusComp.SetSearchSpec("Repository Id", iReposId); bcRepositoryBusComp.SetSearchSpec("Name", sBCName); bcRepositoryBusComp.ExecuteQuery(ForwardBackward); if(bcRepositoryBusComp.FirstRecord()) { iId = bcRepositoryBusComp.GetFieldValue("Id"); Write2Log("Quote Item BC found with Id: " + iId); bcRepositoryField.ClearToQuery(); bcRepositoryField.SetViewMode(AllView); bcRepositoryField.ActivateField("Name"); bcRepositoryField.ActivateField("Parent Id"); bcRepositoryField.ActivateField("Repository Id"); bcRepositoryBusComp.SetSearchSpec("Repository Id", iReposId); bcRepositoryField.SetSearchSpec("Name", sAttributeNameInternal); bcRepositoryField.SetSearchSpec("Parent Id", iId); bcRepositoryField.ExecuteQuery(ForwardBackward); if(bcRepositoryField.FirstRecord()) { boolIsExisting = true; Write2Log("Field " + sAttributeNameInternal + " is existing in BC " + sBCName); } else Write2Log("ADOPTION_MAPPING_ERROR: Field " + sAttributeNameInternal + " is not a field on Quote Item."); } else Write2Log("ERROR: BC Quote Item cannot be found in actual Siebel Repository"); } else Write2Log("ERROR: Siebel repository cannot be found"); } else if(sAttributeType == "XA") { bcAttribute.ClearToQuery(); bcAttribute.SetViewMode(AllView); bcAttribute.ActivateField("Name"); bcAttribute.SetSearchSpec("Name", "'" +sAttributeNameInternal+ "'"); bcAttribute.ExecuteQuery(ForwardOnly); if(bcAttribute.FirstRecord()) { boolIsExisting = true; } } else { if(sAttributeType != "" && sAttributeType != null) Write2Log("ADOPTION_MAPPING_ERROR: Attribute Type is not defined: " + sAttributeType); } if(boolIsExisting) Write2Log("Attribute existing" + sAttributeNameInternal); else Write2Log("ADOPTION_MAPPING_ERROR: Attribute

Adoption Mapping Load Service SCM
CheckProductIfExisting
function CheckProductIfExisting(sProductName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CheckAttributeIfExisting: // This method will check if a product with the given product name is existing in the Siebel Product Definition // Input: sProductName: name of the product (Type: string) that has to be checked // Output: boolIsExisting: return value (Type: boolean) that indicates if the product is existing or not // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CheckProductIfExisting: Start"); var bo = oApp.GetBusObject("Internal Product Performance SCM"); var bc = bo.GetBusComp("Internal Product Performance SCM"); var boolIsExisting = false; with (bc) { ClearToQuery(); SetViewMode(AllView); ActivateField("Name"); SetSearchSpec("Name", "'" +sProductName+ "'"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { boolIsExisting = true; } } if(boolIsExisting) { Write2Log("Product existing" + sProductName); } if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CheckProductIfExisting: End"); // TGDDERO7, 05.07.2011, move return statement behind finally statement // return boolIsExisting; } catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: CheckAttributeIfExisting: Error!"+e.toString()); throw(e); }//end catch finally { bc = null; bo = null; // TGDDERO7, 05.07.2011, do not destroy // boolIsExisting = null; } // TGDDERO7, 05.07.2011, move return statement behind finally statement return boolIsExisting; }

Adoption Mapping Load Service SCM
CheckProductIfExisting
function CheckProductIfExisting(sProductName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CheckAttributeIfExisting: // This method will check if a product with the given product name is existing in the Siebel Product Definition // Input: sProductName: name of the product (Type: string) that has to be checked // Output: boolIsExisting: return value (Type: boolean) that indicates if the product is existing or not // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CheckProductIfExisting: Start"); var bo = oApp.GetBusObject("Internal Product Performance SCM"); var bc = bo.GetBusComp("Internal Product Performance SCM"); var boolIsExisting = false; with (bc) { ClearToQuery(); SetViewMode(AllView); ActivateField("Name"); SetSearchSpec("Name", "'" +sProductName+ "'"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { boolIsExisting = true; } } if(boolIsExisting) { Write2Log("Product existing" + sProductName); } if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CheckProductIfExisting: End"); // TGDDERO7, 05.07.2011, move return statement behind finally statement // return boolIsExisting; } catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: CheckAttributeIfExisting: Error!"+e.toString()); throw(e); }//end catch finally { bc = null; bo = null; // TGDDERO7, 05.07.2011, do not destroy // boolIsExisting = null; } // TGDDERO7, 05.07.2011, move return statement behind finally statement return boolIsExisting; }

Adoption Mapping Load Service SCM
CleanUpAdoptionMappings
function CleanUpAdoptionMappings() { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CleanUpAdoptionMappings: // This method will clean up the adoption mapping data before starting new import // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CleanUpAdoptionMappings: Start"); var bo = oApp.GetBusObject("Adopt Mapping SCM"); var bc = bo.GetBusComp("Adopt Source Definition SCM"); var iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Mapping Type SCM", "Adoption"); ExecuteQuery(ForwardBackward); while (FirstRecord()) { DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace("CleanUpAdoptionMappings: Record " + iCounter + " deleted."); } } if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CleanUpAdoptionMappings: End"); } catch(e) {if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: CleanUpAdoptionMappings: Error!"+e.toString()); throw(e); }//end catch finally { bc = null; bo = null; } }

Adoption Mapping Load Service SCM
CleanUpAdoptionMappings
function CleanUpAdoptionMappings() { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CleanUpAdoptionMappings: // This method will clean up the adoption mapping data before starting new import // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var oApp = TheApplication(); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: CleanUpAdoptionMappings: Start"); var bo = oApp.GetBusObject("Adopt Mapping SCM"); var bc = bo.GetBusComp("Adopt Source Definition SCM"); var iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Mapping Type SCM", "Adoption"); ExecuteQuery(ForwardBackward); while (FirstRecord()) { DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace("CleanUpAdoptionMappings: Record " + iCounter + " deleted."); } } if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CleanUpAdoptionMappings: End"); } catch(e) {if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: CleanUpAdoptionMappings: Error!"+e.toString()); throw(e); }//end catch finally { bc = null; bo = null; } }

Adoption Mapping Load Service SCM
CreateMapping
function CreateMapping(aSplit) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CreateProductMapping: // This method will create the mapping records for the products // Input: aSplit: Array with stored information of mapping record // Output: - // Trigger: ImportAdoptionMapping // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention // Update: TGDHOCH9 16 JAN 2014: Change setting of field "Source Object Type SCM" // Update TGDHOCH9:25 Nov 2014: Added setting for field "Mapping Type SCM" //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var boMapping:BusObject; var bcMappingTDM:BusComp; var bcMappingSiebel:BusComp; var bcPick:BusComp; var sSourceSystemProdName:chars; var sProductName:chars; var sRootProductName:chars; var iSequence:Number; var sObjectTypeExternal:chars; var sTypeInternal:chars; var sAttributeNameExternal:chars; var sAttributeValueExternal:chars; var sObjectTypeInternal:chars; var sAttributeNameInternal:chars; var sAttributeValueInternal:chars; var sParentProductName:chars; var sAttributeTypeExternal:chars; var sReferenceType:chars; var boolIsExistingParent:bool; var boolIsExisting:bool; var boolIsExistingRoot:bool; var iId:chars; try { Write2Log("Mapping Load Service SCM: CreateProductMapping: Start"); // TDM Key sSourceSystemProdName = TrimProductNames(aSplit[8]); // Product sProductName = TrimProductNames(aSplit[18]); // Line Type sObjectTypeExternal = TrimProductNames(aSplit[5]); // Attribute Name sAttributeNameExternal = TrimProductNames(aSplit[6]); // Attribute Value sAttributeValueExternal = TrimProductNames(aSplit[7]); // Line Type sObjectTypeInternal = TrimProductNames(aSplit[12]); // Attribute Name sAttributeNameInternal = TrimProductNames(aSplit[13]); // Attribute Value sAttributeValueInternal = TrimProductNames(aSplit[14]); // Parent Product sParentProductName = TrimProductNames(aSplit[17]); // Root Product sRootProductName = TrimProductNames(aSplit[16]); // Attribute Type sAttributeTypeExternal = TrimProductNames(aSplit[15]); // Reference Type sReferenceType = TrimProductNames(aSplit[19]); // Sequence iSequence = TrimProductNames(aSplit[20]); boolIsExistingParent = false; boolIsExisting = false; boolIsExistingRoot = false; Write2Log("SourceSystemProdName '" + sSourceSystemProdName + "' ..."); Write2Log("ObjectTypeExternal '" + sObjectTypeExternal + "' ..."); Write2Log("AttributeNameExternal '" + sAttributeNameExternal + "' ..."); Write2Log("AttributeValueExternal '" + sAttributeValueExternal + "' ..."); Write2Log("ObjectTypeInternal '" + sObjectTypeInternal + "' ..."); Write2Log("AttributeNameInternal '" + sAttributeNameInternal + "' ..."); Write2Log("AttributeValueInternal '" + sAttributeValueInternal + "' ..."); Write2Log("ProductRootName '" + sRootProductName + "' ..."); Write2Log("ProductParentName '" + sParentProductName + "' ..."); Write2Log("ProductName '" + sProductName + "' ..."); Write2Log("AttributeType '" + sAttributeTypeExternal + "' ..."); Write2Log("ReferenceType '" + sReferenceType + "' ..."); Write2Log("Sequence '" + iSequence + "' ..."); boMapping = oApp.GetBusObject("Adopt Mapping SCM"); bcMappingTDM = boMapping.GetBusComp("Adopt Source Definition SCM"); //Activate Fields bcMappingTDM.ActivateField("Source Attribute Name SCM"); bcMappingTDM.ActivateField("Source Attribute Value SCM"); bcMappingTDM.ActivateField("Source Object Type SCM"); bcMappingTDM.ActivateField("Source Product Name SCM"); bcMappingT

Adoption Mapping Load Service SCM
CreateMapping
function CreateMapping(aSplit) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CreateProductMapping: // This method will create the mapping records for the products // Input: aSplit: Array with stored information of mapping record // Output: - // Trigger: ImportAdoptionMapping // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention // Update: TGDHOCH9 16 JAN 2014: Change setting of field "Source Object Type SCM" // Update TGDHOCH9:25 Nov 2014: Added setting for field "Mapping Type SCM" //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var boMapping:BusObject; var bcMappingTDM:BusComp; var bcMappingSiebel:BusComp; var bcPick:BusComp; var sSourceSystemProdName:chars; var sProductName:chars; var sRootProductName:chars; var iSequence:Number; var sObjectTypeExternal:chars; var sTypeInternal:chars; var sAttributeNameExternal:chars; var sAttributeValueExternal:chars; var sObjectTypeInternal:chars; var sAttributeNameInternal:chars; var sAttributeValueInternal:chars; var sParentProductName:chars; var sAttributeTypeExternal:chars; var sReferenceType:chars; var boolIsExistingParent:bool; var boolIsExisting:bool; var boolIsExistingRoot:bool; var iId:chars; try { Write2Log("Mapping Load Service SCM: CreateProductMapping: Start"); // TDM Key sSourceSystemProdName = TrimProductNames(aSplit[8]); // Product sProductName = TrimProductNames(aSplit[18]); // Line Type sObjectTypeExternal = TrimProductNames(aSplit[5]); // Attribute Name sAttributeNameExternal = TrimProductNames(aSplit[6]); // Attribute Value sAttributeValueExternal = TrimProductNames(aSplit[7]); // Line Type sObjectTypeInternal = TrimProductNames(aSplit[12]); // Attribute Name sAttributeNameInternal = TrimProductNames(aSplit[13]); // Attribute Value sAttributeValueInternal = TrimProductNames(aSplit[14]); // Parent Product sParentProductName = TrimProductNames(aSplit[17]); // Root Product sRootProductName = TrimProductNames(aSplit[16]); // Attribute Type sAttributeTypeExternal = TrimProductNames(aSplit[15]); // Reference Type sReferenceType = TrimProductNames(aSplit[19]); // Sequence iSequence = TrimProductNames(aSplit[20]); boolIsExistingParent = false; boolIsExisting = false; boolIsExistingRoot = false; Write2Log("SourceSystemProdName '" + sSourceSystemProdName + "' ..."); Write2Log("ObjectTypeExternal '" + sObjectTypeExternal + "' ..."); Write2Log("AttributeNameExternal '" + sAttributeNameExternal + "' ..."); Write2Log("AttributeValueExternal '" + sAttributeValueExternal + "' ..."); Write2Log("ObjectTypeInternal '" + sObjectTypeInternal + "' ..."); Write2Log("AttributeNameInternal '" + sAttributeNameInternal + "' ..."); Write2Log("AttributeValueInternal '" + sAttributeValueInternal + "' ..."); Write2Log("ProductRootName '" + sRootProductName + "' ..."); Write2Log("ProductParentName '" + sParentProductName + "' ..."); Write2Log("ProductName '" + sProductName + "' ..."); Write2Log("AttributeType '" + sAttributeTypeExternal + "' ..."); Write2Log("ReferenceType '" + sReferenceType + "' ..."); Write2Log("Sequence '" + iSequence + "' ..."); boMapping = oApp.GetBusObject("Adopt Mapping SCM"); bcMappingTDM = boMapping.GetBusComp("Adopt Source Definition SCM"); //Activate Fields bcMappingTDM.ActivateField("Source Attribute Name SCM"); bcMappingTDM.ActivateField("Source Attribute Value SCM"); bcMappingTDM.ActivateField("Source Object Type SCM"); bcMappingTDM.ActivateField("Source Product Name SCM"); bcMappingT

Adoption Mapping Load Service SCM
GetLogFile
function GetLogFile(sFilePath) { var sPathSep = ""; var nLen = sFilePath.length; var i = nLen; var goFlag = true; var posEnde = 0; var sLogFilePath = ""; var sChar = ""; while (goFlag == true) { sChar = sFilePath.substring(i-1, i); if (i > 0) { switch (sChar) { case ".": goFlag = false; posEnde = i; break; case "\\": case "/": goFlag = false; posEnde = nLen break; default: i = i - 1; break; } // switch (sChar) } // if (i > 0) else { goFlag = false; posEnde = nLen; } // else / if (i > 0) } // while (goFlag == true) sLogFilePath = sFilePath.substring(0, posEnde) + "log" sLogFile = sLogFilePath; // Write2Log("sLogFilePath: " + sLogFilePath); return (sLogFilePath) } // function GetLogFile(sFilePath)

Adoption Mapping Load Service SCM
GetLogFile
function GetLogFile(sFilePath) { var sPathSep = ""; var nLen = sFilePath.length; var i = nLen; var goFlag = true; var posEnde = 0; var sLogFilePath = ""; var sChar = ""; while (goFlag == true) { sChar = sFilePath.substring(i-1, i); if (i > 0) { switch (sChar) { case ".": goFlag = false; posEnde = i; break; case "\\": case "/": goFlag = false; posEnde = nLen break; default: i = i - 1; break; } // switch (sChar) } // if (i > 0) else { goFlag = false; posEnde = nLen; } // else / if (i > 0) } // while (goFlag == true) sLogFilePath = sFilePath.substring(0, posEnde) + "log" sLogFile = sLogFilePath; // Write2Log("sLogFilePath: " + sLogFilePath); return (sLogFilePath) } // function GetLogFile(sFilePath)

Adoption Mapping Load Service SCM
GetPathSep
function GetPathSep(sInputDir) { var sPathSep = ""; var sChar = ""; var goFlag = true; var i = 0; while (goFlag == true) { if (i < sInputDir.length) { sChar = sInputDir.substring(i, i + 1); // Write2Log("i=" + i + " sChar=" + sChar); switch (sChar) { case "//": case "/": case "\\": goFlag = false; sPathSep = sChar; break; default: i = i + 1; } } else { goFlag = false; } } return (sPathSep); }

Adoption Mapping Load Service SCM
GetPathSep
function GetPathSep(sInputDir) { var sPathSep = ""; var sChar = ""; var goFlag = true; var i = 0; while (goFlag == true) { if (i < sInputDir.length) { sChar = sInputDir.substring(i, i + 1); // Write2Log("i=" + i + " sChar=" + sChar); switch (sChar) { case "//": case "/": case "\\": goFlag = false; sPathSep = sChar; break; default: i = i + 1; } } else { goFlag = false; } } return (sPathSep); }

Adoption Mapping Load Service SCM
ImportAdoptionMapping
function ImportAdoptionMapping(sTempFileName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // ImportAdoptionMapping: // This method will read the mapping data from the master list file // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sPath; //var sTXTFile; var sFileLine; var sDefName; var aSplit; var sSourceSystemProdName; var sAttributeNameInternal; var sAttributeNameExternal; var sAttributeValueInternal; var sAttributeValueExternal; var sObjectTypeInternal; var sObjectTypeExternal; var sProductName; var sParentProductName; var boolIsExisting; var boMapping; var aAttribute = new Array(); var intCounter; var lineCounter:Number; try { var oApp = TheApplication(); intCounter = 0; Write2Log("Starting Import of Adoption Mapping..."); Write2Log("*************************************************************************************************************"); Write2Log("Input TXT File: " + sTempFileName); Write2Log("Opening TXT-File " + sTempFileName + " ..."); lineCounter = 1; fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { while ( null != (sFileLine = Clib.fgets(fp)) ) { aSplit = sFileLine.split(";"); Write2Log("Length of line: " + aSplit.length); if(aSplit.length < 23) { Write2Log("ERROR: Number of Line Elemts " + aSplit.length + " is not correct. Search for special characters e.g. Carriage Return inside the line " + lineCounter); Write2Log("ERROR: ExceptionLine: " + sFileLine); } else { sObjectTypeInternal = aSplit[5]; Write2Log("ObjectTypeInternal '" + sObjectTypeInternal + "' ..."); if(sObjectTypeInternal == "Product") { Write2Log("Start product mapping"); Write2Log("Line: " + sFileLine); // Create product mapping CreateMapping(aSplit); } else if(sObjectTypeInternal == "Attribute") { Write2Log("Line: " + sFileLine); aAttribute[intCounter] = sFileLine; intCounter = intCounter + 1; } else { Write2Log("Line: " + sFileLine); Write2Log("ADOPTION_MAPPING_ERROR: Mapping not done. Reason: ObjectType " + sObjectTypeInternal + " is unknown of Key: " + sSourceSystemProdName); } lineCounter = lineCounter + 1; aSplit = null; } } Clib.fclose(fp); } else TheApplication().RaiseErrorText("Cannot open " + sTempFileName); // Create Attribute Mapping for(var i = 0; i < aAttribute.length; i++) { // Create attribute mapping Write2Log("Start attribute mapping"); Write2Log("Line: " + aAttribute[i].toString()); aSplit = aAttribute[i].split(";"); CreateMapping(aSplit); } Write2Log("File " + sTempFileName + " was closed."); Write2Log("*************************************************************************************************************"); Write2Log("Import of Adoption Mapping finished."); } catch(e) { Write2Log(e.toString()); } finally { aAttribute = null; aSplit = null; fp = null; } }

Adoption Mapping Load Service SCM
ImportAdoptionMapping
function ImportAdoptionMapping(sTempFileName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // ImportAdoptionMapping: // This method will read the mapping data from the master list file // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sPath; //var sTXTFile; var sFileLine; var sDefName; var aSplit; var sSourceSystemProdName; var sAttributeNameInternal; var sAttributeNameExternal; var sAttributeValueInternal; var sAttributeValueExternal; var sObjectTypeInternal; var sObjectTypeExternal; var sProductName; var sParentProductName; var boolIsExisting; var boMapping; var aAttribute = new Array(); var intCounter; var lineCounter:Number; try { var oApp = TheApplication(); intCounter = 0; Write2Log("Starting Import of Adoption Mapping..."); Write2Log("*************************************************************************************************************"); Write2Log("Input TXT File: " + sTempFileName); Write2Log("Opening TXT-File " + sTempFileName + " ..."); lineCounter = 1; fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { while ( null != (sFileLine = Clib.fgets(fp)) ) { aSplit = sFileLine.split(";"); Write2Log("Length of line: " + aSplit.length); if(aSplit.length < 23) { Write2Log("ERROR: Number of Line Elemts " + aSplit.length + " is not correct. Search for special characters e.g. Carriage Return inside the line " + lineCounter); Write2Log("ERROR: ExceptionLine: " + sFileLine); } else { sObjectTypeInternal = aSplit[5]; Write2Log("ObjectTypeInternal '" + sObjectTypeInternal + "' ..."); if(sObjectTypeInternal == "Product") { Write2Log("Start product mapping"); Write2Log("Line: " + sFileLine); // Create product mapping CreateMapping(aSplit); } else if(sObjectTypeInternal == "Attribute") { Write2Log("Line: " + sFileLine); aAttribute[intCounter] = sFileLine; intCounter = intCounter + 1; } else { Write2Log("Line: " + sFileLine); Write2Log("ADOPTION_MAPPING_ERROR: Mapping not done. Reason: ObjectType " + sObjectTypeInternal + " is unknown of Key: " + sSourceSystemProdName); } lineCounter = lineCounter + 1; aSplit = null; } } Clib.fclose(fp); } else TheApplication().RaiseErrorText("Cannot open " + sTempFileName); // Create Attribute Mapping for(var i = 0; i < aAttribute.length; i++) { // Create attribute mapping Write2Log("Start attribute mapping"); Write2Log("Line: " + aAttribute[i].toString()); aSplit = aAttribute[i].split(";"); CreateMapping(aSplit); } Write2Log("File " + sTempFileName + " was closed."); Write2Log("*************************************************************************************************************"); Write2Log("Import of Adoption Mapping finished."); } catch(e) { Write2Log(e.toString()); } finally { aAttribute = null; aSplit = null; fp = null; } }

Adoption Mapping Load Service SCM
SearchParentProduct
function SearchParentProduct(sSourceSystemProdName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // SearchParentProduct: // This method will search for the parent product of the attribute // Input: sSourceSystemProdName: Key for searching the right product mapping record // Output: boolIsExisting: return value (Type: boolean) that indicates if the product is existing or not // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: SearchParentProduct: Start"); var boMapping = oApp.GetBusObject("Adopt Mapping SCM"); var bcMapping = boMapping.GetBusComp("Adopt Flat Mapping Matrix SCM"); var boolIsExisting = false; var sProductName; with (bcMapping) { ClearToQuery(); SetViewMode(AllView); ActivateField("TDM Key"); ActivateField("Object Type"); ActivateField("Product Name"); SetSearchSpec("TDM Key", "'" + sSourceSystemProdName + "'"); SetSearchSpec("Object Type", "Product"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { boolIsExisting = true; sProductName = GetFieldValue("Product Name"); } } if(boolIsExisting) Write2Log("ParentProduct found" + sProductName); else Write2Log("ADOPTION_MAPPING_ERROR: ParentProduct could not be found:" + sProductName + "' ..."); if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CheckProductIfExisting: End"); return sProductName; } catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: SearchParentProduct: Error!"+e.toString()); throw(e); }//end catch finally { bcMapping = null; boMapping = null; boolIsExisting = null; } }

Adoption Mapping Load Service SCM
SearchParentProduct
function SearchParentProduct(sSourceSystemProdName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // SearchParentProduct: // This method will search for the parent product of the attribute // Input: sSourceSystemProdName: Key for searching the right product mapping record // Output: boolIsExisting: return value (Type: boolean) that indicates if the product is existing or not // Trigger: Service_InvokeMethod // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge // Update: TGDHOCH9 16 Aug 2011: Rename objects according new naming convention //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: SearchParentProduct: Start"); var boMapping = oApp.GetBusObject("Adopt Mapping SCM"); var bcMapping = boMapping.GetBusComp("Adopt Flat Mapping Matrix SCM"); var boolIsExisting = false; var sProductName; with (bcMapping) { ClearToQuery(); SetViewMode(AllView); ActivateField("TDM Key"); ActivateField("Object Type"); ActivateField("Product Name"); SetSearchSpec("TDM Key", "'" + sSourceSystemProdName + "'"); SetSearchSpec("Object Type", "Product"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { boolIsExisting = true; sProductName = GetFieldValue("Product Name"); } } if(boolIsExisting) Write2Log("ParentProduct found" + sProductName); else Write2Log("ADOPTION_MAPPING_ERROR: ParentProduct could not be found:" + sProductName + "' ..."); if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: CheckProductIfExisting: End"); return sProductName; } catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: SearchParentProduct: Error!"+e.toString()); throw(e); }//end catch finally { bcMapping = null; boMapping = null; boolIsExisting = null; } }

Adoption Mapping Load Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Adoption Mapping Load Service SCM: // This service will read the data from the adoption mapping master list excel and will create // and will create the according mapping records within Siebel. // Input: - // Output: - // Trigger: TDM Product Definition List Applet AIP SCM // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { oApp = TheApplication(); var sReturn = (ContinueOperation); var sTempFileName:chars = Inputs.GetProperty("FileName"); bIsTraceOn = true; if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: Service_PreInvoke: Start"); try { if (MethodName == "LoadAdoptionMapping") { if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace("Adoption Mapping File is existing: " + sTempFileName); //clean up mappings CleanUpAdoptionMappings(); // read from file ImportAdoptionMapping(sTempFileName); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: Service_PreInvoke: End"); sReturn = (CancelOperation); }//end if MethodName }//end try catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: Service_PreInvoke: Error!"+e.toString()); throw(e); }//end catch finally { oApp = null; }//end finally return sReturn; }

Adoption Mapping Load Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Adoption Mapping Load Service SCM: // This service will read the data from the adoption mapping master list excel and will create // and will create the according mapping records within Siebel. // Input: - // Output: - // Trigger: TDM Product Definition List Applet AIP SCM // Date: 18.05.2011 // Author: Tine Hofmann // Project: All IP Merge //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { oApp = TheApplication(); var sReturn = (ContinueOperation); var sTempFileName:chars = Inputs.GetProperty("FileName"); bIsTraceOn = true; if (bIsTraceOn) TheApplication().Trace("Mapping Load Service SCM: Service_PreInvoke: Start"); try { if (MethodName == "LoadAdoptionMapping") { if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace("Adoption Mapping File is existing: " + sTempFileName); //clean up mappings CleanUpAdoptionMappings(); // read from file ImportAdoptionMapping(sTempFileName); if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM: Service_PreInvoke: End"); sReturn = (CancelOperation); }//end if MethodName }//end try catch(e) { if (bIsTraceOn) oApp.Trace("Mapping Load Service SCM:: Service_PreInvoke: Error!"+e.toString()); throw(e); }//end catch finally { oApp = null; }//end finally return sReturn; }

Adoption Mapping Load Service SCM
TrimProductNames
function TrimProductNames(sName) { Write2Log("Trim following string: "+ sName); while(sName.substring(0,1)==' ') { sName = sName.substring(1, sName.length); } while(sName.substring(sName.length-1,sName.length)==' ') { sName = sName.substring(0, sName.length-1); } return sName; }

Adoption Mapping Load Service SCM
TrimProductNames
function TrimProductNames(sName) { Write2Log("Trim following string: "+ sName); while(sName.substring(0,1)==' ') { sName = sName.substring(1, sName.length); } while(sName.substring(sName.length-1,sName.length)==' ') { sName = sName.substring(0, sName.length-1); } return sName; }

Adoption Mapping Load Service SCM
Write2Log
function Write2Log(sLogText) { try { var oDate = new Date(); var sDay = toStringAppendLeadingZero(oDate.getDate()); var sMonth = toStringAppendLeadingZero(oDate.getMonth() + 1); var sHours = toStringAppendLeadingZero(oDate.getHours()); var sMinutes = toStringAppendLeadingZero(oDate.getMinutes()); var sSeconds = toStringAppendLeadingZero(oDate.getSeconds()); var sDatumZeit = sDay + "." + sMonth + "." + oDate.getFullYear() + " " + sHours + ":" + sMinutes + ":" + sSeconds; var sMessage = sDatumZeit + " " + "ADOPTION" + ": " + sLogText + "\r\n"; var fLog = null; if(boolLog) { fLog = Clib.fopen(sLogFile,"a"); Clib.fputs(sMessage, fLog); Clib.fclose(fLog); } if (bIsTraceOn) oApp.Trace(sMessage); } catch(e) { oApp.Trace(e.toString()); } finally { oDate = null; sDay = null; sMonth = null; sHours = null; sMinutes = null; sSeconds = null; sDatumZeit = null; sMessage = null; fLog = null; } }

Adoption Mapping Load Service SCM
Write2Log
function Write2Log(sLogText) { try { var oDate = new Date(); var sDay = toStringAppendLeadingZero(oDate.getDate()); var sMonth = toStringAppendLeadingZero(oDate.getMonth() + 1); var sHours = toStringAppendLeadingZero(oDate.getHours()); var sMinutes = toStringAppendLeadingZero(oDate.getMinutes()); var sSeconds = toStringAppendLeadingZero(oDate.getSeconds()); var sDatumZeit = sDay + "." + sMonth + "." + oDate.getFullYear() + " " + sHours + ":" + sMinutes + ":" + sSeconds; var sMessage = sDatumZeit + " " + "ADOPTION" + ": " + sLogText + "\r\n"; var fLog = null; if(boolLog) { fLog = Clib.fopen(sLogFile,"a"); Clib.fputs(sMessage, fLog); Clib.fclose(fLog); } if (bIsTraceOn) oApp.Trace(sMessage); } catch(e) { oApp.Trace(e.toString()); } finally { oDate = null; sDay = null; sMonth = null; sHours = null; sMinutes = null; sSeconds = null; sDatumZeit = null; sMessage = null; fLog = null; } }

Adoption Mapping Load Service SCM
fileExists
function fileExists(sFileName) { if(bIsTraceOn) oApp.Trace(Name() + ".fileExists: " + sFileName); var fp:File = Clib.fopen(sFileName, "r"); if (fp != null) { Clib.fclose(fp); return true; } else return false; }

Adoption Mapping Load Service SCM
fileExists
function fileExists(sFileName) { if(bIsTraceOn) oApp.Trace(Name() + ".fileExists: " + sFileName); var fp:File = Clib.fopen(sFileName, "r"); if (fp != null) { Clib.fclose(fp); return true; } else return false; }

Adoption Mapping Load Service SCM
toStringAppendLeadingZero
function toStringAppendLeadingZero (nNumber) { var sNumber = ""; if (nNumber < 10) { sNumber = "0" + nNumber.toString(); } else { sNumber = nNumber.toString(); } return (sNumber); }

Adoption Mapping Load Service SCM
toStringAppendLeadingZero
function toStringAppendLeadingZero (nNumber) { var sNumber = ""; if (nNumber < 10) { sNumber = "0" + nNumber.toString(); } else { sNumber = nNumber.toString(); } return (sNumber); }

Agreement BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var bMigLog:bool; var dCounter:Number; var strMigLogHeaderId = ""; // var dLogLevel = 2;

Agreement BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var bMigLog:bool; var dCounter:Number; var strMigLogHeaderId = ""; // var dLogLevel = 2;

Agreement BS SCM
BatchRefreshAgreements
function BatchRefreshAgreements(Inputs, Outputs) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Description: Processes status changes for agreements and // Entitlements and attaches or detaches all // relevant bundle assets. Repricing is done // afterwards for all changed asset line items // // WF "Batch Refresh Agreement Header and Entitlements SCM" // is used to trigger this function every first day of month // // Date: June, 26th 2013 // Author: Mario Geiss //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Change Log: // 1.1 TGDGEMAM added new property "Batch Processing" in order to // 2013-09-25 Def#73612 allow forced repricing during execution of // non-batch runs //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { // activate migration event logging bMigLog = true; dCounter = 100000000; Inputs.SetProperty("Batch Processing", "Y"); // 1.1 TraceMigrationLog(1, "Agreement", "<Begin>"); var objBO: BusObject, objTempBO: BusObject; var objAgrBC: BusComp, objEntBC: BusComp, objAccBC: BusComp, objTempBC: BusComp; var strSearchExpr: String; var isRecord: bool; var iNow, iAgrEndDate, iAgrStartDate, iEntEndDate, iEntStartDate, iCount; try { // unlock BC readonly fields oApp.SetProfileAttr("AGR_RW_FLG", "Y"); /******************************************************************** ***** 1. Inactivate outdated Agreements/Entitlements **************** ********************************************************************/ TraceMigrationLog(1, "Agreement", "Start: 1. Inactivate outdated Agreements/Entitlements"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objEntBC = objBO.GetBusComp("Agreement Entitlement"); objAccBC = objBO.GetBusComp("Account"); // search for agreements - ran out of active timeframe strSearchExpr = "[Agreement Status]=LookupValue('SRV_AGREE_STATUS','Active') AND " + "([Agreement Type]=LookupValue('AGREEMENT_TYPE','Affiliation') OR [Agreement Type]=LookupValue('AGREEMENT_TYPE','Corporate Pricing'))"; objAgrBC.SetViewMode(AllView); objAgrBC.ActivateField("Agreement Status"); objAgrBC.ActivateField("Agreement End Date"); objAgrBC.ActivateField("Agreement Type"); objAgrBC.ClearToQuery(); objAgrBC.SetSearchExpr(strSearchExpr); objAgrBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(2, "Agreement", "|" + objAgrBC.CountRecords() + "| active Agreement(s) will be processed"); isRecord = objAgrBC.FirstRecord(); // store current timestamp iNow = new Date().getTime(); while (isRecord) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' [" + objAgrBC.GetFieldValue("Agreement Status") + "] => [" + objAgrBC.GetFieldValue("Agreement Start Date") + "] - [" + objAgrBC.GetFieldValue("Agreement End Date") + "]"); // in case end date is empty set it higher than current timestamp if (objAgrBC.GetFieldValue("Agreement End Date") == "") iAgrEndDate = iNow + 1; else iAgrEndDate = new Date(objAgrBC.GetFieldValue("Agreement End Date")).getTime(); // if agreement is outdated change status if (iAgrEndDate < iNow) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' will be processed"); objAgrBC.SetFieldValue("Agreement Status", oApp.InvokeMethod("LookupValue", "SRV_AGREE_STATUS", "Inactive")); objAgrBC.WriteRecord(); TraceMigrationLog(2, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' changed to 'Inactive'"); } // search for outdated entitlements strSearchExpr = "[Entitlement Status SCM]=LookupValue('SRV_AGREE_STATUS','Active')"; objEntBC.SetViewMode(AllView); objEntBC.ActivateField("Entitlement Status SCM"); objEntBC.ActivateField("Entitlement Start Date"); objEntBC.ActivateField("Entitlement End Dat

Agreement BS SCM
BatchRefreshAgreements
function BatchRefreshAgreements(Inputs, Outputs) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Description: Processes status changes for agreements and // Entitlements and attaches or detaches all // relevant bundle assets. Repricing is done // afterwards for all changed asset line items // // WF "Batch Refresh Agreement Header and Entitlements SCM" // is used to trigger this function every first day of month // // Date: June, 26th 2013 // Author: Mario Geiss //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Change Log: // 1.1 TGDGEMAM added new property "Batch Processing" in order to // 2013-09-25 Def#73612 allow forced repricing during execution of // non-batch runs //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { // activate migration event logging bMigLog = true; dCounter = 100000000; Inputs.SetProperty("Batch Processing", "Y"); // 1.1 TraceMigrationLog(1, "Agreement", "<Begin>"); var objBO: BusObject, objTempBO: BusObject; var objAgrBC: BusComp, objEntBC: BusComp, objAccBC: BusComp, objTempBC: BusComp; var strSearchExpr: String; var isRecord: bool; var iNow, iAgrEndDate, iAgrStartDate, iEntEndDate, iEntStartDate, iCount; try { // unlock BC readonly fields oApp.SetProfileAttr("AGR_RW_FLG", "Y"); /******************************************************************** ***** 1. Inactivate outdated Agreements/Entitlements **************** ********************************************************************/ TraceMigrationLog(1, "Agreement", "Start: 1. Inactivate outdated Agreements/Entitlements"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objEntBC = objBO.GetBusComp("Agreement Entitlement"); objAccBC = objBO.GetBusComp("Account"); // search for agreements - ran out of active timeframe strSearchExpr = "[Agreement Status]=LookupValue('SRV_AGREE_STATUS','Active') AND " + "([Agreement Type]=LookupValue('AGREEMENT_TYPE','Affiliation') OR [Agreement Type]=LookupValue('AGREEMENT_TYPE','Corporate Pricing'))"; objAgrBC.SetViewMode(AllView); objAgrBC.ActivateField("Agreement Status"); objAgrBC.ActivateField("Agreement End Date"); objAgrBC.ActivateField("Agreement Type"); objAgrBC.ClearToQuery(); objAgrBC.SetSearchExpr(strSearchExpr); objAgrBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(2, "Agreement", "|" + objAgrBC.CountRecords() + "| active Agreement(s) will be processed"); isRecord = objAgrBC.FirstRecord(); // store current timestamp iNow = new Date().getTime(); while (isRecord) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' [" + objAgrBC.GetFieldValue("Agreement Status") + "] => [" + objAgrBC.GetFieldValue("Agreement Start Date") + "] - [" + objAgrBC.GetFieldValue("Agreement End Date") + "]"); // in case end date is empty set it higher than current timestamp if (objAgrBC.GetFieldValue("Agreement End Date") == "") iAgrEndDate = iNow + 1; else iAgrEndDate = new Date(objAgrBC.GetFieldValue("Agreement End Date")).getTime(); // if agreement is outdated change status if (iAgrEndDate < iNow) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' will be processed"); objAgrBC.SetFieldValue("Agreement Status", oApp.InvokeMethod("LookupValue", "SRV_AGREE_STATUS", "Inactive")); objAgrBC.WriteRecord(); TraceMigrationLog(2, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' changed to 'Inactive'"); } // search for outdated entitlements strSearchExpr = "[Entitlement Status SCM]=LookupValue('SRV_AGREE_STATUS','Active')"; objEntBC.SetViewMode(AllView); objEntBC.ActivateField("Entitlement Status SCM"); objEntBC.ActivateField("Entitlement Start Date"); objEntBC.ActivateField("Entitlement End Dat

Agreement BS SCM
CheckUserResponsibility
function CheckUserResponsibility(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Retrieves user responsibilities // // Input: psInputs PropertySet: // -> Login // -> Resp // Output: Outputs PropertySet: // -> None (PA is set during execution) // // Date: December, 9th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objBC: BusComp; var isRecord: bool; try { objBO = oApp.GetBusObject("Employee"); objBC = objBO.GetBusComp("Employee"); with (objBC) { SetViewMode(AllView); ClearToQuery(); SetSearchExpr("EXISTS([Responsibility]='SCM CUC Admin') AND [Login Name]='" + oApp.LoginName() + "'"); ExecuteQuery(ForwardOnly); if (FirstRecord()) { oApp.SetProfileAttr("AGR_APPLT_BUTTON_RW_PA_CHECKED","Y"); } else { oApp.SetProfileAttr("AGR_APPLT_BUTTON_RW_PA_CHECKED","N"); } } } catch (e) { oApp.RaiseErrorText(e.toString()); } finally { objBC = null; objBO = null; } }

Agreement BS SCM
CheckUserResponsibility
function CheckUserResponsibility(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Retrieves user responsibilities // // Input: psInputs PropertySet: // -> Login // -> Resp // Output: Outputs PropertySet: // -> None (PA is set during execution) // // Date: December, 9th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objBC: BusComp; var isRecord: bool; try { objBO = oApp.GetBusObject("Employee"); objBC = objBO.GetBusComp("Employee"); with (objBC) { SetViewMode(AllView); ClearToQuery(); SetSearchExpr("EXISTS([Responsibility]='SCM CUC Admin') AND [Login Name]='" + oApp.LoginName() + "'"); ExecuteQuery(ForwardOnly); if (FirstRecord()) { oApp.SetProfileAttr("AGR_APPLT_BUTTON_RW_PA_CHECKED","Y"); } else { oApp.SetProfileAttr("AGR_APPLT_BUTTON_RW_PA_CHECKED","N"); } } } catch (e) { oApp.RaiseErrorText(e.toString()); } finally { objBC = null; objBO = null; } }

Agreement BS SCM
RefreshAccountContracts
function RefreshAccountContracts(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Updates entitlements for all assets of a given customer // and reprices the belonging asset line items // // Input: psInputs PropertySet: // -> Service Account Id (SA) | Master Account Id (CMA) // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objBC: BusComp; var strCMAId = ""; var strSAId = ""; var strSearchExpr = ""; var strError = ""; var isRecord: bool; try { TraceMigrationLog(3, " » Account", "<Begin>"); // initialize context isRecord = false; objBO = oApp.GetBusObject("Asset Mgmt - Asset (Order Mgmt)"); objBC = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (Inputs.PropertyExists("Service Account Id")) { strSAId = Inputs.GetProperty("Service Account Id"); isRecord = true; } if (Inputs.PropertyExists("Master Account Id")) { strCMAId = Inputs.GetProperty("Master Account Id"); isRecord = true; } if (!isRecord) { strError = "Either Service Account or Customer Master Account is mandatory"; } /* only active bundles? strSearchExpr = "[Status]=LookupValue('IMPL_PHASE','Active') AND "; */ // if everything is alright go ahead isRecord = false; if (strError == "") { // 2014-07-10: TGDGEMAM - Changed the following string concatenation due to performance issues if (strCMAId != "") { strSearchExpr += "[Owner Account Id]='" + strCMAId + "' AND [Service Type]=LookupValue('UT_SERVICE_TYPE','Bundle')"; } else { strSearchExpr += "[Service Account Id]='" + strSAId + "' AND [Service Type]=LookupValue('UT_SERVICE_TYPE','Bundle')"; } // search for bundle assets (~contracts) objBC.SetViewMode(AllView); objBC.ActivateField("Service Account Id"); objBC.ActivateField("Status"); objBC.ActivateField("Service Type"); objBC.ActivateField("Owner Account Id"); objBC.ClearToQuery(); objBC.SetSearchExpr(strSearchExpr); objBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(3, " » Account", "|" + objBC.CountRecords() + "| Contract(s) => (" + strSearchExpr + ")"); isRecord = objBC.FirstRecord(); while (isRecord) { // refresh bundle contract Inputs.SetProperty("Asset Id", objBC.GetFieldValue("Id")); TraceMigrationLog(3, " » Account", "Asset: '" + objBC.GetFieldValue("Id") + "' will be refreshed"); RefreshContract(Inputs, Outputs); strError += Outputs.GetProperty("Error Message"); isRecord = objBC.NextRecord(); } if (strError != "") TraceMigrationLog(1, " » Account", "Asset: '" + objBC.GetFieldValue("Id") + "' => Error: " + strError); } else { TraceMigrationLog(1, " » Account", strError); } TraceMigrationLog(3, " » Account", "<End>"); } catch (e) { TraceMigrationLog(1, " » Account", "<Error: " + e.toString() + ">"); strError = e.toString(); } finally { Outputs.SetProperty("Error Message", strError); objBC = null; objBO = null; strError = null; strSearchExpr = null; } }

Agreement BS SCM
RefreshAccountContracts
function RefreshAccountContracts(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Updates entitlements for all assets of a given customer // and reprices the belonging asset line items // // Input: psInputs PropertySet: // -> Service Account Id (SA) | Master Account Id (CMA) // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objBC: BusComp; var strCMAId = ""; var strSAId = ""; var strSearchExpr = ""; var strError = ""; var isRecord: bool; try { TraceMigrationLog(3, " » Account", "<Begin>"); // initialize context isRecord = false; objBO = oApp.GetBusObject("Asset Mgmt - Asset (Order Mgmt)"); objBC = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (Inputs.PropertyExists("Service Account Id")) { strSAId = Inputs.GetProperty("Service Account Id"); isRecord = true; } if (Inputs.PropertyExists("Master Account Id")) { strCMAId = Inputs.GetProperty("Master Account Id"); isRecord = true; } if (!isRecord) { strError = "Either Service Account or Customer Master Account is mandatory"; } /* only active bundles? strSearchExpr = "[Status]=LookupValue('IMPL_PHASE','Active') AND "; */ // if everything is alright go ahead isRecord = false; if (strError == "") { // 2014-07-10: TGDGEMAM - Changed the following string concatenation due to performance issues if (strCMAId != "") { strSearchExpr += "[Owner Account Id]='" + strCMAId + "' AND [Service Type]=LookupValue('UT_SERVICE_TYPE','Bundle')"; } else { strSearchExpr += "[Service Account Id]='" + strSAId + "' AND [Service Type]=LookupValue('UT_SERVICE_TYPE','Bundle')"; } // search for bundle assets (~contracts) objBC.SetViewMode(AllView); objBC.ActivateField("Service Account Id"); objBC.ActivateField("Status"); objBC.ActivateField("Service Type"); objBC.ActivateField("Owner Account Id"); objBC.ClearToQuery(); objBC.SetSearchExpr(strSearchExpr); objBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(3, " » Account", "|" + objBC.CountRecords() + "| Contract(s) => (" + strSearchExpr + ")"); isRecord = objBC.FirstRecord(); while (isRecord) { // refresh bundle contract Inputs.SetProperty("Asset Id", objBC.GetFieldValue("Id")); TraceMigrationLog(3, " » Account", "Asset: '" + objBC.GetFieldValue("Id") + "' will be refreshed"); RefreshContract(Inputs, Outputs); strError += Outputs.GetProperty("Error Message"); isRecord = objBC.NextRecord(); } if (strError != "") TraceMigrationLog(1, " » Account", "Asset: '" + objBC.GetFieldValue("Id") + "' => Error: " + strError); } else { TraceMigrationLog(1, " » Account", strError); } TraceMigrationLog(3, " » Account", "<End>"); } catch (e) { TraceMigrationLog(1, " » Account", "<Error: " + e.toString() + ">"); strError = e.toString(); } finally { Outputs.SetProperty("Error Message", strError); objBC = null; objBO = null; strError = null; strSearchExpr = null; } }

Agreement BS SCM
RefreshAgreement
function RefreshAgreement(Inputs, Outputs) /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Description: Updates entitlements for all assets belonging to // customers of a given agreement // // Input: psInputs PropertySet: // -> Agreement Id // Output: Outputs PropertySet: // -> Error Message // // Date: March, 20th 2014 // Author: Mario Geiss // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // History TAADAPE2 05.12.2014 Added the possibility to do // some cleanup on inactive agreements. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ { var objBO: BusObject; var objAgrBC: BusComp; var objAccBC: BusComp; var strAgreeId = ""; var strCMAId = ""; var strSearchExpr = ""; var strError = ""; var isRecord: bool; var strAgrStatus = "" // TAADAPE2 05.12.2014 - Used to validate if the agreement is already inactive try { TraceMigrationLog(5, "RefreshAgreements", "BEGIN"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objAccBC = objBO.GetBusComp("Account"); if (Inputs.PropertyExists("Agreement Id")) { strAgreeId = Inputs.GetProperty("Agreement Id"); } else { oApp.RaiseErrorText("<Agreement Id> is mandatory"); } strSearchExpr += "[Id]='" + strAgreeId + "'"; with (objAgrBC) { SetViewMode(AllView); ActivateField("Agreement Status"); // TAADAPE2 05.12.2014 ClearToQuery(); SetSearchExpr(strSearchExpr); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strAgrStatus = objAgrBC.GetFieldValue("Agreement Status"); // TAADAPE2 05.12.2014 TraceMigrationLog(5, "RefreshAgreements", "SearchSpec (" + strSearchExpr + ") found <1> agreement"); with (objAccBC) { oApp.SetProfileAttr("AGR_RW_FLG","Y"); // unlock BC SetViewMode(AllView); ActivateField("Agreement Account Check Flag SCM"); ClearToQuery(); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); while (isRecord) { TraceMigrationLog(5, "RefreshAgreements", "=> Account '" + GetFieldValue("Id") + "' will be refreshed"); // set intersection flag to "X" in order to capture batch modification SetFieldValue("Agreement Account Check Flag SCM","X"); WriteRecord(); // refresh customer assets Inputs.SetProperty("Master Account Id", GetFieldValue("Id")); // TAADAPE2 05.12.2014 Added the if condition to differentiate the case. Either is an Active // Agreement or an Inactive, which in this case some cleanup needs to be performed if (oApp.InvokeMethod("LookupValue","SRV_AGREE_STATUS",strAgrStatus) == oApp.InvokeMethod("LookupValue","SRV_AGREE_STATUS","Active")) { RefreshAccountContracts(Inputs, Outputs); } else { RefreshInactiveAgreement(Inputs, Outputs); // added for QuadriCA CCE VI } strError += Outputs.GetProperty("Error Message"); isRecord = NextRecord(); } } } } if (strError != "") TraceMigrationLog(5, "RefreshAgreements", "Error: '" + strError + "'"); TraceMigrationLog(5, "RefreshAgreements", "END"); } catch (e) { TraceMigrationLog(5, "RefreshAgreements", e.toString()); } finally { Outputs.SetProperty("Error Message", strError); objAccBC = null; objAgrBC = null; objBO = null; strError = null; strSearchExpr = null; strAgrStatus = null; oApp.SetProfileAttr("AGR_RW_FLG","N"); // unlock BC } }

Agreement BS SCM
RefreshAgreement
function RefreshAgreement(Inputs, Outputs) /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Description: Updates entitlements for all assets belonging to // customers of a given agreement // // Input: psInputs PropertySet: // -> Agreement Id // Output: Outputs PropertySet: // -> Error Message // // Date: March, 20th 2014 // Author: Mario Geiss // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // History TAADAPE2 05.12.2014 Added the possibility to do // some cleanup on inactive agreements. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ { var objBO: BusObject; var objAgrBC: BusComp; var objAccBC: BusComp; var strAgreeId = ""; var strCMAId = ""; var strSearchExpr = ""; var strError = ""; var isRecord: bool; var strAgrStatus = "" // TAADAPE2 05.12.2014 - Used to validate if the agreement is already inactive try { TraceMigrationLog(5, "RefreshAgreements", "BEGIN"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objAccBC = objBO.GetBusComp("Account"); if (Inputs.PropertyExists("Agreement Id")) { strAgreeId = Inputs.GetProperty("Agreement Id"); } else { oApp.RaiseErrorText("<Agreement Id> is mandatory"); } strSearchExpr += "[Id]='" + strAgreeId + "'"; with (objAgrBC) { SetViewMode(AllView); ActivateField("Agreement Status"); // TAADAPE2 05.12.2014 ClearToQuery(); SetSearchExpr(strSearchExpr); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strAgrStatus = objAgrBC.GetFieldValue("Agreement Status"); // TAADAPE2 05.12.2014 TraceMigrationLog(5, "RefreshAgreements", "SearchSpec (" + strSearchExpr + ") found <1> agreement"); with (objAccBC) { oApp.SetProfileAttr("AGR_RW_FLG","Y"); // unlock BC SetViewMode(AllView); ActivateField("Agreement Account Check Flag SCM"); ClearToQuery(); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); while (isRecord) { TraceMigrationLog(5, "RefreshAgreements", "=> Account '" + GetFieldValue("Id") + "' will be refreshed"); // set intersection flag to "X" in order to capture batch modification SetFieldValue("Agreement Account Check Flag SCM","X"); WriteRecord(); // refresh customer assets Inputs.SetProperty("Master Account Id", GetFieldValue("Id")); // TAADAPE2 05.12.2014 Added the if condition to differentiate the case. Either is an Active // Agreement or an Inactive, which in this case some cleanup needs to be performed if (oApp.InvokeMethod("LookupValue","SRV_AGREE_STATUS",strAgrStatus) == oApp.InvokeMethod("LookupValue","SRV_AGREE_STATUS","Active")) { RefreshAccountContracts(Inputs, Outputs); } else { RefreshInactiveAgreement(Inputs, Outputs); // added for QuadriCA CCE VI } strError += Outputs.GetProperty("Error Message"); isRecord = NextRecord(); } } } } if (strError != "") TraceMigrationLog(5, "RefreshAgreements", "Error: '" + strError + "'"); TraceMigrationLog(5, "RefreshAgreements", "END"); } catch (e) { TraceMigrationLog(5, "RefreshAgreements", e.toString()); } finally { Outputs.SetProperty("Error Message", strError); objAccBC = null; objAgrBC = null; objBO = null; strError = null; strSearchExpr = null; strAgrStatus = null; oApp.SetProfileAttr("AGR_RW_FLG","N"); // unlock BC } }

Agreement BS SCM
RefreshContract
function RefreshContract(Inputs, Outputs) /* // Description: Attaches the given contract to the correct active agreement, cleans up all entitlement // contract intersection records and reprices the asset line items accordingly. // // Input: Inputs PropertySet: // -> Asset Integration Id || Asset Id // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss // // Change Log: // 1.1 TGDGEMAM added new code in order to suppress or force repricing // 1.2 TGDGEMAM repricing during execution of non-batch runs (Def#73612) // 1.3 TGDGEMAM changed logic to remove bundle necessity (Aug14) // */ { var objBO: BusObject, objTempBO: BusObject; var objBundleAssetBC: BusComp, objAssetBC: BusComp, objAgreeBC: BusComp, objTempBC: BusComp; var strSearchExpr: String, strAssetIntId: String, strAssetId: String, strCMAId: String,strSAId: String, strProductId: String, strAgreementId: String, strTemp: String, strEntitlementId: String; var isRecord: bool; var aProduct: Array, aRootAsset: Array; var strError = ""; var strCurrentDate = ""; try { /* 1. Retrieve Contract Data */ TraceMigrationLog(3, " »» Contract", "<Start>"); TraceMigrationLog(3, " »» Contract", "Start: 1. Retrieve Contract Data"); if (!Inputs.PropertyExists("Asset Integration Id") && Inputs.PropertyExists("Asset Id") || !Inputs.PropertyExists("Asset Id") && Inputs.PropertyExists("Asset Integration Id") || Inputs.PropertyExists("Asset Id") && Inputs.PropertyExists("Asset Integration Id")) { // retrieve bundle asset basic attributes objBO = oApp.GetBusObject("Asset Management"); objBundleAssetBC = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (!Inputs.PropertyExists("Asset Integration Id")) { strAssetId = Inputs.GetProperty("Asset Id"); strSearchExpr = "[Asset Id]='" + strAssetId + "'"; } else { strAssetIntId = Inputs.GetProperty("Asset Integration Id"); strSearchExpr = "[Integration Id]='" + strAssetIntId + "'"; } objBundleAssetBC.SetViewMode(AllView); objBundleAssetBC.ActivateField("Integration Id"); objBundleAssetBC.ActivateField("Reference Number 2 SCM"); objBundleAssetBC.ActivateField("Owner Account Id"); objBundleAssetBC.ActivateField("Service Account Id"); objBundleAssetBC.ActivateField("Product Id"); objBundleAssetBC.ClearToQuery(); objBundleAssetBC.SetSearchExpr(strSearchExpr); objBundleAssetBC.ExecuteQuery(ForwardOnly); if (objBundleAssetBC.FirstRecord()) { strAssetId = objBundleAssetBC.GetFieldValue("Id"); strAssetIntId = objBundleAssetBC.GetFieldValue("Integration Id"); strCMAId = objBundleAssetBC.GetFieldValue("Owner Account Id"); strSAId = objBundleAssetBC.GetFieldValue("Service Account Id"); strProductId = objBundleAssetBC.GetFieldValue("Product Id"); } else { // something is wrong: contract not found strError = "Contract not found - Searchspec: '" + strSearchExpr + "'"; TraceMigrationLog(1, " »» Contract", strError); } } else { // something is wrong: impossible to move ahead strError = "Either Contract Number or Bundle Asset Id is mandatory"; TraceMigrationLog(1, " »» Contract", strError); } TraceMigrationLog(2, " »» Contract", "Bundle Asset Id: '" + strAssetId + "' | Asset Integration Id: '" + strAssetIntId + "' | CMA Id: '" + strCMAId + "' | SA Id: '" + strSAId + "' | Product Id: '" + strProductId + "'"); TraceMigrationLog(3, " »» Contract", "End: 1. Retrieve Contract Data"); if (strError == "") { /* 2. Find Active Agreement(s) */ TraceMigrationLog(3, " »» Contract", "Start: 2. Find Active Agreement(s)"); // initialize basic variables aProduct = null; aProduct = new Array(); strAgreementId = ""; objTempBO = oApp.GetBusObject("Service Agreement/Account SCM"); objAgreeBC = objTempBO.GetBusComp("Service Agreement/Account"); strSearchExpr = "([Account Id]='" + strCMAId

Agreement BS SCM
RefreshContract
function RefreshContract(Inputs, Outputs) /* // Description: Attaches the given contract to the correct active agreement, cleans up all entitlement // contract intersection records and reprices the asset line items accordingly. // // Input: Inputs PropertySet: // -> Asset Integration Id || Asset Id // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss // // Change Log: // 1.1 TGDGEMAM added new code in order to suppress or force repricing // 1.2 TGDGEMAM repricing during execution of non-batch runs (Def#73612) // 1.3 TGDGEMAM changed logic to remove bundle necessity (Aug14) // */ { var objBO: BusObject, objTempBO: BusObject; var objBundleAssetBC: BusComp, objAssetBC: BusComp, objAgreeBC: BusComp, objTempBC: BusComp; var strSearchExpr: String, strAssetIntId: String, strAssetId: String, strCMAId: String,strSAId: String, strProductId: String, strAgreementId: String, strTemp: String, strEntitlementId: String; var isRecord: bool; var aProduct: Array, aRootAsset: Array; var strError = ""; var strCurrentDate = ""; try { /* 1. Retrieve Contract Data */ TraceMigrationLog(3, " »» Contract", "<Start>"); TraceMigrationLog(3, " »» Contract", "Start: 1. Retrieve Contract Data"); if (!Inputs.PropertyExists("Asset Integration Id") && Inputs.PropertyExists("Asset Id") || !Inputs.PropertyExists("Asset Id") && Inputs.PropertyExists("Asset Integration Id") || Inputs.PropertyExists("Asset Id") && Inputs.PropertyExists("Asset Integration Id")) { // retrieve bundle asset basic attributes objBO = oApp.GetBusObject("Asset Management"); objBundleAssetBC = objBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (!Inputs.PropertyExists("Asset Integration Id")) { strAssetId = Inputs.GetProperty("Asset Id"); strSearchExpr = "[Asset Id]='" + strAssetId + "'"; } else { strAssetIntId = Inputs.GetProperty("Asset Integration Id"); strSearchExpr = "[Integration Id]='" + strAssetIntId + "'"; } objBundleAssetBC.SetViewMode(AllView); objBundleAssetBC.ActivateField("Integration Id"); objBundleAssetBC.ActivateField("Reference Number 2 SCM"); objBundleAssetBC.ActivateField("Owner Account Id"); objBundleAssetBC.ActivateField("Service Account Id"); objBundleAssetBC.ActivateField("Product Id"); objBundleAssetBC.ClearToQuery(); objBundleAssetBC.SetSearchExpr(strSearchExpr); objBundleAssetBC.ExecuteQuery(ForwardOnly); if (objBundleAssetBC.FirstRecord()) { strAssetId = objBundleAssetBC.GetFieldValue("Id"); strAssetIntId = objBundleAssetBC.GetFieldValue("Integration Id"); strCMAId = objBundleAssetBC.GetFieldValue("Owner Account Id"); strSAId = objBundleAssetBC.GetFieldValue("Service Account Id"); strProductId = objBundleAssetBC.GetFieldValue("Product Id"); } else { // something is wrong: contract not found strError = "Contract not found - Searchspec: '" + strSearchExpr + "'"; TraceMigrationLog(1, " »» Contract", strError); } } else { // something is wrong: impossible to move ahead strError = "Either Contract Number or Bundle Asset Id is mandatory"; TraceMigrationLog(1, " »» Contract", strError); } TraceMigrationLog(2, " »» Contract", "Bundle Asset Id: '" + strAssetId + "' | Asset Integration Id: '" + strAssetIntId + "' | CMA Id: '" + strCMAId + "' | SA Id: '" + strSAId + "' | Product Id: '" + strProductId + "'"); TraceMigrationLog(3, " »» Contract", "End: 1. Retrieve Contract Data"); if (strError == "") { /* 2. Find Active Agreement(s) */ TraceMigrationLog(3, " »» Contract", "Start: 2. Find Active Agreement(s)"); // initialize basic variables aProduct = null; aProduct = new Array(); strAgreementId = ""; objTempBO = oApp.GetBusObject("Service Agreement/Account SCM"); objAgreeBC = objTempBO.GetBusComp("Service Agreement/Account"); strSearchExpr = "([Account Id]='" + strCMAId

Agreement BS SCM
RefreshInactiveAgreement
function RefreshInactiveAgreement(Inputs, Outputs) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Description: Processes status changes for Entitlements and attaches // or detaches all relevant bundle assets. Repricing is done // afterwards for all changed asset line items . // // Date: December, 05th 2014 // Author: Pedro Ferreira //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { // activate migration event logging bMigLog = true; TraceMigrationLog(1, "Agreement", "<Begin>"); var objBO: BusObject, objTempBO: BusObject; var objAgrBC: BusComp, objEntBC: BusComp, objTempBC: BusComp; var strSearchExpr: String; var isRecord: bool; var iNow, iAgrEndDate, iEntEndDate; var strAgreeId = ""; try { // unlock BC readonly fields oApp.SetProfileAttr("AGR_RW_FLG", "Y"); /********************************************************** ***** 1. Inactivate outdated Entitlements **************** **********************************************************/ TraceMigrationLog(1, "Agreement", "Start: 1. Inactivate outdated Entitlements"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objEntBC = objBO.GetBusComp("Agreement Entitlement"); if (Inputs.PropertyExists("Agreement Id")) { strAgreeId = Inputs.GetProperty("Agreement Id"); } else { oApp.RaiseErrorText("<Agreement Id> is mandatory"); } // search for agreements - ran out of active timeframe strSearchExpr = "[Id]='" + strAgreeId + "'"; objAgrBC.SetViewMode(AllView); objAgrBC.ActivateField("Agreement Status"); objAgrBC.ActivateField("Agreement End Date"); objAgrBC.ActivateField("Agreement Type"); objAgrBC.ClearToQuery(); objAgrBC.SetSearchExpr(strSearchExpr); objAgrBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(2, "Agreement", "|" + objAgrBC.CountRecords() + "| active Agreement(s) will be processed"); isRecord = objAgrBC.FirstRecord(); // store current timestamp iNow = new Date().getTime(); if (isRecord) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' [" + objAgrBC.GetFieldValue("Agreement Status") + "] => [" + objAgrBC.GetFieldValue("Agreement Start Date") + "] - [" + objAgrBC.GetFieldValue("Agreement End Date") + "]"); // search for outdated entitlements strSearchExpr = "[Entitlement Status SCM]=LookupValue('ENTL_STATUS_SCM','Active')"; objEntBC.SetViewMode(AllView); objEntBC.ActivateField("Entitlement Status SCM"); objEntBC.ActivateField("Entitlement Start Date"); objEntBC.ActivateField("Entitlement End Date"); objEntBC.ClearToQuery(); objEntBC.SetSearchExpr(strSearchExpr); objEntBC.ExecuteQuery(ForwardOnly); isRecord = objEntBC.FirstRecord(); while (isRecord) { TraceMigrationLog(3, "Agreement", "»» Entitlement: '" + objEntBC.GetFieldValue("Id") + "' [" + objEntBC.GetFieldValue("Entitlement Status SCM") + "] => [" + objEntBC.GetFieldValue("Entitlement Start Date") + "] - [" + objEntBC.GetFieldValue("Entitlement End Date") + "]"); // in case end date is empty set it higher than current timestamp if (objEntBC.GetFieldValue("Entitlement End Date") == "" || objEntBC.GetFieldValue("Entitlement End Date") == null) iEntEndDate = iNow - 1; else iEntEndDate = new Date(objEntBC.GetFieldValue("Entitlement End Date")).getTime(); // in case entitlement end date > agreement end date - take care if (iEntEndDate > iAgrEndDate) iEntEndDate = iAgrEndDate; // entitlement reached end date - change status if (iEntEndDate < iNow) { TraceMigrationLog(3, "Agreement", "»» Entitlement: '" + objEntBC.GetFieldValue("Id") + "' will be processed"); objEntBC.SetFieldValue("Entitlement Status SCM", oApp.InvokeMethod("LookupValue", "SRV_AGREE_STATUS", "Inactive")); objEntBC.WriteRecord(); TraceMigrationLog(2, "Agreement", "»» Entitlement: '" + objEntBC.GetFie

Agreement BS SCM
RefreshInactiveAgreement
function RefreshInactiveAgreement(Inputs, Outputs) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ // Description: Processes status changes for Entitlements and attaches // or detaches all relevant bundle assets. Repricing is done // afterwards for all changed asset line items . // // Date: December, 05th 2014 // Author: Pedro Ferreira //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { // activate migration event logging bMigLog = true; TraceMigrationLog(1, "Agreement", "<Begin>"); var objBO: BusObject, objTempBO: BusObject; var objAgrBC: BusComp, objEntBC: BusComp, objTempBC: BusComp; var strSearchExpr: String; var isRecord: bool; var iNow, iAgrEndDate, iEntEndDate; var strAgreeId = ""; try { // unlock BC readonly fields oApp.SetProfileAttr("AGR_RW_FLG", "Y"); /********************************************************** ***** 1. Inactivate outdated Entitlements **************** **********************************************************/ TraceMigrationLog(1, "Agreement", "Start: 1. Inactivate outdated Entitlements"); // initialize context objBO = oApp.GetBusObject("Service Agreement"); objAgrBC = objBO.GetBusComp("Service Agreement"); objEntBC = objBO.GetBusComp("Agreement Entitlement"); if (Inputs.PropertyExists("Agreement Id")) { strAgreeId = Inputs.GetProperty("Agreement Id"); } else { oApp.RaiseErrorText("<Agreement Id> is mandatory"); } // search for agreements - ran out of active timeframe strSearchExpr = "[Id]='" + strAgreeId + "'"; objAgrBC.SetViewMode(AllView); objAgrBC.ActivateField("Agreement Status"); objAgrBC.ActivateField("Agreement End Date"); objAgrBC.ActivateField("Agreement Type"); objAgrBC.ClearToQuery(); objAgrBC.SetSearchExpr(strSearchExpr); objAgrBC.ExecuteQuery(ForwardOnly); TraceMigrationLog(2, "Agreement", "|" + objAgrBC.CountRecords() + "| active Agreement(s) will be processed"); isRecord = objAgrBC.FirstRecord(); // store current timestamp iNow = new Date().getTime(); if (isRecord) { TraceMigrationLog(3, "Agreement", "» Agreement: '" + objAgrBC.GetFieldValue("Id") + "' [" + objAgrBC.GetFieldValue("Agreement Status") + "] => [" + objAgrBC.GetFieldValue("Agreement Start Date") + "] - [" + objAgrBC.GetFieldValue("Agreement End Date") + "]"); // search for outdated entitlements strSearchExpr = "[Entitlement Status SCM]=LookupValue('ENTL_STATUS_SCM','Active')"; objEntBC.SetViewMode(AllView); objEntBC.ActivateField("Entitlement Status SCM"); objEntBC.ActivateField("Entitlement Start Date"); objEntBC.ActivateField("Entitlement End Date"); objEntBC.ClearToQuery(); objEntBC.SetSearchExpr(strSearchExpr); objEntBC.ExecuteQuery(ForwardOnly); isRecord = objEntBC.FirstRecord(); while (isRecord) { TraceMigrationLog(3, "Agreement", "»» Entitlement: '" + objEntBC.GetFieldValue("Id") + "' [" + objEntBC.GetFieldValue("Entitlement Status SCM") + "] => [" + objEntBC.GetFieldValue("Entitlement Start Date") + "] - [" + objEntBC.GetFieldValue("Entitlement End Date") + "]"); // in case end date is empty set it higher than current timestamp if (objEntBC.GetFieldValue("Entitlement End Date") == "" || objEntBC.GetFieldValue("Entitlement End Date") == null) iEntEndDate = iNow - 1; else iEntEndDate = new Date(objEntBC.GetFieldValue("Entitlement End Date")).getTime(); // in case entitlement end date > agreement end date - take care if (iEntEndDate > iAgrEndDate) iEntEndDate = iAgrEndDate; // entitlement reached end date - change status if (iEntEndDate < iNow) { TraceMigrationLog(3, "Agreement", "»» Entitlement: '" + objEntBC.GetFieldValue("Id") + "' will be processed"); objEntBC.SetFieldValue("Entitlement Status SCM", oApp.InvokeMethod("LookupValue", "SRV_AGREE_STATUS", "Inactive")); objEntBC.WriteRecord(); TraceMigrationLog(2, "Agreement", "»» Entitlement: '" + objEntBC.GetFie

Agreement BS SCM
RepriceAsset
function RepriceAsset(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Reprices a given Asset Line Item // // Input: psInputs PropertySet: // -> Root Asset Id // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objHeaderBC: BusComp, objLineItemBC: BusComp; var strRowId: String; var strError = ""; var isRecord: bool; try { TraceMigrationLog(3, " »»» Pricing", "<Start>"); // initialize variables objBO = oApp.GetBusObject("Asset Management"); objHeaderBC = objBO.GetBusComp("Asset Mgmt - Asset - Header"); strRowId = Inputs.GetProperty("Root Asset Id"); // prepare header objHeaderBC.SetViewMode(AllView); objHeaderBC.ClearToQuery(); objHeaderBC.SetSearchSpec("Id", strRowId); objHeaderBC.ExecuteQuery(ForwardOnly); // header found? if (objHeaderBC.FirstRecord()) { objLineItemBC = objBO.GetBusComp("Asset Mgmt - Asset"); objLineItemBC.InvokeMethod("CalculatePriceAllAssetSCM"); TraceMigrationLog(3, " »»» Pricing", "Root Asset Id: " + Inputs.GetProperty("Root Asset Id") + " => refreshed"); } TraceMigrationLog(3, " »»» Pricing", "<End>"); } catch (e) { TraceMigrationLog(1, " »»» Pricing", "<Error: " + e.toString() + ">"); strError = e.toString(); } finally { Outputs.SetProperty("Error Message", strError); objLineItemBC = null; objHeaderBC = null; objBO = null; strError = null; strRowId = null; } }

Agreement BS SCM
RepriceAsset
function RepriceAsset(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Reprices a given Asset Line Item // // Input: psInputs PropertySet: // -> Root Asset Id // Output: Outputs PropertySet: // -> Error Message // // Date: June, 24th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBO: BusObject; var objHeaderBC: BusComp, objLineItemBC: BusComp; var strRowId: String; var strError = ""; var isRecord: bool; try { TraceMigrationLog(3, " »»» Pricing", "<Start>"); // initialize variables objBO = oApp.GetBusObject("Asset Management"); objHeaderBC = objBO.GetBusComp("Asset Mgmt - Asset - Header"); strRowId = Inputs.GetProperty("Root Asset Id"); // prepare header objHeaderBC.SetViewMode(AllView); objHeaderBC.ClearToQuery(); objHeaderBC.SetSearchSpec("Id", strRowId); objHeaderBC.ExecuteQuery(ForwardOnly); // header found? if (objHeaderBC.FirstRecord()) { objLineItemBC = objBO.GetBusComp("Asset Mgmt - Asset"); objLineItemBC.InvokeMethod("CalculatePriceAllAssetSCM"); TraceMigrationLog(3, " »»» Pricing", "Root Asset Id: " + Inputs.GetProperty("Root Asset Id") + " => refreshed"); } TraceMigrationLog(3, " »»» Pricing", "<End>"); } catch (e) { TraceMigrationLog(1, " »»» Pricing", "<Error: " + e.toString() + ">"); strError = e.toString(); } finally { Outputs.SetProperty("Error Message", strError); objLineItemBC = null; objHeaderBC = null; objBO = null; strError = null; strRowId = null; } }

Agreement BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod(MethodName, Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Name: Agreement BS SCM // Date: June, 21st 2013 // Author: Mario Geiss // Project: QuadriCA - SME Enablement II // Comment: //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (Inputs.PropertyExists("LogLevel")) dLogLevel = Inputs.GetProperty("LogLevel"); if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: Start"); sReturn = ContinueOperation; switch (MethodName) { case "RefreshContract": RefreshContract(Inputs, Outputs); sReturn = CancelOperation; break; case "RefreshAccountContracts": RefreshAccountContracts(Inputs, Outputs); sReturn = CancelOperation; break; case "BatchRefreshAgreements": BatchRefreshAgreements(Inputs, Outputs); sReturn = CancelOperation; break; case "CheckUserResponsibility": CheckUserResponsibility(Inputs, Outputs); sReturn = CancelOperation; break; case "RefreshAgreement": RefreshAgreement(Inputs, Outputs); sReturn = CancelOperation; // case "RefreshInactiveAgreement": // RefreshInactiveAgreement(Inputs, Outputs); // sReturn = CancelOperation; default: break; } if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: End"); } catch (e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: ERROR: " + e.toString()); throw (e); } finally { oApp = null; } return sReturn; }

Agreement BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod(MethodName, Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Name: Agreement BS SCM // Date: June, 21st 2013 // Author: Mario Geiss // Project: QuadriCA - SME Enablement II // Comment: //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (Inputs.PropertyExists("LogLevel")) dLogLevel = Inputs.GetProperty("LogLevel"); if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: Start"); sReturn = ContinueOperation; switch (MethodName) { case "RefreshContract": RefreshContract(Inputs, Outputs); sReturn = CancelOperation; break; case "RefreshAccountContracts": RefreshAccountContracts(Inputs, Outputs); sReturn = CancelOperation; break; case "BatchRefreshAgreements": BatchRefreshAgreements(Inputs, Outputs); sReturn = CancelOperation; break; case "CheckUserResponsibility": CheckUserResponsibility(Inputs, Outputs); sReturn = CancelOperation; break; case "RefreshAgreement": RefreshAgreement(Inputs, Outputs); sReturn = CancelOperation; // case "RefreshInactiveAgreement": // RefreshInactiveAgreement(Inputs, Outputs); // sReturn = CancelOperation; default: break; } if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: End"); } catch (e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ServicePreInvokeMethod: ERROR: " + e.toString()); throw (e); } finally { oApp = null; } return sReturn; }

Agreement BS SCM
TraceMigrationLog
function TraceMigrationLog(LogLevel, strArea, strText) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Write log entries into migration log // // Input: -> strArea := Type of current process step // -> strText := Current process step details // // Date: July, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBOLog: BusObject; var objBCLogHeader: BusComp; var objBCLogEvent: BusComp; var strErrMsg: String; var strCounter: String; if (bIsTraceOn) oApp.Trace(strArea + ": " + strText); try { if (defined(bMigLog)) if (bMigLog) { objBOLog = oApp.GetBusObject("Log SCM"); objBCLogHeader = objBOLog.GetBusComp("Log SCM"); objBCLogEvent = objBOLog.GetBusComp("Log 2 Event SCM"); // initialize header only the first time the log is written if (strMigLogHeaderId == "") { objBCLogHeader.NewRecord(NewAfter); objBCLogHeader.SetFieldValue("Application Name", "AGREE_BATCH_RUN_1ST_OF_MONTH"); objBCLogHeader.SetFieldValue("Type", "Siebel Workflow"); objBCLogHeader.SetFieldValue("Desc Text", "Batch Refresh Agreement Header and Entitlements SCM"); objBCLogHeader.WriteRecord(); strMigLogHeaderId = objBCLogHeader.GetFieldValue("Id"); } if (dLogLevel >= LogLevel) { dCounter++; strCounter = new String(dCounter).substring(1, 9); // write event log related to the created header above objBCLogEvent.NewRecord(NewAfter); objBCLogEvent.SetFieldValue("Log Id", strMigLogHeaderId); objBCLogEvent.SetFieldValue("Type", strArea.substring(0, 29)); objBCLogEvent.SetFieldValue("Desc Text", strCounter + " {" + LogLevel + "}: " + strText.substring(0, 982)); objBCLogEvent.WriteRecord(); } } } catch (e) { strErrMsg = e.message; objBCLogEvent.NewRecord(NewAfter); objBCLogEvent.SetFieldValue("Log Id", strMigLogHeaderId); objBCLogEvent.SetFieldValue("Type", "Log"); strErrMsg = "<Error: " + strErrMsg + ">"; objBCLogEvent.SetFieldValue("Desc Text", strErrMsg.substring(0, 999)); objBCLogEvent.WriteRecord(); throw (e); } finally { objBCLogHeader = null; objBCLogEvent = null; objBOLog = null; strErrMsg = null; strCounter = null; } }

Agreement BS SCM
TraceMigrationLog
function TraceMigrationLog(LogLevel, strArea, strText) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Write log entries into migration log // // Input: -> strArea := Type of current process step // -> strText := Current process step details // // Date: July, 4th 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var objBOLog: BusObject; var objBCLogHeader: BusComp; var objBCLogEvent: BusComp; var strErrMsg: String; var strCounter: String; if (bIsTraceOn) oApp.Trace(strArea + ": " + strText); try { if (defined(bMigLog)) if (bMigLog) { objBOLog = oApp.GetBusObject("Log SCM"); objBCLogHeader = objBOLog.GetBusComp("Log SCM"); objBCLogEvent = objBOLog.GetBusComp("Log 2 Event SCM"); // initialize header only the first time the log is written if (strMigLogHeaderId == "") { objBCLogHeader.NewRecord(NewAfter); objBCLogHeader.SetFieldValue("Application Name", "AGREE_BATCH_RUN_1ST_OF_MONTH"); objBCLogHeader.SetFieldValue("Type", "Siebel Workflow"); objBCLogHeader.SetFieldValue("Desc Text", "Batch Refresh Agreement Header and Entitlements SCM"); objBCLogHeader.WriteRecord(); strMigLogHeaderId = objBCLogHeader.GetFieldValue("Id"); } if (dLogLevel >= LogLevel) { dCounter++; strCounter = new String(dCounter).substring(1, 9); // write event log related to the created header above objBCLogEvent.NewRecord(NewAfter); objBCLogEvent.SetFieldValue("Log Id", strMigLogHeaderId); objBCLogEvent.SetFieldValue("Type", strArea.substring(0, 29)); objBCLogEvent.SetFieldValue("Desc Text", strCounter + " {" + LogLevel + "}: " + strText.substring(0, 982)); objBCLogEvent.WriteRecord(); } } } catch (e) { strErrMsg = e.message; objBCLogEvent.NewRecord(NewAfter); objBCLogEvent.SetFieldValue("Log Id", strMigLogHeaderId); objBCLogEvent.SetFieldValue("Type", "Log"); strErrMsg = "<Error: " + strErrMsg + ">"; objBCLogEvent.SetFieldValue("Desc Text", strErrMsg.substring(0, 999)); objBCLogEvent.WriteRecord(); throw (e); } finally { objBCLogHeader = null; objBCLogEvent = null; objBOLog = null; strErrMsg = null; strCounter = null; } }

Agreement Date Handling BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Agreement Date Handling BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Agreement Date Handling BS SCM
GetValidDayRangeForMonth
function GetValidDayRangeForMonth(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: The function is used by DVM and Service Agreement BC. // Input: psInputs PropertySet: -> DayOfMonth (Date) // Output: psOutputs PropertySet: -> FirstDayOfMonth (Date) -> IsFirstDayOfMonth [String] - 'true'/'false' -> LastDayOfMonth (Date) -> IsLastDayOfMonth [String] - 'true'/'false' // Date: June, 3rd 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var dDay:Date, dToday:Date, dStart: Date, dEnd: Date, dCurrentStart: Date, dCurrentEnd: Date; var strStart:String, strEnd:String, strDay:String, strCurrentStart: String, strCurrentEnd: String; try { if (Inputs.PropertyExists("Day")) dDay = new Date(Inputs.GetProperty("Day")) else dDay = new Date() dToday = new Date(); var iDayM = ToInteger(dDay.getMonth()+1); var iDayY = ToInteger(dDay.getFullYear()); var iDayYM = ToInteger(dDay.getFullYear())*100 + ToInteger(dDay.getMonth()+1); var iTodayM = ToInteger(dToday.getMonth()+1); var iTodayY = ToInteger(dToday.getFullYear()); var iTodayYM = ToInteger(dToday.getFullYear())*100 + ToInteger(dToday.getMonth()+1); // check whether given date is at least next month if (iDayYM < iTodayYM) // given month is less than or equal current month { if (iTodayM < 12) // year will not change iDayM = iTodayM+1; else // => year changes { iDayM = 1; iDayY = iTodayY+1; } } // // store first day of current month dCurrentStart = new Date(new Date(iTodayY, iTodayM-1, 1)); Clib.strftime(strCurrentStart, "%m/%d/%Y", dCurrentStart); // calculate next month if (iTodayM < 12) // given month is not december { iTodayM = iTodayM+1; } else // => first month of next year { iTodayM = 1; iTodayY = iTodayY+1; } // compute month after start date for end date constructor var iNextMonthM:Number; var iNextMonthY:Number; if (iDayM < 12) // given month is not december { iNextMonthM = iDayM+1; iNextMonthY = iDayY; } else // => first month of next year { iNextMonthM = 1; iNextMonthY = iDayY+1; } dStart = new Date (iDayY, iDayM-1, 1); dEnd = new Date (new Date (iNextMonthY, iNextMonthM-1, 1)-1); dCurrentEnd = new Date (new Date (iTodayY, iTodayM-1, 1)-1); Clib.strftime(strDay, "%m/%d/%Y", dDay); Clib.strftime(strStart, "%m/%d/%Y", dStart); Clib.strftime(strEnd, "%m/%d/%Y", dEnd); Clib.strftime(strCurrentEnd, "%m/%d/%Y", dCurrentEnd); // given date Outputs.SetProperty("Day" , strDay); // first day of month Outputs.SetProperty("FirstDayOfMonth" , strStart); if (strStart == strDay) Outputs.SetProperty("IsFirstDayOfMonth" , "Y"); else Outputs.SetProperty("IsFirstDayOfMonth" , "N"); // last day of month Outputs.SetProperty("LastDayOfMonth" , strEnd); if (strEnd == strDay) Outputs.SetProperty("IsLastDayOfMonth" , "Y"); else Outputs.SetProperty("IsLastDayOfMonth" , "N"); // first day of current month Outputs.SetProperty("FirstDayOfCurrentMonth" , strCurrentStart); if (strCurrentStart == strDay) Outputs.SetProperty("IsFirstDayOfCurrentMonth" , "Y"); else Outputs.SetProperty("IsFirstDayOfCurrentMonth" , "N"); // last day of current month Outputs.SetProperty("LastDayOfCurrentMonth" , strCurrentEnd); if (strCurrentEnd == strDay) Outputs.SetProperty("IsLastDayOfCurrentMonth" , "Y"); else Outputs.SetProperty("IsLastDayOfCurrentMonth" , "N"); // set revision ok flag if (dCurrentEnd < dDay) Outputs.SetProperty("IsValidRevisionMonth" , "Y"); else Outputs.SetProperty("IsValidRevisionMonth" , "N"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name()+": GetValidDayRangeForMonth: Error: "+e.toString()); throw(e); } finally { dDay = null; dToday = null; dStart = null; dEnd = null; dCurrentStart = null; dCurrentEnd = null; } }

Agreement Date Handling BS SCM
GetValidDayRangeForMonth
function GetValidDayRangeForMonth(Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: The function is used by DVM and Service Agreement BC. // Input: psInputs PropertySet: -> DayOfMonth (Date) // Output: psOutputs PropertySet: -> FirstDayOfMonth (Date) -> IsFirstDayOfMonth [String] - 'true'/'false' -> LastDayOfMonth (Date) -> IsLastDayOfMonth [String] - 'true'/'false' // Date: June, 3rd 2013 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var dDay:Date, dToday:Date, dStart: Date, dEnd: Date, dCurrentStart: Date, dCurrentEnd: Date; var strStart:String, strEnd:String, strDay:String, strCurrentStart: String, strCurrentEnd: String; try { if (Inputs.PropertyExists("Day")) dDay = new Date(Inputs.GetProperty("Day")) else dDay = new Date() dToday = new Date(); var iDayM = ToInteger(dDay.getMonth()+1); var iDayY = ToInteger(dDay.getFullYear()); var iDayYM = ToInteger(dDay.getFullYear())*100 + ToInteger(dDay.getMonth()+1); var iTodayM = ToInteger(dToday.getMonth()+1); var iTodayY = ToInteger(dToday.getFullYear()); var iTodayYM = ToInteger(dToday.getFullYear())*100 + ToInteger(dToday.getMonth()+1); // check whether given date is at least next month if (iDayYM < iTodayYM) // given month is less than or equal current month { if (iTodayM < 12) // year will not change iDayM = iTodayM+1; else // => year changes { iDayM = 1; iDayY = iTodayY+1; } } // // store first day of current month dCurrentStart = new Date(new Date(iTodayY, iTodayM-1, 1)); Clib.strftime(strCurrentStart, "%m/%d/%Y", dCurrentStart); // calculate next month if (iTodayM < 12) // given month is not december { iTodayM = iTodayM+1; } else // => first month of next year { iTodayM = 1; iTodayY = iTodayY+1; } // compute month after start date for end date constructor var iNextMonthM:Number; var iNextMonthY:Number; if (iDayM < 12) // given month is not december { iNextMonthM = iDayM+1; iNextMonthY = iDayY; } else // => first month of next year { iNextMonthM = 1; iNextMonthY = iDayY+1; } dStart = new Date (iDayY, iDayM-1, 1); dEnd = new Date (new Date (iNextMonthY, iNextMonthM-1, 1)-1); dCurrentEnd = new Date (new Date (iTodayY, iTodayM-1, 1)-1); Clib.strftime(strDay, "%m/%d/%Y", dDay); Clib.strftime(strStart, "%m/%d/%Y", dStart); Clib.strftime(strEnd, "%m/%d/%Y", dEnd); Clib.strftime(strCurrentEnd, "%m/%d/%Y", dCurrentEnd); // given date Outputs.SetProperty("Day" , strDay); // first day of month Outputs.SetProperty("FirstDayOfMonth" , strStart); if (strStart == strDay) Outputs.SetProperty("IsFirstDayOfMonth" , "Y"); else Outputs.SetProperty("IsFirstDayOfMonth" , "N"); // last day of month Outputs.SetProperty("LastDayOfMonth" , strEnd); if (strEnd == strDay) Outputs.SetProperty("IsLastDayOfMonth" , "Y"); else Outputs.SetProperty("IsLastDayOfMonth" , "N"); // first day of current month Outputs.SetProperty("FirstDayOfCurrentMonth" , strCurrentStart); if (strCurrentStart == strDay) Outputs.SetProperty("IsFirstDayOfCurrentMonth" , "Y"); else Outputs.SetProperty("IsFirstDayOfCurrentMonth" , "N"); // last day of current month Outputs.SetProperty("LastDayOfCurrentMonth" , strCurrentEnd); if (strCurrentEnd == strDay) Outputs.SetProperty("IsLastDayOfCurrentMonth" , "Y"); else Outputs.SetProperty("IsLastDayOfCurrentMonth" , "N"); // set revision ok flag if (dCurrentEnd < dDay) Outputs.SetProperty("IsValidRevisionMonth" , "Y"); else Outputs.SetProperty("IsValidRevisionMonth" , "N"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name()+": GetValidDayRangeForMonth: Error: "+e.toString()); throw(e); } finally { dDay = null; dToday = null; dStart = null; dEnd = null; dCurrentStart = null; dCurrentEnd = null; } }

Agreement Date Handling BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Agreement Date Handling BS SCM // Methods: // Date: June, 3rd 2013 // Author: Mario Geiss // Project: QuadriCA //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: Start"); sReturn = ContinueOperation; switch (MethodName) { case "GetValidDayRangeForMonth": GetValidDayRangeForMonth(Inputs, Outputs); sReturn = CancelOperation; break; default: break; } if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: ERROR: "+e.toString()); throw(e); } finally { oApp = null; } return sReturn; }

Agreement Date Handling BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Agreement Date Handling BS SCM // Methods: // Date: June, 3rd 2013 // Author: Mario Geiss // Project: QuadriCA //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: Start"); sReturn = ContinueOperation; switch (MethodName) { case "GetValidDayRangeForMonth": GetValidDayRangeForMonth(Inputs, Outputs); sReturn = CancelOperation; break; default: break; } if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name()+": ServicePreInvokeMethod: ERROR: "+e.toString()); throw(e); } finally { oApp = null; } return sReturn; }

Agreement Entitlement Utility SCM
(declarations)
var oApp; var bIsTraceOn; var ADJ_GROUP = "Corporate Hierarchy Discounts SCM"; var ACV_ENTLMNT_AGREE_DTL = "Entitlement Mapping Agreement Detail Names"; var ACV_ENTLMNT_PROD = "Entitlement Mapping Products"; var ADJ_TYPE_OVERRIDE = "Price Override"; var ADJ_TYPE_DISCOUNT = "Discount Amount"; var KEY_ADJ_TYPE = "Adjustment Type"; var KEY_ADJ_AMOUNT = "Adjustment Amount"; var AGR_DET_NAME = "AGREE_DETAIL_NAMES"; var AGR_DET_NAME_VALUES = "AGREE_DETAIL_NAME_VALUES"; var PROD_DUOBILL_BUS = "Duo Bill Business"; var PROD_DUOBILL_PAUSCHAL = "Duo Bill Pauschal"; var PROD_DUOBILL_PRIV = "Duo Bill Private";

Agreement Entitlement Utility SCM
(declarations)
var oApp; var bIsTraceOn; var ADJ_GROUP = "Corporate Hierarchy Discounts SCM"; var ACV_ENTLMNT_AGREE_DTL = "Entitlement Mapping Agreement Detail Names"; var ACV_ENTLMNT_PROD = "Entitlement Mapping Products"; var ADJ_TYPE_OVERRIDE = "Price Override"; var ADJ_TYPE_DISCOUNT = "Discount Amount"; var KEY_ADJ_TYPE = "Adjustment Type"; var KEY_ADJ_AMOUNT = "Adjustment Amount"; var AGR_DET_NAME = "AGREE_DETAIL_NAMES"; var AGR_DET_NAME_VALUES = "AGREE_DETAIL_NAME_VALUES"; var PROD_DUOBILL_BUS = "Duo Bill Business"; var PROD_DUOBILL_PAUSCHAL = "Duo Bill Pauschal"; var PROD_DUOBILL_PRIV = "Duo Bill Private";

Agreement Entitlement Utility SCM
LookupDescription
function LookupDescription(type,name) { var lovBusObj; var lovBusComp; var descr; try{ lovBusObj = TheApplication().GetBusObject("List Of Values"); lovBusComp = lovBusObj.GetBusComp("List Of Values"); lovBusComp.ActivateField("Description"); lovBusComp.SetSearchSpec("Type", type); lovBusComp.SetSearchSpec("Name", name); setViewMode(AllView); lovBusComp.ExecuteQuery(); if(lovBusComp.FirstRecord()) descr = lovBusComp.GetFieldValue("Description"); return(descr); } finally{ lovBusComp=null; lovBusObj=null; } }

Agreement Entitlement Utility SCM
LookupDescription
function LookupDescription(type,name) { var lovBusObj; var lovBusComp; var descr; try{ lovBusObj = TheApplication().GetBusObject("List Of Values"); lovBusComp = lovBusObj.GetBusComp("List Of Values"); lovBusComp.ActivateField("Description"); lovBusComp.SetSearchSpec("Type", type); lovBusComp.SetSearchSpec("Name", name); setViewMode(AllView); lovBusComp.ExecuteQuery(); if(lovBusComp.FirstRecord()) descr = lovBusComp.GetFieldValue("Description"); return(descr); } finally{ lovBusComp=null; lovBusObj=null; } }

Agreement Entitlement Utility SCM
LookupVal
/*************************************************************************************************** ** Author: ** Date: 27.01.2009 ** Descr: ***************************************************************************************************/ function LookupVal(type,name,lang) { var lovBusObj = TheApplication().GetBusObject("List Of Values"); var lovBusComp = lovBusObj.GetBusComp("List Of Values"); var value; try{ setViewMode(AllView); lovBusComp.ActivateField("Value"); lovBusComp.ActivateField("Type"); lovBusComp.ActivateField("Name"); lovBusComp.ActivateField("Language"); lovBusComp.SetSearchSpec("Type", type); lovBusComp.SetSearchSpec("Name", name); lovBusComp.SetSearchSpec("Language", lang); lovBusComp.ExecuteQuery(); if(lovBusComp.FirstRecord()) { value = lovBusComp.GetFieldValue("Value"); } return(value); } finally{ lovBusObj=null; lovBusComp=null; } }

Agreement Entitlement Utility SCM
LookupVal
/*************************************************************************************************** ** Author: ** Date: 27.01.2009 ** Descr: ***************************************************************************************************/ function LookupVal(type,name,lang) { var lovBusObj = TheApplication().GetBusObject("List Of Values"); var lovBusComp = lovBusObj.GetBusComp("List Of Values"); var value; try{ setViewMode(AllView); lovBusComp.ActivateField("Value"); lovBusComp.ActivateField("Type"); lovBusComp.ActivateField("Name"); lovBusComp.ActivateField("Language"); lovBusComp.SetSearchSpec("Type", type); lovBusComp.SetSearchSpec("Name", name); lovBusComp.SetSearchSpec("Language", lang); lovBusComp.ExecuteQuery(); if(lovBusComp.FirstRecord()) { value = lovBusComp.GetFieldValue("Value"); } return(value); } finally{ lovBusObj=null; lovBusComp=null; } }

Agreement Entitlement Utility SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: custom method invocation ***************************************************************************************************/ var intReturn = CancelOperation; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch(MethodName) { case "Sync Entitlement-Based Adjustments": SyncAdjustments(Inputs, Outputs); intReturn = CancelOperation; break; default: intReturn = ContinueOperation; } } finally { oApp = null; } return (intReturn); }

Agreement Entitlement Utility SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: custom method invocation ***************************************************************************************************/ var intReturn = CancelOperation; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch(MethodName) { case "Sync Entitlement-Based Adjustments": SyncAdjustments(Inputs, Outputs); intReturn = CancelOperation; break; default: intReturn = ContinueOperation; } } finally { oApp = null; } return (intReturn); }

Agreement Entitlement Utility SCM
SyncAdjustments
function SyncAdjustments(Inputs, Outputs) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Main method for synchronizing entitlement-based adjustments from agreement details. ** The mapping from detail names to adjustment products is defined in 2 admin codes. ** Inputs: SiebelMessage - Instance of EAI Agreed Entitlement SCM IntObj ** Exception: raised if mapping ACVs do not match or input is invalid ***************************************************************************************************/ var psAgree; var psEntlmnt; var aMapDtlNames; var aMapProducts; var hDtlNames; try { aMapDtlNames = getAdminCodeArray(ACV_ENTLMNT_AGREE_DTL); // get mapping ACVs aMapProducts = getAdminCodeArray(ACV_ENTLMNT_PROD); // ACVs must have same number of elements if(aMapDtlNames.length != aMapProducts.length) { oApp.RaiseErrorText(Name() + ".SyncAdjustments: Admin Codes '" + ACV_ENTLMNT_AGREE_DTL + "' and '" + ACV_ENTLMNT_PROD + "' do not match"); } // validate SiebelMessage input if(Inputs.GetChildCount() == 0 || Inputs.GetChild(0).GetType() != "SiebelMessage" || Inputs.GetChild(0).GetProperty("IntObjectName") != "EAI Agreed Entitlement Internal SCM") { oApp.RaiseErrorText(Name() + ".SyncAdjustments: invalid input"); } psAgree = getHierElement(Inputs.GetChild(0), // get agreement "ListOfEAI Agreed Entitlement Internal SCM/Service Agreement"); psEntlmnt = getHierElement(psAgree, // get entitlement "ListOfEntitlement Account SCM/Entitlement Account SCM"); var sAgreeName = psAgree.GetProperty("Integration Id"); var sEntlmntName = psEntlmnt.GetProperty("Entitlement Name SCM"); var sEntlmntId = getEntitlementId(sAgreeName, sEntlmntName); hDtlNames = getDtlInfo(psAgree); // get dtl data from input if(bIsTraceOn) oApp.Trace(Name() + ".SyncAdjustments: sEntlmntName: " + sEntlmntName + ", sAgreeName: " + sAgreeName); syncEntlmntBasedAdj(sEntlmntId, hDtlNames, aMapDtlNames, aMapProducts); } finally { psEntlmnt = null; psAgree = null; aMapDtlNames = null; aMapProducts = null; if(hDtlNames != null) { for(var sKey in hDtlNames) hDtlNames[sKey] = null; hDtlNames = null; } } }

Agreement Entitlement Utility SCM
SyncAdjustments
function SyncAdjustments(Inputs, Outputs) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Main method for synchronizing entitlement-based adjustments from agreement details. ** The mapping from detail names to adjustment products is defined in 2 admin codes. ** Inputs: SiebelMessage - Instance of EAI Agreed Entitlement SCM IntObj ** Exception: raised if mapping ACVs do not match or input is invalid ***************************************************************************************************/ var psAgree; var psEntlmnt; var aMapDtlNames; var aMapProducts; var hDtlNames; try { aMapDtlNames = getAdminCodeArray(ACV_ENTLMNT_AGREE_DTL); // get mapping ACVs aMapProducts = getAdminCodeArray(ACV_ENTLMNT_PROD); // ACVs must have same number of elements if(aMapDtlNames.length != aMapProducts.length) { oApp.RaiseErrorText(Name() + ".SyncAdjustments: Admin Codes '" + ACV_ENTLMNT_AGREE_DTL + "' and '" + ACV_ENTLMNT_PROD + "' do not match"); } // validate SiebelMessage input if(Inputs.GetChildCount() == 0 || Inputs.GetChild(0).GetType() != "SiebelMessage" || Inputs.GetChild(0).GetProperty("IntObjectName") != "EAI Agreed Entitlement Internal SCM") { oApp.RaiseErrorText(Name() + ".SyncAdjustments: invalid input"); } psAgree = getHierElement(Inputs.GetChild(0), // get agreement "ListOfEAI Agreed Entitlement Internal SCM/Service Agreement"); psEntlmnt = getHierElement(psAgree, // get entitlement "ListOfEntitlement Account SCM/Entitlement Account SCM"); var sAgreeName = psAgree.GetProperty("Integration Id"); var sEntlmntName = psEntlmnt.GetProperty("Entitlement Name SCM"); var sEntlmntId = getEntitlementId(sAgreeName, sEntlmntName); hDtlNames = getDtlInfo(psAgree); // get dtl data from input if(bIsTraceOn) oApp.Trace(Name() + ".SyncAdjustments: sEntlmntName: " + sEntlmntName + ", sAgreeName: " + sAgreeName); syncEntlmntBasedAdj(sEntlmntId, hDtlNames, aMapDtlNames, aMapProducts); } finally { psEntlmnt = null; psAgree = null; aMapDtlNames = null; aMapProducts = null; if(hDtlNames != null) { for(var sKey in hDtlNames) hDtlNames[sKey] = null; hDtlNames = null; } } }

Agreement Entitlement Utility SCM
getAdminCodeArray
function getAdminCodeArray(sAdminCode) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: admin code value retrieval and transformation into array ** Returns: array containing comma-separated values from ACV ** Exception: Raised if admin code value is empty or undefined ***************************************************************************************************/ /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects var oAdminCodeBO; var oAdminCodeBC;*/ var sValue = ""; try { /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects oAdminCodeBO = oApp.GetBusObject("Admin Code Value SCM"); oAdminCodeBC = oAdminCodeBO.GetBusComp("Admin Code/Value SCM"); oAdminCodeBC.ClearToQuery(); oAdminCodeBC.ActivateField("Value SCM"); oAdminCodeBC.SetSearchSpec("Code SCM", sAdminCode); oAdminCodeBC.ExecuteQuery(ForwardOnly); var bRecordFound = oAdminCodeBC.FirstRecord(); if(bIsTraceOn) oApp.Trace(Name() + ".getAdminCodeValue: admin code '" + sAdminCode + "' defined: " + bRecordFound); if(bRecordFound) { sValue = oAdminCodeBC.GetFieldValue("Value SCM"); if(bIsTraceOn) oApp.Trace(Name() + ".getAdminCodeValue: value = '" + sValue + "'"); } */ sValue = TheApplication().utils.SCM_RetrieveACV(sAdminCode); if (sValue == "") { oApp.RaiseErrorText("Admin Code '" + sAdminCode + "' is not defined"); } return sValue.split(","); } finally { /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects oAdminCodeBC = null; oAdminCodeBO = null;*/ } }

Agreement Entitlement Utility SCM
getAdminCodeArray
function getAdminCodeArray(sAdminCode) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: admin code value retrieval and transformation into array ** Returns: array containing comma-separated values from ACV ** Exception: Raised if admin code value is empty or undefined ***************************************************************************************************/ /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects var oAdminCodeBO; var oAdminCodeBC;*/ var sValue = ""; try { /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects oAdminCodeBO = oApp.GetBusObject("Admin Code Value SCM"); oAdminCodeBC = oAdminCodeBO.GetBusComp("Admin Code/Value SCM"); oAdminCodeBC.ClearToQuery(); oAdminCodeBC.ActivateField("Value SCM"); oAdminCodeBC.SetSearchSpec("Code SCM", sAdminCode); oAdminCodeBC.ExecuteQuery(ForwardOnly); var bRecordFound = oAdminCodeBC.FirstRecord(); if(bIsTraceOn) oApp.Trace(Name() + ".getAdminCodeValue: admin code '" + sAdminCode + "' defined: " + bRecordFound); if(bRecordFound) { sValue = oAdminCodeBC.GetFieldValue("Value SCM"); if(bIsTraceOn) oApp.Trace(Name() + ".getAdminCodeValue: value = '" + sValue + "'"); } */ sValue = TheApplication().utils.SCM_RetrieveACV(sAdminCode); if (sValue == "") { oApp.RaiseErrorText("Admin Code '" + sAdminCode + "' is not defined"); } return sValue.split(","); } finally { /* TGDDERO7, 06.07.2011: Performance, use cached ACV objects oAdminCodeBC = null; oAdminCodeBO = null;*/ } }

Agreement Entitlement Utility SCM
getDtlInfo
function getDtlInfo(psAgree) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Extracts data from all agreement detail records found in input ** Arguments psAgree - agreement propset from "EAI Agreed Entitlement SCM" IntObj instance ** Returns: associative array, key=detail name, value = another associative array containing ** adjustment type and adjustment amount ***************************************************************************************************/ var psDtlList; var psDtl; var hDtlNames = new Array(); try { psDtlList = getHierElement(psAgree, "ListOfAgreement Detail SCM"); // get detail list if(psDtlList == null) //tgdalre2, if the list of element is not available, return an empty array return hDtlNames; var iDtlCount = psDtlList.GetChildCount(); for(var i = 0; i < iDtlCount; i++) { // process details psDtl = psDtlList.GetChild(i); var sDtlName = psDtl.GetProperty("Name"); var sDiscountVal = psDtl.GetProperty("Discount Value SCM"); var sOverrideVal = psDtl.GetProperty("Price Value SCM"); var sAdjType = sOverrideVal != "" ? ADJ_TYPE_OVERRIDE : ADJ_TYPE_DISCOUNT; var sAdjAmt = sOverrideVal != "" ? sOverrideVal : sDiscountVal; hDtlNames[sDtlName] = new Array(); hDtlNames[sDtlName][KEY_ADJ_TYPE] = sAdjType; hDtlNames[sDtlName][KEY_ADJ_AMOUNT] = sAdjAmt; if(bIsTraceOn) oApp.Trace(Name() + ".getDtlInfo: sDtlName: " + sDtlName + ",sAdjType:" + sAdjType + ",sAdjAmt=" + sAdjAmt); } return hDtlNames; } finally { psDtl = null; psDtlList = null; hDtlNames = null; } }

Agreement Entitlement Utility SCM
getDtlInfo
function getDtlInfo(psAgree) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Extracts data from all agreement detail records found in input ** Arguments psAgree - agreement propset from "EAI Agreed Entitlement SCM" IntObj instance ** Returns: associative array, key=detail name, value = another associative array containing ** adjustment type and adjustment amount ***************************************************************************************************/ var psDtlList; var psDtl; var hDtlNames = new Array(); try { psDtlList = getHierElement(psAgree, "ListOfAgreement Detail SCM"); // get detail list if(psDtlList == null) //tgdalre2, if the list of element is not available, return an empty array return hDtlNames; var iDtlCount = psDtlList.GetChildCount(); for(var i = 0; i < iDtlCount; i++) { // process details psDtl = psDtlList.GetChild(i); var sDtlName = psDtl.GetProperty("Name"); var sDiscountVal = psDtl.GetProperty("Discount Value SCM"); var sOverrideVal = psDtl.GetProperty("Price Value SCM"); var sAdjType = sOverrideVal != "" ? ADJ_TYPE_OVERRIDE : ADJ_TYPE_DISCOUNT; var sAdjAmt = sOverrideVal != "" ? sOverrideVal : sDiscountVal; hDtlNames[sDtlName] = new Array(); hDtlNames[sDtlName][KEY_ADJ_TYPE] = sAdjType; hDtlNames[sDtlName][KEY_ADJ_AMOUNT] = sAdjAmt; if(bIsTraceOn) oApp.Trace(Name() + ".getDtlInfo: sDtlName: " + sDtlName + ",sAdjType:" + sAdjType + ",sAdjAmt=" + sAdjAmt); } return hDtlNames; } finally { psDtl = null; psDtlList = null; hDtlNames = null; } }

Agreement Entitlement Utility SCM
getEntitlementId
function getEntitlementId(sAgreeName, sEntlmntName) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Determines entitlement id based on entitlement and agreement name ** Arguments sAgreeName - agreement name ** sEntlmntName - entitlement name ** Returns: row id of entitlement record ** Exception: raised if entitlement was not found ***************************************************************************************************/ var oEntlmntBO; var oEntlmntBC; try { if(sEntlmntName == null || sEntlmntName == "") { oApp.RaiseErrorText("Entitlement Name is empty"); } oEntlmntBO = oApp.GetBusObject("Agreement Entitlement"); oEntlmntBC = oEntlmntBO.GetBusComp("Agreement Entitlement"); oEntlmntBC.ClearToQuery(); oEntlmntBC.SetSearchSpec("Parent Agreement Name", sAgreeName); oEntlmntBC.SetSearchSpec("Name", sEntlmntName); oEntlmntBC.ExecuteQuery(ForwardOnly); if(!oEntlmntBC.FirstRecord()) { oApp.RaiseErrorText("Entitlement '" + sEntlmntName + "' not found"); } var sEntlmntId = oEntlmntBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".getEntitlementId: sEntlmntId: " + sEntlmntId); return sEntlmntId; } finally { oEntlmntBC = null; oEntlmntBO = null; } }

Agreement Entitlement Utility SCM
getEntitlementId
function getEntitlementId(sAgreeName, sEntlmntName) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Determines entitlement id based on entitlement and agreement name ** Arguments sAgreeName - agreement name ** sEntlmntName - entitlement name ** Returns: row id of entitlement record ** Exception: raised if entitlement was not found ***************************************************************************************************/ var oEntlmntBO; var oEntlmntBC; try { if(sEntlmntName == null || sEntlmntName == "") { oApp.RaiseErrorText("Entitlement Name is empty"); } oEntlmntBO = oApp.GetBusObject("Agreement Entitlement"); oEntlmntBC = oEntlmntBO.GetBusComp("Agreement Entitlement"); oEntlmntBC.ClearToQuery(); oEntlmntBC.SetSearchSpec("Parent Agreement Name", sAgreeName); oEntlmntBC.SetSearchSpec("Name", sEntlmntName); oEntlmntBC.ExecuteQuery(ForwardOnly); if(!oEntlmntBC.FirstRecord()) { oApp.RaiseErrorText("Entitlement '" + sEntlmntName + "' not found"); } var sEntlmntId = oEntlmntBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".getEntitlementId: sEntlmntId: " + sEntlmntId); return sEntlmntId; } finally { oEntlmntBC = null; oEntlmntBO = null; } }

Agreement Entitlement Utility SCM
getHierElement
function getHierElement(psElement, sPath) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Returns child property set identified by path. The path consists of property set types ** which are used to traverse parent/child/grandchild .. property sets until the indicated ** element is found. Cardinality must be one, multiple children with the same type cannot ** be identified. ** Params: psElement - hierarchical property set containing child property set ** sPath - forward slash-separated string containing property set types ** Returns: child property set or null if child ps was not found ***************************************************************************************************/ var psCurrElmt; var aHierarchy; try { var iChildCount; var bElementFound; aHierarchy = sPath.split("/"); psCurrElmt = psElement; for(var i = 0; i < aHierarchy.length; i++) { iChildCount = psCurrElmt.GetChildCount(); bElementFound = false; for(var j = 0; j < iChildCount; j++) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: current type " + psCurrElmt.GetChild(j).GetType()); if(psCurrElmt.GetChild(j).GetType() == aHierarchy[i]) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: found " + aHierarchy[i]); psCurrElmt = psCurrElmt.GetChild(j); // set child as next current element bElementFound = true; break; } } if(!bElementFound) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement:" + aHierarchy[i] + " not found"); return; // return null if hierarchy doesn't match } } return psCurrElmt; } finally { psCurrElmt = null; aHierarchy = null; } }

Agreement Entitlement Utility SCM
getHierElement
function getHierElement(psElement, sPath) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Returns child property set identified by path. The path consists of property set types ** which are used to traverse parent/child/grandchild .. property sets until the indicated ** element is found. Cardinality must be one, multiple children with the same type cannot ** be identified. ** Params: psElement - hierarchical property set containing child property set ** sPath - forward slash-separated string containing property set types ** Returns: child property set or null if child ps was not found ***************************************************************************************************/ var psCurrElmt; var aHierarchy; try { var iChildCount; var bElementFound; aHierarchy = sPath.split("/"); psCurrElmt = psElement; for(var i = 0; i < aHierarchy.length; i++) { iChildCount = psCurrElmt.GetChildCount(); bElementFound = false; for(var j = 0; j < iChildCount; j++) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: current type " + psCurrElmt.GetChild(j).GetType()); if(psCurrElmt.GetChild(j).GetType() == aHierarchy[i]) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement: found " + aHierarchy[i]); psCurrElmt = psCurrElmt.GetChild(j); // set child as next current element bElementFound = true; break; } } if(!bElementFound) { if (bIsTraceOn) oApp.Trace(Name() + ".getHierElement:" + aHierarchy[i] + " not found"); return; // return null if hierarchy doesn't match } } return psCurrElmt; } finally { psCurrElmt = null; aHierarchy = null; } }

Agreement Entitlement Utility SCM
getProductId
function getProductId(sProductName) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Validates product name and returns product id. ** Arguments sProductName - product name ** Returns: row id of product record ** Exception: raised if product was not found ***************************************************************************************************/ var oProductBO; var oProductBC; try { if(sProductName == null || sProductName == "") { oApp.RaiseErrorText("Product Name is empty"); } oProductBO = oApp.GetBusObject("Internal Product Performance SCM"); oProductBC = oProductBO.GetBusComp("Internal Product Performance SCM"); oProductBC.ClearToQuery(); oProductBC.SetSearchSpec("Name", "\'"+sProductName+"\'"); oProductBC.ExecuteQuery(ForwardOnly); if(!oProductBC.FirstRecord()) { oApp.RaiseErrorText("Product '" + sProductName + "' not found"); } var sProductId = oProductBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".getProductId: sProductId: " + sProductId); return sProductId; } finally { oProductBC = null; oProductBO = null; } }

Agreement Entitlement Utility SCM
getProductId
function getProductId(sProductName) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Validates product name and returns product id. ** Arguments sProductName - product name ** Returns: row id of product record ** Exception: raised if product was not found ***************************************************************************************************/ var oProductBO; var oProductBC; try { if(sProductName == null || sProductName == "") { oApp.RaiseErrorText("Product Name is empty"); } oProductBO = oApp.GetBusObject("Internal Product Performance SCM"); oProductBC = oProductBO.GetBusComp("Internal Product Performance SCM"); oProductBC.ClearToQuery(); oProductBC.SetSearchSpec("Name", "\'"+sProductName+"\'"); oProductBC.ExecuteQuery(ForwardOnly); if(!oProductBC.FirstRecord()) { oApp.RaiseErrorText("Product '" + sProductName + "' not found"); } var sProductId = oProductBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".getProductId: sProductId: " + sProductId); return sProductId; } finally { oProductBC = null; oProductBO = null; } }

Agreement Entitlement Utility SCM
syncEntlmntBasedAdj
function syncEntlmntBasedAdj(sEntlmntId, hDtlNames, aMapDtlNames, aMapProducts) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Performs synchronization of entitlement-based adjustment records. The existing ** adjustments are queried from the DB. Then the following sync tasks are executed: ** - adjustment exists in DB + detail exists in input -> update adjustment ** - adjustment doesnt exist in DB + detail exists in input -> create adjustment ** - delete all existing adjustments for which no detail exists in input ** Arguments: sEntlmntId - entitlement id ** hDtlNames - output of getDtlInfo() ** aMapDtlNames - source mapping (detail names defined in mapping ACV) ** aMapProducts - target mapping (products defined in mapping ACV) ** Exception: raised if static adjustment group was not found ***************************************************************************************************/ var oAdjGroupBO; var oAdjGroupBC; var oEntlmntBasedAdjBC; var hExistingAdj = new Array(); try { oAdjGroupBO = oApp.GetBusObject("Adjustment Group"); oAdjGroupBC = oAdjGroupBO.GetBusComp("Adjustment Group"); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", ADJ_GROUP); oAdjGroupBC.ExecuteQuery(ForwardOnly); if(!oAdjGroupBC.FirstRecord()) { oApp.RaiseErrorText("Adjustment Group '" + ADJ_GROUP + "' not found"); } oEntlmntBasedAdjBC = oAdjGroupBO.GetBusComp("Entitlement-Based Adjustment SCM"); oEntlmntBasedAdjBC.ClearToQuery(); oEntlmntBasedAdjBC.ActivateField("Product"); oEntlmntBasedAdjBC.SetSearchSpec("Entitlement Id", sEntlmntId); oEntlmntBasedAdjBC.ExecuteQuery(ForwardOnly); var bRecordFound = oEntlmntBasedAdjBC.FirstRecord(); while(bRecordFound) { var sRowId = oEntlmntBasedAdjBC.GetFieldValue("Id"); var sProduct = oEntlmntBasedAdjBC.GetFieldValue("Product"); if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: sRowId=" + sRowId + ",sProduct=" + sProduct); switch(sProduct) { case PROD_DUOBILL_BUS: // ignore duobill, separate sync case PROD_DUOBILL_PAUSCHAL: case PROD_DUOBILL_PRIV: break; default: // non-duobill adj hExistingAdj[sProduct] = new Array(); hExistingAdj[sProduct]["Id"] = sRowId; hExistingAdj[sProduct]["Found in Input"] = "N"; } bRecordFound = oEntlmntBasedAdjBC.NextRecord(); } for(var i = 0; i < aMapProducts.length; i++) { // process mapping def var sProduct = aMapProducts[i]; var sDtlName = aMapDtlNames[i]; if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: map " + sProduct + " = " + sDtlName); if(hExistingAdj[sProduct] != null) { // adj exists if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: adj found"); if(hDtlNames[sDtlName] != null) { // dtl defined in input hExistingAdj[sProduct]["Found in Input"] = "Y"; if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: dtl found"); oEntlmntBasedAdjBC.ClearToQuery(); oEntlmntBasedAdjBC.ActivateField("Adjustment Type"); oEntlmntBasedAdjBC.ActivateField("Adjustment Amount"); oEntlmntBasedAdjBC.SetSearchSpec("Id", hExistingAdj[sProduct]["Id"]); oEntlmntBasedAdjBC.ExecuteQuery(ForwardOnly); if(oEntlmntBasedAdjBC.FirstRecord()) { // update adj oEntlmntBasedAdjBC.SetFieldValue("Adjustment Type", hDtlNames[sDtlName][KEY_ADJ_TYPE]); oEntlmntBasedAdjBC.SetFieldValue("Adjustment Amount", hDtlNames[sDtlName][KEY_ADJ_AMOUNT]); oEntlmntBasedAdjBC.WriteRecord(); if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: updated adj"); } } else { // dtl not defined in input if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: dtl not found"); } } else { // adj doesnt exist yet if(bIsTraceOn) oApp.Trace(Name() + ".syncE

Agreement Entitlement Utility SCM
syncEntlmntBasedAdj
function syncEntlmntBasedAdj(sEntlmntId, hDtlNames, aMapDtlNames, aMapProducts) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 27.01.2009 ** Descr: Performs synchronization of entitlement-based adjustment records. The existing ** adjustments are queried from the DB. Then the following sync tasks are executed: ** - adjustment exists in DB + detail exists in input -> update adjustment ** - adjustment doesnt exist in DB + detail exists in input -> create adjustment ** - delete all existing adjustments for which no detail exists in input ** Arguments: sEntlmntId - entitlement id ** hDtlNames - output of getDtlInfo() ** aMapDtlNames - source mapping (detail names defined in mapping ACV) ** aMapProducts - target mapping (products defined in mapping ACV) ** Exception: raised if static adjustment group was not found ***************************************************************************************************/ var oAdjGroupBO; var oAdjGroupBC; var oEntlmntBasedAdjBC; var hExistingAdj = new Array(); try { oAdjGroupBO = oApp.GetBusObject("Adjustment Group"); oAdjGroupBC = oAdjGroupBO.GetBusComp("Adjustment Group"); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", ADJ_GROUP); oAdjGroupBC.ExecuteQuery(ForwardOnly); if(!oAdjGroupBC.FirstRecord()) { oApp.RaiseErrorText("Adjustment Group '" + ADJ_GROUP + "' not found"); } oEntlmntBasedAdjBC = oAdjGroupBO.GetBusComp("Entitlement-Based Adjustment SCM"); oEntlmntBasedAdjBC.ClearToQuery(); oEntlmntBasedAdjBC.ActivateField("Product"); oEntlmntBasedAdjBC.SetSearchSpec("Entitlement Id", sEntlmntId); oEntlmntBasedAdjBC.ExecuteQuery(ForwardOnly); var bRecordFound = oEntlmntBasedAdjBC.FirstRecord(); while(bRecordFound) { var sRowId = oEntlmntBasedAdjBC.GetFieldValue("Id"); var sProduct = oEntlmntBasedAdjBC.GetFieldValue("Product"); if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: sRowId=" + sRowId + ",sProduct=" + sProduct); switch(sProduct) { case PROD_DUOBILL_BUS: // ignore duobill, separate sync case PROD_DUOBILL_PAUSCHAL: case PROD_DUOBILL_PRIV: break; default: // non-duobill adj hExistingAdj[sProduct] = new Array(); hExistingAdj[sProduct]["Id"] = sRowId; hExistingAdj[sProduct]["Found in Input"] = "N"; } bRecordFound = oEntlmntBasedAdjBC.NextRecord(); } for(var i = 0; i < aMapProducts.length; i++) { // process mapping def var sProduct = aMapProducts[i]; var sDtlName = aMapDtlNames[i]; if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: map " + sProduct + " = " + sDtlName); if(hExistingAdj[sProduct] != null) { // adj exists if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: adj found"); if(hDtlNames[sDtlName] != null) { // dtl defined in input hExistingAdj[sProduct]["Found in Input"] = "Y"; if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: dtl found"); oEntlmntBasedAdjBC.ClearToQuery(); oEntlmntBasedAdjBC.ActivateField("Adjustment Type"); oEntlmntBasedAdjBC.ActivateField("Adjustment Amount"); oEntlmntBasedAdjBC.SetSearchSpec("Id", hExistingAdj[sProduct]["Id"]); oEntlmntBasedAdjBC.ExecuteQuery(ForwardOnly); if(oEntlmntBasedAdjBC.FirstRecord()) { // update adj oEntlmntBasedAdjBC.SetFieldValue("Adjustment Type", hDtlNames[sDtlName][KEY_ADJ_TYPE]); oEntlmntBasedAdjBC.SetFieldValue("Adjustment Amount", hDtlNames[sDtlName][KEY_ADJ_AMOUNT]); oEntlmntBasedAdjBC.WriteRecord(); if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: updated adj"); } } else { // dtl not defined in input if(bIsTraceOn) oApp.Trace(Name() + ".syncEntlmntBasedAdj: dtl not found"); } } else { // adj doesnt exist yet if(bIsTraceOn) oApp.Trace(Name() + ".syncE

Alert Online Email Notification
PrepareEmail
function PrepareEmail (Inputs, Outputs) { var entSysBO = TheApplication().GetBusObject ("Enterprise System"); var entSysBC = entSysBO.GetBusComp ("Enterprise System"); var entSubSysBC = entSysBO.GetBusComp ("Enterprise Subsystem"); var entSubSysDetBC = entSysBO.GetBusComp ("Enterprise Subsystem Detail"); var entAlertSubBC = entSysBO.GetBusComp ("Enterprise Alert Subscription"); var rowId = Inputs.GetProperty ("RowId"); var sysName; var status; var subSysName; var subStatus; var location; var severity; var reported; var eta; var desc; var notifyUpon; var emailTo; var emailSubject; var emailBody; with (entSysBC) { ActivateField ("Id"); ActivateField ("Name"); ActivateField ("Status"); ClearToQuery (); SetSearchSpec ("Id", rowId); ExecuteQuery (); } if (entSysBC.FirstRecord ()) { sysName = entSysBC.GetFieldValue ("Name"); status = entSysBC.GetFieldValue ("Status"); emailSubject = sysName + " - " + status; } else return; with (entAlertSubBC) { ActivateField ("System Name"); ActivateField ("Notify Email"); ClearToQuery (); SetSearchSpec ("System Name", sysName); if (status == "Currently Available") SetSearchSpec ("Notify Upon", "System Goes Up"); else if (status == "Current Outage") SetSearchSpec ("Notify Upon", "System Goes Down"); else SetSearchSpec ("Notify Upon", "Any Status Change"); ExecuteQuery (); } if (entAlertSubBC.FirstRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); while (entAlertSubBC.NextRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); entAlertSubBC = null; with (entSubSysBC) { ActivateField ("Parent SystemId"); ActivateField ("Name"); ActivateField ("Status"); ActivateField ("Location"); ActivateField ("Severity"); ActivateField ("Reported Time"); ActivateField ("Expected Time Available"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Parent System Id", rowId); ExecuteQuery (); } if (entSubSysBC.FirstRecord ()) { subSysName = entSubSysBC.GetFieldValue ("Name"); subStatus = entSubSysBC.GetFieldValue ("Status"); location = entSubSysBC.GetFieldValue ("Location"); severity = entSubSysBC.GetFieldValue ("Severity"); reported = entSubSysBC.GetFieldValue ("Reported Time"); eta = entSubSysBC.GetFieldValue ("Expected Time Available"); desc = entSubSysBC.GetFieldValue ("Description"); emailBody = "System/Application: " + subSysName + " - " + subStatus + "\n"; emailBody = emailBody + "Location: " + location + "\n"; emailBody = emailBody + "Severity: " severity + "\n"; emailBody = emailBody + "Current Status: " + subStatus + "\n"; emailBody = emailBody + "Reported: " + reported + "\n"; emailBody = emailBody + "ETA: " + eta + "\n"; emailBody = emailBody + "Description: " + reported + ": " + desc + "\n"; with (entSubSysDetBC) { ActivateField ("Subsystem"); ActivateField ("Reported Time"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Subsystem", entSubSysBC.GetFieldValue ("Id")); ExecuteQuery (); } if (entSubSysDetBC.FirstRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\n"; } while (entSubSysDetBC.NextRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\

Alert Online Email Notification
PrepareEmail
function PrepareEmail (Inputs, Outputs) { var entSysBO = TheApplication().GetBusObject ("Enterprise System"); var entSysBC = entSysBO.GetBusComp ("Enterprise System"); var entSubSysBC = entSysBO.GetBusComp ("Enterprise Subsystem"); var entSubSysDetBC = entSysBO.GetBusComp ("Enterprise Subsystem Detail"); var entAlertSubBC = entSysBO.GetBusComp ("Enterprise Alert Subscription"); var rowId = Inputs.GetProperty ("RowId"); var sysName; var status; var subSysName; var subStatus; var location; var severity; var reported; var eta; var desc; var notifyUpon; var emailTo; var emailSubject; var emailBody; with (entSysBC) { ActivateField ("Id"); ActivateField ("Name"); ActivateField ("Status"); ClearToQuery (); SetSearchSpec ("Id", rowId); ExecuteQuery (); } if (entSysBC.FirstRecord ()) { sysName = entSysBC.GetFieldValue ("Name"); status = entSysBC.GetFieldValue ("Status"); emailSubject = sysName + " - " + status; } else return; with (entAlertSubBC) { ActivateField ("System Name"); ActivateField ("Notify Email"); ClearToQuery (); SetSearchSpec ("System Name", sysName); if (status == "Currently Available") SetSearchSpec ("Notify Upon", "System Goes Up"); else if (status == "Current Outage") SetSearchSpec ("Notify Upon", "System Goes Down"); else SetSearchSpec ("Notify Upon", "Any Status Change"); ExecuteQuery (); } if (entAlertSubBC.FirstRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); while (entAlertSubBC.NextRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); entAlertSubBC = null; with (entSubSysBC) { ActivateField ("Parent SystemId"); ActivateField ("Name"); ActivateField ("Status"); ActivateField ("Location"); ActivateField ("Severity"); ActivateField ("Reported Time"); ActivateField ("Expected Time Available"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Parent System Id", rowId); ExecuteQuery (); } if (entSubSysBC.FirstRecord ()) { subSysName = entSubSysBC.GetFieldValue ("Name"); subStatus = entSubSysBC.GetFieldValue ("Status"); location = entSubSysBC.GetFieldValue ("Location"); severity = entSubSysBC.GetFieldValue ("Severity"); reported = entSubSysBC.GetFieldValue ("Reported Time"); eta = entSubSysBC.GetFieldValue ("Expected Time Available"); desc = entSubSysBC.GetFieldValue ("Description"); emailBody = "System/Application: " + subSysName + " - " + subStatus + "\n"; emailBody = emailBody + "Location: " + location + "\n"; emailBody = emailBody + "Severity: " severity + "\n"; emailBody = emailBody + "Current Status: " + subStatus + "\n"; emailBody = emailBody + "Reported: " + reported + "\n"; emailBody = emailBody + "ETA: " + eta + "\n"; emailBody = emailBody + "Description: " + reported + ": " + desc + "\n"; with (entSubSysDetBC) { ActivateField ("Subsystem"); ActivateField ("Reported Time"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Subsystem", entSubSysBC.GetFieldValue ("Id")); ExecuteQuery (); } if (entSubSysDetBC.FirstRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\n"; } while (entSubSysDetBC.NextRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\

Alert Online Email Notification
PrepareEmail
function PrepareEmail (Inputs, Outputs) { var entSysBO = TheApplication().GetBusObject ("Enterprise System"); var entSysBC = entSysBO.GetBusComp ("Enterprise System"); var entSubSysBC = entSysBO.GetBusComp ("Enterprise Subsystem"); var entSubSysDetBC = entSysBO.GetBusComp ("Enterprise Subsystem Detail"); var entAlertSubBC = entSysBO.GetBusComp ("Enterprise Alert Subscription"); var rowId = Inputs.GetProperty ("RowId"); var sysName; var status; var subSysName; var subStatus; var location; var severity; var reported; var eta; var desc; var notifyUpon; var emailTo; var emailSubject; var emailBody; with (entSysBC) { ActivateField ("Id"); ActivateField ("Name"); ActivateField ("Status"); ClearToQuery (); SetSearchSpec ("Id", rowId); ExecuteQuery (); } if (entSysBC.FirstRecord ()) { sysName = entSysBC.GetFieldValue ("Name"); status = entSysBC.GetFieldValue ("Status"); emailSubject = sysName + " - " + status; } else return; with (entAlertSubBC) { ActivateField ("System Name"); ActivateField ("Notify Email"); ClearToQuery (); SetSearchSpec ("System Name", sysName); if (status == "Currently Available") SetSearchSpec ("Notify Upon", "System Goes Up"); else if (status == "Current Outage") SetSearchSpec ("Notify Upon", "System Goes Down"); else SetSearchSpec ("Notify Upon", "Any Status Change"); ExecuteQuery (); } if (entAlertSubBC.FirstRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); while (entAlertSubBC.NextRecord ()) emailTo = emailTo + " ; " + entAlertSubBC.GetFieldValue ("Notify Email"); entAlertSubBC = null; with (entSubSysBC) { ActivateField ("Parent SystemId"); ActivateField ("Name"); ActivateField ("Status"); ActivateField ("Location"); ActivateField ("Severity"); ActivateField ("Reported Time"); ActivateField ("Expected Time Available"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Parent System Id", rowId); ExecuteQuery (); } if (entSubSysBC.FirstRecord ()) { subSysName = entSubSysBC.GetFieldValue ("Name"); subStatus = entSubSysBC.GetFieldValue ("Status"); location = entSubSysBC.GetFieldValue ("Location"); severity = entSubSysBC.GetFieldValue ("Severity"); reported = entSubSysBC.GetFieldValue ("Reported Time"); eta = entSubSysBC.GetFieldValue ("Expected Time Available"); desc = entSubSysBC.GetFieldValue ("Description"); emailBody = "System/Application: " + subSysName + " - " + subStatus + "\n"; emailBody = emailBody + "Location: " + location + "\n"; emailBody = emailBody + "Severity: " severity + "\n"; emailBody = emailBody + "Current Status: " + subStatus + "\n"; emailBody = emailBody + "Reported: " + reported + "\n"; emailBody = emailBody + "ETA: " + eta + "\n"; emailBody = emailBody + "Description: " + reported + ": " + desc + "\n"; with (entSubSysDetBC) { ActivateField ("Subsystem"); ActivateField ("Reported Time"); ActivateField ("Description"); ClearToQuery (); SetSearchSpec ("Subsystem", entSubSysBC.GetFieldValue ("Id")); ExecuteQuery (); } if (entSubSysDetBC.FirstRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\n"; } while (entSubSysDetBC.NextRecord ()) { emailBody = emailBody + "--------------------\n" ; emailBody = emailBody + entSubSysDetBC.GetFieldValue ("Reported Time") + ": " + entSubSysDetBC.GetFieldValue ("Description") + "\

Alert Online Email Notification
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="PrepareEmail") { PrepareEmail(Inputs,Outputs); } else { ret=ContinueOperation; } return ret; }

Alert Online Email Notification
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="PrepareEmail") { PrepareEmail(Inputs,Outputs); } else { ret=ContinueOperation; } return ret; }

Alert Online Email Notification
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ret= CancelOperation; if (MethodName=="PrepareEmail") { PrepareEmail(Inputs,Outputs); } else { ret=ContinueOperation; } return ret; }

Applet PreCanInvoke CAM BS SCM
BCHasRecord
/******************************************************* ** Name: BCHasRecord ** Created: 28.05.2009 ** Created By: Javier Amor ** Description: This method is used to know if a BC has records. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function BCHasRecord(&oBC) { try { var cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Applet PreCanInvoke CAM BS SCM
BCHasRecord
/******************************************************* ** Name: BCHasRecord ** Created: 28.05.2009 ** Created By: Javier Amor ** Description: This method is used to know if a BC has records. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function BCHasRecord(&oBC) { try { var cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Applet PreCanInvoke CAM BS SCM
ChangePrContactFlg
/******************************************************* ** Name: ChangePrContactFlg ** Created: 15.09.2009 ** Created By: Javier Bermejo ** Description: This method is placed instead the code at PreCanInvoke method at applet level ** (Applet Contact List Applet BO Account SCM) Related to issue 13450 ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ChangePrContactFlg(Inputs,Outputs) { var BOAccnt; var BCAccnt; var BCContact; var intTypeCust; var sReadOnly; try { //Get the value of a person customer intTypeCust = TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Person"); sReadOnly = TheApplication().GetProfileAttr("ActiveViewReadOnly"); if (sReadOnly == "TRUE") { Outputs.SetProperty("MethodCheckResult", "FALSE"); return (Outputs); } //Get the Active account and contact BOAccnt = TheApplication().ActiveBusObject(); BCAccnt = BOAccnt.GetBusComp("Account"); BCContact = BOAccnt.GetBusComp("Contact"); if(BCHasRecord(BCAccnt) && BCHasRecord(BCContact)) { //A person customer primary contact cannot be changed in this applet if(BCAccnt.GetFieldValue("Type") == intTypeCust) { Outputs.SetProperty("MethodCheckResult", "FALSE"); } //Otherwise the change will be possible else { //when the primary contact is already selected button must be inactive otherwise it will be active if( BCContact.GetFieldValue("Id") == BCAccnt.GetFieldValue("Primary CNO Contact Id SCM")) Outputs.SetProperty("MethodCheckResult", "FALSE"); else Outputs.SetProperty("MethodCheckResult", "TRUE"); } } else Outputs.SetProperty("MethodCheckResult", "FALSE"); return (Outputs); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { BOAccnt = null; BCAccnt = null; BCContact = null; intTypeCust = null; sReadOnly = null; } }

Applet PreCanInvoke CAM BS SCM
ChangePrContactFlg
/******************************************************* ** Name: ChangePrContactFlg ** Created: 15.09.2009 ** Created By: Javier Bermejo ** Description: This method is placed instead the code at PreCanInvoke method at applet level ** (Applet Contact List Applet BO Account SCM) Related to issue 13450 ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ChangePrContactFlg(Inputs,Outputs) { var BOAccnt; var BCAccnt; var BCContact; var intTypeCust; var sReadOnly; try { //Get the value of a person customer intTypeCust = TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Person"); sReadOnly = TheApplication().GetProfileAttr("ActiveViewReadOnly"); if (sReadOnly == "TRUE") { Outputs.SetProperty("MethodCheckResult", "FALSE"); return (Outputs); } //Get the Active account and contact BOAccnt = TheApplication().ActiveBusObject(); BCAccnt = BOAccnt.GetBusComp("Account"); BCContact = BOAccnt.GetBusComp("Contact"); if(BCHasRecord(BCAccnt) && BCHasRecord(BCContact)) { //A person customer primary contact cannot be changed in this applet if(BCAccnt.GetFieldValue("Type") == intTypeCust) { Outputs.SetProperty("MethodCheckResult", "FALSE"); } //Otherwise the change will be possible else { //when the primary contact is already selected button must be inactive otherwise it will be active if( BCContact.GetFieldValue("Id") == BCAccnt.GetFieldValue("Primary CNO Contact Id SCM")) Outputs.SetProperty("MethodCheckResult", "FALSE"); else Outputs.SetProperty("MethodCheckResult", "TRUE"); } } else Outputs.SetProperty("MethodCheckResult", "FALSE"); return (Outputs); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { BOAccnt = null; BCAccnt = null; BCContact = null; intTypeCust = null; sReadOnly = null; } }

Applet PreCanInvoke CAM BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch (MethodName) { case "ChangePrContactFlg": ChangePrContactFlg(Inputs,Outputs); break; default: break; } return (CancelOperation); }

Applet PreCanInvoke CAM BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch (MethodName) { case "ChangePrContactFlg": ChangePrContactFlg(Inputs,Outputs); break; default: break; } return (CancelOperation); }

Application Utilities Service SCM
(declarations)
var sAttrFirstTime; var fpCRMLog = null; //filepointer für CRM-Logfile var tracefilename; //Name für Tracefile var logfilename; //Name für Logfile var isTraceON = null; //Ist Trace eingeschaltet? var sTraceLevel = ""; var isLogOrTraceON = false;//Ist Log oder Trace eingeschaltet? var isMessPktON = false;//Ist Messpunkt-Protokollierung an? var isCmdTraceOn = false; var strTraceLevel = ""; var AllSCValidationsON;//SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Variable to allow all the validations in the search center. var strContractId = ""; //Begin CR181 var sessionId=""; var counter = 0; //counter will be initialisied with 0 and the first increment will bring him to 1 from the firste session (Issue #12966) //End CR181 var REQUIRED=1; // TAAPENE1: cache use case table var psUseCase = null; /* var oArrSyncPenaltyCommissionOLI = new Array(); // Used in BusSvc SIS OM Order Mgmt SCM // 1) Array is populated from GetOLIInformation_Main // 2) Array is read from SyncPenaltyAndModeaOLI // Both Methods are invoked in the same WF. It is one of // a) SIS OM Edit Complex Asset Workflow // b) SIS OM Edit Service Order Line Item // c) SIS OM Disconnect Asset Sub-process var oMOOArray = new Array(); // Used in BusSvc SIS OM Order Mgmt SCM var MOO_RootAssetIntegId = ""; // 1) Array is populated from UpdateSR_CommitTime?? // 2) Array is read from ?? // Both Methods are invoked in the same WF. It is one of // a) SIS OM Edit Complex Asset Workflow // b) SIS OM Edit Service Order Line Item // c) SIS OM Disconnect Asset Sub-process //OneCRM R1 SCM 2008-07-21 TGDRARO6: array for phonetic conversion var ConversionArray = new Array(); ConversionArray[0] = ""; ConversionArray[1] = ""; ConversionArray[2] = ""; ConversionArray[3] = ""; ConversionArray[4] = ""; ConversionArray[5] = ""; ConversionArray[6] = ""; ConversionArray[7] = ""; ConversionArray[8] = ""; ConversionArray[9] = ""; ConversionArray[10] = ""; ConversionArray[11] = ""; ConversionArray[12] = ""; ConversionArray[13] = ""; ConversionArray[14] = ""; ConversionArray[15] = ""; ConversionArray[16] = ""; ConversionArray[17] = ""; ConversionArray[18] = ""; ConversionArray[19] = ""; ConversionArray[20] = ""; ConversionArray[21] = ""; ConversionArray[22] = ""; ConversionArray[23] = ""; ConversionArray[24] = ""; ConversionArray[25] = ""; ConversionArray[26] = ""; ConversionArray[27] = ""; ConversionArray[28] = ""; ConversionArray[29] = ""; ConversionArray[30] = ""; ConversionArray[31] = ""; ConversionArray[32] = ""; ConversionArray[33] = ""; ConversionArray[34] = ""; ConversionArray[35] = ""; ConversionArray[36] = ""; ConversionArray[37] = ""; ConversionArray[38] = ""; ConversionArray[39] = ""; ConversionArray[40] = ""; ConversionArray[41] = ""; ConversionArray[42] = ""; ConversionArray[43] = ""; ConversionArray[44] = ""; ConversionArray[45] = ""; ConversionArray[46] = ""; ConversionArray[47] = ""; ConversionArray[48] = "0"; // TGDHURO9 08.04.2010 Defect 21766 do not remove numbers during phonetic conversion ConversionArray[49] = "1"; ConversionArray[50] = "2"; ConversionArray[51] = "3"; ConversionArray[52] = "4"; ConversionArray[53] = "5"; ConversionArray[54] = "6"; ConversionArray[55] = "7"; ConversionArray[56] = "8"; ConversionArray[57] = "9"; ConversionArray[58] = ""; ConversionArray[59] = ""; ConversionArray[60] = ""; ConversionArray[61] = ""; ConversionArray[62] = ""; ConversionArray[63] = ""; ConversionArray[64] = ""; ConversionArray[65] = "A"; ConversionArray[66] = "B"; ConversionArray[67] = "C"; ConversionArray[68] = "D"; ConversionArray[69] = "E"; ConversionArray[70] = "F"; ConversionArray[71] = "G"; ConversionArray[72] = "H"; ConversionArray[73] = "I"; //TGDGOFR4 09.06.09 Issue 9011 J -> I ConversionArray[74] = "I"; ConversionArr

Application Utilities Service SCM
(declarations)
var sAttrFirstTime; var fpCRMLog = null; //filepointer für CRM-Logfile var tracefilename; //Name für Tracefile var logfilename; //Name für Logfile var isTraceON = null; //Ist Trace eingeschaltet? var sTraceLevel = ""; var isLogOrTraceON = false;//Ist Log oder Trace eingeschaltet? var isMessPktON = false;//Ist Messpunkt-Protokollierung an? var isCmdTraceOn = false; var strTraceLevel = ""; var AllSCValidationsON;//SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Variable to allow all the validations in the search center. var strContractId = ""; //Begin CR181 var sessionId=""; var counter = 0; //counter will be initialisied with 0 and the first increment will bring him to 1 from the firste session (Issue #12966) //End CR181 var REQUIRED=1; // TAAPENE1: cache use case table var psUseCase = null; /* var oArrSyncPenaltyCommissionOLI = new Array(); // Used in BusSvc SIS OM Order Mgmt SCM // 1) Array is populated from GetOLIInformation_Main // 2) Array is read from SyncPenaltyAndModeaOLI // Both Methods are invoked in the same WF. It is one of // a) SIS OM Edit Complex Asset Workflow // b) SIS OM Edit Service Order Line Item // c) SIS OM Disconnect Asset Sub-process var oMOOArray = new Array(); // Used in BusSvc SIS OM Order Mgmt SCM var MOO_RootAssetIntegId = ""; // 1) Array is populated from UpdateSR_CommitTime?? // 2) Array is read from ?? // Both Methods are invoked in the same WF. It is one of // a) SIS OM Edit Complex Asset Workflow // b) SIS OM Edit Service Order Line Item // c) SIS OM Disconnect Asset Sub-process //OneCRM R1 SCM 2008-07-21 TGDRARO6: array for phonetic conversion var ConversionArray = new Array(); ConversionArray[0] = ""; ConversionArray[1] = ""; ConversionArray[2] = ""; ConversionArray[3] = ""; ConversionArray[4] = ""; ConversionArray[5] = ""; ConversionArray[6] = ""; ConversionArray[7] = ""; ConversionArray[8] = ""; ConversionArray[9] = ""; ConversionArray[10] = ""; ConversionArray[11] = ""; ConversionArray[12] = ""; ConversionArray[13] = ""; ConversionArray[14] = ""; ConversionArray[15] = ""; ConversionArray[16] = ""; ConversionArray[17] = ""; ConversionArray[18] = ""; ConversionArray[19] = ""; ConversionArray[20] = ""; ConversionArray[21] = ""; ConversionArray[22] = ""; ConversionArray[23] = ""; ConversionArray[24] = ""; ConversionArray[25] = ""; ConversionArray[26] = ""; ConversionArray[27] = ""; ConversionArray[28] = ""; ConversionArray[29] = ""; ConversionArray[30] = ""; ConversionArray[31] = ""; ConversionArray[32] = ""; ConversionArray[33] = ""; ConversionArray[34] = ""; ConversionArray[35] = ""; ConversionArray[36] = ""; ConversionArray[37] = ""; ConversionArray[38] = ""; ConversionArray[39] = ""; ConversionArray[40] = ""; ConversionArray[41] = ""; ConversionArray[42] = ""; ConversionArray[43] = ""; ConversionArray[44] = ""; ConversionArray[45] = ""; ConversionArray[46] = ""; ConversionArray[47] = ""; ConversionArray[48] = "0"; // TGDHURO9 08.04.2010 Defect 21766 do not remove numbers during phonetic conversion ConversionArray[49] = "1"; ConversionArray[50] = "2"; ConversionArray[51] = "3"; ConversionArray[52] = "4"; ConversionArray[53] = "5"; ConversionArray[54] = "6"; ConversionArray[55] = "7"; ConversionArray[56] = "8"; ConversionArray[57] = "9"; ConversionArray[58] = ""; ConversionArray[59] = ""; ConversionArray[60] = ""; ConversionArray[61] = ""; ConversionArray[62] = ""; ConversionArray[63] = ""; ConversionArray[64] = ""; ConversionArray[65] = "A"; ConversionArray[66] = "B"; ConversionArray[67] = "C"; ConversionArray[68] = "D"; ConversionArray[69] = "E"; ConversionArray[70] = "F"; ConversionArray[71] = "G"; ConversionArray[72] = "H"; ConversionArray[73] = "I"; //TGDGOFR4 09.06.09 Issue 9011 J -> I ConversionArray[74] = "I"; ConversionArr

Application Utilities Service SCM
AdjustContractCursor
function AdjustContractCursor(strType){ /**************************************************************************************** ** Name: Application_AdjustContractCursor ** Modified By: TGDGEMAM ** Modified: 02.04.2014 ** Description: Workaround for Defect # 82446 Issue was that navigation from 1st level to standard customer view lost the current cursor position on the contract applet. Root cause are the different search specs on the contract list and form applet. Unfortunately this couldn't be fixed due to side effects (see Defect # 37523 for details) ****************************************************************************************/ var oBO: BusObject; var oBC: BusComp; var strId: chars; var isRecord: bool; try{ switch (strType) { // reads the current contract cursors position in case search center was // not used to drilldown case "Read": try { oBO = TheApplication().ActiveBusObject(); if(oBO.Name() == "Account"){ oBC = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (TheApplication().GetProfileAttr("BlockContractFocus") != "Y")strContractId = oBC.GetFieldValue("Id") else TheApplication().SetProfileAttr("BlockContractFocus","N") } else{ strContractId = ""; TheApplication().SetProfileAttr("BlockContractFocus","N"); } } catch (e) { strContractId = ""; TheApplication().SetProfileAttr("BlockContractFocus","N"); } break; // moves the current contract cursors position to the last known position case "Adjust": if (strContractId != "" && defined(strContractId)) { oBO = TheApplication().ActiveBusObject(); oBC = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (oBC) { try {strId = GetFieldValue("Id")} catch (e) {strId = ""} while (strId != "" && strId != strContractId) { try { isRecord = NextRecord(); if (isRecord) strId = GetFieldValue("Id") else strId = "" } catch (e) { strId = ""; } } } strContractId = ""; } break; default: } } catch (e) { } finally { oBC = null; oBO = null; } }

Application Utilities Service SCM
AdjustContractCursor
function AdjustContractCursor(strType){ /**************************************************************************************** ** Name: Application_AdjustContractCursor ** Modified By: TGDGEMAM ** Modified: 02.04.2014 ** Description: Workaround for Defect # 82446 Issue was that navigation from 1st level to standard customer view lost the current cursor position on the contract applet. Root cause are the different search specs on the contract list and form applet. Unfortunately this couldn't be fixed due to side effects (see Defect # 37523 for details) ****************************************************************************************/ var oBO: BusObject; var oBC: BusComp; var strId: chars; var isRecord: bool; try{ switch (strType) { // reads the current contract cursors position in case search center was // not used to drilldown case "Read": try { oBO = TheApplication().ActiveBusObject(); if(oBO.Name() == "Account"){ oBC = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (TheApplication().GetProfileAttr("BlockContractFocus") != "Y")strContractId = oBC.GetFieldValue("Id") else TheApplication().SetProfileAttr("BlockContractFocus","N") } else{ strContractId = ""; TheApplication().SetProfileAttr("BlockContractFocus","N"); } } catch (e) { strContractId = ""; TheApplication().SetProfileAttr("BlockContractFocus","N"); } break; // moves the current contract cursors position to the last known position case "Adjust": if (strContractId != "" && defined(strContractId)) { oBO = TheApplication().ActiveBusObject(); oBC = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (oBC) { try {strId = GetFieldValue("Id")} catch (e) {strId = ""} while (strId != "" && strId != strContractId) { try { isRecord = NextRecord(); if (isRecord) strId = GetFieldValue("Id") else strId = "" } catch (e) { strId = ""; } } } strContractId = ""; } break; default: } } catch (e) { } finally { oBC = null; oBO = null; } }

Application Utilities Service SCM
Application_Close
function Application_Close () { var sessionId:chars = TheApplication().sessionId; // read from app object if(sessionId!="" && sessionId!=null) { //Begin CR181 2009-03-30 var oBOLogin = TheApplication().GetBusObject("EAI Session Login SCM"); var oBCLogin = oBOLogin.GetBusComp("EAI Session Login SCM"); //End CR181 2009-03-30 //Begin CR181 with (oBCLogin){ ClearToQuery(); SetViewMode(AllView); ActivateField("Session Close"); SetSearchSpec("Session Id",sessionId); ExecuteQuery(ForwardOnly); //OneCRM SCM R1 29-07-2009 TGDALAI1, changed from ForwardOnly to ForwardBackward if (FirstRecord()){ SetFormattedFieldValue("Session Close", this.timestamp()); WriteRecord(); } } oBCLogin = null; oBOLogin = null; //End CR181 } if (this.svcACV) this.svcACV = null; if (this.svcACVIn) this.svcACVIn = null; if (this.svcACVOut) this.svcACVOut = null; if (TheApplication().bcAdminCodeValue) TheApplication().bcAdminCodeValue = null; if (TheApplication().boAdminCodeValue) TheApplication().boAdminCodeValue = null; // TGDDERO7, 21.05.2012: Script-Check if (TheApplication().oArrSyncPenaltyCommissionOLI) TheApplication().oArrSyncPenaltyCommissionOLI = null; if (TheApplication().oMOOArray) TheApplication().oMOOArray = null; if (TheApplication().ConversionArray) TheApplication().ConversionArray = null; // TGDDERO7, 21.05.2012: Script-Check // Clean additional global Variables if (TheApplication().WFMResult) TheApplication().WFMResult = null; if (TheApplication().MOO_RootAssetIntegId) TheApplication().MOO_RootAssetIntegId = null; if (TheApplication().sessionId) TheApplication().sessionId = null; // Clean additional global Variables if (fpCRMLog) { Clib.fclose(fpCRMLog); fpCRMLog = null; } if (TheApplication().GetProfileAttr("SCM_Application_Close")) return; TheApplication().SetProfileAttr("SCM_Application_Close" , "Yes"); if (isTraceON) { TheApplication().Trace("=== Application_Close ==="); TheApplication().TraceOff(); } }

Application Utilities Service SCM
Application_Close
function Application_Close () { var sessionId:chars = TheApplication().sessionId; // read from app object if(sessionId!="" && sessionId!=null) { //Begin CR181 2009-03-30 var oBOLogin = TheApplication().GetBusObject("EAI Session Login SCM"); var oBCLogin = oBOLogin.GetBusComp("EAI Session Login SCM"); //End CR181 2009-03-30 //Begin CR181 with (oBCLogin){ ClearToQuery(); SetViewMode(AllView); ActivateField("Session Close"); SetSearchSpec("Session Id",sessionId); ExecuteQuery(ForwardOnly); //OneCRM SCM R1 29-07-2009 TGDALAI1, changed from ForwardOnly to ForwardBackward if (FirstRecord()){ SetFormattedFieldValue("Session Close", this.timestamp()); WriteRecord(); } } oBCLogin = null; oBOLogin = null; //End CR181 } if (this.svcACV) this.svcACV = null; if (this.svcACVIn) this.svcACVIn = null; if (this.svcACVOut) this.svcACVOut = null; if (TheApplication().bcAdminCodeValue) TheApplication().bcAdminCodeValue = null; if (TheApplication().boAdminCodeValue) TheApplication().boAdminCodeValue = null; // TGDDERO7, 21.05.2012: Script-Check if (TheApplication().oArrSyncPenaltyCommissionOLI) TheApplication().oArrSyncPenaltyCommissionOLI = null; if (TheApplication().oMOOArray) TheApplication().oMOOArray = null; if (TheApplication().ConversionArray) TheApplication().ConversionArray = null; // TGDDERO7, 21.05.2012: Script-Check // Clean additional global Variables if (TheApplication().WFMResult) TheApplication().WFMResult = null; if (TheApplication().MOO_RootAssetIntegId) TheApplication().MOO_RootAssetIntegId = null; if (TheApplication().sessionId) TheApplication().sessionId = null; // Clean additional global Variables if (fpCRMLog) { Clib.fclose(fpCRMLog); fpCRMLog = null; } if (TheApplication().GetProfileAttr("SCM_Application_Close")) return; TheApplication().SetProfileAttr("SCM_Application_Close" , "Yes"); if (isTraceON) { TheApplication().Trace("=== Application_Close ==="); TheApplication().TraceOff(); } }

Application Utilities Service SCM
Application_InvokeMethod
function Application_InvokeMethod (MethodName) { }

Application Utilities Service SCM
Application_InvokeMethod
function Application_InvokeMethod (MethodName) { }

Application Utilities Service SCM
Application_Navigate
function Application_Navigate () { var oApp; var ActiveBO; var strActiveViewName; var BCAsset; var bActiveViewReadOnly; var BCBP; var BCBPAddress; var oBCQuote; var bsWPM; //tgdtrth6 added 11.02.2014 var psInp; //tgdtrth6 added 11.02.2014 var psOutp;//tgdtrth6 added 11.02.2014 var oBCQuoteItem:BusComp; var strOrigin try { oApp = TheApplication(); ActiveBO = oApp.ActiveBusObject(); strActiveViewName = oApp.ActiveViewName(); BCAsset = null; bActiveViewReadOnly = null; BCBP = null; BCBPAddress = null; // EMA 21.11.2005: Added as it s the only way to make line breaks in calculated fields // EMA 30.11.2005: Added if, to only set it one time // TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 if (sAttrFirstTime == null) { oApp.SetProfileAttr("CR", "\n"); // TGDGEMAM 2014-07-30: IsOpenUI user property is only available after Application_Start // That's why it was moved over here. Should be triggered only once (Defect # 86709) if (oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_") == "Siebel_Power_Communications" && oApp.GetProfileAttr("Ignore Start Routine Users").toUpperCase().indexOf(oApp.LoginName().toUpperCase()) < 0) { this.SCM_SetUserPreferences(); } sAttrFirstTime = 1; } //TGDMANU1: CR1503 March 2015 release if(strActiveViewName == "Asset Mgmt - Asset Bundle Detail View SCM"){ TheApplication().SetProfileAttr("strAllBundleView",""); } //BEGIN All-IP Quote Fix, for ootB behaviour on ootB Signals Profile Attribute must be set, pointing to Quote Id // TAABAVI3, 13.04.2016, added condition based on PA "IsAutomatedTestON" to make working the call to the Cfg from Business Simulator view over a Quote created in Memory if (ActiveBO.Name() == "Quote" && ( TheApplication().GetProfileAttr("IsAutomatedTestON")!="Y" || TheApplication().GetProfileAttr("IsAutomatedTestON") == "" ) ) { oApp.SetProfileAttr("CurrentQuoteId", ActiveBO.GetBusComp("Quote").GetFieldValue("Id")); oBCQuoteItem = ActiveBO.GetBusComp("Quote Item"); if(oApp.GetProfileAttr("REXRetriggerCfgClose")=="Y") { //TAASAJO1 2015.05.11 - Defect #107699. Trigger by method to fix context issues TheApplication().SetProfileAttr("REXRetriggerCfgClose","N"); oBCQuoteItem.InvokeMethod("AEC Retrigger Eligibility SCM"); bsWPM = oApp.GetService("Workflow Process Manager"); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); psInp.SetProperty("ProcessName", "AEC Post Done Workflow SCM"); psInp.SetProperty("Object Id", oApp.GetProfileAttr("REXRetriggerObjectId")); psInp.SetProperty("Penalty", oApp.GetProfileAttr("REXRetriggerPenalty")); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } oBCQuoteItem = null; } //END All-IP Quote Fix //BEGIN 31-01-2013 TGDKRBI1 - Destroys the Quote Appointment related PA and property set if (strActiveViewName != "Quote Appointment Booking View AIP SCM" && strActiveViewName != "Quote Appointment List Booking View AIP SCM") { oApp.SetProfileAttr("WFM_enforceSLA", ""); oApp.SetProfileAttr("WFM_FulfilmentStrategy", "1"); oApp.SetProfileAttr("WFM_AppointmentRequest", ""); oApp.SetProfileAttr("WFM_ShiftAppointment", ""); oApp.SetProfileAttr("WFM_StartPeriod", ""); if(oApp.WFMResult != null) oApp.WFMResult = null; } //BEGIN OneCRM R1 SCM 2009-02-18 TGDCACO2 - BL2: CR019 if (strActiveViewName != "Dynamic Product Catalog View SCM") { oApp.SetProfileAttr("INPNavigation","N"); } //BEGIN OneCRM R1 SCM 2009-04-16 TGDHIAN4 - BL2: Refresh Service Request Business Component if required when navigating to Customer Entry View //SCM TGDRECHA 21.10.2014 "View Account Entry View 1st Level SCM" has been deactivated for SO2346 ==> removed ; if ((strActiveViewName == "Account Entry View SCM" || strActiveViewName == "MCE Homescreen View SCM") && oApp.GetProfileAttr("SRAutoRefresh") == "Y") { oApp.

Application Utilities Service SCM
Application_Navigate
function Application_Navigate () { var oApp; var ActiveBO; var strActiveViewName; var BCAsset; var bActiveViewReadOnly; var BCBP; var BCBPAddress; var oBCQuote; var bsWPM; //tgdtrth6 added 11.02.2014 var psInp; //tgdtrth6 added 11.02.2014 var psOutp;//tgdtrth6 added 11.02.2014 var oBCQuoteItem:BusComp; var strOrigin try { oApp = TheApplication(); ActiveBO = oApp.ActiveBusObject(); strActiveViewName = oApp.ActiveViewName(); BCAsset = null; bActiveViewReadOnly = null; BCBP = null; BCBPAddress = null; // EMA 21.11.2005: Added as it s the only way to make line breaks in calculated fields // EMA 30.11.2005: Added if, to only set it one time // TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 if (sAttrFirstTime == null) { oApp.SetProfileAttr("CR", "\n"); // TGDGEMAM 2014-07-30: IsOpenUI user property is only available after Application_Start // That's why it was moved over here. Should be triggered only once (Defect # 86709) if (oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_") == "Siebel_Power_Communications" && oApp.GetProfileAttr("Ignore Start Routine Users").toUpperCase().indexOf(oApp.LoginName().toUpperCase()) < 0) { this.SCM_SetUserPreferences(); } sAttrFirstTime = 1; } //TGDMANU1: CR1503 March 2015 release if(strActiveViewName == "Asset Mgmt - Asset Bundle Detail View SCM"){ TheApplication().SetProfileAttr("strAllBundleView",""); } //BEGIN All-IP Quote Fix, for ootB behaviour on ootB Signals Profile Attribute must be set, pointing to Quote Id // TAABAVI3, 13.04.2016, added condition based on PA "IsAutomatedTestON" to make working the call to the Cfg from Business Simulator view over a Quote created in Memory if (ActiveBO.Name() == "Quote" && ( TheApplication().GetProfileAttr("IsAutomatedTestON")!="Y" || TheApplication().GetProfileAttr("IsAutomatedTestON") == "" ) ) { oApp.SetProfileAttr("CurrentQuoteId", ActiveBO.GetBusComp("Quote").GetFieldValue("Id")); oBCQuoteItem = ActiveBO.GetBusComp("Quote Item"); if(oApp.GetProfileAttr("REXRetriggerCfgClose")=="Y") { //TAASAJO1 2015.05.11 - Defect #107699. Trigger by method to fix context issues TheApplication().SetProfileAttr("REXRetriggerCfgClose","N"); oBCQuoteItem.InvokeMethod("AEC Retrigger Eligibility SCM"); bsWPM = oApp.GetService("Workflow Process Manager"); psInp = oApp.NewPropertySet(); psOutp = oApp.NewPropertySet(); psInp.SetProperty("ProcessName", "AEC Post Done Workflow SCM"); psInp.SetProperty("Object Id", oApp.GetProfileAttr("REXRetriggerObjectId")); psInp.SetProperty("Penalty", oApp.GetProfileAttr("REXRetriggerPenalty")); bsWPM.InvokeMethod("RunProcess", psInp, psOutp); } oBCQuoteItem = null; } //END All-IP Quote Fix //BEGIN 31-01-2013 TGDKRBI1 - Destroys the Quote Appointment related PA and property set if (strActiveViewName != "Quote Appointment Booking View AIP SCM" && strActiveViewName != "Quote Appointment List Booking View AIP SCM") { oApp.SetProfileAttr("WFM_enforceSLA", ""); oApp.SetProfileAttr("WFM_FulfilmentStrategy", "1"); oApp.SetProfileAttr("WFM_AppointmentRequest", ""); oApp.SetProfileAttr("WFM_ShiftAppointment", ""); oApp.SetProfileAttr("WFM_StartPeriod", ""); if(oApp.WFMResult != null) oApp.WFMResult = null; } //BEGIN OneCRM R1 SCM 2009-02-18 TGDCACO2 - BL2: CR019 if (strActiveViewName != "Dynamic Product Catalog View SCM") { oApp.SetProfileAttr("INPNavigation","N"); } //BEGIN OneCRM R1 SCM 2009-04-16 TGDHIAN4 - BL2: Refresh Service Request Business Component if required when navigating to Customer Entry View //SCM TGDRECHA 21.10.2014 "View Account Entry View 1st Level SCM" has been deactivated for SO2346 ==> removed ; if ((strActiveViewName == "Account Entry View SCM" || strActiveViewName == "MCE Homescreen View SCM") && oApp.GetProfileAttr("SRAutoRefresh") == "Y") { oApp.

Application Utilities Service SCM
Application_PreInvokeMethod
function Application_PreInvokeMethod (MethodName) { var iReturn = ContinueOperation; switch(MethodName) { case "Logoff": case "LogOff": TheApplication().SetProfileAttr("StartLogoffSCM", "Yes"); iReturn = ContinueOperation; break; /* TGDDERO7, commented out because here is no getEventId() Method case "getEventId": this.getEventId(); break;*/ default: iReturn = ContinueOperation; } return (iReturn); }

Application Utilities Service SCM
Application_PreInvokeMethod
function Application_PreInvokeMethod (MethodName) { var iReturn = ContinueOperation; switch(MethodName) { case "Logoff": case "LogOff": TheApplication().SetProfileAttr("StartLogoffSCM", "Yes"); iReturn = ContinueOperation; break; /* TGDDERO7, commented out because here is no getEventId() Method case "getEventId": this.getEventId(); break;*/ default: iReturn = ContinueOperation; } return (iReturn); }

Application Utilities Service SCM
Application_PreNavigate
function Application_PreNavigate (DestViewName, DestBusObjName) { /**************************************************************************************** ** Name: Application_PreNavigate ** Modified By: TGDSEAI1 ** Modified: 21.02.2011 ** Description: CR513 Added call to check on the Account view when the view is the RTX+ view ** Updated: TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ****************************************************************************************/ var BOAccount; var BCAccount; var BCAssetMgmtOM; var strMasterAccId; var strAssetId; var strClientIP; var strLoginName; var psIn; var psOut; var BS; var oApp; var strActiveViewName; var lsCurrentQuoteId; var lsMessageQuoteId; var loSvc; var loInput; var loOutput; try { oApp = TheApplication(); strActiveViewName = oApp.ActiveViewName(); if (!this.skipClientIPCheck){ this.skipClientIPCheck = true; strClientIP = this.SCM_GetServerVariable("REMOTE_HOST"); if (strClientIP == null || strClientIP == "" || strClientIP == "undefined") strClientIP = "127.0.0.1"; strLoginName = oApp.LoginName().toUpperCase(); if(isTraceON) oApp.Trace("Login with ID " + strLoginName + " from " + strClientIP + "."); } /* added below line of code to set Profile attribute to fix the defect 73097 */ oApp.SetProfileAttr("strDestinationObjName",DestBusObjName); if (isTraceON)oApp.Trace("=== Application_PreNavigate ===" + DestViewName + " " + DestBusObjName); //OneCRM R1.0 SCM 24.11.2009 TSGBEJA1: Defect 16110. The profile attribute 'ReadOnlyApplet' is set //to 'N' previuosly to navigate to another view in order to avoid that the attribute remains set to //'Y' when comming from an EAI (system) activity. oApp.SetProfileAttr("ReadOnlyApplet","N"); // TGDGEMAM 2014-12-15 Sammel_SO Mar15 - Req# 10 - Profile Attribute needed to activate // PreSetFieldValue & SetFieldValue "Mobile Phone #"-validation on BC "Service Request" // SCM TGDRECHA 04.05.2015 added DestViewName for Defect 107613 if (DestBusObjName == "Service Request" || DestViewName == "Quote CNO Contact Information View AIP SCM") { oApp.SetProfileAttr("GUIValidatePhoneNumber4SR","TRUE"); } else { oApp.SetProfileAttr("GUIValidatePhoneNumber4SR","FALSE"); } //TGDMANU1: CR1503 March 2015 release if(DestViewName == "Asset Mgmt - Asset Bundle Detail View SCM"){ TheApplication().SetProfileAttr("strAllBundleView","Y"); } // TGDGEMAM 2016-01-20 Defect # 2422 - Performance Improvement // TGDGEMAM 2016-03-11 Defect # 5820 - Issue with Homescreen Navigation if(strActiveViewName == "MCE Homescreen View SCM" && DestBusObjName == "Account" && DestViewName!= "Billing Profile Address View SCM" && DestViewName!= "Customer Billing Profile View SCM") { // try to read current cursor position from MCE Homescreen always to restore context on customer overview try { strAssetId = ""; BOAccount = oApp.ActiveBusObject(); BCAssetMgmtOM = BOAccount.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (BCHasRecord(BCAssetMgmtOM)){ strAssetId = BCAssetMgmtOM.GetFieldValue("Id"); oApp.SetProfileAttr("SearchForRecord", strAssetId); } else { // workaround for empty Homescreen oApp.SetProfileAttr("SearchForRecord", "HOMESCREEN"); } oApp.SetProfileAttr("CleanAssetBC","N"); } catch (e) {} finally{ BCAssetMgmtOM = null; BOAccount = null; } } // TGDGEMAM 2016-03-15 Defect # 5820 - Issue with Homescreen Navigation if(DestBusObjName != "Account") { oApp.SetProfileAttr("SearchForRecord",""); oApp.SetProfileAttr("CleanAssetBC","N"); // Defect # 5926 } //TAAPENE1, ACS 10.07.2014 - for Catalog views in OpenUI //TAASINI2, 25.02.2016 - Added mock catalog view switch(DestViewName){ case "Quote-Browse Catalog Category Details View - Add to Cart AIP SCM": case "Quote-Browse QuadriCa PoC Catalog Category Detail View - Add to Cart SCM": case "Quot

Application Utilities Service SCM
Application_PreNavigate
function Application_PreNavigate (DestViewName, DestBusObjName) { /**************************************************************************************** ** Name: Application_PreNavigate ** Modified By: TGDSEAI1 ** Modified: 21.02.2011 ** Description: CR513 Added call to check on the Account view when the view is the RTX+ view ** Updated: TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ****************************************************************************************/ var BOAccount; var BCAccount; var BCAssetMgmtOM; var strMasterAccId; var strAssetId; var strClientIP; var strLoginName; var psIn; var psOut; var BS; var oApp; var strActiveViewName; var lsCurrentQuoteId; var lsMessageQuoteId; var loSvc; var loInput; var loOutput; try { oApp = TheApplication(); strActiveViewName = oApp.ActiveViewName(); if (!this.skipClientIPCheck){ this.skipClientIPCheck = true; strClientIP = this.SCM_GetServerVariable("REMOTE_HOST"); if (strClientIP == null || strClientIP == "" || strClientIP == "undefined") strClientIP = "127.0.0.1"; strLoginName = oApp.LoginName().toUpperCase(); if(isTraceON) oApp.Trace("Login with ID " + strLoginName + " from " + strClientIP + "."); } /* added below line of code to set Profile attribute to fix the defect 73097 */ oApp.SetProfileAttr("strDestinationObjName",DestBusObjName); if (isTraceON)oApp.Trace("=== Application_PreNavigate ===" + DestViewName + " " + DestBusObjName); //OneCRM R1.0 SCM 24.11.2009 TSGBEJA1: Defect 16110. The profile attribute 'ReadOnlyApplet' is set //to 'N' previuosly to navigate to another view in order to avoid that the attribute remains set to //'Y' when comming from an EAI (system) activity. oApp.SetProfileAttr("ReadOnlyApplet","N"); // TGDGEMAM 2014-12-15 Sammel_SO Mar15 - Req# 10 - Profile Attribute needed to activate // PreSetFieldValue & SetFieldValue "Mobile Phone #"-validation on BC "Service Request" // SCM TGDRECHA 04.05.2015 added DestViewName for Defect 107613 if (DestBusObjName == "Service Request" || DestViewName == "Quote CNO Contact Information View AIP SCM") { oApp.SetProfileAttr("GUIValidatePhoneNumber4SR","TRUE"); } else { oApp.SetProfileAttr("GUIValidatePhoneNumber4SR","FALSE"); } //TGDMANU1: CR1503 March 2015 release if(DestViewName == "Asset Mgmt - Asset Bundle Detail View SCM"){ TheApplication().SetProfileAttr("strAllBundleView","Y"); } // TGDGEMAM 2016-01-20 Defect # 2422 - Performance Improvement // TGDGEMAM 2016-03-11 Defect # 5820 - Issue with Homescreen Navigation // TGDGEMAM 2016-11-23 Defect # 16512 - Wrong Mobile Abo shown if(strActiveViewName == "MCE Homescreen View SCM" && DestViewName != "MCE Homescreen View SCM" && DestBusObjName == "Account" && DestViewName!= "Billing Profile Address View SCM" && DestViewName!= "Customer Billing Profile View SCM") { // try to read current cursor position from MCE Homescreen always to restore context on customer overview try { strAssetId = ""; BOAccount = oApp.ActiveBusObject(); BCAssetMgmtOM = BOAccount.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (BCHasRecord(BCAssetMgmtOM)){ strAssetId = BCAssetMgmtOM.GetFieldValue("Id"); oApp.SetProfileAttr("SearchForRecord", strAssetId); } else { // workaround for empty Homescreen oApp.SetProfileAttr("SearchForRecord", "HOMESCREEN"); } oApp.SetProfileAttr("CleanAssetBC","N"); } catch (e) {} finally{ BCAssetMgmtOM = null; BOAccount = null; } } // TGDGEMAM 2016-03-15 Defect # 5820 - Issue with Homescreen Navigation if(DestBusObjName != "Account") { oApp.SetProfileAttr("SearchForRecord",""); oApp.SetProfileAttr("CleanAssetBC","N"); // Defect # 5926 } //TAAPENE1, ACS 10.07.2014 - for Catalog views in OpenUI //TAASINI2, 25.02.2016 - Added mock catalog view switch(DestViewName){ case "Quote-Browse Catalog Category Details View - Add to Ca

Application Utilities Service SCM
Application_Start
function Application_Start (CommandLine) { var oApp; var strTraceFile; var strDateTime; var strApplName; var strApplLang; var strLoginName; var strCurrDir; var strTraceDir; var strClientIP; var strCWD; var strOS; try { oApp = TheApplication(); oApp.SetProfileAttr("StartLogoffSCM", "No"); strTraceFile = ""; strDateTime = ""; strApplName = oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_"); strApplLang = oApp.InvokeMethod("LANGUAGE"); strLoginName = oApp.LoginName().toUpperCase(); strCurrDir = Clib.getcwd(); strTraceDir = ""; strClientIP = ""; // If Profile Attr is already set, end Script to not execute // Application_Start twice if (oApp.GetProfileAttr("gsCLIENT")) return; oApp.SetProfileAttr("gsCLIENT" , "Yes"); oApp.SetProfileAttr("EAISystem" , "GUI"); //TGDSEAI1 18.03.2013 Added also in the application start for the EAI part to use it. if (sAttrFirstTime == null) { oApp.SetProfileAttr("CR", "\n"); oApp.SetProfileAttr("TABSCM", "\t"); } if (CommandLine.toUpperCase().indexOf("SCMDEBUG") >= 0) { oApp.SetProfileAttr("gsSCMDebug", "Yes"); isCmdTraceOn = true; this.SCM_WriteLog ("UserProfile gsSCMDebug=" + oApp.GetProfileAttr("gsSCMDebug")); } strCWD = Clib.getcwd(); // if (strCWD.indexOf("/") >= 0) => UNIX strOS = Clib.getenv("OS"); // if (strOS.toUpperCase().indexOf("WINDOWS") >= 0) => WINDOWS if (strCWD.indexOf("/") >= 0) { oApp.SetProfileAttr("OPERATING_SYSTEM", "UNIX"); } else { oApp.SetProfileAttr("OPERATING_SYSTEM", "WINDOWS"); } if (this.SCM_IsTraceOn()) { isLogOrTraceON = true; Clib.strftime(strDateTime, "%Y%m%d_%H%M%S", Clib.localtime(Clib.time()) ); if (CommandLine.toUpperCase().indexOf(".EXE ") >= 0) { strTraceDir = strCurrDir + "\\traces"; strTraceFile = strCurrDir + "\\traces\\" + strLoginName + "_" + strDateTime + "_" + strApplName + "_" + strApplLang + "_$p_$t.trc"; } else { strTraceDir = strCurrDir + "/traces"; strTraceFile = strCurrDir + "/traces/" + strLoginName + "_" + strDateTime + "_" + strApplName + "_" + strApplLang + "_$p_$t.trc"; } tracefilename = strTraceFile; oApp.tracefilename = tracefilename; Clib.mkdir(strTraceDir); oApp.TraceOn(strTraceFile, strTraceLevel, "All"); } /************************************************************************/ // TGDDERO7, 16.05.2011: application independent start routines this.SCM_ReiSParameterCacheInit(); // TGDDERO7, 16.05.2011: application independent start routines /************************************************************************/ /************************************************************************/ // TGDDERO7, 16.05.2011: Call application specific start routines switch (strApplName) { case "Siebel_Power_Communications": case "Siebel_Power_Communications_EM_SCM": this.Application_Start_Siebel_Power_Communications(CommandLine); break; case "Siebel_eChannel": this.Application_Start_Siebel_eChannel(CommandLine); break; case "Siebel_eChannel_for_CME": this.Application_Start_Siebel_eChannel_for_CME(CommandLine); break; default: break; } // TGDDERO7, 16.05.2011: Call application specific start routines /************************************************************************/ //This should be the last call in Application_Start if (isLogOrTraceON) { //SCM_WriteLog("CommandLine: " + CommandLine); this.SCM_WriteLog("=== End of Application_Start ==="); } } catch(e) { oApp.TraceOn("", "Allocation", "All"); oApp.Trace("Error in Application_Start: " + e.toString()); } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start
function Application_Start (CommandLine) { var oApp; var strTraceFile; var strDateTime; var strApplName; var strApplLang; var strLoginName; var strCurrDir; var strTraceDir; var strClientIP; var strCWD; var strOS; try { oApp = TheApplication(); oApp.SetProfileAttr("StartLogoffSCM", "No"); strTraceFile = ""; strDateTime = ""; strApplName = oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_"); strApplLang = oApp.InvokeMethod("LANGUAGE"); strLoginName = oApp.LoginName().toUpperCase(); strCurrDir = Clib.getcwd(); strTraceDir = ""; strClientIP = ""; // If Profile Attr is already set, end Script to not execute // Application_Start twice if (oApp.GetProfileAttr("gsCLIENT")) return; oApp.SetProfileAttr("gsCLIENT" , "Yes"); oApp.SetProfileAttr("EAISystem" , "GUI"); //TGDSEAI1 18.03.2013 Added also in the application start for the EAI part to use it. if (sAttrFirstTime == null) { oApp.SetProfileAttr("CR", "\n"); oApp.SetProfileAttr("TABSCM", "\t"); } if (CommandLine.toUpperCase().indexOf("SCMDEBUG") >= 0) { oApp.SetProfileAttr("gsSCMDebug", "Yes"); isCmdTraceOn = true; this.SCM_WriteLog ("UserProfile gsSCMDebug=" + oApp.GetProfileAttr("gsSCMDebug")); } strCWD = Clib.getcwd(); // if (strCWD.indexOf("/") >= 0) => UNIX strOS = Clib.getenv("OS"); // if (strOS.toUpperCase().indexOf("WINDOWS") >= 0) => WINDOWS if (strCWD.indexOf("/") >= 0) { oApp.SetProfileAttr("OPERATING_SYSTEM", "UNIX"); } else { oApp.SetProfileAttr("OPERATING_SYSTEM", "WINDOWS"); } if (this.SCM_IsTraceOn()) { isLogOrTraceON = true; Clib.strftime(strDateTime, "%Y%m%d_%H%M%S", Clib.localtime(Clib.time()) ); if (CommandLine.toUpperCase().indexOf(".EXE ") >= 0) { strTraceDir = strCurrDir + "\\traces"; strTraceFile = strCurrDir + "\\traces\\" + strLoginName + "_" + strDateTime + "_" + strApplName + "_" + strApplLang + "_$p_$t.trc"; } else { strTraceDir = strCurrDir + "/traces"; strTraceFile = strCurrDir + "/traces/" + strLoginName + "_" + strDateTime + "_" + strApplName + "_" + strApplLang + "_$p_$t.trc"; } tracefilename = strTraceFile; oApp.tracefilename = tracefilename; Clib.mkdir(strTraceDir); oApp.TraceOn(strTraceFile, strTraceLevel, "All"); } /************************************************************************/ // TGDDERO7, 16.05.2011: application independent start routines this.SCM_ReiSParameterCacheInit(); // TGDDERO7, 16.05.2011: application independent start routines /************************************************************************/ /************************************************************************/ // TGDDERO7, 16.05.2011: Call application specific start routines switch (strApplName) { case "Siebel_Power_Communications": case "Siebel_Power_Communications_EM_SCM": this.Application_Start_Siebel_Power_Communications(CommandLine); break; case "Siebel_eChannel": this.Application_Start_Siebel_eChannel(CommandLine); break; case "Siebel_eChannel_for_CME": this.Application_Start_Siebel_eChannel_for_CME(CommandLine); break; default: break; } // TGDDERO7, 16.05.2011: Call application specific start routines /************************************************************************/ //This should be the last call in Application_Start if (isLogOrTraceON) { //SCM_WriteLog("CommandLine: " + CommandLine); this.SCM_WriteLog("=== End of Application_Start ==="); } } catch(e) { oApp.TraceOn("", "Allocation", "All"); oApp.Trace("Error in Application_Start: " + e.toString()); } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_Power_Communications
function Application_Start_Siebel_Power_Communications(CommandLine){ var oApp; var strApplName; var strIgnoreStartRoutineUsers; var aUsers; var nUsers; var strLoginName; var bIgnoreStartRoutine; var i; try { oApp = TheApplication(); strApplName = oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_"); oApp.SetProfileAttr("SRAutoRefresh","N"); oApp.SetProfileAttr("AssetInQueryMode","N"); oApp.SetProfileAttr("INPNavigation","N"); oApp.SetProfileAttr("BPNavigation",""); oApp.SetProfileAttr("SearchForRecord", ""); oApp.SetProfileAttr("SearchForRecordStatus", ""); oApp.SetProfileAttr("SearchInCenterDone", "N"); oApp.SetProfileAttr("SRActivatedFlag", ""); oApp.SetProfileAttr("ValidAddr", "true"); strIgnoreStartRoutineUsers = oApp.GetProfileAttr("Ignore Start Routine Users").toUpperCase(); aUsers = strIgnoreStartRoutineUsers.split(","); nUsers = aUsers.length; strLoginName = oApp.LoginName().toUpperCase(); bIgnoreStartRoutine = false; i = 0; while (!bIgnoreStartRoutine && i<nUsers){ if (strLoginName == this.allTrim(aUsers[i]).toUpperCase()){ bIgnoreStartRoutine = true; } i++; } aUsers = null; this.SCM_SetUniqueTaskId(); if (!bIgnoreStartRoutine){ this.SCM_IndividualCNOControl(); } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_IndividualCNOControl()...") } } if (!bIgnoreStartRoutine){ //BEGIN OneCRM 07/09/2009 TGDSEAI1: SmallCR 12599 Set Outbound Communication User Preferences at application start // TGDGEMAM 2014-07-30: moved over to Application_Navigate due to issues with "IsOpenUI" user profile not beeing available yet //if (isLogOrTraceON){ this.SCM_WriteLog("Setting Outbound Communications User preferences")} //this.SCM_SetUserPreferences(); // Defect # 86709 } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_SetUserPreferences()...") } } //END if (!bIgnoreStartRoutine){ //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (BEGIN) this.SCM_AllSCValidations(); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (END) } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_AllSCValidations()...") } } //BEGIN OneCRM 30/10/2009 TGDSEAI1: Set TeamboxIdSCM profile attribute with the Id of the active position teambox this.SCM_setTeamboxId(); if(isLogOrTraceON)this.SCM_WriteLog("Application: TeamboxId prof attribute set"); //END OneCRM 30/10/2009 TGDSEAI1 if (!bIgnoreStartRoutine){ // TGDMAEM1 11.07.2012 Added to check if RTD should be enable or not this.SCM_setRTD_SiebeleMail_Enabled(); // END } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_setRTD_SiebeleMail_Enabled()...") } } //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. var strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. //TGDCRAN2 25.11.13 SO1385 START - initialise profile of agent this.SCM_CTIAgentInit(); // END if(strApplName == "Siebel_Power_Communications_EM_SCM"){ this.SCM_IsAdminUser(); this.SCM_ISPOSEMUser(); } this.SCM_SetDefaultTheme(); // 09.12.2014 tgdstre0 this.SCM_ISCTIAdminUser(); // TAAPENE1: cache Use Case table this.SCM_GetUseCaseList(); //TGDMANU1: Defect# 1806 this.SCM_FASWirelessAgentInit(); } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_Power_Communications
function Application_Start_Siebel_Power_Communications(CommandLine){ var oApp; var strApplName; var strIgnoreStartRoutineUsers; var aUsers; var nUsers; var strLoginName; var bIgnoreStartRoutine; var i; try { oApp = TheApplication(); strApplName = oApp.GetProfileAttr("ApplicationName").replace(/( )/g, "_"); oApp.SetProfileAttr("SRAutoRefresh","N"); oApp.SetProfileAttr("AssetInQueryMode","N"); oApp.SetProfileAttr("INPNavigation","N"); oApp.SetProfileAttr("BPNavigation",""); oApp.SetProfileAttr("SearchForRecord", ""); oApp.SetProfileAttr("SearchForRecordStatus", ""); oApp.SetProfileAttr("SearchInCenterDone", "N"); oApp.SetProfileAttr("SRActivatedFlag", ""); oApp.SetProfileAttr("ValidAddr", "true"); strIgnoreStartRoutineUsers = oApp.GetProfileAttr("Ignore Start Routine Users").toUpperCase(); aUsers = strIgnoreStartRoutineUsers.split(","); nUsers = aUsers.length; strLoginName = oApp.LoginName().toUpperCase(); bIgnoreStartRoutine = false; i = 0; while (!bIgnoreStartRoutine && i<nUsers){ if (strLoginName == this.allTrim(aUsers[i]).toUpperCase()){ bIgnoreStartRoutine = true; } i++; } aUsers = null; this.SCM_SetUniqueTaskId(); if (!bIgnoreStartRoutine){ this.SCM_IndividualCNOControl(); } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_IndividualCNOControl()...") } } if (!bIgnoreStartRoutine){ //BEGIN OneCRM 07/09/2009 TGDSEAI1: SmallCR 12599 Set Outbound Communication User Preferences at application start // TGDGEMAM 2014-07-30: moved over to Application_Navigate due to issues with "IsOpenUI" user profile not beeing available yet //if (isLogOrTraceON){ this.SCM_WriteLog("Setting Outbound Communications User preferences")} //this.SCM_SetUserPreferences(); // Defect # 86709 } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_SetUserPreferences()...") } } //END if (!bIgnoreStartRoutine){ //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (BEGIN) this.SCM_AllSCValidations(); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (END) } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_AllSCValidations()...") } } //BEGIN OneCRM 30/10/2009 TGDSEAI1: Set TeamboxIdSCM profile attribute with the Id of the active position teambox this.SCM_setTeamboxId(); if(isLogOrTraceON)this.SCM_WriteLog("Application: TeamboxId prof attribute set"); //END OneCRM 30/10/2009 TGDSEAI1 if (!bIgnoreStartRoutine){ // TGDMAEM1 11.07.2012 Added to check if RTD should be enable or not this.SCM_setRTD_SiebeleMail_Enabled(); // END } else{ if (isLogOrTraceON) { this.SCM_WriteLog("LoginName " + strLoginName + ": Skipping SCM_setRTD_SiebeleMail_Enabled()...") } } //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. var strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. //TGDCRAN2 25.11.13 SO1385 START - initialise profile of agent this.SCM_CTIAgentInit(); // END if(strApplName == "Siebel_Power_Communications_EM_SCM"){ this.SCM_IsAdminUser(); this.SCM_ISPOSEMUser(); } if (!bIgnoreStartRoutine){ this.fLoadUIAppletModesConfig(); } this.SCM_SetDefaultTheme(); // 09.12.2014 tgdstre0 this.SCM_ISCTIAdminUser(); // TAAPENE1: cache Use Case table this.SCM_GetUseCaseList(); //TGDMANU1: Defect# 1806 this.SCM_FASWirelessAgentInit(); } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_eChannel
function Application_Start_Siebel_eChannel(CommandLine) { var oApp; var strTestingDate; try { oApp = TheApplication(); // BEGIN: OneCRM R1 SCM 2008-12-23 TGDEGDI1: Variable to select asset from which button "Customer Overview" was clicked. oApp.SetProfileAttr("SearchForRecord", ""); // END: OneCRM R1 SCM 2008-12-23 TGDEGDI1. //BEGIN OneCRM R1 SCM 2009-01-15 TGDHIAN4 - BL2: CR020 oApp.SetProfileAttr("BPNavigation",""); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (BEGIN) this.SCM_AllSCValidations(); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (END) //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. this.SCM_SetDefaultTheme(); // 09.12.2014 tgdstre0 } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_eChannel
function Application_Start_Siebel_eChannel(CommandLine) { var oApp; var strTestingDate; try { oApp = TheApplication(); // BEGIN: OneCRM R1 SCM 2008-12-23 TGDEGDI1: Variable to select asset from which button "Customer Overview" was clicked. oApp.SetProfileAttr("SearchForRecord", ""); // END: OneCRM R1 SCM 2008-12-23 TGDEGDI1. //BEGIN OneCRM R1 SCM 2009-01-15 TGDHIAN4 - BL2: CR020 oApp.SetProfileAttr("BPNavigation",""); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (BEGIN) this.SCM_AllSCValidations(); //SCM 2009.10.28 TGDAMJA1. Issue 14998,14999,15002.Function to fill variable AllSCValidationsON (END) //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. this.SCM_SetDefaultTheme(); // 09.12.2014 tgdstre0 } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_eChannel_for_CME
function Application_Start_Siebel_eChannel_for_CME(CommandLine) { var oApp; var strTestingDate; try { oApp = TheApplication(); //Begin Code Commented, issue #12966 /* //Begin CR181 2009-03-30 var oBOLogin = TheApplication().GetBusObject("EAI Session Login SCM"); var oBCLogin = oBOLogin.GetBusComp("EAI Session Login SCM"); var Id; // End CR181 2009-03-30 */ //End Code Commented, issue #12966 //Begin Code Commented, issue #12966 /* //Begin CR181 with (oBCLogin){ NewRecord(NewAfter); //SetFormattedFieldValue("Session Start", timestamp()); WriteRecord(); Id = GetFieldValue("Id"); //retrieve the session id ClearToQuery(); SetViewMode(AllView); SetSearchSpec("Id",Id); ExecuteQuery(ForwardOnly); if (FirstRecord()){ sessionId = GetFieldValue("Session Id"); // It is force acteve therefore not required to activate it. } } //End CR181 */ //End Code Commented, issue #12966 //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. } finally { oApp = null; } }

Application Utilities Service SCM
Application_Start_Siebel_eChannel_for_CME
function Application_Start_Siebel_eChannel_for_CME(CommandLine) { var oApp; var strTestingDate; try { oApp = TheApplication(); //Begin Code Commented, issue #12966 /* //Begin CR181 2009-03-30 var oBOLogin = TheApplication().GetBusObject("EAI Session Login SCM"); var oBCLogin = oBOLogin.GetBusComp("EAI Session Login SCM"); var Id; // End CR181 2009-03-30 */ //End Code Commented, issue #12966 //Begin Code Commented, issue #12966 /* //Begin CR181 with (oBCLogin){ NewRecord(NewAfter); //SetFormattedFieldValue("Session Start", timestamp()); WriteRecord(); Id = GetFieldValue("Id"); //retrieve the session id ClearToQuery(); SetViewMode(AllView); SetSearchSpec("Id",Id); ExecuteQuery(ForwardOnly); if (FirstRecord()){ sessionId = GetFieldValue("Session Id"); // It is force acteve therefore not required to activate it. } } //End CR181 */ //End Code Commented, issue #12966 //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. strTestingDate = oApp.GetProfileAttr("PMC TEST DATE"); if( strTestingDate != null && strTestingDate != "") // only execute if there is a testing date in the system. this.SCM_ChangeTestingDate(strTestingDate, "FUTURE_DATE_TEST_PWS"); //SCM 2013.11.25 TGDLOHU1 added set code of future test dates. } finally { oApp = null; } }

Application Utilities Service SCM
BCHasRecord
function BCHasRecord(&oBC) { var cId; try { cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Application Utilities Service SCM
BCHasRecord
function BCHasRecord(&oBC) { var cId; try { cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

Application Utilities Service SCM
Init
function Init() { if (!this.svcACV) this.svcACV = TheApplication().GetService("Admin Code Value SCM"); if (!this.svcACVIn) this.svcACVIn = TheApplication().NewPropertySet(); if (!this.svcACVOut) this.svcACVOut = TheApplication().NewPropertySet(); }

Application Utilities Service SCM
Init
function Init() { if (!this.svcACV) this.svcACV = TheApplication().GetService("Admin Code Value SCM"); if (!this.svcACVIn) this.svcACVIn = TheApplication().NewPropertySet(); if (!this.svcACVOut) this.svcACVOut = TheApplication().NewPropertySet(); }

Application Utilities Service SCM
SCM_AllSCValidations
function SCM_AllSCValidations() { /*********************************************************************************************** ** Name: SCM_AllSCValidations ** Created: 28.10.2009 ** Created By: Javier Amor ** Description: Issues 14998,14999,15002 Function to get the value of an admin code value called AllSCValidations ** to decide if every validation must be checked in the search center.Validations are ** implemented in BC Find Entry. Depending on the value of the admin code value every validation ** will be checked in the search center or not. ***********************************************************************************************/ var strVal; try { strVal = this.SCM_RetrieveACV("AllSCValidations"); if(strVal.toUpperCase() == "TRUE") { AllSCValidationsON = true; } else { AllSCValidationsON = false; } // TGDDERO7, 13.05.2011: // Populate variable to Application Object for downwards compatibility. TheApplication().AllSCValidationsON = AllSCValidationsON; } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { } }

Application Utilities Service SCM
SCM_AllSCValidations
function SCM_AllSCValidations() { /*********************************************************************************************** ** Name: SCM_AllSCValidations ** Created: 28.10.2009 ** Created By: Javier Amor ** Description: Issues 14998,14999,15002 Function to get the value of an admin code value called AllSCValidations ** to decide if every validation must be checked in the search center.Validations are ** implemented in BC Find Entry. Depending on the value of the admin code value every validation ** will be checked in the search center or not. ***********************************************************************************************/ var strVal; try { strVal = this.SCM_RetrieveACV("AllSCValidations"); if(strVal.toUpperCase() == "TRUE") { AllSCValidationsON = true; } else { AllSCValidationsON = false; } // TGDDERO7, 13.05.2011: // Populate variable to Application Object for downwards compatibility. TheApplication().AllSCValidationsON = AllSCValidationsON; } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { } }

Application Utilities Service SCM
SCM_CTIAgentInit
function SCM_CTIAgentInit() { /******************************************************* ** Name: SCM_CTIAgentInit ** Created: 02.12.2013 ** Created By: TGDCRAN2 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM MCE Homescreen"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ) { // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "TRUE"); } else { // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "FALSE"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_CTIAgentInit
function SCM_CTIAgentInit() { /******************************************************* ** Name: SCM_CTIAgentInit ** Created: 02.12.2013 ** Created By: TGDCRAN2 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM MCE Homescreen"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ) { // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "TRUE"); } else { // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "FALSE"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_ChangeTestingDate
// TGDLOHU, this fuctions activates the PWS for future date testing. function SCM_ChangeTestingDate(strTestingDate, strPWSName) { var oBO; var oBC; var oTestDate; var oWrittenDate; try { oBO = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); oBC = oBO.GetBusComp("ISS Joint Workspace BusComp"); oBC.ClearToQuery(); oBC.ActivateField("Active Workspace Flag"); oBC.ActivateField("Tesing DateTime"); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Name]='" + strPWSName + "'"); oBC.ExecuteQuery(ForwardOnly); if (oBC.FirstRecord()) { oTestDate = new Date(strTestingDate); oWrittenDate = new Date(oBC.GetFieldValue("Tesing DateTime")); if(oTestDate.toString() != oWrittenDate.toString()) { oBC.SetFieldValue("Tesing DateTime",strTestingDate); oBC.WriteRecord(); } oBC.SetFieldValue("Active Workspace Flag", "Y"); } } catch(e) { // silence } finally { oTestDate = null; oWrittenDate = null; oBC = null; oBO = null; } }

Application Utilities Service SCM
SCM_ChangeTestingDate
// TGDLOHU, this fuctions activates the PWS for future date testing. function SCM_ChangeTestingDate(strTestingDate, strPWSName) { var oBO; var oBC; var oTestDate; var oWrittenDate; try { oBO = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); oBC = oBO.GetBusComp("ISS Joint Workspace BusComp"); oBC.ClearToQuery(); oBC.ActivateField("Active Workspace Flag"); oBC.ActivateField("Tesing DateTime"); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Name]='" + strPWSName + "'"); oBC.ExecuteQuery(ForwardOnly); if (oBC.FirstRecord()) { oTestDate = new Date(strTestingDate); oWrittenDate = new Date(oBC.GetFieldValue("Tesing DateTime")); if(oTestDate.toString() != oWrittenDate.toString()) { oBC.SetFieldValue("Tesing DateTime",strTestingDate); oBC.WriteRecord(); } oBC.SetFieldValue("Active Workspace Flag", "Y"); } } catch(e) { // silence } finally { oTestDate = null; oWrittenDate = null; oBC = null; oBO = null; } }

Application Utilities Service SCM
SCM_FASWirelessAgentInit
function SCM_FASWirelessAgentInit() { /******************************************************* ** Name: SCM_FASWirelessAgentInit ** Created: 21.12.2015 ** Created By: TGDMANU1 ** Description: Created for Defect# 1806 ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM FAS Wireless Prozesse"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ) { // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("IS_FASWIRELESS_PROCESS", "Y"); } else { // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("IS_FASWIRELESS_PROCESS", "N"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_FASWirelessAgentInit
function SCM_FASWirelessAgentInit() { /******************************************************* ** Name: SCM_FASWirelessAgentInit ** Created: 21.12.2015 ** Created By: TGDMANU1 ** Description: Created for Defect# 1806 ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM FAS Wireless Prozesse"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ) { // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("IS_FASWIRELESS_PROCESS", "Y"); } else { // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("IS_FASWIRELESS_PROCESS", "N"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_FilterOutAssets
function SCM_FilterOutAssets() { /**************************************************************************************** ** Name: SCM_FilterOutAssets ** Created: 29.10.2009 ** Created By: Iñaki R. Zabalegui,Vicente Hernandez ** Description: Issue 11767. Old script has been completely deleted and a new one has been created ** This script filter and position on contracts (when necessary) on the customer entry view. ** For CBU customers, it position on the seached contract(not inactive contracts) no matter where the agent comes from. ** For CBU and inactive contracts, when the agent comes from the search center, no contracts are displayed and ** if the agent does not come from the search center, all contracts but inactive ones will be displayed. ** For not CBU customers when the agent looks for non inactive contracts , the contract must be positiones. ** For not CBU customers if the agent looks for an inactive contract, all contracts but inactive ones will be displayed ** ****************************************************************************************/ var oApp; var CleanAssetBC; var BOAccount; var BCAccount; var BCAsset; var assetid; var inactive; var isRecord; var keepSearching; var status; var searchst; var SearchForRecord; var segment; var customertype; try { oApp = TheApplication(); CleanAssetBC = ""; BOAccount = null; BCAccount = null; BCAsset = null; assetid = ""; inactive= false; isRecord = false; keepSearching = true; status = ""; searchst = ""; SearchForRecord = ""; segment = ""; customertype = ""; //------------------- (1) VARIABLES -------------------------------- CleanAssetBC = oApp.GetProfileAttr("CleanAssetBC"); SearchForRecord = oApp.GetProfileAttr("SearchForRecord"); BOAccount = oApp.ActiveBusObject(); BCAccount = BOAccount.GetBusComp("Account"); BCAsset = BOAccount.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); try{ // TGDGEMAM 2016-03-23: CR-1605-WP-1041-001 => Performance Enhancements Symphony customertype = BCAccount.GetFieldValue("Type LIC"); //Calculating CBU if (BCAccount.GetFieldValue("Sub Type SCM") == oApp.InvokeMethod("LookUpValue","ACCOUNT_SUB_TYPE_SCM","SA")) segment = BCAccount.GetFieldValue("Parent Grobsegment SCM"); else segment = BCAccount.GetFieldValue("Grobsegment SCM"); } catch(e) {} finally{} // --------------- (2) CALCULATING ASSET's ROW_ID --------------- // CASE A --> Search Center if (CleanAssetBC == "Y") // The focus of the Asset is done just if the CleanAssetBC = Y { try { assetid = BCAsset.GetFieldValue("Id"); // Get the Id searched } catch (e) { //If value could not be got, that means that the contract is inactive. inactive=true; // TGDGEMAM 2016-01-18 Defect # 2422 - Performance Improvement if (oApp.GetProfileAttr("ActiveViewName") != "MCE Homescreen View SCM") oApp.SetProfileAttr("ContractSearchedStatus", "Inactive");//Error browser script } finally { // It is not necessary to change the variable itself // TGDGEMAM 2016-03-23: CR-1605-WP-1041-001 => Performance Enhancements Symphony oApp.SetProfileAttr("CleanAssetBC", "N"); if (segment == oApp.InvokeMethod("LookUpValue","CUSTOMER_SEGMENT_SCM","CBU") || customertype != "Person") { //Do nothing because the CBU in Search Center is already focused } else { //In case is not CBU then it is necessary to clean the Contract List Applet if (inactive==true || assetid=="") { BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSortSpec("AIP User External Integration Id (ASCENDING)"); BCAsset.ExecuteQuery(ForwardBackward); } } } } // CASE B --> Some view is navigating knowing the row_id of the specific contract else if (SearchForRecord != "") // Case we focus the Asset knowing its Row_Id { // workaround for HOMESCREEN if inactive contract was s

Application Utilities Service SCM
SCM_FilterOutAssets
function SCM_FilterOutAssets() { /**************************************************************************************** ** Name: SCM_FilterOutAssets ** Created: 29.10.2009 ** Created By: Iñaki R. Zabalegui,Vicente Hernandez ** Description: Issue 11767. Old script has been completely deleted and a new one has been created ** This script filter and position on contracts (when necessary) on the customer entry view. ** For CBU customers, it position on the seached contract(not inactive contracts) no matter where the agent comes from. ** For CBU and inactive contracts, when the agent comes from the search center, no contracts are displayed and ** if the agent does not come from the search center, all contracts but inactive ones will be displayed. ** For not CBU customers when the agent looks for non inactive contracts , the contract must be positiones. ** For not CBU customers if the agent looks for an inactive contract, all contracts but inactive ones will be displayed ** ****************************************************************************************/ var oApp; var CleanAssetBC; var BOAccount; var BCAccount; var BCAsset; var assetid; var inactive; var isRecord; var keepSearching; var status; var searchst; var SearchForRecord; var segment; var customertype; try { oApp = TheApplication(); CleanAssetBC = ""; BOAccount = null; BCAccount = null; BCAsset = null; assetid = ""; inactive= false; isRecord = false; keepSearching = true; status = ""; searchst = ""; SearchForRecord = ""; segment = ""; customertype = ""; //------------------- (1) VARIABLES -------------------------------- CleanAssetBC = oApp.GetProfileAttr("CleanAssetBC"); SearchForRecord = oApp.GetProfileAttr("SearchForRecord"); BOAccount = oApp.ActiveBusObject(); BCAccount = BOAccount.GetBusComp("Account"); BCAsset = BOAccount.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); try{ // TGDGEMAM 2016-03-23: CR-1605-WP-1041-001 => Performance Enhancements Symphony customertype = BCAccount.GetFieldValue("Type LIC"); //Calculating CBU if (BCAccount.GetFieldValue("Sub Type SCM") == oApp.InvokeMethod("LookUpValue","ACCOUNT_SUB_TYPE_SCM","SA")) segment = BCAccount.GetFieldValue("Parent Grobsegment SCM"); else segment = BCAccount.GetFieldValue("Grobsegment SCM"); } catch(e) {} finally{} // --------------- (2) CALCULATING ASSET's ROW_ID --------------- // CASE A --> Search Center if (CleanAssetBC == "Y") // The focus of the Asset is done just if the CleanAssetBC = Y { try { assetid = BCAsset.GetFieldValue("Id"); // Get the Id searched } catch (e) { //If value could not be got, that means that the contract is inactive. inactive=true; // TGDGEMAM 2016-01-18 Defect # 2422 - Performance Improvement if (oApp.GetProfileAttr("ActiveViewName") != "MCE Homescreen View SCM") oApp.SetProfileAttr("ContractSearchedStatus", "Inactive");//Error browser script } finally { // It is not necessary to change the variable itself // TGDGEMAM 2016-03-23: CR-1605-WP-1041-001 => Performance Enhancements Symphony oApp.SetProfileAttr("CleanAssetBC", "N"); if (segment == oApp.InvokeMethod("LookUpValue","CUSTOMER_SEGMENT_SCM","CBU") || customertype != "Person") { //Do nothing because the CBU in Search Center is already focused } else { //In case is not CBU then it is necessary to clean the Contract List Applet if (inactive==true || assetid=="") { BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSortSpec("AIP User External Integration Id (ASCENDING)"); BCAsset.ExecuteQuery(ForwardBackward); } } } } // CASE B --> Some view is navigating knowing the row_id of the specific contract else if (SearchForRecord != "") // Case we focus the Asset knowing its Row_Id { // workaround for HOMESCREEN if inactive contract was s

Application Utilities Service SCM
SCM_FilterOutBPs
function SCM_FilterOutBPs() { /******************************************************* ** Name: SCM_FilterOutBPs ** Created: 30.03.2009 ** Created By: Iñaki R. Zabalegui ** Description: This script does: ** 1.- Cleans the BC List Applet when coming from the ** Search Center to display all BPS ** Variable CleanBPBC is set in Search Center. Find Result List Applet. ** it could be used also from other places. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 06.08.2009 ** Changed By: Javier Amor ** Description: Scripting improved to be able to position when comes from a drilldown from a view different ** to the search center. ******************************************************/ var oApp; var CleanBPBC; var BOAccount; var BCAccount; var BCBP; var BPid; var isRecord; var keepSearching; var SearchForRecord; var SearchForRecord_AS; var SearchForRecord_BP; var SearchForRecordEntry_BE; var segment = ""; try { oApp = TheApplication(); CleanBPBC=""; BOAccount=null; BCAccount = null; BCBP=null; BPid=""; isRecord=false; keepSearching=true; SearchForRecord = ""; SearchForRecord_AS = ""; SearchForRecord_BP = ""; SearchForRecordEntry_BE =""; segment = ""; if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs start!"); /* If it comes from the search center */ BOAccount = oApp.ActiveBusObject(); /* Now only when the drilldown is checked, one record is displayed in the View */ BCBP = BOAccount.GetBusComp("Com Invoice Profile SCM"); //Comes from the Search center CleanBPBC = oApp.GetProfileAttr("CleanBPBC"); // "SearchForRecord" used when the BP to focus is known SearchForRecord = oApp.GetProfileAttr("SearchForRecord"); SearchForRecord_BP = oApp.GetProfileAttr("SearchForRecord_BP"); SearchForRecordEntry_BE = oApp.GetProfileAttr("BPIdFromCustomerEntryView"); //TAASAAI2 16.04.2015 Defect 106703 - get segment BCAccount = BOAccount.GetBusComp("Account"); try{ if (BCAccount.GetFieldValue("Sub Type SCM") == oApp.InvokeMethod("LookUpValue","ACCOUNT_SUB_TYPE_SCM","SA")){ segment = BCAccount.GetFieldValue("Parent Grobsegment SCM"); } else{ segment = BCAccount.GetFieldValue("Grobsegment SCM"); } } catch(e){} finally{} if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs segment" + segment); if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs SearchForRecord_BP" + SearchForRecord_BP); if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs SearchForRecordEntry_BE" + SearchForRecordEntry_BE); // --------------- CALCULATING BP's ROW_ID --------------- if (SearchForRecord != "") // Case we focus the Asset knowing its Row_Id { BPid = SearchForRecord; // Id of the known Asset // Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord", ""); } //SCM 2009.09.22 TGDRARO6: New property added. Issue 13241 else if (SearchForRecord_BP != "") { BPid = SearchForRecord_BP; //Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord_BP", ""); oApp.SetProfileAttr("SearchForRecord_AS", ""); oApp.SetProfileAttr("BPIdFromCustomerEntryView", ""); } else if (SearchForRecordEntry_BE != ""){ BPid = SearchForRecordEntry_BE; //Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord_BP", ""); oApp.SetProfileAttr("SearchForRecord_AS", ""); oApp.SetProfileAttr("BPIdFromCustomerEntryView", ""); } //END TGDRARO6 else if (CleanBPBC == "Y")//The focus of the BP is done just if the CleanBPBC=Y { /* Get the Id Searched */ BPid = BCBP.GetFieldValue("Id"); oApp.SetProfileAttr("CleanBPBC","N"); } // --------------- FOCUSING IF THERE IS A BP TO FOCUS --------------- if

Application Utilities Service SCM
SCM_FilterOutBPs
function SCM_FilterOutBPs() { /******************************************************* ** Name: SCM_FilterOutBPs ** Created: 30.03.2009 ** Created By: Iñaki R. Zabalegui ** Description: This script does: ** 1.- Cleans the BC List Applet when coming from the ** Search Center to display all BPS ** Variable CleanBPBC is set in Search Center. Find Result List Applet. ** it could be used also from other places. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 06.08.2009 ** Changed By: Javier Amor ** Description: Scripting improved to be able to position when comes from a drilldown from a view different ** to the search center. ******************************************************/ var oApp; var CleanBPBC; var BOAccount; var BCAccount; var BCBP; var BPid; var isRecord; var keepSearching; var SearchForRecord; var SearchForRecord_AS; var SearchForRecord_BP; var SearchForRecordEntry_BE; var segment = ""; try { oApp = TheApplication(); CleanBPBC=""; BOAccount=null; BCAccount = null; BCBP=null; BPid=""; isRecord=false; keepSearching=true; SearchForRecord = ""; SearchForRecord_AS = ""; SearchForRecord_BP = ""; SearchForRecordEntry_BE =""; segment = ""; if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs start!"); /* If it comes from the search center */ BOAccount = oApp.ActiveBusObject(); /* Now only when the drilldown is checked, one record is displayed in the View */ BCBP = BOAccount.GetBusComp("Com Invoice Profile SCM"); //Comes from the Search center CleanBPBC = oApp.GetProfileAttr("CleanBPBC"); // "SearchForRecord" used when the BP to focus is known SearchForRecord = oApp.GetProfileAttr("SearchForRecord"); SearchForRecord_BP = oApp.GetProfileAttr("SearchForRecord_BP"); SearchForRecordEntry_BE = oApp.GetProfileAttr("BPIdFromCustomerEntryView"); //TAASAAI2 16.04.2015 Defect 106703 - get segment BCAccount = BOAccount.GetBusComp("Account"); try{ if (BCAccount.GetFieldValue("Sub Type SCM") == oApp.InvokeMethod("LookUpValue","ACCOUNT_SUB_TYPE_SCM","SA")){ segment = BCAccount.GetFieldValue("Parent Grobsegment SCM"); } else{ segment = BCAccount.GetFieldValue("Grobsegment SCM"); } } catch(e){} finally{} if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs segment" + segment); if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs SearchForRecord_BP" + SearchForRecord_BP); if (isTraceON) oApp.Trace(this.Name() + " SCM_FilterOutBPs SearchForRecordEntry_BE" + SearchForRecordEntry_BE); // --------------- CALCULATING BP's ROW_ID --------------- if (SearchForRecord != "") // Case we focus the Asset knowing its Row_Id { BPid = SearchForRecord; // Id of the known Asset // Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord", ""); } //SCM 2009.09.22 TGDRARO6: New property added. Issue 13241 else if (SearchForRecord_BP != "") { BPid = SearchForRecord_BP; //Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord_BP", ""); oApp.SetProfileAttr("SearchForRecord_AS", ""); oApp.SetProfileAttr("BPIdFromCustomerEntryView", ""); } else if (SearchForRecordEntry_BE != ""){ BPid = SearchForRecordEntry_BE; //Reset Profile Attributes oApp.SetProfileAttr("SearchForRecord_BP", ""); oApp.SetProfileAttr("SearchForRecord_AS", ""); oApp.SetProfileAttr("BPIdFromCustomerEntryView", ""); } //END TGDRARO6 else if (CleanBPBC == "Y")//The focus of the BP is done just if the CleanBPBC=Y { /* Get the Id Searched */ BPid = BCBP.GetFieldValue("Id"); oApp.SetProfileAttr("CleanBPBC","N"); } // --------------- FOCUSING IF THERE IS A BP TO FOCUS --------------- if

Application Utilities Service SCM
SCM_GeneratePersonUId
function SCM_GeneratePersonUId(sAccountLoc, sFirstName, sLastName, sAdditive) { /* Desc: Defines the new user key for Contacts used by SCM WP: sAccountLoc, sFirstName, sLastName not null and not empty PC: returns sAccountLoc:sLastName:sFirstName:sAdditive TGDDERO7, 15.02.2012: Migrated from scmcore.js */ var sPersonUId; var sFirstNameNotNull; if(sAccountLoc == null || sAccountLoc == "" || sLastName == null || sLastName == "") { throw "WP violated"; } sFirstNameNotNull = ((sFirstName == null) || (sFirstName == "")) ? "_" : sFirstName; if((sAdditive == null) || (sAdditive == "")) { sPersonUId = sAccountLoc + ":" + sLastName + ":" + sFirstNameNotNull; } else { sPersonUId = sAccountLoc + ":" + sLastName + ":" + sFirstNameNotNull + ":" + sAdditive; } // trim user key to 100 if(sPersonUId.length > 100) { sPersonUId = sPersonUId.substring(0, 100); } return (sPersonUId); }

Application Utilities Service SCM
SCM_GeneratePersonUId
function SCM_GeneratePersonUId(sAccountLoc, sFirstName, sLastName, sAdditive) { /* Desc: Defines the new user key for Contacts used by SCM WP: sAccountLoc, sFirstName, sLastName not null and not empty PC: returns sAccountLoc:sLastName:sFirstName:sAdditive TGDDERO7, 15.02.2012: Migrated from scmcore.js */ var sPersonUId; var sFirstNameNotNull; if(sAccountLoc == null || sAccountLoc == "" || sLastName == null || sLastName == "") { throw "WP violated"; } sFirstNameNotNull = ((sFirstName == null) || (sFirstName == "")) ? "_" : sFirstName; if((sAdditive == null) || (sAdditive == "")) { sPersonUId = sAccountLoc + ":" + sLastName + ":" + sFirstNameNotNull; } else { sPersonUId = sAccountLoc + ":" + sLastName + ":" + sFirstNameNotNull + ":" + sAdditive; } // trim user key to 100 if(sPersonUId.length > 100) { sPersonUId = sPersonUId.substring(0, 100); } return (sPersonUId); }

Application Utilities Service SCM
SCM_GetAllNodesByType
function SCM_GetAllNodesByType(oParentNode, &Result, sType) { /****************************************************************************** * * Description: * Returns all Childs of Type "sType" in the reference parameter PropSet "Result" * Return Value iCount is Result.GetChildCount() * * * Date changed Changed by Kind of change * --------------------------------------------------------------------------- * ******************************************************************************/ var iChildCount; var iCount; var i; try { iChildCount = oParentNode.GetChildCount(); iCount = 0; // Number of Childs in Result PropSet if (sType) { for (i=0; i<iChildCount; i++) { if (isTraceON) TheApplication().Trace(" SCM_GetNodeByType("+i+"): " + oParentNode.GetChild(i).GetType()); if (oParentNode.GetChild(i).GetType() == sType) { Result.AddChild(oParentNode.GetChild(i).Copy()); iCount++; } } } } finally { } return iCount; }

Application Utilities Service SCM
SCM_GetAllNodesByType
function SCM_GetAllNodesByType(oParentNode, &Result, sType) { /****************************************************************************** * * Description: * Returns all Childs of Type "sType" in the reference parameter PropSet "Result" * Return Value iCount is Result.GetChildCount() * * * Date changed Changed by Kind of change * --------------------------------------------------------------------------- * ******************************************************************************/ var iChildCount; var iCount; var i; try { iChildCount = oParentNode.GetChildCount(); iCount = 0; // Number of Childs in Result PropSet if (sType) { for (i=0; i<iChildCount; i++) { if (isTraceON) TheApplication().Trace(" SCM_GetNodeByType("+i+"): " + oParentNode.GetChild(i).GetType()); if (oParentNode.GetChild(i).GetType() == sType) { Result.AddChild(oParentNode.GetChild(i).Copy()); iCount++; } } } } finally { } return iCount; }

Application Utilities Service SCM
SCM_GetCachedACVBC
function SCM_GetCachedACVBC() { var oApp; var bcAdminCodeValue; try { oApp = TheApplication(); bcAdminCodeValue = null; // TGDDERO7,05.07.2011: if (!oApp.bcAdminCodeValue) { oApp.boAdminCodeValue = oApp.GetBusObject("Admin Code Value SCM"); oApp.bcAdminCodeValue = oApp.boAdminCodeValue.GetBusComp("Admin Code/Value SCM"); oApp.bcAdminCodeValue.ClearToQuery(); oApp.bcAdminCodeValue.ActivateField("Code SCM"); // used in "Update() function" oApp.bcAdminCodeValue.ActivateField("Value SCM"); } bcAdminCodeValue = oApp.bcAdminCodeValue; } finally { oApp = null; } return (bcAdminCodeValue); }

Application Utilities Service SCM
SCM_GetCachedACVBC
function SCM_GetCachedACVBC() { var oApp; var bcAdminCodeValue; try { oApp = TheApplication(); bcAdminCodeValue = null; // TGDDERO7,05.07.2011: if (!oApp.bcAdminCodeValue) { oApp.boAdminCodeValue = oApp.GetBusObject("Admin Code Value SCM"); oApp.bcAdminCodeValue = oApp.boAdminCodeValue.GetBusComp("Admin Code/Value SCM"); oApp.bcAdminCodeValue.ClearToQuery(); oApp.bcAdminCodeValue.ActivateField("Code SCM"); // used in "Update() function" oApp.bcAdminCodeValue.ActivateField("Value SCM"); } bcAdminCodeValue = oApp.bcAdminCodeValue; } finally { oApp = null; } return (bcAdminCodeValue); }

Application Utilities Service SCM
SCM_GetEnterpriseServerName
function SCM_GetEnterpriseServerName() { var oApp; var strReturn; var bsSvc; var psIn; var psOut; try { oApp = TheApplication(); strReturn = ""; if (!oApp.EnterpriseServerName) { bsSvc = oApp.GetService("CMU External Integration Service"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); bsSvc.InvokeMethod("GetEnterpriseParameters", psIn, psOut); oApp.SiebelServerName = psOut.GetProperty("SiebelServerName"); oApp.EnterpriseServerName = psOut.GetProperty("EnterpriseServerName"); } strReturn = oApp.EnterpriseServerName; } finally { psOut = null; psIn = null; bsSvc = null; oApp = null; } return (strReturn); }

Application Utilities Service SCM
SCM_GetEnterpriseServerName
function SCM_GetEnterpriseServerName() { var oApp; var strReturn; var bsSvc; var psIn; var psOut; try { oApp = TheApplication(); strReturn = ""; if (!oApp.EnterpriseServerName) { bsSvc = oApp.GetService("CMU External Integration Service"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); bsSvc.InvokeMethod("GetEnterpriseParameters", psIn, psOut); oApp.SiebelServerName = psOut.GetProperty("SiebelServerName"); oApp.EnterpriseServerName = psOut.GetProperty("EnterpriseServerName"); } strReturn = oApp.EnterpriseServerName; } finally { psOut = null; psIn = null; bsSvc = null; oApp = null; } return (strReturn); }

Application Utilities Service SCM
SCM_GetNodeByType
function SCM_GetNodeByType(oParentNode, sType) { var iChildCount; var i; try { iChildCount = oParentNode.GetChildCount(); for (i=0; i<iChildCount; i++) { if (oParentNode.GetChild(i).GetType() == sType) return oParentNode.GetChild(i); } return null; } finally { } }

Application Utilities Service SCM
SCM_GetNodeByType
function SCM_GetNodeByType(oParentNode, sType) { var iChildCount; var i; try { iChildCount = oParentNode.GetChildCount(); for (i=0; i<iChildCount; i++) { if (oParentNode.GetChild(i).GetType() == sType) return oParentNode.GetChild(i); } return null; } finally { } }

Application Utilities Service SCM
SCM_GetServerVariable
function SCM_GetServerVariable(strVariable) { var oApp:Application; var bsWeb:Service; var psIn:PropertySet; var psOut:PropertySet; var propName:chars; var propVal:chars; var strReturn:chars; try { oApp = TheApplication(); bsWeb = oApp.GetService("Web Engine HTTP TXN"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); propName = ""; propVal = ""; strReturn = ""; bsWeb.InvokeMethod("GetAllServerVariables", psIn, psOut); propName = psOut.GetFirstProperty(); while (propName != null && propName != "") { propVal = psOut.GetProperty(propName); if (isTraceON && (strVariable==null || strVariable=="")) oApp.Trace(propName + "=" + propVal); if (strVariable == propName) strReturn = propVal; propName = psOut.GetNextProperty(); } /* REQUEST_URL=http://stdev2fe1v.swissptt.ch:1080/cuc_enu/start.swe REQUEST_METHOD=POST AUTH_USER_ID=sadmin REMOTE_HOST=10.58.34.125 SERVER_PORT=1080 */ // return (strReturn); tgdtrth6 12.02.2014 inactivated and moved to the function as it was leading to a script compilation error } catch (e) { // ignore if (isTraceON) oApp.Trace("ERROR (ignored): " + e.toString()); } finally { psIn = null; psOut = null; bsWeb = null; oApp = null; } return (strReturn); //tgdtrth6 12.02.2014 moved to the function as it was leading to a script compilation error }

Application Utilities Service SCM
SCM_GetServerVariable
function SCM_GetServerVariable(strVariable) { var oApp:Application; var bsWeb:Service; var psIn:PropertySet; var psOut:PropertySet; var propName:chars; var propVal:chars; var strReturn:chars; try { oApp = TheApplication(); bsWeb = oApp.GetService("Web Engine HTTP TXN"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); propName = ""; propVal = ""; strReturn = ""; bsWeb.InvokeMethod("GetAllServerVariables", psIn, psOut); propName = psOut.GetFirstProperty(); while (propName != null && propName != "") { propVal = psOut.GetProperty(propName); if (isTraceON && (strVariable==null || strVariable=="")) oApp.Trace(propName + "=" + propVal); if (strVariable == propName) strReturn = propVal; propName = psOut.GetNextProperty(); } /* REQUEST_URL=http://stdev2fe1v.swissptt.ch:1080/cuc_enu/start.swe REQUEST_METHOD=POST AUTH_USER_ID=sadmin REMOTE_HOST=10.58.34.125 SERVER_PORT=1080 */ // return (strReturn); tgdtrth6 12.02.2014 inactivated and moved to the function as it was leading to a script compilation error } catch (e) { // ignore if (isTraceON) oApp.Trace("ERROR (ignored): " + e.toString()); } finally { psIn = null; psOut = null; bsWeb = null; oApp = null; } return (strReturn); //tgdtrth6 12.02.2014 moved to the function as it was leading to a script compilation error }

Application Utilities Service SCM
SCM_GetSiebelServerName
function SCM_GetSiebelServerName() { var oApp; var strReturn; var bsSvc; var psIn; var psOut; try { oApp = TheApplication(); strReturn = ""; if (!oApp.SiebelServerName) { bsSvc = oApp.GetService("CMU External Integration Service"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); bsSvc.InvokeMethod("GetEnterpriseParameters", psIn, psOut); oApp.SiebelServerName = psOut.GetProperty("SiebelServerName"); oApp.EnterpriseServerName = psOut.GetProperty("EnterpriseServerName"); } strReturn = oApp.SiebelServerName; } finally { psOut = null; psIn = null; bsSvc = null; oApp = null; } return (strReturn); }

Application Utilities Service SCM
SCM_GetSiebelServerName
function SCM_GetSiebelServerName() { var oApp; var strReturn; var bsSvc; var psIn; var psOut; try { oApp = TheApplication(); strReturn = ""; if (!oApp.SiebelServerName) { bsSvc = oApp.GetService("CMU External Integration Service"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); bsSvc.InvokeMethod("GetEnterpriseParameters", psIn, psOut); oApp.SiebelServerName = psOut.GetProperty("SiebelServerName"); oApp.EnterpriseServerName = psOut.GetProperty("EnterpriseServerName"); } strReturn = oApp.SiebelServerName; } finally { psOut = null; psIn = null; bsSvc = null; oApp = null; } return (strReturn); }

Application Utilities Service SCM
SCM_GetUseCaseList
function SCM_GetUseCaseList(){ /************************************************************************************* ** Name: SCM_GetUseCaseList ** Created: 15.12.2015 ** Created By: TAAPENE1 ** Description: Query Use Case table and store result property set (SiebelMessage) in global variable psUseCase **************************************************************************************/ var objBS; var psInp; var psOut; psInp = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); try{ psInp.SetProperty("OutputIntObjectName","Transformation Object SCM"); objBS = TheApplication().GetService("EAI Siebel Adapter"); objBS.InvokeMethod("Query",psInp,psOut); psUseCase = psOut.GetChild(0).GetChild(0); }finally{ psOut = null; psInp = null; objBS = null; } }

Application Utilities Service SCM
SCM_GetUseCaseList
function SCM_GetUseCaseList(){ /************************************************************************************* ** Name: SCM_GetUseCaseList ** Created: 15.12.2015 ** Created By: TAAPENE1 ** Description: Query Use Case table and store result property set (SiebelMessage) in global variable psUseCase **************************************************************************************/ var objBS; var psInp; var psOut; psInp = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); try{ psInp.SetProperty("OutputIntObjectName","Transformation Object SCM"); objBS = TheApplication().GetService("EAI Siebel Adapter"); objBS.InvokeMethod("Query",psInp,psOut); psUseCase = psOut.GetChild(0).GetChild(0); }finally{ psOut = null; psInp = null; objBS = null; } }

Application Utilities Service SCM
SCM_ISCTIAdminUser
function SCM_ISCTIAdminUser(){ /******************************************************* ** Name: SCM_ISCTIAdminUser ** Created: 21.12.2015 ** Created By: TAASAAI2 ** Description: Created for WP855 to mark CTI Admin user for debug integration with NICE ******************************************************/ var oApp:Application; var strLoginName:chars = ""; var strListCTIUsers:chars = ""; var aUsers:Array; var index:float = 0; var nUsers:float = 0; var isCTIAdminUser = false; try { oApp = TheApplication(); strLoginName = oApp.GetProfileAttr("Login Name"); strListCTIUsers = this.SCM_RetrieveACV("CTIAdminUserListSCM"); aUsers = strListCTIUsers.split(","); nUsers = aUsers.length; while (!isCTIAdminUser && index < nUsers){ if (strLoginName == this.allTrim(aUsers[index]).toUpperCase()){ isCTIAdminUser = true; } index++; } if(isCTIAdminUser){ oApp.SetProfileAttr("CTI_ADMIN_USER_SCM","TRUE"); } else{ oApp.SetProfileAttr("CTI_ADMIN_USER_SCM","FALSE"); } } finally { aUsers = null; oApp = null; } }

Application Utilities Service SCM
SCM_ISCTIAdminUser
function SCM_ISCTIAdminUser(){ /******************************************************* ** Name: SCM_ISCTIAdminUser ** Created: 21.12.2015 ** Created By: TAASAAI2 ** Description: Created for WP855 to mark CTI Admin user for debug integration with NICE ******************************************************/ var oApp:Application; var strLoginName:chars = ""; var strListCTIUsers:chars = ""; var aUsers:Array; var index:float = 0; var nUsers:float = 0; var isCTIAdminUser = false; try { oApp = TheApplication(); strLoginName = oApp.GetProfileAttr("Login Name"); strListCTIUsers = this.SCM_RetrieveACV("CTIAdminUserListSCM"); aUsers = strListCTIUsers.split(","); nUsers = aUsers.length; while (!isCTIAdminUser && index < nUsers){ if (strLoginName == this.allTrim(aUsers[index]).toUpperCase()){ isCTIAdminUser = true; } index++; } if(isCTIAdminUser){ oApp.SetProfileAttr("CTI_ADMIN_USER_SCM","TRUE"); } else{ oApp.SetProfileAttr("CTI_ADMIN_USER_SCM","FALSE"); } } finally { aUsers = null; oApp = null; } }

Application Utilities Service SCM
SCM_ISPOSEMUser
function SCM_ISPOSEMUser(){ /******************************************************* ** Name: SCM_ISPOSEMUser ** Created: 02.02.2016 ** Created By: TAASAAI2 ** Description: Created for SO3143 to distinguish POS & SHOP Agents ******************************************************/ var objApp:Application; var boUser:BusObject; var bcUser:BusComp; var bcResp:BusComp; var strResp:chars; var arrResp:Array; var strSearchSpec:chars = ""; var index:float = 0; var nResp:float = 0; try { objApp = TheApplication(); if(this.isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser START"); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); strResp = this.SCM_RetrieveACV("POS_RESPONSIBILITIES_SCM"); if(strResp != null && strResp != ""){ arrResp = strResp.split(","); nResp = arrResp.length; for(index = 0; index < nResp; index++){ if(strSearchSpec == "" && arrResp[index] != ""){ strSearchSpec = "[Name]='" + arrResp[index] + "'"; } else{ strSearchSpec = strSearchSpec + " OR [Name]='" + arrResp[index] + "'"; } } if(isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser strSearchSpec:" + strSearchSpec); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchExpr(strSearchSpec); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ){ // found responsibility therefore he is a POS Agent objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "POS"); } else{ // no POS responsibility objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "SHOP"); } } else{ if(this.isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser NO ACV :POS_RESPONSIBILITIES_SCM"); objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "SHOP"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; arrResp = null; } }

Application Utilities Service SCM
SCM_ISPOSEMUser
function SCM_ISPOSEMUser(){ /******************************************************* ** Name: SCM_ISPOSEMUser ** Created: 02.02.2016 ** Created By: TAASAAI2 ** Description: Created for SO3143 to distinguish POS & SHOP Agents ******************************************************/ var objApp:Application; var boUser:BusObject; var bcUser:BusComp; var bcResp:BusComp; var strResp:chars; var arrResp:Array; var strSearchSpec:chars = ""; var index:float = 0; var nResp:float = 0; try { objApp = TheApplication(); if(this.isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser START"); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); strResp = this.SCM_RetrieveACV("POS_RESPONSIBILITIES_SCM"); if(strResp != null && strResp != ""){ arrResp = strResp.split(","); nResp = arrResp.length; for(index = 0; index < nResp; index++){ if(strSearchSpec == "" && arrResp[index] != ""){ strSearchSpec = "[Name]='" + arrResp[index] + "'"; } else{ strSearchSpec = strSearchSpec + " OR [Name]='" + arrResp[index] + "'"; } } if(isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser strSearchSpec:" + strSearchSpec); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchExpr(strSearchSpec); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ){ // found responsibility therefore he is a POS Agent objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "POS"); } else{ // no POS responsibility objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "SHOP"); } } else{ if(this.isTraceON)objApp.Trace(this.Name() + ".SCM_ISPOSEMUser NO ACV :POS_RESPONSIBILITIES_SCM"); objApp.SetProfileAttr("SCM_CHANNEL_EM_SCM", "SHOP"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; arrResp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOControl
function SCM_IndividualCNOControl() { var oApp; var oBOLOV; var oBCLOV; var cStatus; var cReturn; var cPositionID; try { oApp = TheApplication(); cReturn = "OFF"; cPositionID = oApp.PositionId(); oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_CONFIGURATION"); oBCLOV.SetSearchSpec("Name", "Status"); oBCLOV.ExecuteQuery(ForwardOnly); if (oBCLOV.FirstRecord()) { cStatus = oBCLOV.GetFieldValue("Description"); switch (cStatus.toLowerCase()) { case "on": cReturn = "ON"; break; case "off": cReturn = "OFF"; break; case "pilot": cReturn = "PILOT"; this.SCM_InvididualCNOPilotUser(cPositionID); break; default: cReturn = "OFF"; break; } } this.SCM_IndividualCNOFormControl(cPositionID); this.SCM_IndividualCNOFilter(); } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_Status", cReturn); oApp.SetProfileAttr("SCM_C4_PositionID", cPositionID); oApp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOControl
function SCM_IndividualCNOControl() { var oApp; var oBOLOV; var oBCLOV; var cStatus; var cReturn; var cPositionID; try { oApp = TheApplication(); cReturn = "OFF"; cPositionID = oApp.PositionId(); oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_CONFIGURATION"); oBCLOV.SetSearchSpec("Name", "Status"); oBCLOV.ExecuteQuery(ForwardOnly); if (oBCLOV.FirstRecord()) { cStatus = oBCLOV.GetFieldValue("Description"); switch (cStatus.toLowerCase()) { case "on": cReturn = "ON"; break; case "off": cReturn = "OFF"; break; case "pilot": cReturn = "PILOT"; this.SCM_InvididualCNOPilotUser(cPositionID); break; default: cReturn = "OFF"; break; } } this.SCM_IndividualCNOFormControl(cPositionID); this.SCM_IndividualCNOFilter(); } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_Status", cReturn); oApp.SetProfileAttr("SCM_C4_PositionID", cPositionID); oApp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOFilter
function SCM_IndividualCNOFilter() { var oApp; var oBOLOV; var oBCLOV; var cReturn; var cDescription; var bIsRecord; var cLIC; var cValue; var iCounter; try { oApp = TheApplication(); iCounter = 0; cReturn = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); oBCLOV.ActivateField("Value"); oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_CONFIGURATION"); oBCLOV.SetSearchSpec("Name", "Filter"); oBCLOV.ExecuteQuery(ForwardOnly); if (oBCLOV.FirstRecord()) { cDescription = oBCLOV.GetFieldValue("Description"); if (cDescription.toLowerCase() == "on") { cReturn = "true"; } else { cReturn = "false"; } } if (cReturn == "true") { oBCLOV.ClearToQuery(); // 07.03.2012 added filter // oBCLOV.SetSearchSpec("Type", "C4_FILTER"); // 11.04.2012 removed Language // oBCLOV.SetSearchExpr("[Type]='C4_FILTER' AND [Active]='Y' AND [Language]='" + oApp.InvokeMethod("LANGUAGE") + "'"); oBCLOV.SetSearchExpr("[Type]='C4_FILTER' AND [Active]='Y'"); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); while (bIsRecord) { iCounter++; cLIC = oBCLOV.GetFieldValue("Name"); cDescription = oBCLOV.GetFieldValue("Description"); cValue = oBCLOV.GetFieldValue("Value"); oApp.SetProfileAttr("SCM_C4"+cLIC, cDescription); oApp.SetProfileAttr("SCM_C4Label"+cLIC, cValue); oApp.SetProfileAttr("SCM_C4CountFilter", iCounter); bIsRecord = oBCLOV.NextRecord(); } } } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_Filter", cReturn); oApp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOFilter
function SCM_IndividualCNOFilter() { var oApp; var oBOLOV; var oBCLOV; var cReturn; var cDescription; var bIsRecord; var cLIC; var cValue; var iCounter; try { oApp = TheApplication(); iCounter = 0; cReturn = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); oBCLOV.ActivateField("Value"); oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_CONFIGURATION"); oBCLOV.SetSearchSpec("Name", "Filter"); oBCLOV.ExecuteQuery(ForwardOnly); if (oBCLOV.FirstRecord()) { cDescription = oBCLOV.GetFieldValue("Description"); if (cDescription.toLowerCase() == "on") { cReturn = "true"; } else { cReturn = "false"; } } if (cReturn == "true") { oBCLOV.ClearToQuery(); // 07.03.2012 added filter // oBCLOV.SetSearchSpec("Type", "C4_FILTER"); // 11.04.2012 removed Language // oBCLOV.SetSearchExpr("[Type]='C4_FILTER' AND [Active]='Y' AND [Language]='" + oApp.InvokeMethod("LANGUAGE") + "'"); oBCLOV.SetSearchExpr("[Type]='C4_FILTER' AND [Active]='Y'"); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); while (bIsRecord) { iCounter++; cLIC = oBCLOV.GetFieldValue("Name"); cDescription = oBCLOV.GetFieldValue("Description"); cValue = oBCLOV.GetFieldValue("Value"); oApp.SetProfileAttr("SCM_C4"+cLIC, cDescription); oApp.SetProfileAttr("SCM_C4Label"+cLIC, cValue); oApp.SetProfileAttr("SCM_C4CountFilter", iCounter); bIsRecord = oBCLOV.NextRecord(); } } } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_Filter", cReturn); oApp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOFormControl
function SCM_IndividualCNOFormControl(cPositionID) { var oApp; var oBOLOV; var oBCLOV; var bIsRecord; var cFormExceptionPosID; var cFormException; try { oApp = TheApplication() cFormException = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_FORM_EXCEPTION"); oBCLOV.SetSearchSpec("Description", cPositionID); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); if (bIsRecord) { cFormException = "true"; } /* while (bIsRecord) { cFormExceptionPosID = oBCLOV.GetFieldValue("Description"); bIsRecord = oBCLOV.NextRecord(); if (cFormExceptionPosID == cPositionID) { cFormException = "true"; bIsRecord = null; } } */ } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_FormException", cFormException); oApp = null; } }

Application Utilities Service SCM
SCM_IndividualCNOFormControl
function SCM_IndividualCNOFormControl(cPositionID) { var oApp; var oBOLOV; var oBCLOV; var bIsRecord; var cFormExceptionPosID; var cFormException; try { oApp = TheApplication() cFormException = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_FORM_EXCEPTION"); oBCLOV.SetSearchSpec("Description", cPositionID); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); if (bIsRecord) { cFormException = "true"; } /* while (bIsRecord) { cFormExceptionPosID = oBCLOV.GetFieldValue("Description"); bIsRecord = oBCLOV.NextRecord(); if (cFormExceptionPosID == cPositionID) { cFormException = "true"; bIsRecord = null; } } */ } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_FormException", cFormException); oApp = null; } }

Application Utilities Service SCM
SCM_InvididualCNOPilotUser
function SCM_InvididualCNOPilotUser(cPositionID) { var oApp; var oBOLOV; var oBCLOV; var bIsRecord; var cAlphaPosID; var cPilotUser; try { oApp = TheApplication(); cPilotUser = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_ALPHA_USER"); oBCLOV.SetSearchSpec("Description", cPositionID); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); if (bIsRecord) { cPilotUser = "true"; } /* while (bIsRecord) { cAlphaPosID = oBCLOV.GetFieldValue("Description"); bIsRecord = oBCLOV.NextRecord(); if (cAlphaPosID == cPositionID) { cPilotUser = "true"; bIsRecord = null; } } */ } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_PilotUser", cPilotUser); oApp = null; } }

Application Utilities Service SCM
SCM_InvididualCNOPilotUser
function SCM_InvididualCNOPilotUser(cPositionID) { var oApp; var oBOLOV; var oBCLOV; var bIsRecord; var cAlphaPosID; var cPilotUser; try { oApp = TheApplication(); cPilotUser = "false"; oBOLOV = oApp.GetBusObject("List Of Values"); oBCLOV = oBOLOV.GetBusComp("List Of Values"); // oracle config review - 29.1 // oBCLOV.ActivateField("Type"); // oBCLOV.ActivateField("Value"); // oBCLOV.ActivateField("Name"); oBCLOV.ActivateField("Description"); // oBCLOV.ActivateField("Language Name"); oBCLOV.ClearToQuery(); oBCLOV.SetSearchSpec("Type", "C4_ALPHA_USER"); oBCLOV.SetSearchSpec("Description", cPositionID); oBCLOV.ExecuteQuery(ForwardOnly); bIsRecord = oBCLOV.FirstRecord(); if (bIsRecord) { cPilotUser = "true"; } /* while (bIsRecord) { cAlphaPosID = oBCLOV.GetFieldValue("Description"); bIsRecord = oBCLOV.NextRecord(); if (cAlphaPosID == cPositionID) { cPilotUser = "true"; bIsRecord = null; } } */ } finally { oBCLOV = null; oBOLOV = null; oApp.SetProfileAttr("SCM_C4_PilotUser", cPilotUser); oApp = null; } }

Application Utilities Service SCM
SCM_IsAdminUser
function SCM_IsAdminUser(){ /******************************************************* ** Name: SCM_IsAdminUser ** Created: 13.10.2016 ** Created By: TAASAAI2 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM Admin"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ){ // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("SCM_ADMIN_USER_EM_SCM", "TRUE"); } else{ // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("SCM_ADMIN_USER_EM_SCM", "FALSE"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_IsAdminUser
function SCM_IsAdminUser(){ /******************************************************* ** Name: SCM_IsAdminUser ** Created: 13.10.2016 ** Created By: TAASAAI2 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; try { objApp = TheApplication(); boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", objApp.LoginName() ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM Admin"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ){ // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("SCM_ADMIN_USER_EM_SCM", "TRUE"); } else{ // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("SCM_ADMIN_USER_EM_SCM", "FALSE"); } } finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

Application Utilities Service SCM
SCM_IsTraceOn
function SCM_IsTraceOn() { var oApp; var bIsTracingOn; var strLevel; var strVal; var strLoginName; var aUsers; var nUsers; var i; try { oApp = TheApplication(); bIsTracingOn = false; strLevel = "Allocation"; strVal = null; strLoginName = oApp.LoginName().toUpperCase(); nUsers=0; i=0; if (isTraceON == null) { if (!isCmdTraceOn) { strVal = this.SCM_RetrieveACV("Tracing"); if (strVal != null && (strVal.toUpperCase() == "ON" || strVal.toUpperCase() == "TRUE")) { bIsTracingOn = true; } else { strVal = this.SCM_RetrieveACV("Trace Users"); aUsers = strVal.split(","); nUsers = aUsers.length; i=0; while (!bIsTracingOn && i<nUsers) { if (strLoginName == this.allTrim(aUsers[i]).toUpperCase()) { bIsTracingOn = true; } i++; } aUsers = null; } } if (bIsTracingOn || isCmdTraceOn) { bIsTracingOn = true; strLevel = this.SCM_RetrieveACV("Trace Level"); switch (strLevel.toUpperCase()) { case "ALLOCATION": strLevel = "Allocation"; break; case "SQL": strLevel = "SQL"; break; default: strLevel = "Allocation"; } } isLogOrTraceON = bIsTracingOn; isTraceON = bIsTracingOn; strTraceLevel = strLevel; } else { bIsTracingOn = isTraceON; } oApp.isLogOrTraceON = bIsTracingOn; oApp.isTraceON = bIsTracingOn; oApp.strTraceLevel = strLevel; } catch (e) { } finally { aUsers = null; oApp = null; } return (bIsTracingOn); }

Application Utilities Service SCM
SCM_IsTraceOn
function SCM_IsTraceOn() { var oApp; var bIsTracingOn; var strLevel; var strVal; var strLoginName; var aUsers; var nUsers; var i; try { oApp = TheApplication(); bIsTracingOn = false; strLevel = "Allocation"; strVal = null; strLoginName = oApp.LoginName().toUpperCase(); nUsers=0; i=0; if (isTraceON == null) { if (!isCmdTraceOn) { strVal = this.SCM_RetrieveACV("Tracing"); if (strVal != null && (strVal.toUpperCase() == "ON" || strVal.toUpperCase() == "TRUE")) { bIsTracingOn = true; } else { strVal = this.SCM_RetrieveACV("Trace Users"); aUsers = strVal.split(","); nUsers = aUsers.length; i=0; while (!bIsTracingOn && i<nUsers) { if (strLoginName == this.allTrim(aUsers[i]).toUpperCase()) { bIsTracingOn = true; } i++; } aUsers = null; } } if (bIsTracingOn || isCmdTraceOn) { bIsTracingOn = true; strLevel = this.SCM_RetrieveACV("Trace Level"); switch (strLevel.toUpperCase()) { case "ALLOCATION": strLevel = "Allocation"; break; case "SQL": strLevel = "SQL"; break; default: strLevel = "Allocation"; } } isLogOrTraceON = bIsTracingOn; isTraceON = bIsTracingOn; strTraceLevel = strLevel; } else { bIsTracingOn = isTraceON; } oApp.isLogOrTraceON = bIsTracingOn; oApp.isTraceON = bIsTracingOn; oApp.strTraceLevel = strLevel; } catch (e) { } finally { aUsers = null; oApp = null; } return (bIsTracingOn); }

Application Utilities Service SCM
SCM_PositionOnRecord
function SCM_PositionOnRecord(bc:BusComp, id:String) { /*********************************************************************************************** ** Name: SCM_AllSCValidations ** Created: 28.10.2009 ** Created By: Javier Amor ** Description: Issues 14998,14999,15002 Function to get the value of an admin code value called AllSCValidations ** to decide if every validation must be checked in the search center.Validations are ** implemented in BC Find Entry. Depending on the value of the admin code value every validation ** will be checked in the search center or not. ***********************************************************************************************/ var isRecord; var keepSearching; // Reset business component state bc.SetViewMode(AllView); bc.ClearToQuery(); bc.ExecuteQuery(ForwardBackward); // Position on desired id isRecord = bc.FirstRecord(); keepSearching = true; while (isRecord && keepSearching) { if (id != bc.GetFieldValue("Id")) { isRecord = bc.NextRecord(); } else { keepSearching = false; } } }

Application Utilities Service SCM
SCM_PositionOnRecord
function SCM_PositionOnRecord(bc:BusComp, id:String) { /*********************************************************************************************** ** Name: SCM_AllSCValidations ** Created: 28.10.2009 ** Created By: Javier Amor ** Description: Issues 14998,14999,15002 Function to get the value of an admin code value called AllSCValidations ** to decide if every validation must be checked in the search center.Validations are ** implemented in BC Find Entry. Depending on the value of the admin code value every validation ** will be checked in the search center or not. ***********************************************************************************************/ var isRecord; var keepSearching; // Reset business component state bc.SetViewMode(AllView); bc.ClearToQuery(); bc.ExecuteQuery(ForwardBackward); // Position on desired id isRecord = bc.FirstRecord(); keepSearching = true; while (isRecord && keepSearching) { if (id != bc.GetFieldValue("Id")) { isRecord = bc.NextRecord(); } else { keepSearching = false; } } }

Application Utilities Service SCM
SCM_ReiSParameterCacheInit
function SCM_ReiSParameterCacheInit(){ /***************************************************************** ** Function: SCM_ReiSParameterCacheInit ** Created: 23.12.2016 ** Created By: TAASAAI2 Move all logic to the same bs ** Description: BS to Set Profile Attribute With ACV *****************************************************************/ var oApp:Application; var bcAdminCode:BusComp = null; var isRecord:bool = false; var strCode:chars = ""; var strValue:chars = ""; var strSearchExpr:chars = ""; try{ oApp = TheApplication(); if(isTraceON)oApp.Trace(this.Name() + ".SCM_ReiSParameterCacheInit START"); bcAdminCode = oApp.utils.SCM_GetCachedACVBC(); isRecord = false; strSearchExpr = "[Cache Flag SCM] = 'Y' OR [Code SCM] ~like 'REIS:*' OR [Code SCM] ~like 'INIT:*'"; with (bcAdminCode){ SetViewMode(AllView); ClearToQuery(); SetSearchExpr(strSearchExpr); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); while (isRecord){ strCode = GetFieldValue("Code SCM"); strValue = GetFieldValue("Value SCM"); oApp.SetProfileAttr(strCode, strValue); if (isTraceON) oApp.Trace(this.Name() + ".SCM_ReiSParameterCacheInit: Setting Profile Attr '" + strCode + "' to '" + oApp.GetProfileAttr(strCode) + "'"); isRecord = NextRecord(); } } } catch (e){ if(isTraceON)oApp.Trace(this.Name() + ".SCM_ReiSParameterCacheInit ERROR: " + e.message); } finally{ bcAdminCode = null; oApp = null; bcAdminCode = null; isRecord = null; strCode = null; strValue = null; strSearchExpr = null; } }

Application Utilities Service SCM
SCM_ReiSParameterCacheInit
function SCM_ReiSParameterCacheInit() { var oApp; var bsReiSParam; var psIn; var psOut; try { oApp = TheApplication(); bsReiSParam = oApp.GetService("ReiS Parameter Cache SCM"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); bsReiSParam.InvokeMethod("Init", psIn, psOut); } catch (e) { if (isTraceON) TheApplication().Trace(e.toString()); } finally { psOut = null; psIn = null; bsReiSParam = null; oApp = null; } }

Application Utilities Service SCM
SCM_RetrieveACV
function SCM_RetrieveACV(strAdminCode) { /******************************************************************** ** Name: SCM_RetrieveACV ** Created: 13.05.2011 ** Created By: Rouven Degen ** Description: Retrieve Admin Code Value for specific Admin Code ** Used objects like BusSvc and PropSets are cached ** and reused to avoid reinstantiating the objects ********************************************************************/ var oApp; var strMethodName; var strAdminValue; try { oApp = TheApplication(); strMethodName = this.Name() + ".SCM_RetrieveACV(" + strAdminCode + ")"; strAdminValue = ""; if (!this.svcACV) this.svcACV = oApp.GetService("Admin Code Value SCM"); if (!this.svcACVIn) this.svcACVIn = oApp.NewPropertySet(); if (!this.svcACVOut) this.svcACVOut = oApp.NewPropertySet(); this.svcACVIn.Reset(); this.svcACVOut.Reset(); this.svcACVIn.SetProperty("Code", strAdminCode); this.svcACV.InvokeMethod("Retrieve", this.svcACVIn, this.svcACVOut); strAdminValue = this.svcACVOut.GetProperty("Value"); if (isTraceON) oApp.Trace(strMethodName + ": Retrieved Admin Code '" + strAdminCode + "' => '" + strAdminValue + "'"); } finally { oApp = null; } return (strAdminValue); }

Application Utilities Service SCM
SCM_RetrieveACV
function SCM_RetrieveACV(strAdminCode) { /******************************************************************** ** Name: SCM_RetrieveACV ** Created: 13.05.2011 ** Created By: Rouven Degen ** Description: Retrieve Admin Code Value for specific Admin Code ** Used objects like BusSvc and PropSets are cached ** and reused to avoid reinstantiating the objects ********************************************************************/ var oApp; var strMethodName; var strAdminValue; try { oApp = TheApplication(); strMethodName = this.Name() + ".SCM_RetrieveACV(" + strAdminCode + ")"; strAdminValue = ""; if (!this.svcACV) this.svcACV = oApp.GetService("Admin Code Value SCM"); if (!this.svcACVIn) this.svcACVIn = oApp.NewPropertySet(); if (!this.svcACVOut) this.svcACVOut = oApp.NewPropertySet(); this.svcACVIn.Reset(); this.svcACVOut.Reset(); this.svcACVIn.SetProperty("Code", strAdminCode); this.svcACV.InvokeMethod("Retrieve", this.svcACVIn, this.svcACVOut); strAdminValue = this.svcACVOut.GetProperty("Value"); if (isTraceON) oApp.Trace(strMethodName + ": Retrieved Admin Code '" + strAdminCode + "' => '" + strAdminValue + "'"); } finally { oApp = null; } return (strAdminValue); }

Application Utilities Service SCM
SCM_SetDefaultTheme
function SCM_SetDefaultTheme() { var oBOUP:BusObject; var oBCUP:BusComp; var oBCPickDN:BusComp; var oBCPickDT:BusComp; var sValue:chars; var cValue:chars = "Swisscom Tab"; var strMethodName = this.Name() + ".SCM_SetDefaultTheme()"; try { oBOUP = TheApplication().GetBusObject("User Preferences"); oBCUP = oBOUP.GetBusComp("User Preferences"); oBCUP.SetViewMode(AllView); oBCUP.ActivateField("Behavior/DefaultNavCtrl"); oBCUP.ActivateField("Behavior/DefaultTheme"); oBCUP.ClearToQuery(); oBCUP.ExecuteQuery(ForwardOnly); if (oBCUP.FirstRecord()) { sValue = oBCUP.GetFieldValue("Behavior/DefaultTheme"); SCM_WriteLog(strMethodName + ": '" + sValue +"'"); if (sValue == null || sValue != cValue) { oBCPickDN = oBCUP.GetPicklistBusComp("Behavior/DefaultNavCtrl"); oBCPickDN.ClearToQuery(); oBCPickDN.SetSearchSpec("Value", "Tab"); oBCPickDN.ExecuteQuery(ForwardOnly); if (oBCPickDN.FirstRecord()) { oBCPickDN.Pick(); oBCPickDT = oBCUP.GetPicklistBusComp("Behavior/DefaultTheme"); oBCPickDT.ClearToQuery(); oBCPickDT.SetSearchSpec("Value", cValue); oBCPickDT.ExecuteQuery(ForwardOnly); if (oBCPickDT.FirstRecord()) { oBCPickDT.Pick(); oBCUP.WriteRecord(); SCM_WriteLog(strMethodName + ": WriteRecord()"); } } } } } catch(e) { SCM_WriteLog(strMethodName + ": Error " + e.toString()); } finally { oBCPickDT = null; oBCPickDN = null; oBCUP = null; oBOUP = null; } }

Application Utilities Service SCM
SCM_SetDefaultTheme
function SCM_SetDefaultTheme() { var oBOUP:BusObject; var oBCUP:BusComp; var oBCPickDN:BusComp; var oBCPickDT:BusComp; var sValue:chars; var cValue:chars = "Swisscom Tab"; var strMethodName = this.Name() + ".SCM_SetDefaultTheme()"; try { oBOUP = TheApplication().GetBusObject("User Preferences"); oBCUP = oBOUP.GetBusComp("User Preferences"); oBCUP.SetViewMode(AllView); oBCUP.ActivateField("Behavior/DefaultNavCtrl"); oBCUP.ActivateField("Behavior/DefaultTheme"); oBCUP.ClearToQuery(); oBCUP.ExecuteQuery(ForwardOnly); if (oBCUP.FirstRecord()) { sValue = oBCUP.GetFieldValue("Behavior/DefaultTheme"); SCM_WriteLog(strMethodName + ": '" + sValue +"'"); if (sValue == null || sValue != cValue) { oBCPickDN = oBCUP.GetPicklistBusComp("Behavior/DefaultNavCtrl"); oBCPickDN.ClearToQuery(); oBCPickDN.SetSearchSpec("Value", "Tab"); oBCPickDN.ExecuteQuery(ForwardOnly); if (oBCPickDN.FirstRecord()) { oBCPickDN.Pick(); oBCPickDT = oBCUP.GetPicklistBusComp("Behavior/DefaultTheme"); oBCPickDT.ClearToQuery(); oBCPickDT.SetSearchSpec("Value", cValue); oBCPickDT.ExecuteQuery(ForwardOnly); if (oBCPickDT.FirstRecord()) { oBCPickDT.Pick(); oBCUP.WriteRecord(); SCM_WriteLog(strMethodName + ": WriteRecord()"); } } } } } catch(e) { SCM_WriteLog(strMethodName + ": Error " + e.toString()); } finally { oBCPickDT = null; oBCPickDN = null; oBCUP = null; oBOUP = null; } }

Application Utilities Service SCM
SCM_SetUniqueTaskId
function SCM_SetUniqueTaskId() { var strMethodName; var date:Date; var iRandomNum:float; var sUniqueTaskId:chars; try { strMethodName = this.Name() + ".SCM_SetUniqueTaskId()"; date = new Date(); iRandomNum = Math.floor(Math.random() * 10000); sUniqueTaskId = Clib.rsprintf("%s_%d", date.getTime(), iRandomNum); if(isTraceON) TheApplication().Trace(strMethodName + ": sUniqueTaskId = " + sUniqueTaskId); TheApplication().SetProfileAttr("Unique Task Id SCM", sUniqueTaskId); } finally { // TGDDERO7, 21.05.2012: Script-Check date = null; } }

Application Utilities Service SCM
SCM_SetUniqueTaskId
function SCM_SetUniqueTaskId() { var strMethodName; var date:Date; var iRandomNum:float; var sUniqueTaskId:chars; try { strMethodName = this.Name() + ".SCM_SetUniqueTaskId()"; date = new Date(); iRandomNum = Math.floor(Math.random() * 10000); sUniqueTaskId = Clib.rsprintf("%s_%d", date.getTime(), iRandomNum); if(isTraceON) TheApplication().Trace(strMethodName + ": sUniqueTaskId = " + sUniqueTaskId); TheApplication().SetProfileAttr("Unique Task Id SCM", sUniqueTaskId); } finally { // TGDDERO7, 21.05.2012: Script-Check date = null; } }

Application Utilities Service SCM
SCM_SetUserPreferences
function SCM_SetUserPreferences() { /**************************************************************************************** ** Name: SCMSetUserPreferences ** Created: 07.09.2009 ** Created By: TGDSEAI1 ** Description: This script set the agent user preferences for Outbound Communications required ** for Send Email F9 functionality, added due to SmallCR 12599 ****************************************************************************************/ var oBOUP:BusObject; var oBCUP:BusComp; var sSCM_SiebeleMail; var strMethodName; var sOpenUIFlag; try { strMethodName = this.Name() + ".SCM_SetUserPreferences()"; sOpenUIFlag = TheApplication().GetProfileAttr("IsOpenUI"); oBOUP = TheApplication().GetBusObject("User Preferences"); oBCUP = oBOUP.GetBusComp("User Preferences"); oBCUP.SetViewMode(AllView); oBCUP.ActivateField("Communications/SendEmailFormat"); oBCUP.ActivateField("Communications/MapiProfile"); oBCUP.ActivateField("Communications/MailClientType"); oBCUP.ActivateField("Communications/LangCode"); //Defect 59972 ensure it is allways empty at log-in oBCUP.ClearToQuery(); oBCUP.ExecuteQuery(ForwardOnly); if (oBCUP.FirstRecord()) { if (sOpenUIFlag == "") { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); //oBCUP.SetFieldValue("Communications/MapiProfile","Default SMTP Profile"); oBCUP.SetFieldValue("Communications/MailClientType","Microsoft Outlook"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } else { // is Open UI sSCM_SiebeleMail = TheApplication().GetProfileAttr("SCM_SiebeleMail"); if (sSCM_SiebeleMail == "Y") // Siebel eMail must be activated { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); oBCUP.SetFieldValue("Communications/MailClientType","Siebel Mail Client"); oBCUP.SetFieldValue("Communications/MapiProfile","NoReply SMTP Profile SCM"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } else { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); oBCUP.SetFieldValue("Communications/MailClientType","External Email Client"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } } oBCUP.WriteRecord(); } } catch(e) { SCM_WriteLog(strMethodName + ": Error " + e.toString()); } finally { oBCUP = null; oBOUP = null; } }

Application Utilities Service SCM
SCM_SetUserPreferences
function SCM_SetUserPreferences() { /**************************************************************************************** ** Name: SCMSetUserPreferences ** Created: 07.09.2009 ** Created By: TGDSEAI1 ** Description: This script set the agent user preferences for Outbound Communications required ** for Send Email F9 functionality, added due to SmallCR 12599 ****************************************************************************************/ var oBOUP:BusObject; var oBCUP:BusComp; var sSCM_SiebeleMail; var strMethodName; var sOpenUIFlag; try { strMethodName = this.Name() + ".SCM_SetUserPreferences()"; sOpenUIFlag = TheApplication().GetProfileAttr("IsOpenUI"); oBOUP = TheApplication().GetBusObject("User Preferences"); oBCUP = oBOUP.GetBusComp("User Preferences"); oBCUP.SetViewMode(AllView); oBCUP.ActivateField("Communications/SendEmailFormat"); oBCUP.ActivateField("Communications/MapiProfile"); oBCUP.ActivateField("Communications/MailClientType"); oBCUP.ActivateField("Communications/LangCode"); //Defect 59972 ensure it is allways empty at log-in oBCUP.ClearToQuery(); oBCUP.ExecuteQuery(ForwardOnly); if (oBCUP.FirstRecord()) { if (sOpenUIFlag == "") { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); //oBCUP.SetFieldValue("Communications/MapiProfile","Default SMTP Profile"); oBCUP.SetFieldValue("Communications/MailClientType","Microsoft Outlook"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } else { // is Open UI sSCM_SiebeleMail = TheApplication().GetProfileAttr("SCM_SiebeleMail"); if (sSCM_SiebeleMail == "Y") // Siebel eMail must be activated { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); oBCUP.SetFieldValue("Communications/MailClientType","Siebel Mail Client"); oBCUP.SetFieldValue("Communications/MapiProfile","NoReply SMTP Profile SCM"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } else { oBCUP.SetFieldValue("Communications/SendEmailFormat","HTML"); oBCUP.SetFieldValue("Communications/MailClientType","External Email Client"); oBCUP.SetFieldValue("Communications/LangCode","");//Defect 59972 ensure it is allways empty at log-in } } oBCUP.WriteRecord(); } } catch(e) { SCM_WriteLog(strMethodName + ": Error " + e.toString()); } finally { oBCUP = null; oBOUP = null; } }

Application Utilities Service SCM
SCM_TracePropSet
function SCM_TracePropSet (PropSet, title, Level) { if (!isTraceON) return; var oApp; var aProps; var children; var propName; var propValue; var nI; var x; var indent; try { oApp = TheApplication(); aProps = null; children = null; propName = ""; propValue = ""; nI = 0; x = 0; indent = ""; if ((Level == "") || (typeof(Level) == "undefined")) { Level = 0; } if (Level == 0 && title.length > 0) { oApp.Trace("---------------------------------------------------"); oApp.Trace(title); } for (x = 0; x < Level; x++){ indent += "\t"; } oApp.Trace(indent + "Type: " + PropSet.GetType() + " Value: " + PropSet.GetValue()); aProps = new Array; propName = PropSet.GetFirstProperty(); while (propName != "") { aProps[nI] = propName; nI++; propName = PropSet.GetNextProperty(); } aProps.sort(); for (x = 0; x < aProps.length; x++) { propName = aProps[x]; propValue = PropSet.GetProperty(propName); oApp.Trace(indent + propName + " = " + propValue); } children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { oApp.Trace(indent + "CHILD PROPERTY SET " + x); this.SCM_TracePropSet(PropSet.GetChild(x), title, (Level + 1)); } } // end try catch(e) { // silence } finally { children = null; aProps = null; oApp = null; } }

Application Utilities Service SCM
SCM_TracePropSet
function SCM_TracePropSet (PropSet, title, Level) { if (!isTraceON) return; var oApp; var aProps; var children; var propName; var propValue; var nI; var x; var indent; try { oApp = TheApplication(); aProps = null; children = null; propName = ""; propValue = ""; nI = 0; x = 0; indent = ""; if ((Level == "") || (typeof(Level) == "undefined")) { Level = 0; } if (Level == 0 && title.length > 0) { oApp.Trace("---------------------------------------------------"); oApp.Trace(title); } for (x = 0; x < Level; x++){ indent += "\t"; } oApp.Trace(indent + "Type: " + PropSet.GetType() + " Value: " + PropSet.GetValue()); aProps = new Array; propName = PropSet.GetFirstProperty(); while (propName != "") { aProps[nI] = propName; nI++; propName = PropSet.GetNextProperty(); } aProps.sort(); for (x = 0; x < aProps.length; x++) { propName = aProps[x]; propValue = PropSet.GetProperty(propName); oApp.Trace(indent + propName + " = " + propValue); } children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { oApp.Trace(indent + "CHILD PROPERTY SET " + x); this.SCM_TracePropSet(PropSet.GetChild(x), title, (Level + 1)); } } // end try catch(e) { // silence } finally { children = null; aProps = null; oApp = null; } }

Application Utilities Service SCM
SCM_TracePropSetFlat
function SCM_TracePropSetFlat (PropSet, title, Level) { if (!isTraceON) return; var oApp; var aProps; var children; var propName; var propValue; var nI; var x; var cDeli; var cHeader; var cString; try { oApp = TheApplication(); aProps = null; children = null; propName = ""; propValue = ""; nI = 0; x = 0; // var file = Clib.fopen("c:\\SCM_Trace.txt", "at"); cDeli = ";" cHeader = ""; cString = ""; if ((Level == "") || (typeof(Level) == "undefined")) { Level = 0; } if (title.length > 0) { cHeader += title + cDeli; } cHeader += PropSet.GetType() + cDeli + PropSet.GetValue() + cDeli; aProps = new Array; propName = PropSet.GetFirstProperty(); while (propName != "") { aProps[nI] = propName; nI++; propName = PropSet.GetNextProperty(); } aProps.sort(); for (x = 0; x < aProps.length; x++) { propName = aProps[x]; propValue = PropSet.GetProperty(propName); cString = cHeader; cString += propName + cDeli + propValue + cDeli; //cString += "\n"; oApp.Trace(cString); // Clib.fputs(cString, file); } children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { this.SCM_TracePropSetFlat(PropSet.GetChild(x), title, (Level + 1)); } // Clib.fclose(file); } // end try catch(e) { // silence } finally { children = null; aProps = null; oApp = null; } }

Application Utilities Service SCM
SCM_TracePropSetFlat
function SCM_TracePropSetFlat (PropSet, title, Level) { if (!isTraceON) return; var oApp; var aProps; var children; var propName; var propValue; var nI; var x; var cDeli; var cHeader; var cString; try { oApp = TheApplication(); aProps = null; children = null; propName = ""; propValue = ""; nI = 0; x = 0; // var file = Clib.fopen("c:\\SCM_Trace.txt", "at"); cDeli = ";" cHeader = ""; cString = ""; if ((Level == "") || (typeof(Level) == "undefined")) { Level = 0; } if (title.length > 0) { cHeader += title + cDeli; } cHeader += PropSet.GetType() + cDeli + PropSet.GetValue() + cDeli; aProps = new Array; propName = PropSet.GetFirstProperty(); while (propName != "") { aProps[nI] = propName; nI++; propName = PropSet.GetNextProperty(); } aProps.sort(); for (x = 0; x < aProps.length; x++) { propName = aProps[x]; propValue = PropSet.GetProperty(propName); cString = cHeader; cString += propName + cDeli + propValue + cDeli; //cString += "\n"; oApp.Trace(cString); // Clib.fputs(cString, file); } children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { this.SCM_TracePropSetFlat(PropSet.GetChild(x), title, (Level + 1)); } // Clib.fclose(file); } // end try catch(e) { // silence } finally { children = null; aProps = null; oApp = null; } }

Application Utilities Service SCM
SCM_WriteLog
function SCM_WriteLog (s) { //********************************************************************************** // // FUNCTIONALITY: // // Writes a Log-Entry // If global Trace Variable isTraceOn is true, then trace the message. // // PARAMS: // // Input: // // s String // [Bsp.: catch(e) { // TheApplication().SCM_WriteToLog( this.Name() + ".<Methname>() " // + e.name + "#" + e.toString() + "#" + e.errText) // } ] // // Output: // // nothing // // MODIFICATIONS: // // //********************************************************************************** var sTime; var sMessage; try { if ( fpCRMLog != null ) { Clib.strftime( sTime,"%d.%m.%y %X",Clib.localtime(Clib.time()) ); // 27.08.2008;tgdstre0;SR 3-163502911 //Clib.fprintf(fpCRMLog, "%s %s\n", sTime, s.toString() ); sMessage = sTime + " " + s.toString() + "\n"; Clib.fputs(sMessage, fpCRMLog); Clib.fflush(fpCRMLog); } if (isTraceON) TheApplication().Trace(s.toString()); } finally { } }

Application Utilities Service SCM
SCM_WriteLog
function SCM_WriteLog (s) { //********************************************************************************** // // FUNCTIONALITY: // // Writes a Log-Entry // If global Trace Variable isTraceOn is true, then trace the message. // // PARAMS: // // Input: // // s String // [Bsp.: catch(e) { // TheApplication().SCM_WriteToLog( this.Name() + ".<Methname>() " // + e.name + "#" + e.toString() + "#" + e.errText) // } ] // // Output: // // nothing // // MODIFICATIONS: // // //********************************************************************************** var sTime; var sMessage; try { if ( fpCRMLog != null ) { Clib.strftime( sTime,"%d.%m.%y %X",Clib.localtime(Clib.time()) ); // 27.08.2008;tgdstre0;SR 3-163502911 //Clib.fprintf(fpCRMLog, "%s %s\n", sTime, s.toString() ); sMessage = sTime + " " + s.toString() + "\n"; Clib.fputs(sMessage, fpCRMLog); Clib.fflush(fpCRMLog); } if (isTraceON) TheApplication().Trace(s.toString()); } finally { } }

Application Utilities Service SCM
SCM_checkEmployeeAndAccountType
function SCM_checkEmployeeAndAccountType(){ /********************************************************************************************************************************** ** Function: SCM_checkEmployeeAndAccountType ** Created: 17.02.2011 ** Created By: TGDSEAI1 ** Description: CR513 Check the Account segment when navigating to RTX+ view and rise an error if the Segment is CBU and the employee type is extern **********************************************************************************************************************************/ //Variable declarations var oApp:Application; var strMethodName; var boActive:BusObject; var bcActive:BusComp; var bcQuery:BusComp; var boEmployee:BusObject; var bcEmployee:BusComp; var strSegment; var strId; var strEmployeeType; var boName; try{ oApp = TheApplication(); strMethodName = this.Name() + ".SCM_checkEmployeeAndAccountType()"; strSegment = ""; strId = ""; strEmployeeType = ""; boName = ""; if (isTraceON) oApp.Trace(strMethodName + " Start: Check Employee Type and customer segment"); //Get active BO boActive = oApp.ActiveBusObject(); boName = boActive.Name(); //Get account Id depending on the context BO switch(boName) { case "Account": bcActive = boActive.GetBusComp("Account"); strId = bcActive.GetFieldValue("Id"); break; case "Service Request": bcActive = boActive.GetBusComp("Service Request"); strId = bcActive.GetFieldValue("Account Id"); break; case "Asset Management": bcActive = boActive.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); strId = bcActive.GetFieldValue("Service Account Id"); break; default: //Not any expected BO -> Rise an error oApp.RaiseError("UNEXPECTED_BO_ON_NAVIGATION"); break; } //If Account Id is set if( strId != "" && strId != null){ //Grobsegment is not force active bcQuery = oApp.GetBusObject("Account").GetBusComp("Account"); bcQuery.SetViewMode(AllView); //TGDSEAI1 27.04.2011 Defect 36115, check calculated fiedl as for SA Grobsegment is null //bcQuery.ActivateField("Grobsegment SCM"); bcQuery.ActivateField("Calculated Grobsegment SCM"); bcQuery.ClearToQuery(); bcQuery.SetSearchSpec("Id",strId); bcQuery.ExecuteQuery(ForwardOnly); if(bcQuery.FirstRecord()){ //Get Account Segment //TGDSEAI1 27.04.2011 Defect 36115, check calculated fiedl as for SA Grobsegment is null //strSegment = bcQuery.GetFieldValue("Grobsegment SCM"); strSegment = bcQuery.GetFieldValue("Calculated Grobsegment SCM"); //Check if customer segment is CBU if(strSegment == "CBU"){ if (isTraceON) oApp.Trace(strMethodName + " Account segment is CBU"); //Query for the employee type boEmployee = oApp.GetBusObject("Employee"); bcEmployee = boEmployee.GetBusComp("Employee"); bcEmployee.SetViewMode(AllView); bcEmployee.ActivateField("Employee Type Code"); bcEmployee.ClearToQuery(); bcEmployee.SetSearchSpec("Id",oApp.LoginId()); bcEmployee.ExecuteQuery(ForwardOnly); if(bcEmployee.FirstRecord()){ strEmployeeType = bcEmployee.GetFieldValue("Employee Type Code"); //Check if employee is extern if(strEmployeeType == "Extern"){ if (isTraceON) oApp.Trace(strMethodName + " Employee is extern rise an error"); //Navigation needs to be prevented Rise an error oApp.RaiseError("NO_ALLOWED_FOR_CBU_SCM"); }//End If extern }//End if employee }//End if CBU }//End Query }//End if strId }//End try catch(e){ if (isTraceON) oApp.Trace(strMethodName + " Error: " + e.toString()); throw(e); } finally { //Destroy variables bcActive = null; bcQuery = null; bcEmployee = null; boActive = null; boEmployee = null; strSegment = null; strId = null; strEmployeeType = null; boName = null; oApp = null; } }

Application Utilities Service SCM
SCM_checkEmployeeAndAccountType
function SCM_checkEmployeeAndAccountType(){ /********************************************************************************************************************************** ** Function: SCM_checkEmployeeAndAccountType ** Created: 17.02.2011 ** Created By: TGDSEAI1 ** Description: CR513 Check the Account segment when navigating to RTX+ view and rise an error if the Segment is CBU and the employee type is extern **********************************************************************************************************************************/ //Variable declarations var oApp:Application; var strMethodName; var boActive:BusObject; var bcActive:BusComp; var bcQuery:BusComp; var boEmployee:BusObject; var bcEmployee:BusComp; var strSegment; var strId; var strEmployeeType; var boName; try{ oApp = TheApplication(); strMethodName = this.Name() + ".SCM_checkEmployeeAndAccountType()"; strSegment = ""; strId = ""; strEmployeeType = ""; boName = ""; if (isTraceON) oApp.Trace(strMethodName + " Start: Check Employee Type and customer segment"); //Get active BO boActive = oApp.ActiveBusObject(); boName = boActive.Name(); //Get account Id depending on the context BO switch(boName) { case "Account": bcActive = boActive.GetBusComp("Account"); strId = bcActive.GetFieldValue("Id"); break; case "Service Request": bcActive = boActive.GetBusComp("Service Request"); strId = bcActive.GetFieldValue("Account Id"); break; case "Asset Management": bcActive = boActive.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); strId = bcActive.GetFieldValue("Service Account Id"); break; default: //Not any expected BO -> Rise an error oApp.RaiseError("UNEXPECTED_BO_ON_NAVIGATION"); break; } //If Account Id is set if( strId != "" && strId != null){ //Grobsegment is not force active bcQuery = oApp.GetBusObject("Account").GetBusComp("Account"); bcQuery.SetViewMode(AllView); //TGDSEAI1 27.04.2011 Defect 36115, check calculated fiedl as for SA Grobsegment is null //bcQuery.ActivateField("Grobsegment SCM"); bcQuery.ActivateField("Calculated Grobsegment SCM"); bcQuery.ClearToQuery(); bcQuery.SetSearchSpec("Id",strId); bcQuery.ExecuteQuery(ForwardOnly); if(bcQuery.FirstRecord()){ //Get Account Segment //TGDSEAI1 27.04.2011 Defect 36115, check calculated fiedl as for SA Grobsegment is null //strSegment = bcQuery.GetFieldValue("Grobsegment SCM"); strSegment = bcQuery.GetFieldValue("Calculated Grobsegment SCM"); //Check if customer segment is CBU if(strSegment == "CBU"){ if (isTraceON) oApp.Trace(strMethodName + " Account segment is CBU"); //Query for the employee type boEmployee = oApp.GetBusObject("Employee"); bcEmployee = boEmployee.GetBusComp("Employee"); bcEmployee.SetViewMode(AllView); bcEmployee.ActivateField("Employee Type Code"); bcEmployee.ClearToQuery(); bcEmployee.SetSearchSpec("Id",oApp.LoginId()); bcEmployee.ExecuteQuery(ForwardOnly); if(bcEmployee.FirstRecord()){ strEmployeeType = bcEmployee.GetFieldValue("Employee Type Code"); //Check if employee is extern if(strEmployeeType == "Extern"){ if (isTraceON) oApp.Trace(strMethodName + " Employee is extern rise an error"); //Navigation needs to be prevented Rise an error oApp.RaiseError("NO_ALLOWED_FOR_CBU_SCM"); }//End If extern }//End if employee }//End if CBU }//End Query }//End if strId }//End try catch(e){ if (isTraceON) oApp.Trace(strMethodName + " Error: " + e.toString()); throw(e); } finally { //Destroy variables bcActive = null; bcQuery = null; bcEmployee = null; boActive = null; boEmployee = null; strSegment = null; strId = null; strEmployeeType = null; boName = null; oApp = null; } }

Application Utilities Service SCM
SCM_setRTD_SiebeleMail_Enabled
function SCM_setRTD_SiebeleMail_Enabled() { var oApp; var strMethodName; var sRTDEnabledSCM; var sSiebeleMailEnabledSCM; var BOEmployee; var BCEmployee; var strLogin; var srtExpr; try{ oApp = TheApplication(); strMethodName = this.Name() + ".SCM_setRTD_SiebeleMail_Enabled()"; sRTDEnabledSCM=""; sSiebeleMailEnabledSCM=""; // RTD Part strLogin = TheApplication().GetProfileAttr("Login Name"); //Instance Employee BC BOEmployee = TheApplication().GetBusObject("Employee"); BCEmployee = BOEmployee.GetBusComp("Employee"); srtExpr = "EXISTS([Responsibility]='SCM RTD User') AND [Login Name] ='"+ strLogin +"'"; //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); if(BCEmployee.FirstRecord()) { sRTDEnabledSCM = "RTD"; if (isTraceON) TheApplication().Trace(strMethodName + " : RTD enabled due to SCM RTD Resp."); } TheApplication().SetProfileAttr("SCM_RTD_User", sRTDEnabledSCM); // Siebel eMail srtExpr = "EXISTS([Responsibility]='SCM Siebel Email Client') AND [Login Name] ='"+ strLogin +"'"; //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); if(BCEmployee.FirstRecord()) { sSiebeleMailEnabledSCM = "Y"; if (isTraceON) TheApplication().Trace(strMethodName + " : Siebel eMail enabled due to SCM Siebel Email Client Resp."); } TheApplication().SetProfileAttr("SCM_SiebeleMail", sSiebeleMailEnabledSCM); } catch(e){ if (isTraceON) TheApplication().Trace(strMethodName + ": Error " + e.toString()); } finally{ BCEmployee = null; BOEmployee = null; oApp = null; } }

Application Utilities Service SCM
SCM_setRTD_SiebeleMail_Enabled
function SCM_setRTD_SiebeleMail_Enabled() { var oApp; var strMethodName; var sRTDEnabledSCM; var sSiebeleMailEnabledSCM; var BOEmployee; var BCEmployee; var strLogin; var srtExpr; try{ oApp = TheApplication(); strMethodName = this.Name() + ".SCM_setRTD_SiebeleMail_Enabled()"; sRTDEnabledSCM=""; sSiebeleMailEnabledSCM=""; // RTD Part strLogin = TheApplication().GetProfileAttr("Login Name"); //Instance Employee BC BOEmployee = TheApplication().GetBusObject("Employee"); BCEmployee = BOEmployee.GetBusComp("Employee"); srtExpr = "EXISTS([Responsibility]='SCM RTD User') AND [Login Name] ='"+ strLogin +"'"; //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); if(BCEmployee.FirstRecord()) { sRTDEnabledSCM = "RTD"; if (isTraceON) TheApplication().Trace(strMethodName + " : RTD enabled due to SCM RTD Resp."); } TheApplication().SetProfileAttr("SCM_RTD_User", sRTDEnabledSCM); // Siebel eMail srtExpr = "EXISTS([Responsibility]='SCM Siebel Email Client') AND [Login Name] ='"+ strLogin +"'"; //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); if(BCEmployee.FirstRecord()) { sSiebeleMailEnabledSCM = "Y"; if (isTraceON) TheApplication().Trace(strMethodName + " : Siebel eMail enabled due to SCM Siebel Email Client Resp."); } TheApplication().SetProfileAttr("SCM_SiebeleMail", sSiebeleMailEnabledSCM); } catch(e){ if (isTraceON) TheApplication().Trace(strMethodName + ": Error " + e.toString()); } finally{ BCEmployee = null; BOEmployee = null; oApp = null; } }

Application Utilities Service SCM
SCM_setTeamboxId
function SCM_setTeamboxId(){ /***************************************************************** ** Function: SCM_setTeamboxId ** Created: 29.10.2009 ** Created By: TGDSEAI1 ** Description: call BS to Set Profile Attribute TeamboxId *****************************************************************/ var oApp; var strMethodName; var bsService:Service; var objInputs:PropertySet; var objOutputs:PropertySet; try { oApp = TheApplication(); strMethodName = this.Name() + ".SCM_setTeamboxId()"; objInputs = oApp.NewPropertySet(); objOutputs = oApp.NewPropertySet(); bsService = oApp.GetService("Set Teambox Id SCM"); bsService.InvokeMethod("SetTeamboxIdSCM",objInputs,objOutputs); } catch(e) { if (isTraceON) oApp.Trace(strMethodName + " Error: " + e.toString()); } finally { bsService = null; objInputs = null; objOutputs = null; oApp = null; } }

Application Utilities Service SCM
SCM_setTeamboxId
function SCM_setTeamboxId(){ /***************************************************************** ** Function: SCM_setTeamboxId ** Created: 22.12.2016 ** Created By: TAASAAI2 Move all logic to the same bs ** Description: BS to Set Profile Attribute TeamboxId *****************************************************************/ var oApp:Application; var boPosition:BusObject; var bcPosition:BusComp; var strPositionId:chars; var strTeamboxId:chars; var oBOEmp:BusObject; var oBCEmp:BusComp; try{ oApp = TheApplication(); boPosition = oApp.GetBusObject("Position"); bcPosition = boPosition.GetBusComp("Position"); //Retrieve the position Id strPositionId = oApp.PositionId(); if(isTraceON) oApp.Trace(this.Name() + ".SCM_setTeamboxId ActivePosition Id: " + strPositionId); with(bcPosition){ ClearToQuery(); ActivateField("Teambox Id SCM"); SetSearchSpec("Id",strPositionId); ExecuteQuery(ForwardOnly); if(FirstRecord()){ strTeamboxId = GetFieldValue("Teambox Id SCM"); oApp.SetProfileAttr("TeamboxIdSCM",strTeamboxId); if(isTraceON)oApp.Trace(this.Name() + ".SCM_setTeamboxId TeamboxId ProfAtt set: " + strTeamboxId); oBOEmp = oApp.GetBusObject("Employee"); oBCEmp = oBOEmp.GetBusComp("Employee"); oBCEmp.SetViewMode(AllView); oBCEmp.ClearToQuery(); oBCEmp.SetSearchExpr("[Login Name]='" + oApp.GetProfileAttr("Login Name" )+ "' AND [Primary Position Id]<>'" + strPositionId + "'"); oBCEmp.ExecuteQuery(ForwardOnly); if (oBCEmp.FirstRecord()){ oBCEmp.SetFieldValue("Primary Position Id", strPositionId); oBCEmp.WriteRecord(); if(isTraceON) oApp.Trace(this.Name() + ".SCM_setTeamboxId: changed Primary Position"); } } } } catch(e){ if(isTraceON)oApp.Trace(this.Name() + ".SCM_setTeamboxId: Error: " + e.message); throw(e); } finally{ oBCEmp = null; oBOEmp = null; bcPosition = null; boPosition = null; strPositionId = null; strTeamboxId = null; oApp = null; } }

Application Utilities Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn = CancelOperation; var sMsg; var sLog; switch (MethodName) { case "Init": this.Init(Inputs, Outputs); break; case "GetSiebelServerName": case "GetEnterpriseServerName": Outputs.SetProperty("Siebel Server Name", this.SCM_GetSiebelServerName()); Outputs.SetProperty("Enterprise Server Name", this.SCM_GetEnterpriseServerName()); break; case "Write2Log": sLog = Inputs.GetProperty("Log File"); sMsg = Inputs.GetProperty("Log Text"); this.Write2Log(sLog, sMsg); break; default: iReturn = ContinueOperation; } return (iReturn); }

Application Utilities Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ var iReturn = CancelOperation; var sMsg; var sLog; try{ switch (MethodName){ case "Init": this.Init(Inputs, Outputs); break; case "GetSiebelServerName": case "GetEnterpriseServerName": Outputs.SetProperty("Siebel Server Name", this.SCM_GetSiebelServerName()); Outputs.SetProperty("Enterprise Server Name", this.SCM_GetEnterpriseServerName()); break; case "Write2Log": sLog = Inputs.GetProperty("Log File"); sMsg = Inputs.GetProperty("Log Text"); this.Write2Log(sLog, sMsg); break; case "SetTeamboxId": SCM_setTeamboxId(); break; default: iReturn = ContinueOperation; } } catch(e){ throw(e); } finally{ sMsg = null; sLog = null; } return (iReturn); }

Application Utilities Service SCM
TraceAdvSCM
function TraceAdvSCM(strMessage) { var dtCurrent; var strCurrentDate; var strText; try { dtCurrent = new Date(); strCurrentDate = Clib.rsprintf("%04d-%02d-%02d %02d:%02d:%02d.%03d", dtCurrent.getFullYear(), dtCurrent.getMonth()+1, dtCurrent.getDate(), dtCurrent.getHours(), dtCurrent.getMinutes(), dtCurrent.getSeconds(), dtCurrent.getMilliseconds()); strText = strCurrentDate+"\t"+strMessage; TheApplication().Trace(strText); } finally { dtCurrent = null; strCurrentDate = null; } }

Application Utilities Service SCM
TraceAdvSCM
function TraceAdvSCM(strMessage) { var dtCurrent; var strCurrentDate; var strText; try { dtCurrent = new Date(); strCurrentDate = Clib.rsprintf("%04d-%02d-%02d %02d:%02d:%02d.%03d", dtCurrent.getFullYear(), dtCurrent.getMonth()+1, dtCurrent.getDate(), dtCurrent.getHours(), dtCurrent.getMinutes(), dtCurrent.getSeconds(), dtCurrent.getMilliseconds()); strText = strCurrentDate+"\t"+strMessage; TheApplication().Trace(strText); } finally { dtCurrent = null; strCurrentDate = null; } }

Application Utilities Service SCM
Write2Log
function Write2Log(strLogFile, strLogText) { // Write2Log is used by several Deployment Procedures var oApp; var bIsTraceOn; var strDateTime; var sMessage; var fLog; var iMaxRetries; var bContinue; var i; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; iMaxRetries = 20; i = 1; if (bIsTraceOn) oApp.Trace(strLogText); if (!this.strLoginName || this.strLoginName == "") this.strLoginName = oApp.LoginName().toUpperCase(); if (strLogFile != "") { strDateTime = ""; Clib.strftime(strDateTime, "%d.%m.%Y %H:%M:%S", Clib.localtime(Clib.time())); sMessage = strDateTime + " " + this.strLoginName + ": " + strLogText + "\r\n"; bContinue = true; while (bContinue && i<=iMaxRetries) { try { fLog = Clib.fopen(strLogFile,"a"); Clib.fputs(sMessage, fLog); Clib.fclose(fLog); bContinue = false; } catch (e) { this.sleep(1); } finally { i++; } } strDateTime = null; sMessage = null; fLog = null; } } finally { strDateTime = null; sMessage = null; fLog = null; oApp = null; } }

Application Utilities Service SCM
Write2Log
function Write2Log(strLogFile, strLogText) { // Write2Log is used by several Deployment Procedures var oApp; var bIsTraceOn; var strDateTime; var sMessage; var fLog; var iMaxRetries; var bContinue; var i; try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; iMaxRetries = 20; i = 1; if (bIsTraceOn) oApp.Trace(strLogText); if (!this.strLoginName || this.strLoginName == "") this.strLoginName = oApp.LoginName().toUpperCase(); if (strLogFile != "") { strDateTime = ""; Clib.strftime(strDateTime, "%d.%m.%Y %H:%M:%S", Clib.localtime(Clib.time())); sMessage = strDateTime + " " + this.strLoginName + ": " + strLogText + "\r\n"; bContinue = true; while (bContinue && i<=iMaxRetries) { try { fLog = Clib.fopen(strLogFile,"a"); Clib.fputs(sMessage, fLog); Clib.fclose(fLog); bContinue = false; } catch (e) { this.sleep(1); } finally { i++; } } strDateTime = null; sMessage = null; fLog = null; } } finally { strDateTime = null; sMessage = null; fLog = null; oApp = null; } }

Application Utilities Service SCM
allTrim
function allTrim(strStringToTrim) { var nLen; var strReturn; var i; var iStart; var iEnd; strReturn = strStringToTrim; if (strReturn && strReturn.length > 0) { nLen = strReturn.length; i=0; iStart = 0; while (i<nLen && (strReturn.charAt(i) == " " || strReturn.charAt(i) == "\n" || strReturn.charAt(i) == "\r" || strReturn.charAt(i) == "\r\n") ) { iStart = i+1; i++; } strReturn = strReturn.substring(iStart); iStart = 0; nLen = strReturn.length; i=nLen-1; iEnd=nLen; while (i>=0 && (strReturn.charAt(i) == " " || strReturn.charAt(i) == "\n" || strReturn.charAt(i) == "\r" || strReturn.charAt(i) == "\r\n") ) { iEnd=i; i--; } strReturn = strReturn.substring(iStart, iEnd); } return (strReturn); }

Application Utilities Service SCM
allTrim
function allTrim(strStringToTrim) { var nLen; var strReturn; var i; var iStart; var iEnd; strReturn = strStringToTrim; if (strReturn && strReturn.length > 0) { nLen = strReturn.length; i=0; iStart = 0; while (i<nLen && (strReturn.charAt(i) == " " || strReturn.charAt(i) == "\n" || strReturn.charAt(i) == "\r" || strReturn.charAt(i) == "\r\n") ) { iStart = i+1; i++; } strReturn = strReturn.substring(iStart); iStart = 0; nLen = strReturn.length; i=nLen-1; iEnd=nLen; while (i>=0 && (strReturn.charAt(i) == " " || strReturn.charAt(i) == "\n" || strReturn.charAt(i) == "\r" || strReturn.charAt(i) == "\r\n") ) { iEnd=i; i--; } strReturn = strReturn.substring(iStart, iEnd); } return (strReturn); }

Application Utilities Service SCM
fCancelDialogScriptRunning
function fCancelDialogScriptRunning(strActiveViewName, DestViewName) { /************************************************************************************************************** ** BS: Application Utilities Service SCM ** Function: fCancelDialogScriptRunning ** Created: 06.11.2013 TGDSEAI1 NESA ** Description: Call the cancel script in case a running script exists **************************************************************************************************************/ var objBOActive:BusObject; var objBCScriptPlayer:BusComp; var strDialogId; if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning START->" + strActiveViewName +" ->" + DestViewName); try { strDialogId = TheApplication().GetProfileAttr("ScriptStartedDialogIdSCM"); if(strDialogId != ""){ if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Script Started"); TheApplication().SetProfileAttr("ScriptStartedDialogIdSCM",""); objBOActive = TheApplication().ActiveBusObject(); if(objBOActive!= null){ objBCScriptPlayer = objBOActive.GetBusComp("Smart Script Player"); if(objBCScriptPlayer != null){ objBCScriptPlayer.InvokeMethod("CancelScript"); if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Cancel Script called"); } } } if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning END"); } catch(e){ if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Error: " + e.message); throw(e); } finally{ objBCScriptPlayer = null; objBOActive = null; } }

Application Utilities Service SCM
fCancelDialogScriptRunning
function fCancelDialogScriptRunning(strActiveViewName, DestViewName) { /************************************************************************************************************** ** BS: Application Utilities Service SCM ** Function: fCancelDialogScriptRunning ** Created: 06.11.2013 TGDSEAI1 NESA ** Description: Call the cancel script in case a running script exists **************************************************************************************************************/ var objBOActive:BusObject; var objBCScriptPlayer:BusComp; var strDialogId; if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning START->" + strActiveViewName +" ->" + DestViewName); try { strDialogId = TheApplication().GetProfileAttr("ScriptStartedDialogIdSCM"); if(strDialogId != ""){ if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Script Started"); TheApplication().SetProfileAttr("ScriptStartedDialogIdSCM",""); objBOActive = TheApplication().ActiveBusObject(); if(objBOActive!= null){ objBCScriptPlayer = objBOActive.GetBusComp("Smart Script Player"); if(objBCScriptPlayer != null){ objBCScriptPlayer.InvokeMethod("CancelScript"); if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Cancel Script called"); } } } if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning END"); } catch(e){ if(isTraceON)TheApplication().Trace(this.Name() + ".fCancelDialogScriptRunning Error: " + e.message); throw(e); } finally{ objBCScriptPlayer = null; objBOActive = null; } }

Application Utilities Service SCM
fLoadUIAppletModesConfig
function fLoadUIAppletModesConfig(){ /******************************************************* ** Name: fLoadUIAppletModesConfig ** Created: 13.12.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: SO-3488 Call WF to load applet ui ******************************************************/ var psInputs:PropertySet; var psOutputs:PropertySet; var bsWF:Service; var oApp:Application; try{ oApp =TheApplication(); if(isTraceON) TheApplication().Trace(this.Name() + ".fLoadUIAppletModesConfig START"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); bsWF = oApp.GetService("Workflow Process Manager"); psInputs.SetProperty("ProcessName", "FE Load UI Applet Config SCM"); try{ bsWF.InvokeMethod("RunProcess", psInputs, psOutputs); if(isTraceON) oApp.Trace(this.Name() + ".fLoadUIAppletModesConfig END"); } catch(e){ if(isTraceON) oApp.Trace(this.Name() + ".fLoadUIAppletModesConfig CRASHED!" + e.message); } } catch(e){ if(isTraceON) oApp.Trace(this.Name() + ".fLoadUIAppletModesConfig ERROR: " + e.message); } finally{ psInputs = null; psOutputs = null; bsWF = null; oApp = null; } }

Application Utilities Service SCM
fSaveDialogScriptRunning
function fSaveDialogScriptRunning() { /************************************************************************************************************** ** BS: Application Utilities Service SCM ** Function: fSaveDialogScriptRunning ** Created: 03.07.2013 TGDSEAI1 NESA ** Description: Call the save script in case a running script exists **************************************************************************************************************/ var objBOActive:BusObject; var objBCScriptPlayer:BusComp; var strDialogId; if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning START"); try { strDialogId = TheApplication().GetProfileAttr("ScriptStartedDialogIdSCM"); if(strDialogId != ""){ TheApplication().SetProfileAttr("ScriptStartedDialogIdSCM",""); objBOActive = TheApplication().ActiveBusObject(); if(objBOActive!= null){ objBCScriptPlayer = objBOActive.GetBusComp("Smart Script Player"); if(objBCScriptPlayer != null){ objBCScriptPlayer.InvokeMethod("SaveScript"); if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning Save Script called"); } } } } catch(e){ if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning Error: " + e.message); throw(e); } finally{ objBCScriptPlayer = null; objBOActive = null; } }

Application Utilities Service SCM
fSaveDialogScriptRunning
function fSaveDialogScriptRunning() { /************************************************************************************************************** ** BS: Application Utilities Service SCM ** Function: fSaveDialogScriptRunning ** Created: 03.07.2013 TGDSEAI1 NESA ** Description: Call the save script in case a running script exists **************************************************************************************************************/ var objBOActive:BusObject; var objBCScriptPlayer:BusComp; var strDialogId; if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning START"); try { strDialogId = TheApplication().GetProfileAttr("ScriptStartedDialogIdSCM"); if(strDialogId != ""){ TheApplication().SetProfileAttr("ScriptStartedDialogIdSCM",""); objBOActive = TheApplication().ActiveBusObject(); if(objBOActive!= null){ objBCScriptPlayer = objBOActive.GetBusComp("Smart Script Player"); if(objBCScriptPlayer != null){ objBCScriptPlayer.InvokeMethod("SaveScript"); if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning Save Script called"); } } } } catch(e){ if(isTraceON)TheApplication().Trace(this.Name() + ".fSaveDialogScriptRunning Error: " + e.message); throw(e); } finally{ objBCScriptPlayer = null; objBOActive = null; } }

Application Utilities Service SCM
getUseCaseList
function getUseCaseList() { /************************************************************************************* ** Name: getUseCaseList ** Created: 15.12.2015 ** Created By: TAAPENE1 ** Description: Return global variable psUseCase value - use case list **************************************************************************************/ return psUseCase; }

Application Utilities Service SCM
getUseCaseList
function getUseCaseList() { /************************************************************************************* ** Name: getUseCaseList ** Created: 15.12.2015 ** Created By: TAAPENE1 ** Description: Return global variable psUseCase value - use case list **************************************************************************************/ return psUseCase; }

Application Utilities Service SCM
getValidChar
function getValidChar(sChar) { //==================================================================================================== // Copyright: eC4u Expert Consulting AG // Project: Siebel Competence Center // Authors: Rouven Degen // Purpose: Helper Funktion für GetValidFileName Funktion // Überprüft, ob das übergebene Zeichen sChar // für einen Dateinamen valide ist, oder nicht. // Falls valide, wird sChar wieder zurückgegeben, // falls nicht, wird ein Substitut zurückgegeben. // Substitute: // - Umlaute werden ersetzt, z.B. ä durch ae, Ä durch Ae // - ß durch ss // - sonstige invalide Zeichen durch _ // // Revision Date Who Ver Comments // ------------- --- --- -------- // 25.09.2007 DEGEN 1 created // //==================================================================================================== // Reihe valider Zeichen initialisieren; Zeichen die hier nicht // angereiht sind, werden durch _ ersetzt. var sValidChars; var nValCharLen; var lFound; var goFlag; var sTempChar; var i; var sReturn; try { sValidChars = " &._-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; nValCharLen = sValidChars.length; lFound = false; goFlag = true; sTempChar = ""; i = nValCharLen; sReturn = ""; while (goFlag) { sTempChar = sValidChars.substring(i-1, i); if (sChar == sTempChar) { lFound = true; goFlag = false; } else { lFound = false; if (i > 0) { i = i - 1; } else { goFlag = false; } } } if (lFound) { sReturn = sChar; } else { switch (sChar) { case "ä": sReturn = "ae"; break; case "Ä": sReturn = "Ae"; break; case "ö": sReturn = "oe"; break; case "Ö": sReturn = "Oe"; break; case "ü": sReturn = "ue"; break; case "Ü": sReturn = "Ue"; break; case "ß": sReturn = "ss"; break; default: sReturn = "_"; break; } } } finally { } return (sReturn); }

Application Utilities Service SCM
getValidChar
function getValidChar(sChar) { //==================================================================================================== // Copyright: eC4u Expert Consulting AG // Project: Siebel Competence Center // Authors: Rouven Degen // Purpose: Helper Funktion für GetValidFileName Funktion // Überprüft, ob das übergebene Zeichen sChar // für einen Dateinamen valide ist, oder nicht. // Falls valide, wird sChar wieder zurückgegeben, // falls nicht, wird ein Substitut zurückgegeben. // Substitute: // - Umlaute werden ersetzt, z.B. ä durch ae, Ä durch Ae // - ß durch ss // - sonstige invalide Zeichen durch _ // // Revision Date Who Ver Comments // ------------- --- --- -------- // 25.09.2007 DEGEN 1 created // //==================================================================================================== // Reihe valider Zeichen initialisieren; Zeichen die hier nicht // angereiht sind, werden durch _ ersetzt. var sValidChars; var nValCharLen; var lFound; var goFlag; var sTempChar; var i; var sReturn; try { sValidChars = " &._-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; nValCharLen = sValidChars.length; lFound = false; goFlag = true; sTempChar = ""; i = nValCharLen; sReturn = ""; while (goFlag) { sTempChar = sValidChars.substring(i-1, i); if (sChar == sTempChar) { lFound = true; goFlag = false; } else { lFound = false; if (i > 0) { i = i - 1; } else { goFlag = false; } } } if (lFound) { sReturn = sChar; } else { switch (sChar) { case "ä": sReturn = "ae"; break; case "Ä": sReturn = "Ae"; break; case "ö": sReturn = "oe"; break; case "Ö": sReturn = "Oe"; break; case "ü": sReturn = "ue"; break; case "Ü": sReturn = "Ue"; break; case "ß": sReturn = "ss"; break; default: sReturn = "_"; break; } } } finally { } return (sReturn); }

Application Utilities Service SCM
getValidFileName
function getValidFileName(sName, sExt) { //==================================================================================================== // Copyright: eC4u Expert Consulting AG // Project: Siebel Competence Center // Authors: Rouven Degen // Purpose: Gibt einen validen Dateinamen zurück, der keine // Leer- oder Sonderzeichen und keine Umlaute enthält. // Erlaubte Zeichen sind in GetValidChar aneinander gereiht. // // Revision Date Who Ver Comments // ------------- --- --- -------- // 25.09.2007 DEGEN 1 created // //==================================================================================================== var sReturn; var nLen; var i; var sChar; var goFlag; var sValidChar; try { if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName()"); sReturn = ""; nLen = 0; i = sName.length; sChar = ""; goFlag = true; sValidChar = ""; while (goFlag) { if (i > 0) { sChar = sName.substring(i - 1, i); sValidChar = this.getValidChar(sChar); sReturn = sValidChar + sReturn; // Write2Log("sReturn (temp) = '" + sReturn + "';"); i = i - 1; } else { goFlag = false; } } sReturn = sReturn + sExt; if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName -> " + sReturn); } catch (e) { var strError = e.toString(); if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName -> Error: " + strError); TheApplication().RaiseErrorText(e.toString()); } finally { } return (sReturn); }

Application Utilities Service SCM
getValidFileName
function getValidFileName(sName, sExt) { //==================================================================================================== // Copyright: eC4u Expert Consulting AG // Project: Siebel Competence Center // Authors: Rouven Degen // Purpose: Gibt einen validen Dateinamen zurück, der keine // Leer- oder Sonderzeichen und keine Umlaute enthält. // Erlaubte Zeichen sind in GetValidChar aneinander gereiht. // // Revision Date Who Ver Comments // ------------- --- --- -------- // 25.09.2007 DEGEN 1 created // //==================================================================================================== var sReturn; var nLen; var i; var sChar; var goFlag; var sValidChar; try { if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName()"); sReturn = ""; nLen = 0; i = sName.length; sChar = ""; goFlag = true; sValidChar = ""; while (goFlag) { if (i > 0) { sChar = sName.substring(i - 1, i); sValidChar = this.getValidChar(sChar); sReturn = sValidChar + sReturn; // Write2Log("sReturn (temp) = '" + sReturn + "';"); i = i - 1; } else { goFlag = false; } } sReturn = sReturn + sExt; if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName -> " + sReturn); } catch (e) { var strError = e.toString(); if (this.isTraceON) TheApplication().Trace(this.Name() + ".getValidFileName -> Error: " + strError); TheApplication().RaiseErrorText(e.toString()); } finally { } return (sReturn); }

Application Utilities Service SCM
isPOSEMUser
function isPOSEMUser(){ }

Application Utilities Service SCM
isPOSEMUser
function isPOSEMUser(){ }

Application Utilities Service SCM
sleep
function sleep(nSecs) { var nMillis = 0; try { SElib.dynamicLink("libc.so", "sleep", nSecs); } catch(e) { nMillis = nSecs * 1000; SElib.dynamicLink("kernel32.dll", "Sleep", STDCALL, nSecs * nMillis); } }

Application Utilities Service SCM
sleep
function sleep(nSecs) { var nMillis = 0; try { SElib.dynamicLink("libc.so", "sleep", nSecs); } catch(e) { nMillis = nSecs * 1000; SElib.dynamicLink("kernel32.dll", "Sleep", STDCALL, nSecs * nMillis); } }

Application Utilities Service SCM
timestamp
function timestamp() { /*************************************************** CR 181: Creates a date in format dd/mm/yyyy hh:mm:ss ****************************************************/ var oDate; var sTimestamp =""; var dateCalc var monthCalc; var hoursCalc; var minutesCalc; var secondsCalc; try{ oDate = new Date; dateCalc = oDate.getDate(); dateCalc = dateCalc < 10 ? "0"+dateCalc : dateCalc; monthCalc = oDate.getMonth(); monthCalc= monthCalc < 9 ? "0"+(monthCalc+1) : (monthCalc+1); hoursCalc =oDate.getHours(); hoursCalc = hoursCalc < 10 ? "0"+hoursCalc : hoursCalc; minutesCalc = oDate.getMinutes(); minutesCalc = minutesCalc < 10 ? "0"+minutesCalc : minutesCalc; secondsCalc = oDate.getSeconds(); secondsCalc = secondsCalc < 10 ? "0"+secondsCalc : secondsCalc; sTimestamp =""+dateCalc+"/"+monthCalc+"/"+oDate.getFullYear()+" "+hoursCalc+":"+minutesCalc+":"+secondsCalc; return sTimestamp; }finally{ oDate = null; } }

Application Utilities Service SCM
timestamp
function timestamp() { /*************************************************** CR 181: Creates a date in format dd/mm/yyyy hh:mm:ss ****************************************************/ var oDate; var sTimestamp =""; var dateCalc var monthCalc; var hoursCalc; var minutesCalc; var secondsCalc; try{ oDate = new Date; dateCalc = oDate.getDate(); dateCalc = dateCalc < 10 ? "0"+dateCalc : dateCalc; monthCalc = oDate.getMonth(); monthCalc= monthCalc < 9 ? "0"+(monthCalc+1) : (monthCalc+1); hoursCalc =oDate.getHours(); hoursCalc = hoursCalc < 10 ? "0"+hoursCalc : hoursCalc; minutesCalc = oDate.getMinutes(); minutesCalc = minutesCalc < 10 ? "0"+minutesCalc : minutesCalc; secondsCalc = oDate.getSeconds(); secondsCalc = secondsCalc < 10 ? "0"+secondsCalc : secondsCalc; sTimestamp =""+dateCalc+"/"+monthCalc+"/"+oDate.getFullYear()+" "+hoursCalc+":"+minutesCalc+":"+secondsCalc; return sTimestamp; }finally{ oDate = null; } }

Appointment Slots VBC SCM
(declarations)
//Variable Declarations var bIsTraceOn:bool = TheApplication().isTraceON; var STARS:String = "****"; var STARS_DT:String ="**/**/**/ **:**:**"; //ERROR String var ERROR_VBC:String = "Error in VBC"; //Field names in VBC var ACT_ID_VBC:String = "Activity Id SCM"; var START_DT_VBC:String = "Start Date Time SCM"; var END_DT_VBC:String = "End Date Time SCM"; var DUR_SEC_VBC:String = "Duration Seconds SCM"; var DUR_GUI_VBC:String = "Duration GUI SCM"; var TAR_TM_VBC:String = "Target Restore Time SCM"; var SLA_FLAG_VBC:String = "Out of SLA Flag SCM"; var SLOTID_VBC:String = "Slot Id SCM"; var RANK_VBC:String = "Slot Rank SCM"; //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors var COMMENT_VBC:String = "Comment SCM"; //Field names in IO returned by EAI var START_DT_IO:String = "StartDateTime"; var END_DT_IO:String = "EndDateTime"; var TAR_TM_IO:String = "TargetRestoreTime"; var SLOTID_IO:String = "SlotId"; var RANK_IO:String = "Rank"; //TGDGPAANC 21.11.2013 SLA SME - OutOfSLA flag in IO var OUT_OF_SLA_IO:String = "OutOfSLAFlag"; //Comparation types for the compareFieldsFunction var DATE_TYPE:String = "Date"; var NUMBER_TYPE:String = "Number"; var SORT_ASC:String = "Ascending"; var SORT_DESC:String = "Descending";

Appointment Slots VBC SCM
(declarations)
//Variable Declarations var bIsTraceOn:bool = TheApplication().isTraceON; var STARS:String = "****"; var STARS_DT:String ="**/**/**/ **:**:**"; //ERROR String var ERROR_VBC:String = "Error in VBC"; //Field names in VBC var ACT_ID_VBC:String = "Activity Id SCM"; var START_DT_VBC:String = "Start Date Time SCM"; var END_DT_VBC:String = "End Date Time SCM"; var DUR_SEC_VBC:String = "Duration Seconds SCM"; var DUR_GUI_VBC:String = "Duration GUI SCM"; var TAR_TM_VBC:String = "Target Restore Time SCM"; var SLA_FLAG_VBC:String = "Out of SLA Flag SCM"; var SLOTID_VBC:String = "Slot Id SCM"; var RANK_VBC:String = "Slot Rank SCM"; //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors var COMMENT_VBC:String = "Comment SCM"; //Field names in IO returned by EAI var START_DT_IO:String = "StartDateTime"; var END_DT_IO:String = "EndDateTime"; var TAR_TM_IO:String = "TargetRestoreTime"; var SLOTID_IO:String = "SlotId"; var RANK_IO:String = "Rank"; //TGDGPAANC 21.11.2013 SLA SME - OutOfSLA flag in IO var OUT_OF_SLA_IO:String = "OutOfSLAFlag"; //Comparation types for the compareFieldsFunction var DATE_TYPE:String = "Date"; var NUMBER_TYPE:String = "Number"; var SORT_ASC:String = "Ascending"; var SORT_DESC:String = "Descending";

Appointment Slots VBC SCM
CalculateDuration
function CalculateDuration (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function CalculateDuration ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Calculates the duration based on star and end date and returns as an HH:MM format *****************************************************************/ //Variable declaration var StartDateTime = Inputs.GetProperty("StartDateTime"); var EndDateTime = Inputs.GetProperty("EndDateTime"); var dStartDate; var dEndDate; var diffMiliSecond; var diffSeconds; var diffMinutes; var diffHour; try{ //GetInput Parameters SCM StartDateTime = Inputs.GetProperty("StartDateTime"); EndDateTime = Inputs.GetProperty("EndDateTime"); //Calculate duration set as difference between start and end time in milisecodns dStartDate = Date.parse(StartDateTime); dEndDate = Date.parse(EndDateTime); diffMiliSecond = dEndDate - dStartDate; //Obtain total seconds diffSeconds = Math.round(diffMiliSecond/1000); //Format as hour + minutes diffHour = ToInteger(diffSeconds/3600); diffMinutes = ToInteger((diffSeconds-diffHour*3600)/60); //The display needs to be like 01:00 so evaluation of the length is necessary if(diffHour.toString().length == 1) { diffHour = "0" + diffHour.toString(); } if(diffMinutes.toString().length ==1) { diffMinutes = "0" + diffMinutes.toString(); } Outputs.SetProperty("Duration GUI", diffHour + ":" +diffMinutes); Outputs.SetProperty("DuractionSec", diffSeconds); } catch(e){ if(bIsTraceOn) TheApplication().Trace("Appointment Slots VBC SCM CalculateDuration method. Error: " + e.message); throw(e); } finally{ //Variable destruction StartDateTime = null; EndDateTime = null; dStartDate = null; dEndDate = null; diffMiliSecond = null; diffSeconds = null; diffMinutes = null; diffHour = null; } }

Appointment Slots VBC SCM
CalculateDuration
function CalculateDuration (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function CalculateDuration ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Calculates the duration based on star and end date and returns as an HH:MM format *****************************************************************/ //Variable declaration var StartDateTime = Inputs.GetProperty("StartDateTime"); var EndDateTime = Inputs.GetProperty("EndDateTime"); var dStartDate; var dEndDate; var diffMiliSecond; var diffSeconds; var diffMinutes; var diffHour; try{ //GetInput Parameters SCM StartDateTime = Inputs.GetProperty("StartDateTime"); EndDateTime = Inputs.GetProperty("EndDateTime"); //Calculate duration set as difference between start and end time in milisecodns dStartDate = Date.parse(StartDateTime); dEndDate = Date.parse(EndDateTime); diffMiliSecond = dEndDate - dStartDate; //Obtain total seconds diffSeconds = Math.round(diffMiliSecond/1000); //Format as hour + minutes diffHour = ToInteger(diffSeconds/3600); diffMinutes = ToInteger((diffSeconds-diffHour*3600)/60); //The display needs to be like 01:00 so evaluation of the length is necessary if(diffHour.toString().length == 1) { diffHour = "0" + diffHour.toString(); } if(diffMinutes.toString().length ==1) { diffMinutes = "0" + diffMinutes.toString(); } Outputs.SetProperty("Duration GUI", diffHour + ":" +diffMinutes); Outputs.SetProperty("DuractionSec", diffSeconds); } catch(e){ if(bIsTraceOn) TheApplication().Trace("Appointment Slots VBC SCM CalculateDuration method. Error: " + e.message); throw(e); } finally{ //Variable destruction StartDateTime = null; EndDateTime = null; dStartDate = null; dEndDate = null; diffMiliSecond = null; diffSeconds = null; diffMinutes = null; diffHour = null; } }

Appointment Slots VBC SCM
Init
function Init (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty(ACT_ID_VBC, ""); Outputs.SetProperty(START_DT_VBC, ""); Outputs.SetProperty(END_DT_VBC, ""); Outputs.SetProperty(DUR_SEC_VBC, ""); Outputs.SetProperty(DUR_GUI_VBC,""); Outputs.SetProperty(TAR_TM_VBC,""); Outputs.SetProperty(SLA_FLAG_VBC, ""); Outputs.SetProperty(SLOTID_VBC, ""); Outputs.SetProperty(RANK_VBC, ""); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors Outputs.SetProperty(COMMENT_VBC, ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } finally{ //Do nothing } }

Appointment Slots VBC SCM
Init
function Init (Inputs, Outputs){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty(ACT_ID_VBC, ""); Outputs.SetProperty(START_DT_VBC, ""); Outputs.SetProperty(END_DT_VBC, ""); Outputs.SetProperty(DUR_SEC_VBC, ""); Outputs.SetProperty(DUR_GUI_VBC,""); Outputs.SetProperty(TAR_TM_VBC,""); Outputs.SetProperty(SLA_FLAG_VBC, ""); Outputs.SetProperty(SLOTID_VBC, ""); Outputs.SetProperty(RANK_VBC, ""); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors Outputs.SetProperty(COMMENT_VBC, ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } finally{ //Do nothing } }

Appointment Slots VBC SCM
Query
function Query(Inputs, Outputs){ /************************************************************************************************** * Function: Query in BusService "Appointments Slots VBC SCM" * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking Call the EAI WS and process the response to display in VBC * Date : 03.08.2010 **************************************************************************************************/ //Declare variables var wsInputs:PropertySet; var wsOutputs:PropertySet; var bsCallWFGetSlots:Service; var strSearchString; var strActivityId; var TargetRestoreTime; if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query function"); try{ //Activity Id retrieved from the Inputs (field predefaulted) strActivityId = Inputs.GetChild(0).GetProperty("Activity Id SCM"); if(validateCall(strActivityId)) { //SCM 14.02.2012 TGDSEAI1: CR675 Set the lock attributte to empty TheApplication().SetProfileAttr("GetSlotExplicitInvocation",""); // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); strSearchString = Inputs.GetProperty("search-string"); //Call EAI Service to getSlots bsCallWFGetSlots = TheApplication().GetService("EAI Appointment Booking SCM"); wsInputs.SetProperty("Activity Id",strActivityId); bsCallWFGetSlots.InvokeMethod("Get Assurance Appointment Slots", wsInputs,wsOutputs); // TGDPAANC 17.12.2013 If WS call errored with time out - proper message needs to be displayed if (wsOutputs.GetProperty("HasTimeout Flag") == "Y") { Outputs.AddChild(createErrorRecord(getErrorMessage("RESERVE_APPT_EXCEPTION", TheApplication().InvokeMethod("LANGUAGE")))); return(Outputs); } //Go trough records returned by the EAI BS and process them one by one returnTransformedSlots(wsOutputs, Outputs, strActivityId); } return(Outputs); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty Outputs.Reset(); //Return a record with the error to display in the GUI Outputs.AddChild(createErrorRecord(e.message)); return(Outputs); } finally{ //Variable destruction wsInputs = null; wsOutputs = null; bsCallWFGetSlots = null; strSearchString = null; strActivityId = null; TargetRestoreTime = null; } }

Appointment Slots VBC SCM
Query
function Query(Inputs, Outputs){ /************************************************************************************************** * Function: Query in BusService "Appointments Slots VBC SCM" * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking Call the EAI WS and process the response to display in VBC * Date : 03.08.2010 **************************************************************************************************/ //Declare variables var wsInputs:PropertySet; var wsOutputs:PropertySet; var bsCallWFGetSlots:Service; var strSearchString; var strActivityId; var TargetRestoreTime; if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query function"); try{ //Activity Id retrieved from the Inputs (field predefaulted) strActivityId = Inputs.GetChild(0).GetProperty("Activity Id SCM"); if(validateCall(strActivityId)) { //SCM 14.02.2012 TGDSEAI1: CR675 Set the lock attributte to empty TheApplication().SetProfileAttr("GetSlotExplicitInvocation",""); // Initialize variables wsInputs = TheApplication().NewPropertySet(); wsOutputs = TheApplication().NewPropertySet(); strSearchString = Inputs.GetProperty("search-string"); //Call EAI Service to getSlots bsCallWFGetSlots = TheApplication().GetService("EAI Appointment Booking SCM"); wsInputs.SetProperty("Activity Id",strActivityId); bsCallWFGetSlots.InvokeMethod("Get Assurance Appointment Slots", wsInputs,wsOutputs); // TGDPAANC 17.12.2013 If WS call errored with time out - proper message needs to be displayed if (wsOutputs.GetProperty("HasTimeout Flag") == "Y") { Outputs.AddChild(createErrorRecord(getErrorMessage("RESERVE_APPT_EXCEPTION", TheApplication().InvokeMethod("LANGUAGE")))); return(Outputs); } //Go trough records returned by the EAI BS and process them one by one returnTransformedSlots(wsOutputs, Outputs, strActivityId); } return(Outputs); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty Outputs.Reset(); //Return a record with the error to display in the GUI Outputs.AddChild(createErrorRecord(e.message)); return(Outputs); } finally{ //Variable destruction wsInputs = null; wsOutputs = null; bsCallWFGetSlots = null; strSearchString = null; strActivityId = null; TargetRestoreTime = null; } }

Appointment Slots VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking: BS for the VBC , Appointment Slots VBC SCM to initialize and fill the BC with data from ** the external WS call *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; case "CalculateDuration": CalculateDuration (Inputs, Outputs); break; default: break; } return (CancelOperation); }

Appointment Slots VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking: BS for the VBC , Appointment Slots VBC SCM to initialize and fill the BC with data from ** the external WS call *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; case "CalculateDuration": CalculateDuration (Inputs, Outputs); break; default: break; } return (CancelOperation); }

Appointment Slots VBC SCM
compareDate
function compareDate(a, b) { /*************************************************************************************************** ** Created: 16.08.2010 ** Created By: Jan Hengst ** Description: Compares Date a with Date b and returns comparison result as number. ** Arguments: a - date as parseable string (see Date constructor) ** b - date as parseable string (see Date constructor) ** Returns: 0 if a = b ** 1 if a > b ** -1 if a < b **************************************************************************************************/ var d1:Date; var d2:Date; try { d1 = new Date(a); d2 = new Date(b); if(d1.getTime() > d2.getTime()) return 1; if(d1.getTime() < d2.getTime()) return -1; return 0; } finally { d1 = null; d2 = null; } }

Appointment Slots VBC SCM
compareDate
function compareDate(a, b) { /*************************************************************************************************** ** Created: 16.08.2010 ** Created By: Jan Hengst ** Description: Compares Date a with Date b and returns comparison result as number. ** Arguments: a - date as parseable string (see Date constructor) ** b - date as parseable string (see Date constructor) ** Returns: 0 if a = b ** 1 if a > b ** -1 if a < b **************************************************************************************************/ var d1:Date; var d2:Date; try { d1 = new Date(a); d2 = new Date(b); if(d1.getTime() > d2.getTime()) return 1; if(d1.getTime() < d2.getTime()) return -1; return 0; } finally { d1 = null; d2 = null; } }

Appointment Slots VBC SCM
compareFields
function compareFields(aField, bField, strFieldType){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : compareFields * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will compare two field of different types dates number * Date : 10.08.2010 * Input : aField: First field to compare * : bField: Second field to be compare * : strFieldType: This field will indicate the type of comparation that needs to be done * Output : 0 if a = b ** positive value if a > b ** negative value if a < b **************************************************************************************************/ try{ switch(strFieldType) { case DATE_TYPE: return(compareDate(aField, bField)); break; case NUMBER_TYPE: return(compareNum(aField, bField)); break; default: //No defined type return an error: TheApplication().RaiseErrorText(this.Name() + " compareField Function not defined type: " + strFieldType); break; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + "compareFields Error:" + e.message); throw(e); } finally{ } }

Appointment Slots VBC SCM
compareFields
function compareFields(aField, bField, strFieldType){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : compareFields * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will compare two field of different types dates number * Date : 10.08.2010 * Input : aField: First field to compare * : bField: Second field to be compare * : strFieldType: This field will indicate the type of comparation that needs to be done * Output : 0 if a = b ** positive value if a > b ** negative value if a < b **************************************************************************************************/ try{ switch(strFieldType) { case DATE_TYPE: return(compareDate(aField, bField)); break; case NUMBER_TYPE: return(compareNum(aField, bField)); break; default: //No defined type return an error: TheApplication().RaiseErrorText(this.Name() + " compareField Function not defined type: " + strFieldType); break; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + "compareFields Error:" + e.message); throw(e); } finally{ } }

Appointment Slots VBC SCM
compareNum
function compareNum(a, b) { /*************************************************************************************************** ** Created: 16.08.2010 ** Created By: Jan Hengst ** Description: Compares number a with number b and returns comparison result as number. ** Arguments: a - number ** b - number ** Returns: 0 if a = b ** positive value if a > b ** negative value if a < b **************************************************************************************************/ return a - b; }

Appointment Slots VBC SCM
compareNum
function compareNum(a, b) { /*************************************************************************************************** ** Created: 16.08.2010 ** Created By: Jan Hengst ** Description: Compares number a with number b and returns comparison result as number. ** Arguments: a - number ** b - number ** Returns: 0 if a = b ** positive value if a > b ** negative value if a < b **************************************************************************************************/ return a - b; }

Appointment Slots VBC SCM
createDummyRecord
function createDummyRecord(){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment booking record *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set all the record with stars //pOutputRecord.SetProperty(START_DT_VBC, STARS); pOutputRecord.SetProperty(START_DT_VBC, STARS_DT); //pOutputRecord.SetProperty(END_DT_VBC, STARS); pOutputRecord.SetProperty(END_DT_VBC, STARS_DT); pOutputRecord.SetProperty(RANK_VBC, STARS); pOutputRecord.SetProperty(SLOTID_VBC, STARS); pOutputRecord.SetProperty(TAR_TM_VBC, STARS); pOutputRecord.SetProperty(DUR_SEC_VBC, STARS); pOutputRecord.SetProperty(DUR_GUI_VBC, STARS); pOutputRecord.SetProperty(SLA_FLAG_VBC,STARS); // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ // Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Appointment Slots VBC SCM
createDummyRecord
function createDummyRecord(){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment booking record *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set all the record with stars //pOutputRecord.SetProperty(START_DT_VBC, STARS); pOutputRecord.SetProperty(START_DT_VBC, STARS_DT); //pOutputRecord.SetProperty(END_DT_VBC, STARS); pOutputRecord.SetProperty(END_DT_VBC, STARS_DT); pOutputRecord.SetProperty(RANK_VBC, STARS); pOutputRecord.SetProperty(SLOTID_VBC, STARS); pOutputRecord.SetProperty(TAR_TM_VBC, STARS); pOutputRecord.SetProperty(DUR_SEC_VBC, STARS); pOutputRecord.SetProperty(DUR_GUI_VBC, STARS); pOutputRecord.SetProperty(SLA_FLAG_VBC,STARS); // TGDDERO7, 31.05.2011, move line behind finally statement // return (pOutputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ // Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Appointment Slots VBC SCM
createErrorRecord
function createErrorRecord(strError){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment to display error ** Update: 14.02.2012 CR675 Added change due to new error handling, error in comment fields *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set slot id with stars -> disable the button on the Applet pOutputRecord.SetProperty(SLOTID_VBC, STARS); //Set Rank field with the error message pOutputRecord.SetProperty(RANK_VBC, ""); //Set rest of the fields with the ERROR string pOutputRecord.SetProperty(START_DT_VBC, "") pOutputRecord.SetProperty(END_DT_VBC, ""); pOutputRecord.SetProperty(TAR_TM_VBC, ""); pOutputRecord.SetProperty(DUR_SEC_VBC, ""); pOutputRecord.SetProperty(DUR_GUI_VBC, ""); pOutputRecord.SetProperty(SLA_FLAG_VBC,""); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors pOutputRecord.SetProperty(COMMENT_VBC, strError); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Appointment Slots VBC SCM
createErrorRecord
function createErrorRecord(strError){ /***************************************************************** ** Bussiness Service: Appointment Slots VBC SCM ** Function createDummyRecord ** Created: 03.08.2010 ** Created By: TGDSEAI1 ** Description: CTM: Appointment Booking creates a dummy appointment to display error ** Update: 14.02.2012 CR675 Added change due to new error handling, error in comment fields *****************************************************************/ //Variable declarations var pOutputRecord:PropertySet; try{ //Initialize pOutputRecord = TheApplication().NewPropertySet(); //Set slot id with stars -> disable the button on the Applet pOutputRecord.SetProperty(SLOTID_VBC, STARS); //Set Rank field with the error message pOutputRecord.SetProperty(RANK_VBC, ""); //Set rest of the fields with the ERROR string pOutputRecord.SetProperty(START_DT_VBC, "") pOutputRecord.SetProperty(END_DT_VBC, ""); pOutputRecord.SetProperty(TAR_TM_VBC, ""); pOutputRecord.SetProperty(DUR_SEC_VBC, ""); pOutputRecord.SetProperty(DUR_GUI_VBC, ""); pOutputRecord.SetProperty(SLA_FLAG_VBC,""); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors pOutputRecord.SetProperty(COMMENT_VBC, strError); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " CreateDummyRecord. Error: " + e.message); throw(e); } finally{ //Variable destruction // TGDDERO7, 31.05.2011, do not destroy // pOutputRecord = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return (pOutputRecord); }

Appointment Slots VBC SCM
getErrorMessage
function getErrorMessage(sMessageCode, sLanguage) { /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: getErrorMessage * Author : TGDPAANC * Purpose : Returns language specific DVM Message identified by Message Code * Date : 17.12.2013 **************************************************************************************************/ var bsAux:Service; var psIn:PropertySet; var psOut:PropertySet; try { bsAux = TheApplication().GetService("Generic Retention SCM"); psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); psIn.SetProperty("Code", sMessageCode); psIn.SetProperty("LanguageCode", sLanguage); bsAux.InvokeMethod("Get Error Message", psIn, psOut); return(psOut.GetProperty("Result")); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " getErrorMessage. Error: " + e.message); throw(e); } finally { bsAux = null; psIn = null; psOut = null; } }

Appointment Slots VBC SCM
getErrorMessage
function getErrorMessage(sMessageCode, sLanguage) { /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: getErrorMessage * Author : TGDPAANC * Purpose : Returns language specific DVM Message identified by Message Code * Date : 17.12.2013 **************************************************************************************************/ var bsAux:Service; var psIn:PropertySet; var psOut:PropertySet; try { bsAux = TheApplication().GetService("Generic Retention SCM"); psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); psIn.SetProperty("Code", sMessageCode); psIn.SetProperty("LanguageCode", sLanguage); bsAux.InvokeMethod("Get Error Message", psIn, psOut); return(psOut.GetProperty("Result")); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " getErrorMessage. Error: " + e.message); throw(e); } finally { bsAux = null; psIn = null; psOut = null; } }

Appointment Slots VBC SCM
processRecord
function processRecord(wsRecord, TargetRestoreTime, strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: processRecord * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will receive a record as returned by EAI Service and return a record * valit to assign it to the VBC * Date : 03.08.2010 **************************************************************************************************/ //Variable Declarations var outputRecord:PropertySet; var pInputs:PropertySet; var pOutputs:PropertySet; var StartDateTime; var EndDateTime; try{ //Initialize variables pOutputs = TheApplication().NewPropertySet(); pInputs = TheApplication().NewPropertySet(); outputRecord = TheApplication().NewPropertySet(); //Fields mapped directly from EAI return outputRecord.SetProperty(ACT_ID_VBC, strActivityId); outputRecord.SetProperty(START_DT_VBC, wsRecord.GetProperty(START_DT_IO)) outputRecord.SetProperty(END_DT_VBC, wsRecord.GetProperty(END_DT_IO)); outputRecord.SetProperty(RANK_VBC, wsRecord.GetProperty(RANK_IO)); outputRecord.SetProperty(SLOTID_VBC, wsRecord.GetProperty(SLOTID_IO)); outputRecord.SetProperty(TAR_TM_VBC, TargetRestoreTime); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors outputRecord.SetProperty(COMMENT_VBC,""); //TGDPAANC 21.11.2013 SLA SME - OutOfSLA flag mapped from WS response if (wsRecord.GetProperty(OUT_OF_SLA_IO) == null || wsRecord.GetProperty(OUT_OF_SLA_IO) == "") { outputRecord.SetProperty(SLA_FLAG_VBC, "N"); } else { outputRecord.SetProperty(SLA_FLAG_VBC, wsRecord.GetProperty(OUT_OF_SLA_IO)); } //Calculate duration based on StartAndEndTime pInputs.SetProperty("StartDateTime", wsRecord.GetProperty(START_DT_IO)); pInputs.SetProperty("EndDateTime", wsRecord.GetProperty(END_DT_IO)); CalculateDuration (pInputs,pOutputs); outputRecord.SetProperty(DUR_SEC_VBC, pOutputs.GetProperty("DuractionSec")); outputRecord.SetProperty(DUR_GUI_VBC, pOutputs.GetProperty("Duration GUI")); // TGDDERO7, 31.05.2011, move line behind finally statement // return(outputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " ProcessRecord function. Error: " + e.message); throw(e); } finally{ //Variable Destruction // TGDDERO7, 31.05.2011, do not destroy // outputRecord = null; StartDateTime = null; EndDateTime = null; pInputs = null; pOutputs = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return(outputRecord); }

Appointment Slots VBC SCM
processRecord
function processRecord(wsRecord, TargetRestoreTime, strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function: processRecord * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will receive a record as returned by EAI Service and return a record * valit to assign it to the VBC * Date : 03.08.2010 **************************************************************************************************/ //Variable Declarations var outputRecord:PropertySet; var pInputs:PropertySet; var pOutputs:PropertySet; var StartDateTime; var EndDateTime; try{ //Initialize variables pOutputs = TheApplication().NewPropertySet(); pInputs = TheApplication().NewPropertySet(); outputRecord = TheApplication().NewPropertySet(); //Fields mapped directly from EAI return outputRecord.SetProperty(ACT_ID_VBC, strActivityId); outputRecord.SetProperty(START_DT_VBC, wsRecord.GetProperty(START_DT_IO)) outputRecord.SetProperty(END_DT_VBC, wsRecord.GetProperty(END_DT_IO)); outputRecord.SetProperty(RANK_VBC, wsRecord.GetProperty(RANK_IO)); outputRecord.SetProperty(SLOTID_VBC, wsRecord.GetProperty(SLOTID_IO)); outputRecord.SetProperty(TAR_TM_VBC, TargetRestoreTime); //SCM 14.02.2012 TGDSEAI1: CR675 Added new comment field for errors outputRecord.SetProperty(COMMENT_VBC,""); //TGDPAANC 21.11.2013 SLA SME - OutOfSLA flag mapped from WS response if (wsRecord.GetProperty(OUT_OF_SLA_IO) == null || wsRecord.GetProperty(OUT_OF_SLA_IO) == "") { outputRecord.SetProperty(SLA_FLAG_VBC, "N"); } else { outputRecord.SetProperty(SLA_FLAG_VBC, wsRecord.GetProperty(OUT_OF_SLA_IO)); } //Calculate duration based on StartAndEndTime pInputs.SetProperty("StartDateTime", wsRecord.GetProperty(START_DT_IO)); pInputs.SetProperty("EndDateTime", wsRecord.GetProperty(END_DT_IO)); CalculateDuration (pInputs,pOutputs); outputRecord.SetProperty(DUR_SEC_VBC, pOutputs.GetProperty("DuractionSec")); outputRecord.SetProperty(DUR_GUI_VBC, pOutputs.GetProperty("Duration GUI")); // TGDDERO7, 31.05.2011, move line behind finally statement // return(outputRecord); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " ProcessRecord function. Error: " + e.message); throw(e); } finally{ //Variable Destruction // TGDDERO7, 31.05.2011, do not destroy // outputRecord = null; StartDateTime = null; EndDateTime = null; pInputs = null; pOutputs = null; } // TGDDERO7, 31.05.2011, move line behind finally statement return(outputRecord); }

Appointment Slots VBC SCM
returnTransformedSlots
function returnTransformedSlots(wsOutput, Outputs, strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : getTargetRestoreTime * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will return a property set with the structure in the VBC * Date : 10.08.2010 * Input : wsOutput: Property set with the EAI Output ****************psReturnOutput**********************************************************************************/ //Variable declarations var psInputs:PropertySet; var psOutputs:PropertySet; var psAux:PropertySet; var psReturnRecord:PropertySet; var strPreviousDay; var dDateAux; var strCurrentDate; var intPreviousDay; var strTargetRestoreTime; var intRecords; var intIndex; try{ // variable initialization psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); psAux = TheApplication().NewPropertySet(); psReturnRecord = TheApplication().NewPropertySet(); //Get Target restore time from header strTargetRestoreTime = wsOutput.GetChild(0).GetChild(0).GetChild(0).GetProperty(TAR_TM_IO); //Get Appointmen Slots psAux = wsOutput.GetChild(0).GetChild(0).GetChild(0).GetChild(0).Copy(); //sort psAux based on start date sortPsOnFieldName(psAux, START_DT_IO, DATE_TYPE); //Initialize previous day dDateAux = new Date(psAux.GetChild(0).GetProperty(START_DT_IO)); strPreviousDay = dDateAux.getDate(); intPreviousDay = 0; //Process each appointment slot one by one callin function processRecord intRecords = psAux.GetChildCount(); for(intIndex = 0; intIndex<intRecords;intIndex++) { psReturnRecord = processRecord(psAux.GetChild(intIndex), strTargetRestoreTime, strActivityId); //Get current record date dDateAux = new Date(psAux.GetChild(intIndex).GetProperty(START_DT_IO)); strCurrentDate = dDateAux.getDate(); //If date has changed and it is not the last record if(strPreviousDay != strCurrentDate && intIndex != intRecords -1) { //Sort all the record in the same day based on the duration sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); //Add dummy record Outputs.AddChild(createDummyRecord()); //Set Previous date fields strPreviousDay = strCurrentDate; intPreviousDay = intIndex +1; } //If Not the last record, add it if(intIndex != intRecords - 1){ Outputs.AddChild(psReturnRecord);//Add the current record } else //Last record { //If it is the last record with different date -> sort previous day records, add dummy and then add last record if(strPreviousDay != strCurrentDate) { //Sort all the record in the same day based on the duration sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); Outputs.AddChild(createDummyRecord());//Add dummy Outputs.AddChild(psReturnRecord); //Add last } else {//If it is the last record with same day, add the last record and sort Outputs.AddChild(psReturnRecord); sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); } } }//End for }//End try catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " returnTransformedSlots Error:" + e.message); throw(e); } finally{ //variable destruction psInputs = null; psOutputs = null; psAux = null; psReturnRecord = null; dDateAux = null; strTargetRestoreTime = null; strPreviousDay =null; strCurrentDate = null; intRecords = null; intIndex = null; intPreviousDay = null; } }

Appointment Slots VBC SCM
returnTransformedSlots
function returnTransformedSlots(wsOutput, Outputs, strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : getTargetRestoreTime * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will return a property set with the structure in the VBC * Date : 10.08.2010 * Input : wsOutput: Property set with the EAI Output ****************psReturnOutput**********************************************************************************/ //Variable declarations var psInputs:PropertySet; var psOutputs:PropertySet; var psAux:PropertySet; var psReturnRecord:PropertySet; var strPreviousDay; var dDateAux; var strCurrentDate; var intPreviousDay; var strTargetRestoreTime; var intRecords; var intIndex; try{ // variable initialization psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); psAux = TheApplication().NewPropertySet(); psReturnRecord = TheApplication().NewPropertySet(); //Get Target restore time from header strTargetRestoreTime = wsOutput.GetChild(0).GetChild(0).GetChild(0).GetProperty(TAR_TM_IO); //Get Appointmen Slots psAux = wsOutput.GetChild(0).GetChild(0).GetChild(0).GetChild(0).Copy(); //sort psAux based on start date sortPsOnFieldName(psAux, START_DT_IO, DATE_TYPE); //Initialize previous day dDateAux = new Date(psAux.GetChild(0).GetProperty(START_DT_IO)); strPreviousDay = dDateAux.getDate(); intPreviousDay = 0; //Process each appointment slot one by one callin function processRecord intRecords = psAux.GetChildCount(); for(intIndex = 0; intIndex<intRecords;intIndex++) { psReturnRecord = processRecord(psAux.GetChild(intIndex), strTargetRestoreTime, strActivityId); //Get current record date dDateAux = new Date(psAux.GetChild(intIndex).GetProperty(START_DT_IO)); strCurrentDate = dDateAux.getDate(); //If date has changed and it is not the last record if(strPreviousDay != strCurrentDate && intIndex != intRecords -1) { //Sort all the record in the same day based on the duration sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); //Add dummy record Outputs.AddChild(createDummyRecord()); //Set Previous date fields strPreviousDay = strCurrentDate; intPreviousDay = intIndex +1; } //If Not the last record, add it if(intIndex != intRecords - 1){ Outputs.AddChild(psReturnRecord);//Add the current record } else //Last record { //If it is the last record with different date -> sort previous day records, add dummy and then add last record if(strPreviousDay != strCurrentDate) { //Sort all the record in the same day based on the duration sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); Outputs.AddChild(createDummyRecord());//Add dummy Outputs.AddChild(psReturnRecord); //Add last } else {//If it is the last record with same day, add the last record and sort Outputs.AddChild(psReturnRecord); sortPsOnFieldName(Outputs, DUR_SEC_VBC, NUMBER_TYPE, intPreviousDay, Outputs.GetChildCount(), SORT_DESC); } } }//End for }//End try catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " returnTransformedSlots Error:" + e.message); throw(e); } finally{ //variable destruction psInputs = null; psOutputs = null; psAux = null; psReturnRecord = null; dDateAux = null; strTargetRestoreTime = null; strPreviousDay =null; strCurrentDate = null; intRecords = null; intIndex = null; intPreviousDay = null; } }

Appointment Slots VBC SCM
sortPsOnFieldName
function sortPsOnFieldName(&psInput, strPName, strFieldType, intStart, intEnd, strSortOrder) { /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : sortPsOnFieldName * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will sort the property set returned by EAI based on a Date field * Date : 10.08.2010 * Input : psInput: Not Ordered property set returned by EAI * : strPName: Name of the property set that is required to be sorted * : strFieldType: Type of the fields that needs to be used in the sorting * : intStart: Optional, Record number in the property set where the sorting must start if not in the call ->0 * : intEnd: Optional, Record number in the property set where the sorting must end if not in the call -> End of the psInput * : strSortOrder: Optional, ascending or descending order by default the order will be ascending * Output : psInput: Property set ordered by strPName **************************************************************************************************/ //Variable declarations var psTemp:PropertySet; var j; var intCompareSorting; try { //Check input parameter field type if(strFieldType == "" || strFieldType == null){ TheApplication().RaiseErrorText(this.Name() + " sortPsOnFieldName Function not type in call: " + strFieldType); } //Check optional input parameters if(intStart == "" || intStart == null){ //Set to 0 by default intStart = 0; } if(intEnd == "" || intEnd == null){ //Get number of records by default intEnd = psInput.GetChildCount(); } if(strSortOrder == "" || strSortOrder ==null){ strSortOrder = SORT_ASC; } //Implementation of the Insertion sorting algorithm for(var i = intStart + 1; i < intEnd; i++) { psTemp = psInput.GetChild(i); j = i -1; //initialize second index //compare the fields intCompareSorting = compareFields(psInput.GetChild(j).GetProperty(strPName), psTemp.GetProperty(strPName), strFieldType); if (strSortOrder == SORT_DESC) intCompareSorting = 0 - intCompareSorting; //Invert the result is the order is descending while(j>=intStart && (intCompareSorting > 0)) { psInput.RemoveChild(j+1); psInput.InsertChildAt(psInput.GetChild(j), j+1); j--; //Compare the fields if(j>=intStart){ intCompareSorting = compareFields(psInput.GetChild(j).GetProperty(strPName), psTemp.GetProperty(strPName), strFieldType); if (strSortOrder == SORT_DESC) intCompareSorting = 0 - intCompareSorting;//Invert the result is the order is descending } } psInput.RemoveChild(j+1); psInput.InsertChildAt(psTemp, j+1); }//End for //End of sorting } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + "sortPsOnFieldName Error:" + e.message); throw(e); } finally { //Variable destruction psTemp = null; j = null; intCompareSorting = null; } }

Appointment Slots VBC SCM
sortPsOnFieldName
function sortPsOnFieldName(&psInput, strPName, strFieldType, intStart, intEnd, strSortOrder) { /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : sortPsOnFieldName * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will sort the property set returned by EAI based on a Date field * Date : 10.08.2010 * Input : psInput: Not Ordered property set returned by EAI * : strPName: Name of the property set that is required to be sorted * : strFieldType: Type of the fields that needs to be used in the sorting * : intStart: Optional, Record number in the property set where the sorting must start if not in the call ->0 * : intEnd: Optional, Record number in the property set where the sorting must end if not in the call -> End of the psInput * : strSortOrder: Optional, ascending or descending order by default the order will be ascending * Output : psInput: Property set ordered by strPName **************************************************************************************************/ //Variable declarations var psTemp:PropertySet; var j; var intCompareSorting; try { //Check input parameter field type if(strFieldType == "" || strFieldType == null){ TheApplication().RaiseErrorText(this.Name() + " sortPsOnFieldName Function not type in call: " + strFieldType); } //Check optional input parameters if(intStart == "" || intStart == null){ //Set to 0 by default intStart = 0; } if(intEnd == "" || intEnd == null){ //Get number of records by default intEnd = psInput.GetChildCount(); } if(strSortOrder == "" || strSortOrder ==null){ strSortOrder = SORT_ASC; } //Implementation of the Insertion sorting algorithm for(var i = intStart + 1; i < intEnd; i++) { psTemp = psInput.GetChild(i); j = i -1; //initialize second index //compare the fields intCompareSorting = compareFields(psInput.GetChild(j).GetProperty(strPName), psTemp.GetProperty(strPName), strFieldType); if (strSortOrder == SORT_DESC) intCompareSorting = 0 - intCompareSorting; //Invert the result is the order is descending while(j>=intStart && (intCompareSorting > 0)) { psInput.RemoveChild(j+1); psInput.InsertChildAt(psInput.GetChild(j), j+1); j--; //Compare the fields if(j>=intStart){ intCompareSorting = compareFields(psInput.GetChild(j).GetProperty(strPName), psTemp.GetProperty(strPName), strFieldType); if (strSortOrder == SORT_DESC) intCompareSorting = 0 - intCompareSorting;//Invert the result is the order is descending } } psInput.RemoveChild(j+1); psInput.InsertChildAt(psTemp, j+1); }//End for //End of sorting } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + "sortPsOnFieldName Error:" + e.message); throw(e); } finally { //Variable destruction psTemp = null; j = null; intCompareSorting = null; } }

Appointment Slots VBC SCM
validateCall
function validateCall(strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : validateCall * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will check if for the selected activity the call to the * external system is necessary. * Date : 03.08.2010 * Input : strActivityId: Activity Id of the selected record * Update : 14.02.2012 TGDSEAI CR675 Change the conditions on the script, if the DVM returns error, means that the activity * matches the conditions to enable the call **************************************************************************************************/ var psIn:PropertySet; var psOut:PropertySet; var bsDataVal:Service; try{ psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); bsDataVal = TheApplication().GetService("Workflow Process Manager"); //Call a DVM to check if the call is necessary psIn.SetProperty("ProcessName", "FE Data Validation Manager Action SCM"); psIn.SetProperty("Object Id", strActivityId); psIn.SetProperty("DVM Rule", "Appointment GetSlot PreValidation SCM"); psIn.SetProperty("Enable Log", "N"); bsDataVal.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetProperty("DVM Code")!=""&&psOut.GetProperty("DVM Code")!=null) { //DVM end with error activity matches some of the condition to call the rule if(bIsTraceOn) TheApplication().Trace(this.Name() + " validateCall function, DVM return code: " + psOut.GetProperty("DVM Code")); return(true); } else{ if(bIsTraceOn) TheApplication().Trace(this.Name() + " validateCall function, DVM returned empty code "); return(false); } } catch (e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error:" + e.message); throw(e); } finally{ bsDataVal = null; psIn = null; psOut = null; } }

Appointment Slots VBC SCM
validateCall
function validateCall(strActivityId){ /************************************************************************************************** * Service : Appointments Slots VBC SCM * Function : validateCall * Author : TGDSEAI1 * Purpose : CTM: Appointment Booking this method will check if for the selected activity the call to the * external system is necessary. * Date : 03.08.2010 * Input : strActivityId: Activity Id of the selected record * Update : 14.02.2012 TGDSEAI CR675 Change the conditions on the script, if the DVM returns error, means that the activity * matches the conditions to enable the call **************************************************************************************************/ var psIn:PropertySet; var psOut:PropertySet; var bsDataVal:Service; try{ psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); bsDataVal = TheApplication().GetService("Workflow Process Manager"); //Call a DVM to check if the call is necessary psIn.SetProperty("ProcessName", "FE Data Validation Manager Action SCM"); psIn.SetProperty("Object Id", strActivityId); psIn.SetProperty("DVM Rule", "Appointment GetSlot PreValidation SCM"); psIn.SetProperty("Enable Log", "N"); bsDataVal.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetProperty("DVM Code")!=""&&psOut.GetProperty("DVM Code")!=null) { //DVM end with error activity matches some of the condition to call the rule if(bIsTraceOn) TheApplication().Trace(this.Name() + " validateCall function, DVM return code: " + psOut.GetProperty("DVM Code")); return(true); } else{ if(bIsTraceOn) TheApplication().Trace(this.Name() + " validateCall function, DVM returned empty code "); return(false); } } catch (e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error:" + e.message); throw(e); } finally{ bsDataVal = null; psIn = null; psOut = null; } }

Archive Closed Activities SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON;

Archive Closed Activities SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON;

Archive Closed Activities SCM
ArchiveActivities
function ArchiveActivities() { /******************************************************* ** Name: ArchiveActivities ** Created: 15.01.2009 ** Created By: Alberto López Arellano ** Modified: 04.01.2011 ** Modified By: Emmanuel Marxer ** Change: to avoid long running query the script is modifying the activity user by user ******************************************************/ var boEmp:BusObject; var bcEmp:BusComp; var objNow:Date; //Default values to ACV placeholders var intNumberDay = 5; var intDayInactiveUser = 200; var archLogin = "APP_SR_ARCHIVE"; var sSearchEmp = ""; var strNewOwnerId = ""; var strOldOwnerId = ""; var isEmp; // Migration Logging var strLogEventDescText = ""; var iCount = 0; var strParentLogId = ""; var strActSearchSpec = ""; var iOwnerCount = 0; try{ //Initialize login message objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; // Create Log strParentLogId = fLogInit("ARCHIVE_ACTIVITIES", "Siebel Workflow", "Archive Closed/Cancelled Activities"); // Create Start Log Event if(strParentLogId != "" && strParentLogId != null){ fLogEvent(strParentLogId, "Start", strLogEventDescText); } //Get ACV Values intNumberDay = ToInteger(TheApplication().utils.SCM_RetrieveACV("SCMNumberDaysBefChangeOwnerAct")); archLogin = TheApplication().utils.SCM_RetrieveACV("ArchiveActivitiesUser"); intDayInactiveUser = ToInteger(TheApplication().utils.SCM_RetrieveACV("SCMNumberDaysInactiveUser")); //Log initial values if(strParentLogId != "" && strParentLogId != null){ fLogEvent(strParentLogId, "Init", "Retrieve ACV SCMNumberDaysBefChangeOwnerAct: " + intNumberDay); fLogEvent(strParentLogId, "Init", "Retrieve ACV strLogEventDescText: " + archLogin); fLogEvent(strParentLogId, "Init", "Retrieve ACV SCMNumberDaysInactiveUser" + intDayInactiveUser); } //Get new owner id strNewOwnerId = fGetArchiveOwnerId(archLogin); if(strNewOwnerId != "" && strNewOwnerId != null){ boEmp = TheApplication().GetBusObject("Employee"); bcEmp = boEmp.GetBusComp("Employee"); //Query employee by employee logged in the last sSearchEmp = "([Last Logged In] > Today () - " + intDayInactiveUser + " OR [Employee Type Code]= 'Teambox' OR [Employee Type Code]= 'Sales Teambox') and [First Name] <> 'archive' and [Login Name] <> 'APP_SSCP' and [Login Name] <> 'APP_SR_ARCHIVE'"; bcEmp.SetViewMode(AllView); bcEmp.ClearToQuery(); bcEmp.SetSearchExpr(sSearchEmp); bcEmp.ExecuteQuery(ForwardOnly); isEmp = bcEmp.FirstRecord(); while (isEmp && iCount < 200001) { strOldOwnerId = bcEmp.GetFieldValue("Id"); strActSearchSpec = "[Updated] < Today () - " + intNumberDay + " AND ([Status] = 'Closed' OR [Status] = 'Cancelled') AND [Owned By ID SCM] = '" + strOldOwnerId + "' AND [Activity SR Id] IS NOT NULL"; iOwnerCount = fUpdateActivity(strActSearchSpec, strNewOwnerId, iCount); iCount = iCount + iOwnerCount; if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId,"Query", "Search Spec: " + strActSearchSpec); fLogEvent(strParentLogId,"Update", "Activities Updated for owner " + strOldOwnerId+ ": " + iOwnerCount); } isEmp = bcEmp.NextRecord(); } }//End strNewOwnerId else { if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId, "Error", "User " + archLogin + " does not exist"); } } strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)"; if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId,"TOTAL", "TOTAL Number of Actitivies updated: " + iCount); fLogEvent(strParentLogId,"Stop", strLogEventDescText); } } catch (e) { if(strParentLogId != null && strParentLogId != ""){ fLogEvent(strParentLogId,"ERROR", e.message); } throw (e); } finally{ //Destroy va

Archive Closed Activities SCM
ArchiveActivities
function ArchiveActivities() { /******************************************************* ** Name: ArchiveActivities ** Created: 15.01.2009 ** Created By: Alberto López Arellano ** Modified: 04.01.2011 ** Modified By: Emmanuel Marxer ** Change: to avoid long running query the script is modifying the activity user by user ******************************************************/ var boEmp:BusObject; var bcEmp:BusComp; var objNow:Date; //Default values to ACV placeholders var intNumberDay = 5; var intDayInactiveUser = 200; var archLogin = "APP_SR_ARCHIVE"; var sSearchEmp = ""; var strNewOwnerId = ""; var strOldOwnerId = ""; var isEmp; // Migration Logging var strLogEventDescText = ""; var iCount = 0; var strParentLogId = ""; var strActSearchSpec = ""; var iOwnerCount = 0; try{ //Initialize login message objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; // Create Log strParentLogId = fLogInit("ARCHIVE_ACTIVITIES", "Siebel Workflow", "Archive Closed/Cancelled Activities"); // Create Start Log Event if(strParentLogId != "" && strParentLogId != null){ fLogEvent(strParentLogId, "Start", strLogEventDescText); } //Get ACV Values intNumberDay = ToInteger(TheApplication().utils.SCM_RetrieveACV("SCMNumberDaysBefChangeOwnerAct")); archLogin = TheApplication().utils.SCM_RetrieveACV("ArchiveActivitiesUser"); intDayInactiveUser = ToInteger(TheApplication().utils.SCM_RetrieveACV("SCMNumberDaysInactiveUser")); //Log initial values if(strParentLogId != "" && strParentLogId != null){ fLogEvent(strParentLogId, "Init", "Retrieve ACV SCMNumberDaysBefChangeOwnerAct: " + intNumberDay); fLogEvent(strParentLogId, "Init", "Retrieve ACV strLogEventDescText: " + archLogin); fLogEvent(strParentLogId, "Init", "Retrieve ACV SCMNumberDaysInactiveUser" + intDayInactiveUser); } //Get new owner id strNewOwnerId = fGetArchiveOwnerId(archLogin); if(strNewOwnerId != "" && strNewOwnerId != null){ boEmp = TheApplication().GetBusObject("Employee"); bcEmp = boEmp.GetBusComp("Employee"); //Query employee by employee logged in the last sSearchEmp = "([Last Logged In] > Today () - " + intDayInactiveUser + " OR [Employee Type Code]= 'Teambox' OR [Employee Type Code]= 'Sales Teambox') and [First Name] <> 'archive' and [Login Name] <> 'APP_SSCP' and [Login Name] <> 'APP_SR_ARCHIVE'"; bcEmp.SetViewMode(AllView); bcEmp.ClearToQuery(); bcEmp.SetSearchExpr(sSearchEmp); bcEmp.ExecuteQuery(ForwardOnly); isEmp = bcEmp.FirstRecord(); while (isEmp && iCount < 200001) { strOldOwnerId = bcEmp.GetFieldValue("Id"); strActSearchSpec = "[Updated] < Today () - " + intNumberDay + " AND ([Status] = 'Closed' OR [Status] = 'Cancelled') AND [Owned By ID SCM] = '" + strOldOwnerId + "' AND [Activity SR Id] IS NOT NULL"; iOwnerCount = fUpdateActivity(strActSearchSpec, strNewOwnerId, iCount); iCount = iCount + iOwnerCount; if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId,"Query", "Search Spec: " + strActSearchSpec); fLogEvent(strParentLogId,"Update", "Activities Updated for owner " + strOldOwnerId+ ": " + iOwnerCount); } isEmp = bcEmp.NextRecord(); } }//End strNewOwnerId else { if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId, "Error", "User " + archLogin + " does not exist"); } } strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)"; if(strParentLogId != "" && strParentLogId != null) { fLogEvent(strParentLogId,"TOTAL", "TOTAL Number of Actitivies updated: " + iCount); fLogEvent(strParentLogId,"Stop", strLogEventDescText); } } catch (e) { if(strParentLogId != null && strParentLogId != ""){ fLogEvent(strParentLogId,"ERROR", e.message); } throw (e); } finally{ //Destroy va

Archive Closed Activities SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var intRetVal = ContinueOperation; switch (MethodName) { case "ArchiveActivities": CanInvoke="TRUE"; intRetVal = CancelOperation; break; default: intRetVal = ContinueOperation; } return(intRetVal); }

Archive Closed Activities SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var intRetVal = ContinueOperation; switch (MethodName) { case "ArchiveActivities": CanInvoke="TRUE"; intRetVal = CancelOperation; break; default: intRetVal = ContinueOperation; } return(intRetVal); }

Archive Closed Activities SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName) { var intRetVal = CancelOperation; try { switch (MethodName) { case "ArchiveActivities": ArchiveActivities(); break; default: intRetVal = ContinueOperation; break; } } catch ( e ) { throw (e); } return(intRetVal); }

Archive Closed Activities SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName) { var intRetVal = CancelOperation; try { switch (MethodName) { case "ArchiveActivities": ArchiveActivities(); break; default: intRetVal = ContinueOperation; break; } } catch ( e ) { throw (e); } return(intRetVal); }

Archive Closed Activities SCM
fGetArchiveOwnerId
function fGetArchiveOwnerId(archLogin) { /************************************************************************************************************** ** Name: fGetArchiveOwnerId ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Updates activity owners and returns the number of updated records ** Inputs: intNumberDay, Consider the last update of the activity ** strOldOwnerId, current owner of the activity ** strNewOwnerId, new owner to be set ** iCount, current counter, to be incremented and returned *************************************************************************************************************/ //Variable declarations var boEmp:BusObject; var bcEmp:BusComp; var strNewOwnerId = ""; try{ boEmp = TheApplication().GetBusObject("Employee"); bcEmp = boEmp.GetBusComp("Employee"); bcEmp.SetViewMode(AllView); bcEmp.ClearToQuery(); bcEmp.SetSearchExpr("[Login Name] = '"+archLogin+"'"); bcEmp.ExecuteQuery(ForwardOnly); if(bcEmp.FirstRecord()) { strNewOwnerId = bcEmp.GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fGetArchiveOwnerId ERROR: " + e.message); throw(e); } finally{ bcEmp = null; boEmp = null; } return(strNewOwnerId); }

Archive Closed Activities SCM
fGetArchiveOwnerId
function fGetArchiveOwnerId(archLogin) { /************************************************************************************************************** ** Name: fGetArchiveOwnerId ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Updates activity owners and returns the number of updated records ** Inputs: intNumberDay, Consider the last update of the activity ** strOldOwnerId, current owner of the activity ** strNewOwnerId, new owner to be set ** iCount, current counter, to be incremented and returned *************************************************************************************************************/ //Variable declarations var boEmp:BusObject; var bcEmp:BusComp; var strNewOwnerId = ""; try{ boEmp = TheApplication().GetBusObject("Employee"); bcEmp = boEmp.GetBusComp("Employee"); bcEmp.SetViewMode(AllView); bcEmp.ClearToQuery(); bcEmp.SetSearchExpr("[Login Name] = '"+archLogin+"'"); bcEmp.ExecuteQuery(ForwardOnly); if(bcEmp.FirstRecord()) { strNewOwnerId = bcEmp.GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fGetArchiveOwnerId ERROR: " + e.message); throw(e); } finally{ bcEmp = null; boEmp = null; } return(strNewOwnerId); }

Archive Closed Activities SCM
fLogEvent
function fLogEvent(strParentLogId, strType, strDescText) { /************************************************************************************************************** ** Name: fLogEvent ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Log Event ** Inputs: strParentLogId, strType, type of event ** strDescText, description text to be added *************************************************************************************************************/ //Variable declarations var boLog:BusObject; var bcLogEvent:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogEvent = boLog.GetBusComp("Log 2 Event SCM"); with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Log Id", strParentLogId); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogEvent: " + e.message); throw(e); } finally{ bcLogEvent = null; boLog = null; } }

Archive Closed Activities SCM
fLogEvent
function fLogEvent(strParentLogId, strType, strDescText) { /************************************************************************************************************** ** Name: fLogEvent ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Log Event ** Inputs: strParentLogId, strType, type of event ** strDescText, description text to be added *************************************************************************************************************/ //Variable declarations var boLog:BusObject; var bcLogEvent:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogEvent = boLog.GetBusComp("Log 2 Event SCM"); with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Log Id", strParentLogId); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogEvent: " + e.message); throw(e); } finally{ bcLogEvent = null; boLog = null; } }

Archive Closed Activities SCM
fLogInit
function fLogInit(strAppName, strType, strDescText) { /************************************************************************************************************** ** Name: fLogInit ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Log Event ** Inputs: strParentLogId, strType, type of event ** strDescText, description text to be added ** Outputs: *************************************************************************************************************/ //Variable declarations var boLog:BusObject; var bcLog:BusComp; var strParentLogId = ""; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLog = boLog.GetBusComp("Log 2 SCM"); with(bcLog) { NewRecord(NewAfter); SetFieldValue("Application Name", strAppName); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); strParentLogId = GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogInit: " + e.message); throw(e); } finally{ bcLog = null; boLog = null; } return(strParentLogId); }

Archive Closed Activities SCM
fLogInit
function fLogInit(strAppName, strType, strDescText) { /************************************************************************************************************** ** Name: fLogInit ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Log Event ** Inputs: strParentLogId, strType, type of event ** strDescText, description text to be added ** Outputs: *************************************************************************************************************/ //Variable declarations var boLog:BusObject; var bcLog:BusComp; var strParentLogId = ""; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLog = boLog.GetBusComp("Log 2 SCM"); with(bcLog) { NewRecord(NewAfter); SetFieldValue("Application Name", strAppName); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); strParentLogId = GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogInit: " + e.message); throw(e); } finally{ bcLog = null; boLog = null; } return(strParentLogId); }

Archive Closed Activities SCM
fUpdateActivity
function fUpdateActivity(strActSearchSpec, strNewOwnerId) { /************************************************************************************************************** ** Name: fUpdateActivity ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Updates activity owners and returns the number of updated records ** Inputs: strActSearchSpec, search spec on activities ** strNewOwnerId, new owner to be set ** iCount, current counter, to be incremented and returned *************************************************************************************************************/ var boAction:BusObject; var bcAction:BusComp; var intReturnCount = 0; var isRecord; try{ boAction = TheApplication().GetBusObject("EAI Action SCM"); bcAction = boAction.GetBusComp("EAI Action SCM"); bcAction.SetViewMode(AllView); bcAction.ActivateField("Status"); bcAction.ActivateField("Owned By ID SCM"); bcAction.ActivateField("Done"); bcAction.ClearToQuery(); bcAction.SetSearchExpr(strActSearchSpec); bcAction.ExecuteQuery(ForwardBackward); isRecord = bcAction.FirstRecord(); while (isRecord) { bcAction.SetFieldValue("Owned By ID SCM", strNewOwnerId); bcAction.WriteRecord(); intReturnCount = intReturnCount + 1; isRecord = bcAction.NextRecord(); } } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fUpdateActivity ERROR: " + e.message); throw(e); } finally{ bcAction = null; boAction = null; isRecord = null; } return(intReturnCount); }

Archive Closed Activities SCM
fUpdateActivity
function fUpdateActivity(strActSearchSpec, strNewOwnerId) { /************************************************************************************************************** ** Name: fUpdateActivity ** Created: 01.10.2012 ** Created By: TGDSEAI1 ** Description: Updates activity owners and returns the number of updated records ** Inputs: strActSearchSpec, search spec on activities ** strNewOwnerId, new owner to be set ** iCount, current counter, to be incremented and returned *************************************************************************************************************/ var boAction:BusObject; var bcAction:BusComp; var intReturnCount = 0; var isRecord; try{ boAction = TheApplication().GetBusObject("EAI Action SCM"); bcAction = boAction.GetBusComp("EAI Action SCM"); bcAction.SetViewMode(AllView); bcAction.ActivateField("Status"); bcAction.ActivateField("Owned By ID SCM"); bcAction.ActivateField("Done"); bcAction.ClearToQuery(); bcAction.SetSearchExpr(strActSearchSpec); bcAction.ExecuteQuery(ForwardBackward); isRecord = bcAction.FirstRecord(); while (isRecord) { bcAction.SetFieldValue("Owned By ID SCM", strNewOwnerId); bcAction.WriteRecord(); intReturnCount = intReturnCount + 1; isRecord = bcAction.NextRecord(); } } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fUpdateActivity ERROR: " + e.message); throw(e); } finally{ bcAction = null; boAction = null; isRecord = null; } return(intReturnCount); }

Asset Details EM SCM
(declarations)
var bIsTraceOn:bool; var oApp:Application;

Asset Details EM SCM
(declarations)
var bIsTraceOn:bool; var oApp:Application;

Asset Details EM SCM
Init
function Init (Inputs, Outputs){ /******************************************************* ** Name: Asset Details EM SCM ** Event: Init ** Update: 25.08.2015 ** Author: TAASTPA5 Patrizio Stavola ** Description: WP-905 Shop Retention PoC Init method for Asset landing view VBC ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".Init Start"); Outputs.SetProperty("Abogroup SCM", ""); Outputs.SetProperty("Asset Id", ""); Outputs.SetProperty("Asset Integration Id", ""); Outputs.SetProperty("Asset Type SCM", ""); Outputs.SetProperty("Billing Account Id", ""); Outputs.SetProperty("Billing Profile Id", ""); Outputs.SetProperty("Detailed Segment SCM", ""); Outputs.SetProperty("Missing Invoice SCM", ""); Outputs.SetProperty("Missing Outporting SCM", ""); Outputs.SetProperty("MSISDN SCM", ""); Outputs.SetProperty("Product SCM", ""); Outputs.SetProperty("Prom Instance Asset Id", ""); Outputs.SetProperty("Promotion Period SCM", ""); Outputs.SetProperty("Promotion Prod ID AIP SCM", ""); Outputs.SetProperty("Promotion Startdate SCM", ""); Outputs.SetProperty("Retention Date SCM", ""); Outputs.SetProperty("Retention Description SCM", ""); Outputs.SetProperty("Retention Message Green EM SCM",""); Outputs.SetProperty("Retention Message SCM", ""); Outputs.SetProperty("Retention Status SCM", ""); Outputs.SetProperty("Service Account", ""); Outputs.SetProperty("Service Account Id", ""); Outputs.SetProperty("SIM Card HLR ID", ""); Outputs.SetProperty("SIM Card Number SCM", ""); Outputs.SetProperty("SIM Card Type SCM", ""); Outputs.SetProperty("Specific Segment SCM", ""); Outputs.SetProperty("Start Date arch SCM", ""); Outputs.SetProperty("Subfine Segment SCM", ""); Outputs.SetProperty("Account Id", ""); Outputs.SetProperty("SIM Additional Card Numer SCM", ""); Outputs.SetProperty("Customer Value SCM", ""); if(bIsTraceOn) oApp.Trace(this.Name() + ".Init End"); return (CancelOperation); }

Asset Details EM SCM
Init
function Init (Inputs, Outputs){ /******************************************************* ** Name: Asset Details EM SCM ** Event: Init ** Update: 25.08.2015 ** Author: TAASTPA5 Patrizio Stavola ** Description: WP-905 Shop Retention PoC Init method for Asset landing view VBC ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".Init Start"); Outputs.SetProperty("Abogroup SCM", ""); Outputs.SetProperty("Asset Id", ""); Outputs.SetProperty("Asset Integration Id", ""); Outputs.SetProperty("Asset Type SCM", ""); Outputs.SetProperty("Billing Account Id", ""); Outputs.SetProperty("Billing Profile Id", ""); Outputs.SetProperty("Detailed Segment SCM", ""); Outputs.SetProperty("Missing Invoice SCM", ""); Outputs.SetProperty("Missing Outporting SCM", ""); Outputs.SetProperty("MSISDN SCM", ""); Outputs.SetProperty("Product SCM", ""); Outputs.SetProperty("Prom Instance Asset Id", ""); Outputs.SetProperty("Promotion Period SCM", ""); Outputs.SetProperty("Promotion Prod ID AIP SCM", ""); Outputs.SetProperty("Promotion Startdate SCM", ""); Outputs.SetProperty("Retention Date SCM", ""); Outputs.SetProperty("Retention Description SCM", ""); Outputs.SetProperty("Retention Message Green EM SCM",""); Outputs.SetProperty("Retention Message SCM", ""); Outputs.SetProperty("Retention Status SCM", ""); Outputs.SetProperty("Service Account", ""); Outputs.SetProperty("Service Account Id", ""); Outputs.SetProperty("SIM Card HLR ID", ""); Outputs.SetProperty("SIM Card Number SCM", ""); Outputs.SetProperty("SIM Card Type SCM", ""); Outputs.SetProperty("Specific Segment SCM", ""); Outputs.SetProperty("Start Date arch SCM", ""); Outputs.SetProperty("Subfine Segment SCM", ""); Outputs.SetProperty("Account Id", ""); Outputs.SetProperty("SIM Additional Card Numer SCM", ""); Outputs.SetProperty("Customer Value SCM", ""); Outputs.SetProperty("SIM Only Allowed Flag SCM", ""); if(bIsTraceOn) oApp.Trace(this.Name() + ".Init End"); return (CancelOperation); }

Asset Details EM SCM
Query
function Query(Inputs, Outputs){ /******************************************************* ** Name: Asset Details EM SCM ** Event: Query ** Update: 25.08.2015 ** Author: TAASTPA5 Patrizio Stavola ** Description: WP-905 Shop Retention PoC. Query method for Asset landing view VBC. Retrieves infos from Asset light BusComp and APP_SBL_IN_721 Get Retention Info. ******************************************************/ var sServAccId:String, sAssetIntegrationId:String, sAssetId:String, sErrorCode:String, sErrorMessage:String, sMSISDN:String; var oWFInputs:PropertySet; var oWFOutputs:PropertySet; var oPSOutputStruct:PropertySet; var oBOAssetLite:BusObject; var oBCAssetLite:BusComp; var bsCallWFGetRetInfo:Service; var sSearchSpec:chars = ""; var sChannel:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".Query : Start"); oWFInputs = oApp.NewPropertySet(); oWFOutputs = oApp.NewPropertySet(); sServAccId = Inputs.GetChild(0).GetProperty("Service Account Id"); oBOAssetLite = oApp.GetBusObject("Asset Mgmt - Asset Light EM SCM"); oBCAssetLite = oBOAssetLite.GetBusComp("Asset Mgmt - Asset Light EM SCM"); sMSISDN = oApp.GetProfileAttr("SearchMSISDNEMSCM"); sChannel = oApp.GetProfileAttr("SCM_CHANNEL_EM_SCM"); if(sChannel == "POS"){ sChannel = "CHAIN"; } else{ sChannel = "SHOP"; } if(sMSISDN!=null && sMSISDN!=""){ with (oBCAssetLite){ SetViewMode(AllView); ActivateField("Service Type"); ActivateField("MSISDN SCM"); ActivateField("Integration Id"); ActivateField("Billing Account Id"); ActivateField("Promotion Prod ID AIP SCM"); ActivateField("Prom Instance Asset Id"); ActivateField("Billing Profile Id"); ActivateField("Product Description multilingual AIP SCM"); ActivateField("Service Account"); ActivateField("SIM Card Type SCM"); ActivateField("SIM Card HLR ID"); ActivateField("SIM Card Number SCM"); ActivateField("Detailed Segment SCM"); ActivateField("Subfine Segment SCM"); ActivateField("Promotion Startdate SCM"); ActivateField("Promotion Period SCM"); ActivateField("Specific Segment SCM"); ActivateField("Service Account Id"); ActivateField("SIM Additional Card Numer SCM"); ActivateField("Customer Value SCM"); ClearToQuery(); //TAASAAI2 05.02.2016 Should filter as in the MVL of the Account by mobile product and status sSearchSpec = "[Service Account Id] = '" + sServAccId + "' AND [Parent Asset Id] IS NULL AND [MSISDN SCM] = '" + sMSISDN + "' AND [Status]='Active'"; SetSearchExpr(sSearchSpec); if(bIsTraceOn) oApp.Trace(this.Name() + ".Query: sSearchSpec: " + sSearchSpec); ExecuteQuery(ForwardOnly); var isRecord = FirstRecord(); if(isRecord){ sAssetIntegrationId = GetFieldValue("Integration Id"); sAssetId = GetFieldValue("Id"); oPSOutputStruct = oApp.NewPropertySet(); oPSOutputStruct.SetProperty("Asset Integration Id", sAssetIntegrationId); oPSOutputStruct.SetProperty("Id", sAssetId); oPSOutputStruct.SetProperty("Asset Type SCM", GetFieldValue("Service Type")); oPSOutputStruct.SetProperty("MSISDN SCM", GetFieldValue("MSISDN SCM")); oPSOutputStruct.SetProperty("Product SCM", GetFieldValue("Product Description multilingual AIP SCM")); oPSOutputStruct.SetProperty("Billing Account Id", GetFieldValue("Billing Account Id")); oPSOutputStruct.SetProperty("Promotion Prod ID AIP SCM", GetFieldValue("Promotion Prod ID AIP SCM")); oPSOutputStruct.SetProperty("Prom Instance Asset Id", GetFieldValue("Prom Instance Asset Id")); oPSOutputStruct.SetProperty("Asset Id", GetFieldValue("Id")); oPSOutputStruct.SetProperty("Billing Profile Id", GetFieldValue("Billing Profile Id")); oPSOutputStruct.SetProperty("Service Account", GetFieldValue("Service Account")); oPSOutputStruct.SetProperty("SIM Card Type SCM", GetFieldValue("SIM Card Type SCM")); oPSOutputStruct.SetProperty("SIM Card HLR ID", GetFieldValu

Asset Details EM SCM
Query
function Query(Inputs, Outputs){ /******************************************************* ** Name: Asset Details EM SCM ** Event: Query ** Update: 25.08.2015 ** Author: TAASTPA5 Patrizio Stavola ** Description: WP-905 Shop Retention PoC. Query method for Asset landing view VBC. Retrieves infos from Asset light BusComp and APP_SBL_IN_721 Get Retention Info. ******************************************************/ var sServAccId:String, sAssetIntegrationId:String, sAssetId:String, sErrorCode:String, sErrorMessage:String, sMSISDN:String; var oWFInputs:PropertySet; var oWFOutputs:PropertySet; var oPSOutputStruct:PropertySet; var oBOAssetLite:BusObject; var oBCAssetLite:BusComp; var bsCallWFGetRetInfo:Service; var sSearchSpec:chars = ""; var sChannel:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".Query : Start"); oWFInputs = oApp.NewPropertySet(); oWFOutputs = oApp.NewPropertySet(); sServAccId = Inputs.GetChild(0).GetProperty("Service Account Id"); oBOAssetLite = oApp.GetBusObject("Asset Mgmt - Asset Light EM SCM"); oBCAssetLite = oBOAssetLite.GetBusComp("Asset Mgmt - Asset Light EM SCM"); sMSISDN = oApp.GetProfileAttr("SearchMSISDNEMSCM"); sChannel = oApp.GetProfileAttr("SCM_CHANNEL_EM_SCM"); if(sChannel == "POS"){ sChannel = "CHAIN"; } else{ sChannel = "SHOP"; } if(sMSISDN!=null && sMSISDN!=""){ with (oBCAssetLite){ SetViewMode(AllView); ActivateField("Service Type"); ActivateField("MSISDN SCM"); ActivateField("Integration Id"); ActivateField("Billing Account Id"); ActivateField("Promotion Prod ID AIP SCM"); ActivateField("Prom Instance Asset Id"); ActivateField("Billing Profile Id"); ActivateField("Product Description multilingual AIP SCM"); ActivateField("Service Account"); ActivateField("SIM Card Type SCM"); ActivateField("SIM Card HLR ID"); ActivateField("SIM Card Number SCM"); ActivateField("Detailed Segment SCM"); ActivateField("Subfine Segment SCM"); ActivateField("Promotion Startdate SCM"); ActivateField("Promotion Period SCM"); ActivateField("Specific Segment SCM"); ActivateField("Service Account Id"); ActivateField("SIM Additional Card Numer SCM"); ActivateField("Customer Value SCM"); ClearToQuery(); //TAASAAI2 05.02.2016 Should filter as in the MVL of the Account by mobile product and status sSearchSpec = "[Service Account Id] = '" + sServAccId + "' AND [Parent Asset Id] IS NULL AND [MSISDN SCM] = '" + sMSISDN + "' AND [Status]='Active'"; SetSearchExpr(sSearchSpec); if(bIsTraceOn) oApp.Trace(this.Name() + ".Query: sSearchSpec: " + sSearchSpec); ExecuteQuery(ForwardOnly); var isRecord = FirstRecord(); if(isRecord){ sAssetIntegrationId = GetFieldValue("Integration Id"); sAssetId = GetFieldValue("Id"); oPSOutputStruct = oApp.NewPropertySet(); oPSOutputStruct.SetProperty("Asset Integration Id", sAssetIntegrationId); oPSOutputStruct.SetProperty("Id", sAssetId); oPSOutputStruct.SetProperty("Asset Type SCM", GetFieldValue("Service Type")); oPSOutputStruct.SetProperty("MSISDN SCM", GetFieldValue("MSISDN SCM")); oPSOutputStruct.SetProperty("Product SCM", GetFieldValue("Product Description multilingual AIP SCM")); oPSOutputStruct.SetProperty("Billing Account Id", GetFieldValue("Billing Account Id")); oPSOutputStruct.SetProperty("Promotion Prod ID AIP SCM", GetFieldValue("Promotion Prod ID AIP SCM")); oPSOutputStruct.SetProperty("Prom Instance Asset Id", GetFieldValue("Prom Instance Asset Id")); oPSOutputStruct.SetProperty("Asset Id", GetFieldValue("Id")); oPSOutputStruct.SetProperty("Billing Profile Id", GetFieldValue("Billing Profile Id")); oPSOutputStruct.SetProperty("Service Account", GetFieldValue("Service Account")); oPSOutputStruct.SetProperty("SIM Card Type SCM", GetFieldValue("SIM Card Type SCM")); oPSOutputStruct.SetProperty("SIM Card HLR ID", GetFieldValu

Asset Details EM SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if(bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName: " + MethodName); switch (MethodName){ case "Init": Init(Inputs,Outputs); break; case "Query": Query (Inputs,Outputs); break; default: break; } return (CancelOperation); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); //Do not throw error as this will lead to a not screen loading } finally { oApp = null; bIsTraceOn = null; } }

Asset Details EM SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /******************************************************* ** Name: Asset Details EM SCM ** Event: Service_PreInvokeMethod ** Update: 25.08.2015 ** Author: TAASTPA5 Patrizio Stavola ** Description: WP-905 Shop Retention PoC. ******************************************************/ try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if(bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName: " + MethodName); switch (MethodName){ case "Init": Init(Inputs,Outputs); break; case "Query": Query (Inputs,Outputs); break; default: break; } return (CancelOperation); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod Error: " + e.message); //Do not throw error as this will lead to a not screen loading } finally { oApp = null; bIsTraceOn = null; } }

Asset Details EM SCM
fWritePs
function fWritePs(Inputs:PropertySet){ /************************************************************************************************************** ** Name: fWritePs ** Created: 23.09.2015 ** Created By: TAASAAI1 ** Description: Trace a propertySet *************************************************************************************************************/ var objBS:Service = oApp.GetService("XML Converter"); var psOutputs:PropertySet = oApp.NewPropertySet(); var strXML:chars = ""; try{ Inputs.SetType("SiebelMessage"); objBS.InvokeMethod("PropSetToXML", Inputs, psOutputs) strXML = psOutputs.GetValue(); if(bIsTraceOn) oApp.Trace(this.Name() + ".WritePs"); if(bIsTraceOn)oApp.Trace(strXML); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fWritePs Error: " + e.message); throw(e); } finally{ psOutputs = null; objBS = null; } }

Asset Details EM SCM
fWritePs
function fWritePs(Inputs:PropertySet){ /************************************************************************************************************** ** Name: fWritePs ** Created: 23.09.2015 ** Created By: TAASAAI1 ** Description: Trace a propertySet *************************************************************************************************************/ var objBS:Service = oApp.GetService("XML Converter"); var psOutputs:PropertySet = oApp.NewPropertySet(); var strXML:chars = ""; try{ Inputs.SetType("SiebelMessage"); objBS.InvokeMethod("PropSetToXML", Inputs, psOutputs) strXML = psOutputs.GetValue(); if(bIsTraceOn) oApp.Trace(this.Name() + ".WritePs"); if(bIsTraceOn)oApp.Trace(strXML); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fWritePs Error: " + e.message); throw(e); } finally{ psOutputs = null; objBS = null; } }

Asset Mutation Template Attributes VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Attributes VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Attributes VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Name",""); }

Asset Mutation Template Attributes VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Name",""); }

Asset Mutation Template Attributes VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sValue = ""; var sProdId = sId; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (sProdId != "") { var oBS = oApp.GetService("Cfg Object Broker"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("RootId", sProdId); oIn.SetProperty("Full", "N"); try { oBS.InvokeMethod("GetProdStruct", oIn, oOut); if (bIsTraceOn) WritePS(oOut); } catch(e) { // do nothing // oApp.Trace("AMTAttributesVBC-Query()-GetProdStruct - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { if (oOut.GetChildCount() == 1) { var oAttr = null; var sAttr = ""; var oRoot = oOut.GetChild(0) var iAttrMax = oRoot.GetChildCount(); for (var iAttr = 0; iAttr < iAttrMax; iAttr++) { oAttr = oRoot.GetChild(iAttr); if (oAttr.GetType() == "Attribute") { if (bIsTraceOn) oApp.Trace("oAttr.GetProperty('Name') = " + oAttr.GetProperty("Name")); if (sSearch == "" || (oAttr.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); oOutputsRow.SetProperty("Name", oAttr.GetProperty("Name")); Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } oAttr = null; } oRoot = null; } } catch(e) { if (bIsTraceOn) oApp.Trace("AMTAttributesVBC-Query() - " +e.toString()); } } oOut = null; } }

Asset Mutation Template Attributes VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sValue = ""; var sProdId = sId; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (sProdId != "") { var oBS = oApp.GetService("Cfg Object Broker"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("RootId", sProdId); oIn.SetProperty("Full", "N"); try { oBS.InvokeMethod("GetProdStruct", oIn, oOut); if (bIsTraceOn) WritePS(oOut); } catch(e) { // do nothing // oApp.Trace("AMTAttributesVBC-Query()-GetProdStruct - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { if (oOut.GetChildCount() == 1) { var oAttr = null; var sAttr = ""; var oRoot = oOut.GetChild(0) var iAttrMax = oRoot.GetChildCount(); for (var iAttr = 0; iAttr < iAttrMax; iAttr++) { oAttr = oRoot.GetChild(iAttr); if (oAttr.GetType() == "Attribute") { if (bIsTraceOn) oApp.Trace("oAttr.GetProperty('Name') = " + oAttr.GetProperty("Name")); if (sSearch == "" || (oAttr.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); oOutputsRow.SetProperty("Name", oAttr.GetProperty("Name")); Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } oAttr = null; } oRoot = null; } } catch(e) { if (bIsTraceOn) oApp.Trace("AMTAttributesVBC-Query() - " +e.toString()); } } oOut = null; } }

Asset Mutation Template Attributes VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); var iPos = sSearch.indexOf("*"); if (iPos == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Attributes VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); var iPos = sSearch.indexOf("*"); if (iPos == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Attributes VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) WritePS(Inputs); try { switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template Attributes VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) WritePS(Inputs); try { switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template Attributes VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template Attributes VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template Ports VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Ports VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Ports VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Class Id", ""); Outputs.SetProperty("Class Name",""); Outputs.SetProperty("DefCardinality",""); Outputs.SetProperty("DefaultPortObjId",""); Outputs.SetProperty("DefaultProdName",""); Outputs.SetProperty("MaxCardinality",""); Outputs.SetProperty("MinCardinality",""); Outputs.SetProperty("Name",""); Outputs.SetProperty("Port Display Name",""); Outputs.SetProperty("Port Item Id",""); }

Asset Mutation Template Ports VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Class Id", ""); Outputs.SetProperty("Class Name",""); Outputs.SetProperty("DefCardinality",""); Outputs.SetProperty("DefaultPortObjId",""); Outputs.SetProperty("DefaultProdName",""); Outputs.SetProperty("MaxCardinality",""); Outputs.SetProperty("MinCardinality",""); Outputs.SetProperty("Name",""); Outputs.SetProperty("Port Display Name",""); Outputs.SetProperty("Port Item Id",""); }

Asset Mutation Template Ports VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sValue = ""; var sProdId = sId; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (sProdId != "") { var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProdId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { // do nothing // if (bIsTraceOn) oApp.Trace("AMTPortsVBC-Query()-GetAllPorts - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; var oPort = null; var oProd = null; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (sSearch == "" || (oPort.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); sProperty = oPort.GetFirstProperty(); while (sProperty.length > 0) { sValue = oPort.GetProperty(sProperty); oOutputsRow.SetProperty(sProperty, sValue); sProperty = oPort.GetNextProperty(); } if (oOutputsRow.GetProperty("DefaultPortObjId") != "") { iProdMax = oPort.GetChildCount(); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (oProd.GetProperty("Product Id") == oOutputsRow.GetProperty("DefaultPortObjId")) { oOutputsRow.SetProperty("DefaultProdName", oProd.GetProperty("Name")); } oProd = null; } } Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } } catch(e) { if (bIsTraceOn) oApp.Trace("AMTPortsVBC-Query() - " +e.toString()); } finally { oPort = null; } } oOut = null; } }

Asset Mutation Template Ports VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sValue = ""; var sProdId = sId; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (sProdId != "") { var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProdId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { // do nothing // if (bIsTraceOn) oApp.Trace("AMTPortsVBC-Query()-GetAllPorts - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; var oPort = null; var oProd = null; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (sSearch == "" || (oPort.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); sProperty = oPort.GetFirstProperty(); while (sProperty.length > 0) { sValue = oPort.GetProperty(sProperty); oOutputsRow.SetProperty(sProperty, sValue); sProperty = oPort.GetNextProperty(); } if (oOutputsRow.GetProperty("DefaultPortObjId") != "") { iProdMax = oPort.GetChildCount(); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (oProd.GetProperty("Product Id") == oOutputsRow.GetProperty("DefaultPortObjId")) { oOutputsRow.SetProperty("DefaultProdName", oProd.GetProperty("Name")); } oProd = null; } } Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } } catch(e) { if (bIsTraceOn) oApp.Trace("AMTPortsVBC-Query() - " +e.toString()); } finally { oPort = null; } } oOut = null; } }

Asset Mutation Template Ports VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); var iPos = sSearch.indexOf("*"); if (iPos == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Ports VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); var iPos = sSearch.indexOf("*"); if (iPos == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Ports VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) WritePS(Inputs); try { switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } } finally { oApp = null; // TGDSOAN5 4.02.08 } return (CancelOperation); }

Asset Mutation Template Ports VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if (bIsTraceOn) WritePS(Inputs); try { switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } } finally { oApp = null; // TGDSOAN5 4.02.08 } return (CancelOperation); }

Asset Mutation Template Ports VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template Ports VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template Products VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Products VBC SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template Products VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Default", ""); Outputs.SetProperty("Description",""); Outputs.SetProperty("Name",""); Outputs.SetProperty("Prod Item Id",""); Outputs.SetProperty("Product Id",""); Outputs.SetProperty("Version",""); Outputs.SetProperty("Port Name",""); }

Asset Mutation Template Products VBC SCM
Init
function Init(Inputs, Outputs) { Outputs.SetProperty("Default", ""); Outputs.SetProperty("Description",""); Outputs.SetProperty("Name",""); Outputs.SetProperty("Prod Item Id",""); Outputs.SetProperty("Product Id",""); Outputs.SetProperty("Version",""); Outputs.SetProperty("Port Name",""); }

Asset Mutation Template Products VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sPortName = ""; var sProdId = sId; var sValue = ""; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sPortName = oBO.GetBusComp( "Asset Mutation Template Instruction SCM" ).GetFieldValue("Logical Port Name" ); sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sPortName = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Port Name"); sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (bIsTraceOn) oApp.Trace("sProdId = " +sProdId); if (sProdId != "") { var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProdId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { // do nothing // oApp.Trace("AMTProductsVBC-Query()-GetAllPorts - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oPort = null; var oProd = null; var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (bIsTraceOn) oApp.Trace("oPort.Name = " +oPort.GetProperty("Name")); if (sPortName.length == 0 || oPort.GetProperty("Name") == sPortName) { iProdMax = oPort.GetChildCount(); if (bIsTraceOn) oApp.Trace("iProdMax = " +iProdMax); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (sSearch == "" || (oProd.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); sProperty = oProd.GetFirstProperty(); while (sProperty.length > 0) { sValue = oProd.GetProperty(sProperty); oOutputsRow.SetProperty(sProperty, sValue); sProperty = oProd.GetNextProperty(); } oOutputsRow.SetProperty("Port Name", oPort.GetProperty("Name")); Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } } } } catch(e) { oApp.Trace("AMTProductsVBC-Query() - " +e.toString()); } finally { oPort = null; oProd = null; } } oOut = null; } }

Asset Mutation Template Products VBC SCM
Query
function Query(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sId = Inputs.GetChild(0).GetProperty("Id"); var sPortName = ""; var sProdId = sId; var sValue = ""; var sSearch = QueryCheck(Inputs); var oBO = oApp.ActiveBusObject(); if ( oBO != null ) { if (bIsTraceOn) oApp.Trace("oBO.Name() = " +oBO.Name()); switch (oBO.Name()) { case "Asset Mutation Template SCM": sPortName = oBO.GetBusComp( "Asset Mutation Template Instruction SCM" ).GetFieldValue("Logical Port Name" ); sProdId = oBO.GetBusComp( "Asset Mutation Template SCM" ).GetFieldValue("Root Product Id" ); break; case "SSCP SMS Product Keyword Administration SCM": sPortName = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Port Name"); sProdId = oBO.GetBusComp( "SSCP SMS Product Keyword Administration SCM" ).GetFieldValue("AMT Start Root Product Id"); break; } oBO = null; } if (bIsTraceOn) oApp.Trace("sProdId = " +sProdId); if (sProdId != "") { var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProdId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { // do nothing // oApp.Trace("AMTProductsVBC-Query()-GetAllPorts - " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); // if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oPort = null; var oProd = null; var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (bIsTraceOn) oApp.Trace("oPort.Name = " +oPort.GetProperty("Name")); if (sPortName.length == 0 || oPort.GetProperty("Name") == sPortName) { iProdMax = oPort.GetChildCount(); if (bIsTraceOn) oApp.Trace("iProdMax = " +iProdMax); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (sSearch == "" || (oProd.GetProperty("Name").indexOf(sSearch) >= 0)) { oOutputsRow = oApp.NewPropertySet(); sProperty = oProd.GetFirstProperty(); while (sProperty.length > 0) { sValue = oProd.GetProperty(sProperty); oOutputsRow.SetProperty(sProperty, sValue); sProperty = oProd.GetNextProperty(); } oOutputsRow.SetProperty("Port Name", oPort.GetProperty("Name")); Outputs.AddChild (oOutputsRow); oOutputsRow = null; } } } } } catch(e) { oApp.Trace("AMTProductsVBC-Query() - " +e.toString()); } finally { oPort = null; oProd = null; } } oOut = null; } }

Asset Mutation Template Products VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); sSearch = sSearch.substring(0, sSearch.indexOf('"')) + "*"; if (sSearch.indexOf("*") == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Products VBC SCM
QueryCheck
function QueryCheck(oInputs) { var sSearch = ""; if (oInputs.PropertyExists("search-string")) { sSearch = oInputs.GetProperty("search-string"); sSearch = sSearch.substring(sSearch.indexOf('"')+1); sSearch = sSearch.substring(0, sSearch.indexOf('"')) + "*"; if (sSearch.indexOf("*") == 0) { sSearch = sSearch.substring(1); } sSearch = sSearch.substring(0, sSearch.indexOf("*")); } return (sSearch); }

Asset Mutation Template Products VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { if (bIsTraceOn) WritePS(Inputs); switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } if (bIsTraceOn) WritePS(Outputs); } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template Products VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { if (bIsTraceOn) WritePS(Inputs); switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; default: break; } if (bIsTraceOn) WritePS(Outputs); } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template Products VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template Products VBC SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template SCM
(declarations)
var oApp; var bIsTraceOn;

Asset Mutation Template SCM
GetAttributeInfo
function GetAttributeInfo(Inputs, Outputs) { try { var oBO = null; var oBC = null; var sName = ""; // output var sValue = ""; // output var sTypeCode = ""; // output var sXAId = ""; // output var sFound = "N"; // output, Y or N var sProductId = Inputs.GetProperty("Product Id"); var sAttrName = Inputs.GetProperty("Attribute Name"); var sAttrValue = Inputs.GetProperty("Attribute Value"); var oBS = oApp.GetService("Cfg Object Broker"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("RootId", sProductId); oIn.SetProperty("Full", "N"); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sProductId = " +sProductId); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sAttrName = " +sAttrName); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sAttrValue = " +sAttrValue); try { oBS.InvokeMethod("GetProdStruct", oIn, oOut); if (bIsTraceOn) WritePS(oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { if (oOut.GetChildCount() == 1) { var oAttr = null; var sAttr = ""; var oRoot = oOut.GetChild(0) var iAttrMax = oRoot.GetChildCount(); var iDomainMax = 0; var iDomain = 0; var oDomain = null; for (var iAttr = 0; iAttr < iAttrMax; iAttr++) { oAttr = oRoot.GetChild(iAttr); if (oAttr.GetType() == "Attribute") { if (oAttr.GetProperty("Name") == sAttrName) { sTypeCode = oAttr.GetProperty("LocalType"); iDomainMax = oAttr.GetChildCount(); //TGDSEAI1 31.08.2011 Olympia R3 //Check if value is valid only when it is a enumerated value when it has a child domain if(iDomainMax > 0){ for (iDomain = 0; iDomain < iDomainMax; iDomain++) { oDomain = oAttr.GetChild(iDomain); if (oDomain.GetProperty("InternalValue") == sAttrValue) { sValue = oDomain.GetProperty("LocalValue"); oBO = oApp.GetBusObject("VOD ImpExp BO"); oBC = oBO.GetBusComp("VOD ImpExp BC"); oBC.ClearToQuery(); oBC.SetSearchSpec("VOD Name", sAttrName); oBC.ExecuteQuery(ForwardOnly); if(oBC.FirstRecord()) { sXAId = oBC.GetFieldValue("VOD Object Num"); sFound = "Y"; } break; }//End If }//End for }//End If else{ //TGDSEAI1 31.08.2011 Olympia R3 //No domain freetext attr sValue = sAttrValue; oBO = oApp.GetBusObject("VOD ImpExp BO"); oBC = oBO.GetBusComp("VOD ImpExp BC"); oBC.ClearToQuery(); oBC.SetSearchSpec("VOD Name", sAttrName); oBC.ExecuteQuery(ForwardOnly); if(oBC.FirstRecord()) { sXAId = oBC.GetFieldValue("VOD Object Num"); sFound = "Y"; } }//End else break; } } } } } } catch (e) { oApp.Trace("error: " + e.toString()); // throw (e); } finally { with(Outputs) { SetProperty("Value", sValue); SetProperty("XA Id", sXAId); SetProperty("Property Type Code", sTypeCode); SetProperty("Found", sFound); } oDomain = null; oAttr = null; oRoot = null; oOut = null; oBC = null; oBO = null; } }

Asset Mutation Template SCM
GetAttributeInfo
function GetAttributeInfo(Inputs, Outputs) { try { var oBO = null; var oBC = null; var sName = ""; // output var sValue = ""; // output var sTypeCode = ""; // output var sXAId = ""; // output var sFound = "N"; // output, Y or N var sProductId = Inputs.GetProperty("Product Id"); var sAttrName = Inputs.GetProperty("Attribute Name"); var sAttrValue = Inputs.GetProperty("Attribute Value"); var oBS = oApp.GetService("Cfg Object Broker"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("RootId", sProductId); oIn.SetProperty("Full", "N"); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sProductId = " +sProductId); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sAttrName = " +sAttrName); if (bIsTraceOn) oApp.Trace(this.Name() + "GetAttributeInfo sAttrValue = " +sAttrValue); try { oBS.InvokeMethod("GetProdStruct", oIn, oOut); if (bIsTraceOn) WritePS(oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { if (oOut.GetChildCount() == 1) { var oAttr = null; var sAttr = ""; var oRoot = oOut.GetChild(0) var iAttrMax = oRoot.GetChildCount(); var iDomainMax = 0; var iDomain = 0; var oDomain = null; for (var iAttr = 0; iAttr < iAttrMax; iAttr++) { oAttr = oRoot.GetChild(iAttr); if (oAttr.GetType() == "Attribute") { if (oAttr.GetProperty("Name") == sAttrName) { sTypeCode = oAttr.GetProperty("LocalType"); iDomainMax = oAttr.GetChildCount(); //TGDSEAI1 31.08.2011 Olympia R3 //Check if value is valid only when it is a enumerated value when it has a child domain if(iDomainMax > 0){ for (iDomain = 0; iDomain < iDomainMax; iDomain++) { oDomain = oAttr.GetChild(iDomain); if (oDomain.GetProperty("InternalValue") == sAttrValue) { sValue = oDomain.GetProperty("LocalValue"); oBO = oApp.GetBusObject("VOD ImpExp BO"); oBC = oBO.GetBusComp("VOD ImpExp BC"); oBC.ClearToQuery(); oBC.SetSearchSpec("VOD Name", sAttrName); oBC.ExecuteQuery(ForwardOnly); if(oBC.FirstRecord()) { sXAId = oBC.GetFieldValue("VOD Object Num"); sFound = "Y"; } break; }//End If }//End for }//End If else{ //TGDSEAI1 31.08.2011 Olympia R3 //No domain freetext attr sValue = sAttrValue; oBO = oApp.GetBusObject("VOD ImpExp BO"); oBC = oBO.GetBusComp("VOD ImpExp BC"); oBC.ClearToQuery(); oBC.SetSearchSpec("VOD Name", sAttrName); oBC.ExecuteQuery(ForwardOnly); if(oBC.FirstRecord()) { sXAId = oBC.GetFieldValue("VOD Object Num"); sFound = "Y"; } }//End else break; } } } } } } catch (e) { oApp.Trace("error: " + e.toString()); // throw (e); } finally { with(Outputs) { SetProperty("Value", sValue); SetProperty("XA Id", sXAId); SetProperty("Property Type Code", sTypeCode); SetProperty("Found", sFound); } oDomain = null; oAttr = null; oRoot = null; oOut = null; oBC = null; oBO = null; } }

Asset Mutation Template SCM
GetFirstTwoIds
function GetFirstTwoIds(Inputs, Outputs) { try { var sObjId = ""; var sRootId = ""; sObjId = Inputs.GetChild(0).GetChild(0).GetChild(0).GetProperty("Id"); sRootId = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetProperty("Id"); } catch(e) { // error - do nothing } finally { Outputs.SetProperty("ObjId", sObjId); Outputs.SetProperty("RootId", sRootId); } }

Asset Mutation Template SCM
GetFirstTwoIds
function GetFirstTwoIds(Inputs, Outputs) { try { var sObjId = ""; var sRootId = ""; sObjId = Inputs.GetChild(0).GetChild(0).GetChild(0).GetProperty("Id"); sRootId = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetProperty("Id"); } catch(e) { // error - do nothing } finally { Outputs.SetProperty("ObjId", sObjId); Outputs.SetProperty("RootId", sRootId); } }

Asset Mutation Template SCM
GetPath
function GetPath(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sObjId = Inputs.GetProperty("ObjId"); var sRootId = Inputs.GetProperty("RootId"); var sIntObjName = Inputs.GetProperty("IntObjName"); var sParentPath = Inputs.GetProperty("Parent Path"); var sItemName = Inputs.GetProperty("Item Name"); var sValue = ""; var sPath = ""; //output var sFound = "N"; //output, Y or N var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("ObjId", sObjId); oIn.SetProperty("RootId", sRootId); oIn.SetProperty("IntObjName", sIntObjName); oIn.SetProperty("Parent Path", sParentPath); try { oBS.InvokeMethod("EnumObjects", oIn, oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oChild = null; var iChildMax = oOut.GetChildCount(); for (var iChild = 0; iChild < iChildMax; iChild++) { oChild = oOut.GetChild(iChild); if (bIsTraceOn) oApp.Trace("oChild.Name = " +oChild.GetProperty("Name")); if (oChild.GetProperty("Name") == sItemName) { sPath = oChild.GetProperty("Path"); sFound = "Y"; } } } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oChild = null; with(Outputs) { SetProperty("Path", sPath); SetProperty("Found", sFound); } } } oOut = null; }

Asset Mutation Template SCM
GetPath
function GetPath(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sObjId = Inputs.GetProperty("ObjId"); var sRootId = Inputs.GetProperty("RootId"); var sIntObjName = Inputs.GetProperty("IntObjName"); var sParentPath = Inputs.GetProperty("Parent Path"); var sItemName = Inputs.GetProperty("Item Name"); var sValue = ""; var sPath = ""; //output var sFound = "N"; //output, Y or N var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("ObjId", sObjId); oIn.SetProperty("RootId", sRootId); oIn.SetProperty("IntObjName", sIntObjName); oIn.SetProperty("Parent Path", sParentPath); try { oBS.InvokeMethod("EnumObjects", oIn, oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oChild = null; var iChildMax = oOut.GetChildCount(); for (var iChild = 0; iChild < iChildMax; iChild++) { oChild = oOut.GetChild(iChild); if (bIsTraceOn) oApp.Trace("oChild.Name = " +oChild.GetProperty("Name")); if (oChild.GetProperty("Name") == sItemName) { sPath = oChild.GetProperty("Path"); sFound = "Y"; } } } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oChild = null; with(Outputs) { SetProperty("Path", sPath); SetProperty("Found", sFound); } } } oOut = null; }

Asset Mutation Template SCM
GetProductDetails
function GetProductDetails(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sProductId = Inputs.GetProperty("Product Id"); var sPortName = Inputs.GetProperty("Port Name"); var sItemName = Inputs.GetProperty("Item Name"); var sValue = ""; var sPortId = ""; //output var sItemId = ""; //output var sProdId = ""; //output var sFound = "N"; //output, Y or N var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProductId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oPort = null; var oProd = null; var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (bIsTraceOn) oApp.Trace("oPort.Name = " +oPort.GetProperty("Name")); if (sPortName.length == 0 || oPort.GetProperty("Name") == sPortName) { iProdMax = oPort.GetChildCount(); if (bIsTraceOn) oApp.Trace("iProdMax = " +iProdMax); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (bIsTraceOn) oApp.Trace("oProd.Name = " +oProd.GetProperty("Name")); if (oProd.GetProperty("Name") == sItemName) { sPortId = oPort.GetProperty("Port Item Id"); sProdId = oProd.GetProperty("Prod Item Id"); sItemId = oProd.GetProperty("Product Id"); sFound = "Y"; } } } } } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oPort = null; oProd = null; with(Outputs) { SetProperty("Port Item Id", sPortId); SetProperty("Prod Item Id", sProdId); SetProperty("Item Id", sItemId); SetProperty("Found", sFound); } } } oOut = null; }

Asset Mutation Template SCM
GetProductDetails
function GetProductDetails(Inputs, Outputs) { var oOutputsRow = null; var sProperty = ""; var sProductId = Inputs.GetProperty("Product Id"); var sPortName = Inputs.GetProperty("Port Name"); var sItemName = Inputs.GetProperty("Item Name"); var sValue = ""; var sPortId = ""; //output var sItemId = ""; //output var sProdId = ""; //output var sFound = "N"; //output, Y or N var oBS = oApp.GetService("Remote Complex Object Instance Service"); var oIn = oApp.NewPropertySet(); var oOut = oApp.NewPropertySet(); oIn.SetProperty("Product Id", sProductId); oIn.SetProperty("GetPortDomain", "Y"); try { oBS.InvokeMethod("GetAllPorts", oIn, oOut); } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oBS = null; oIn = null } var sError = oOut.GetProperty("Error Message"); if (bIsTraceOn) oApp.Trace("sError = " +sError); if (sError.length == 0) { try { var oPort = null; var oProd = null; var iPortMax = oOut.GetChildCount(); var iProdMax = 0; var iProd = 0; for (var iPort = 0; iPort < iPortMax; iPort++) { oPort = oOut.GetChild(iPort); if (bIsTraceOn) oApp.Trace("oPort.Name = " +oPort.GetProperty("Name")); if (sPortName.length == 0 || oPort.GetProperty("Name") == sPortName) { iProdMax = oPort.GetChildCount(); if (bIsTraceOn) oApp.Trace("iProdMax = " +iProdMax); for (iProd = 0; iProd < iProdMax; iProd++) { oProd = oPort.GetChild(iProd); if (bIsTraceOn) oApp.Trace("oProd.Name = " +oProd.GetProperty("Name")); if (oProd.GetProperty("Name") == sItemName) { sPortId = oPort.GetProperty("Port Item Id"); sProdId = oProd.GetProperty("Prod Item Id"); sItemId = oProd.GetProperty("Product Id"); sFound = "Y"; } } } } } catch(e) { oApp.Trace("catch(e) = " +e.toString()); } finally { oPort = null; oProd = null; with(Outputs) { SetProperty("Port Item Id", sPortId); SetProperty("Prod Item Id", sProdId); SetProperty("Item Id", sItemId); SetProperty("Found", sFound); } } } oOut = null; }

Asset Mutation Template SCM
IndentedSiebelMessage
function IndentedSiebelMessage(Inputs, Outputs) { var newInputs = Inputs.Copy(); newInputs.SetType("IndentedSiebelMessage"); Outputs.AddChild(newInputs); newInputs = null; }

Asset Mutation Template SCM
IndentedSiebelMessage
function IndentedSiebelMessage(Inputs, Outputs) { var newInputs = Inputs.Copy(); newInputs.SetType("IndentedSiebelMessage"); Outputs.AddChild(newInputs); newInputs = null; }

Asset Mutation Template SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { if (bIsTraceOn) WritePS(Inputs); switch (MethodName) { case "GetProductDetails": GetProductDetails(Inputs, Outputs); break; case "GetPath": GetPath(Inputs, Outputs); break; case "IndentedSiebelMessage": IndentedSiebelMessage(Inputs, Outputs); break; case "GetAttributeInfo": GetAttributeInfo(Inputs, Outputs); break; case "GetFirstTwoIds": GetFirstTwoIds(Inputs, Outputs); break; } if (bIsTraceOn) WritePS(Outputs); } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { if (bIsTraceOn) WritePS(Inputs); switch (MethodName) { case "GetProductDetails": GetProductDetails(Inputs, Outputs); break; case "GetPath": GetPath(Inputs, Outputs); break; case "IndentedSiebelMessage": IndentedSiebelMessage(Inputs, Outputs); break; case "GetAttributeInfo": GetAttributeInfo(Inputs, Outputs); break; case "GetFirstTwoIds": GetFirstTwoIds(Inputs, Outputs); break; } if (bIsTraceOn) WritePS(Outputs); } finally { oApp = null; } return (CancelOperation); }

Asset Mutation Template SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asset Mutation Template SCM
WritePS
function WritePS(oIn) { var oBS = oApp.GetService("XML Converter"); var oOut = oApp.NewPropertySet(); oIn.SetType("SiebelMessage"); oBS.InvokeMethod("PropSetToXML", oIn, oOut) var sXML = oOut.GetValue(); oApp.Trace(sXML); oOut = null; oBS = null; }

Asynchronous Server Requests
(declarations)
var oApp:Application = TheApplication(); var bIsTraceOn:bool = oApp.isTraceON;

Asynchronous Server Requests
(declarations)
var oApp:Application = TheApplication(); var bIsTraceOn:bool = oApp.isTraceON;

Asynchronous Server Requests
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch(MethodName) { case "SubmitRequest": return SubmitRequest(Inputs, Outputs); } return (ContinueOperation); }

Asynchronous Server Requests
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch(MethodName) { case "SubmitRequest": return SubmitRequest(Inputs, Outputs); } return (ContinueOperation); }

Asynchronous Server Requests
SubmitRequest
function SubmitRequest(Inputs:PropertySet, Outputs:PropertySet) { var oBusSvc:Service = oApp.GetService("Server Requests SCM"); var psRequest:PropertySet; var psIn:PropertySet; var psOut:PropertySet = oApp.NewPropertySet(); try { if(bIsTraceOn) oApp.Trace(Name() + ".SubmitRequest"); if(!isEnabled(Inputs)) return ContinueOperation; // feature is disabled if(Inputs.GetChildCount == 0) oApp.RaiseErrorText(Name() + ": No WF input found !"); psIn = Inputs.Copy(); psRequest = psIn.GetChild(0); setProfileAttr(psRequest); var sInputs:chars = getSerializedPS(psRequest); psRequest.Reset(); // clear input property psRequest.SetProperty("Serialized Input", sInputs); psRequest.SetProperty("ProcessName", "EAI Workflow Process Manager SCM"); psIn.SetProperty("Mode", "DirectDb"); setWorkspaceId(psRequest); psIn.AddChild(psRequest); oBusSvc.InvokeMethod("SubmitRequest", psIn, psOut); copyPS(psOut, Outputs); return CancelOperation; } catch(e) { if(bIsTraceOn) oApp.Trace(Name() + ".SubmitRequest exception=" + e.toString()); throw e; } finally { psRequest = null; psIn = null; psOut = null; oBusSvc = null; } }

Asynchronous Server Requests
SubmitRequest
function SubmitRequest(Inputs:PropertySet, Outputs:PropertySet) { var oBusSvc:Service = oApp.GetService("Server Requests SCM"); var psRequest:PropertySet; var psIn:PropertySet; var psOut:PropertySet = oApp.NewPropertySet(); try { if(bIsTraceOn) oApp.Trace(Name() + ".SubmitRequest"); if(!isEnabled(Inputs)) return ContinueOperation; // feature is disabled if(Inputs.GetChildCount == 0) oApp.RaiseErrorText(Name() + ": No WF input found !"); psIn = Inputs.Copy(); psRequest = psIn.GetChild(0); setProfileAttr(psRequest); var sInputs:chars = getSerializedPS(psRequest); psRequest.Reset(); // clear input property psRequest.SetProperty("Serialized Input", sInputs); psRequest.SetProperty("ProcessName", "EAI Workflow Process Manager SCM"); psIn.SetProperty("Mode", "DirectDb"); setWorkspaceId(psRequest); psIn.AddChild(psRequest); oBusSvc.InvokeMethod("SubmitRequest", psIn, psOut); copyPS(psOut, Outputs); return CancelOperation; } catch(e) { if(bIsTraceOn) oApp.Trace(Name() + ".SubmitRequest exception=" + e.toString()); throw e; } finally { psRequest = null; psIn = null; psOut = null; oBusSvc = null; } }

Asynchronous Server Requests
copyPS
function copyPS(psSource:PropertySet, psDest:PropertySet) { /*************************************************************************************************** ** Author: Jan Hengst ** Descr: Copies psSource into psDest. ** Params: psSource - source propertyset ** psDest - target propertyset ***************************************************************************************************/ var psChild:PropertySet; try { var sPropName:chars = psSource.GetFirstProperty(); // loop through toplevel src PS while (sPropName != "") { var sPropVal:chars = psSource.GetProperty(sPropName); if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: sPropName=" + sPropName + ",sPropVal=" + sPropVal); psDest.SetProperty(sPropName, sPropVal); // copy all properties sPropName = psSource.GetNextProperty(); } var iChildCount:float = psSource.GetChildCount(); // loop children of toplevel src PS if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: iChildCount=" + iChildCount); for(var i:float = 0; i < iChildCount; i++) { psChild = psSource.GetChild(i).Copy(); var sType:chars = psChild.GetType(); if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: copy child " + i + ",sType=" + sType); psChild.SetType(sType); psDest.AddChild(psChild); // copy all child PS } } finally { psChild = null; } }

Asynchronous Server Requests
copyPS
function copyPS(psSource:PropertySet, psDest:PropertySet) { /*************************************************************************************************** ** Author: Jan Hengst ** Descr: Copies psSource into psDest. ** Params: psSource - source propertyset ** psDest - target propertyset ***************************************************************************************************/ var psChild:PropertySet; try { var sPropName:chars = psSource.GetFirstProperty(); // loop through toplevel src PS while (sPropName != "") { var sPropVal:chars = psSource.GetProperty(sPropName); if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: sPropName=" + sPropName + ",sPropVal=" + sPropVal); psDest.SetProperty(sPropName, sPropVal); // copy all properties sPropName = psSource.GetNextProperty(); } var iChildCount:float = psSource.GetChildCount(); // loop children of toplevel src PS if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: iChildCount=" + iChildCount); for(var i:float = 0; i < iChildCount; i++) { psChild = psSource.GetChild(i).Copy(); var sType:chars = psChild.GetType(); if(bIsTraceOn) oApp.Trace(Name() + ".copyPS: copy child " + i + ",sType=" + sType); psChild.SetType(sType); psDest.AddChild(psChild); // copy all child PS } } finally { psChild = null; } }

Asynchronous Server Requests
getSerializedPS
function getSerializedPS(ps:PropertySet) { /*************************************************************************************************** ** Author: Jan Hengst ** Descr: Serializes PS to string using vanila serializer. ** Params: ps - property set to serialize ** Returns: string - serialized representatino of PS ***************************************************************************************************/ var oBusSvc:Service = oApp.GetService("Workflow Utilities"); var psOut:PropertySet = oApp.NewPropertySet(); try { oBusSvc.InvokeMethod("PropSetToText", ps, psOut); return psOut.GetValue(); } finally { psOut = null; oBusSvc = null; } }

Asynchronous Server Requests
getSerializedPS
function getSerializedPS(ps:PropertySet) { /*************************************************************************************************** ** Author: Jan Hengst ** Descr: Serializes PS to string using vanila serializer. ** Params: ps - property set to serialize ** Returns: string - serialized representatino of PS ***************************************************************************************************/ var oBusSvc:Service = oApp.GetService("Workflow Utilities"); var psOut:PropertySet = oApp.NewPropertySet(); try { oBusSvc.InvokeMethod("PropSetToText", ps, psOut); return psOut.GetValue(); } finally { psOut = null; oBusSvc = null; } }

Asynchronous Server Requests
isEnabled
function isEnabled(Inputs:PropertySet) { var oAdminCodeBC:BusComp; try { var sComponent:chars = Inputs.GetProperty("Component"); if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: sComponent=" + sComponent); if(sComponent.indexOf("WfProc") != 0 || sComponent.indexOf("Batch") > -1) return false; oAdminCodeBC = TheApplication().utils.SCM_GetCachedACVBC(); oAdminCodeBC.ClearToQuery(); oAdminCodeBC.SetSearchExpr("[Code SCM] = 'Asynchronous Session Variables Enabled'"); oAdminCodeBC.ExecuteQuery(ForwardOnly); if(oAdminCodeBC.FirstRecord()) { var sValue:chars = oAdminCodeBC.GetFieldValue("Value SCM"); if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: sValue=" + sValue); return sValue.toLowerCase() == "true" ? true : false; } else { if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: no ACV"); return false; } } finally { oAdminCodeBC = null; } }

Asynchronous Server Requests
isEnabled
function isEnabled(Inputs:PropertySet) { var oAdminCodeBC:BusComp; try { var sComponent:chars = Inputs.GetProperty("Component"); if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: sComponent=" + sComponent); if(sComponent.indexOf("WfProc") != 0 || sComponent.indexOf("Batch") > -1) return false; oAdminCodeBC = TheApplication().utils.SCM_GetCachedACVBC(); oAdminCodeBC.ClearToQuery(); oAdminCodeBC.SetSearchExpr("[Code SCM] = 'Asynchronous Session Variables Enabled'"); oAdminCodeBC.ExecuteQuery(ForwardOnly); if(oAdminCodeBC.FirstRecord()) { var sValue:chars = oAdminCodeBC.GetFieldValue("Value SCM"); if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: sValue=" + sValue); return sValue.toLowerCase() == "true" ? true : false; } else { if(bIsTraceOn) oApp.Trace(Name() + ".isEnabled: no ACV"); return false; } } finally { oAdminCodeBC = null; } }

Asynchronous Server Requests
setProfileAttr
function setProfileAttr(ps:PropertySet) { var aProfAttrs:Array; try { var sProfAttrList:chars = oApp.GetProfileAttr("SPE Default Profile Attributes"); if(bIsTraceOn) oApp.Trace(Name() + ".setProfileAttr: sProfAttrList=" + sProfAttrList); if(sProfAttrList != "") { aProfAttrs = sProfAttrList.split(","); for(var i:float = 0; i < aProfAttrs.length; i++) { var sProfAttrName:chars = aProfAttrs[i].replace(/^\s*(.*?)\s*$/, "$1"); // strip leading and trailing whitespaces ps.SetProperty("PA_" + sProfAttrName, oApp.GetProfileAttr(sProfAttrName)); } } } finally { aProfAttrs = null; } }

Asynchronous Server Requests
setProfileAttr
function setProfileAttr(ps:PropertySet) { var aProfAttrs:Array; try { var sProfAttrList:chars = oApp.GetProfileAttr("SPE Default Profile Attributes"); if(bIsTraceOn) oApp.Trace(Name() + ".setProfileAttr: sProfAttrList=" + sProfAttrList); if(sProfAttrList != "") { aProfAttrs = sProfAttrList.split(","); for(var i:float = 0; i < aProfAttrs.length; i++) { var sProfAttrName:chars = aProfAttrs[i].replace(/^\s*(.*?)\s*$/, "$1"); // strip leading and trailing whitespaces ps.SetProperty("PA_" + sProfAttrName, oApp.GetProfileAttr(sProfAttrName)); } } } finally { aProfAttrs = null; } }

Asynchronous Server Requests
setWorkspaceId
function setWorkspaceId(ps:PropertySet) { var sWorkspaceId:chars = oApp.GetProfileAttr("Active JWS Id"); if(bIsTraceOn) oApp.Trace(Name() + ".setWorkspaceId: sWorkspaceId=" + sWorkspaceId); if(sWorkspaceId != "") ps.SetProperty("Active JWS Id", sWorkspaceId); }

Asynchronous Server Requests
setWorkspaceId
function setWorkspaceId(ps:PropertySet) { var sWorkspaceId:chars = oApp.GetProfileAttr("Active JWS Id"); if(bIsTraceOn) oApp.Trace(Name() + ".setWorkspaceId: sWorkspaceId=" + sWorkspaceId); if(sWorkspaceId != "") ps.SetProperty("Active JWS Id", sWorkspaceId); }

Auto Order Entry API SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var bsXmlUtil:Service; var bsGenericRetention:Service;

Auto Order Entry API SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var bsXmlUtil:Service; var bsGenericRetention:Service;

Auto Order Entry API SCM
AddAttributeListToProduct
function AddAttributeListToProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an arbitrary number of attributes to a product instance * * * * Input : - Product: the product instance (PropSet) * * - Attribute Name List: comma separated list with attribute names * * - Attribute Value List: comma separated list with attribute values * * Ouptut : - Product with attributes as child enities * * * * Date : 2013-08-28 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; var aNames:Array; var aValues:Array; var psIn:PropertySet; var psOut:PropertySet; var sNames; var sValues; try { // error handling/trace setup Trace(Name()+" -> Method AddAttributeListToProduct: START"); psProduct = null; aNames = null; aValues = null; sNames = ""; sValues = ""; psIn = null; psOut = null; for(var i = 0; i < Inputs.GetChildCount(); i++) { if (Inputs.GetChild(i).GetType() == "Product"){ psProduct = Inputs.GetChild(i); } } sNames = Inputs.GetProperty("Attribute Name List"); sValues = Inputs.GetProperty("Attribute Value List"); if ((psProduct != null) && (sNames != "") && (sValues !="")){ aNames = sNames.split(","); aValues = sValues.split(","); if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for attribute names and values are of different lengths"); } for(var j = 0; j<aNames.length; j++){ psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); psIn.SetProperty("Name", trim(aNames[j])); psIn.SetProperty("Value", trim(aValues[j])); CreateAttribute(psIn,psOut); psProduct.AddChild(psOut.GetChild(0)); psIn = null; psOut = null; } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psProduct); Trace(Name()+" -> Method AddAttributeListToProduct: END"); TracePropertySet(Outputs,Name()+" AddAttributeListToProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddAttributeListToProduct Error: "+sError); throw(e); } finally { psProduct = null; aNames = null; aValues = null; psIn = null; psOut = null; } }

Auto Order Entry API SCM
AddAttributeListToProduct
function AddAttributeListToProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an arbitrary number of attributes to a product instance * * * * Input : - Product: the product instance (PropSet) * * - Attribute Name List: comma separated list with attribute names * * - Attribute Value List: comma separated list with attribute values * * Ouptut : - Product with attributes as child enities * * * * Date : 2013-08-28 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; var aNames:Array; var aValues:Array; var psIn:PropertySet; var psOut:PropertySet; var sNames; var sValues; try { // error handling/trace setup Trace(Name()+" -> Method AddAttributeListToProduct: START"); psProduct = null; aNames = null; aValues = null; sNames = ""; sValues = ""; psIn = null; psOut = null; for(var i = 0; i < Inputs.GetChildCount(); i++) { if (Inputs.GetChild(i).GetType() == "Product"){ psProduct = Inputs.GetChild(i); } } sNames = Inputs.GetProperty("Attribute Name List"); sValues = Inputs.GetProperty("Attribute Value List"); if ((psProduct != null) && (sNames != "") && (sValues !="")){ aNames = sNames.split(","); aValues = sValues.split(","); if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for attribute names and values are of different lengths"); } for(var j = 0; j<aNames.length; j++){ psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); psIn.SetProperty("Name", trim(aNames[j])); psIn.SetProperty("Value", trim(aValues[j])); CreateAttribute(psIn,psOut); psProduct.AddChild(psOut.GetChild(0)); psIn = null; psOut = null; } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psProduct); Trace(Name()+" -> Method AddAttributeListToProduct: END"); TracePropertySet(Outputs,Name()+" AddAttributeListToProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddAttributeListToProduct Error: "+sError); throw(e); } finally { psProduct = null; aNames = null; aValues = null; psIn = null; psOut = null; } }

Auto Order Entry API SCM
AddAttributeToProduct
function AddAttributeToProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an attribute created by the use of ¿CreateAttribute¿ as a child to * the Product Instance * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; var psAttribute:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddAttributeToProduct: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "Product"){ psProduct = psTemp; } if (psTemp.GetType() == "Attribute"){ psAttribute = psTemp; } } if ((psProduct) && (psAttribute)){ psReturn = psProduct.Copy(); psTemp = psAttribute.Copy(); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddAttributeToProduct: END"); TracePropertySet(Outputs,Name()+" AddAttributeToProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddAttributeToProduct Error: "+sError); throw(e); } finally { psProduct = null; psAttribute = null; psTemp = null; psReturn = null; } }

Auto Order Entry API SCM
AddAttributeToProduct
function AddAttributeToProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an attribute created by the use of ¿CreateAttribute¿ as a child to * the Product Instance * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; var psAttribute:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddAttributeToProduct: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "Product"){ psProduct = psTemp; } if (psTemp.GetType() == "Attribute"){ psAttribute = psTemp; } } if ((psProduct) && (psAttribute)){ psReturn = psProduct.Copy(); psTemp = psAttribute.Copy(); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddAttributeToProduct: END"); TracePropertySet(Outputs,Name()+" AddAttributeToProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddAttributeToProduct Error: "+sError); throw(e); } finally { psProduct = null; psAttribute = null; psTemp = null; psReturn = null; } }

Auto Order Entry API SCM
AddChildEntity
function AddChildEntity(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an arbitrary entity (PropSet) as a child to another arbitrary entity (PropSet) * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psParent:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method AddChildEntity: START"); psReturn = oApp.NewPropertySet(); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "Parent Entity"){ psParent = psTemp; } if (psTemp.GetType() == "Child Entity"){ psChild = psTemp; } } if ((psParent) && (psChild) && (sChildType)){ psReturn = psParent.Copy(); psTemp = psChild.Copy(); psTemp.SetType(sChildType); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddChildEntity: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddChildEntity Error: "+sError); throw(e); } finally { psParent = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry API SCM
AddChildEntity
function AddChildEntity(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds an arbitrary entity (PropSet) as a child to another arbitrary entity (PropSet) * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psParent:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method AddChildEntity: START"); psReturn = oApp.NewPropertySet(); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "Parent Entity"){ psParent = psTemp; } if (psTemp.GetType() == "Child Entity"){ psChild = psTemp; } } if ((psParent) && (psChild) && (sChildType)){ psReturn = psParent.Copy(); psTemp = psChild.Copy(); psTemp.SetType(sChildType); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddChildEntity: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddChildEntity Error: "+sError); throw(e); } finally { psParent = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry API SCM
AddControlData
function AddControlData(Inputs:PropertySet, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Create the ControlData Entity if not existing and upserts arbitrary control data fields * to it * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : 2013-09-09 Dan Dragan: changed to take as input 2 lists: field name and value list * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var bControlDataFound:bool; var aNames:Array; var aValues:Array; var bIgnoreEmptyValues; try { // error handling/trace setup Trace(Name()+" -> Method AddControlData: START"); psReturn = oApp.NewPropertySet(); bControlDataFound = false; aNames = null; aValues = null; bIgnoreEmptyValues = "Y"; // per default do not add control data fields with no value for(var i = 0; i < Inputs.GetChildCount(); i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } } if ((psMsg) && (Inputs.PropertyExists("Control Data Name List")) && (Inputs.PropertyExists("Control Data Value List")) ){ /* Get required arguments */ psReturn = psMsg.Copy(); aNames = Inputs.GetProperty("Control Data Name List").split(","); aValues = Inputs.GetProperty("Control Data Value List").split(","); /* Get optional arguments */ if (Inputs.PropertyExists("Ignore Empty Values")) bIgnoreEmptyValues = Inputs.GetProperty("Ignore Empty Values"); /* Sanity check*/ if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for control data field names and values are of different lengths"); } /* Create / Update ControlData entity */ for(var j = 0; j < psReturn.GetChildCount(); j++) { if (psReturn.GetChild(j).GetType() == "ControlData"){ psTemp = psReturn.GetChild(j); bControlDataFound = true; break; }//end if ControlData }//end for if (bControlDataFound == false){ psTemp = oApp.NewPropertySet(); psTemp.SetType("ControlData"); psReturn.AddChild(psTemp); } for(var k=0; k<aNames.length; k++) { if ((trim(aValues[k]).length > 0) || (trim(aValues[k]).length == 0 && bIgnoreEmptyValues == "N")) psTemp.SetProperty(trim(aNames[k]), trim(aValues[k])); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddControlData: END"); TracePropertySet(Outputs,Name()+" AddControlData Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddControlData Error: "+sError); throw(e); } finally { psMsg = null; psReturn = null; psTemp = null; aNames = null; aValues = null; } }

Auto Order Entry API SCM
AddControlData
function AddControlData(Inputs:PropertySet, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Create the ControlData Entity if not existing and upserts arbitrary control data fields * to it * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : 2013-09-09 Dan Dragan: changed to take as input 2 lists: field name and value list * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var bControlDataFound:bool; var aNames:Array; var aValues:Array; var bIgnoreEmptyValues; try { // error handling/trace setup Trace(Name()+" -> Method AddControlData: START"); psReturn = oApp.NewPropertySet(); bControlDataFound = false; aNames = null; aValues = null; bIgnoreEmptyValues = "Y"; // per default do not add control data fields with no value for(var i = 0; i < Inputs.GetChildCount(); i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } } if ((psMsg) && (Inputs.PropertyExists("Control Data Name List")) && (Inputs.PropertyExists("Control Data Value List")) ){ /* Get required arguments */ psReturn = psMsg.Copy(); aNames = Inputs.GetProperty("Control Data Name List").split(","); aValues = Inputs.GetProperty("Control Data Value List").split(","); /* Get optional arguments */ if (Inputs.PropertyExists("Ignore Empty Values")) bIgnoreEmptyValues = Inputs.GetProperty("Ignore Empty Values"); /* Sanity check*/ if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for control data field names and values are of different lengths"); } /* Create / Update ControlData entity */ for(var j = 0; j < psReturn.GetChildCount(); j++) { if (psReturn.GetChild(j).GetType() == "ControlData"){ psTemp = psReturn.GetChild(j); bControlDataFound = true; break; }//end if ControlData }//end for if (bControlDataFound == false){ psTemp = oApp.NewPropertySet(); psTemp.SetType("ControlData"); psReturn.AddChild(psTemp); } for(var k=0; k<aNames.length; k++) { if ((trim(aValues[k]).length > 0) || (trim(aValues[k]).length == 0 && bIgnoreEmptyValues == "N")) psTemp.SetProperty(trim(aNames[k]), trim(aValues[k])); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddControlData: END"); TracePropertySet(Outputs,Name()+" AddControlData Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddControlData Error: "+sError); throw(e); } finally { psMsg = null; psReturn = null; psTemp = null; aNames = null; aValues = null; } }

Auto Order Entry API SCM
AddEntityToMsg
function AddEntityToMsg(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds a custom entity to the "Entities" element in the message * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psEntity:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddEntityToMsg: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } if (psTemp.GetType() == "Entity"){ psEntity = psTemp; } } if ((psMsg) && (psEntity)){ psReturn = psMsg.Copy(); nChilds = psReturn.GetChildCount(); for(var j = 0; j < nChilds; j++) { //if "Entities" Entity found, extract it from the message, add the new Entity to it //and replace the old Entities child with the enriched one if (psReturn.GetChild(j).GetType() == "Entities"){ psTemp = psReturn.GetChild(j).Copy(); psTemp.AddChild(psEntity); psReturn.RemoveChild(j); psReturn.InsertChildAt(psTemp,j); }//end if Entities }//end for } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddEntityToMsg: END"); TracePropertySet(Outputs,Name()+" AddEntityToMsg Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddEntityToMsg Error: "+sError); throw(e); } finally { psMsg = null; psEntity = null; psReturn = null; psTemp = null; } }

Auto Order Entry API SCM
AddEntityToMsg
function AddEntityToMsg(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds a custom entity to the "Entities" element in the message * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psEntity:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddEntityToMsg: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } if (psTemp.GetType() == "Entity"){ psEntity = psTemp; } } if ((psMsg) && (psEntity)){ psReturn = psMsg.Copy(); nChilds = psReturn.GetChildCount(); for(var j = 0; j < nChilds; j++) { //if "Entities" Entity found, extract it from the message, add the new Entity to it //and replace the old Entities child with the enriched one if (psReturn.GetChild(j).GetType() == "Entities"){ psTemp = psReturn.GetChild(j).Copy(); psTemp.AddChild(psEntity); psReturn.RemoveChild(j); psReturn.InsertChildAt(psTemp,j); }//end if Entities }//end for } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddEntityToMsg: END"); TracePropertySet(Outputs,Name()+" AddEntityToMsg Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddEntityToMsg Error: "+sError); throw(e); } finally { psMsg = null; psEntity = null; psReturn = null; psTemp = null; } }

Auto Order Entry API SCM
AddProductToProductSet
function AddProductToProductSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds a product instance created by the use of ¿CreateProduct¿, ¿CreateAttribute¿ * and ¿AddAttributeToProduct¿ as a child to the ProductSet in the message instance * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psProduct:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddProductToProductSet: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } if (psTemp.GetType() == "Product"){ psProduct = psTemp; } } if ((psMsg) && (psProduct)){ psReturn = psMsg.Copy(); for(i = 0; i < psReturn.GetChildCount(); i++) { //if "Entities" Entity found, extract the ProductSet from it, add the Product to the ProductSet //and replace the old ProductSet with the enriched ProductSet if (psReturn.GetChild(i).GetType() == "Entities"){ nChilds = psReturn.GetChild(i).GetChildCount(); for (var j=0; j < nChilds; j++){ if (psReturn.GetChild(i).GetChild(j).GetType() == "ProductSet"){ psTemp = psReturn.GetChild(i).GetChild(j).Copy(); psTemp.AddChild(psProduct); psReturn.GetChild(i).RemoveChild(j); psReturn.GetChild(i).InsertChildAt(psTemp,j); }//end if ProductSet }//end for }//end if Entities }//end for } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddProductToProductSet: END"); TracePropertySet(Outputs,Name()+" AddProductToProductSet Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddProductToProductSet Error: "+sError); throw(e); } finally { psMsg = null; psProduct = null; psReturn = null; psTemp = null; } }

Auto Order Entry API SCM
AddProductToProductSet
function AddProductToProductSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Adds a product instance created by the use of ¿CreateProduct¿, ¿CreateAttribute¿ * and ¿AddAttributeToProduct¿ as a child to the ProductSet in the message instance * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psMsg:PropertySet; var psProduct:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method AddProductToProductSet: START"); psReturn = oApp.NewPropertySet(); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "RequestMsg"){ psMsg = psTemp; } if (psTemp.GetType() == "Product"){ psProduct = psTemp; } } if ((psMsg) && (psProduct)){ psReturn = psMsg.Copy(); for(i = 0; i < psReturn.GetChildCount(); i++) { //if "Entities" Entity found, extract the ProductSet from it, add the Product to the ProductSet //and replace the old ProductSet with the enriched ProductSet if (psReturn.GetChild(i).GetType() == "Entities"){ nChilds = psReturn.GetChild(i).GetChildCount(); for (var j=0; j < nChilds; j++){ if (psReturn.GetChild(i).GetChild(j).GetType() == "ProductSet"){ psTemp = psReturn.GetChild(i).GetChild(j).Copy(); psTemp.AddChild(psProduct); psReturn.GetChild(i).RemoveChild(j); psReturn.GetChild(i).InsertChildAt(psTemp,j); }//end if ProductSet }//end for }//end if Entities }//end for } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddProductToProductSet: END"); TracePropertySet(Outputs,Name()+" AddProductToProductSet Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddProductToProductSet Error: "+sError); throw(e); } finally { psMsg = null; psProduct = null; psReturn = null; psTemp = null; } }

Auto Order Entry API SCM
AddQuoteData
function AddQuoteData(Inputs, Outputs, EntityName) { /**************************************************************************************************** * Author : Raphaël Lesceux (TGDLERA4) * * Purpose : Upserts arbitrary fields in the Entity/Quote * * Prerequisites: Entity / Quote should exist * * Date : 2014-12-08 * *---------------------------------------------------------------------------------------------------* * Update : 2014-12-10 - add check for RouterNotNeededFlag * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var psTemp:PropertySet; var psSubRoutineOutput:PropertySet; var nChilds:Number; var propName:String; var propVal:String; var RouterNotNeededFlag:String; var aNames:Array; var aValues:Array; var bIgnoreEmptyValues; try { // error handling/trace setup Trace(Name()+" -> Method AddQuoteToEntity: START"); bIgnoreEmptyValues = "Y"; // per default do not add control data fields with no value nChilds = Inputs.GetChildCount(); if (nChilds == 1){ psReturn = oApp.NewPropertySet(); psReturn = Inputs.GetChild(0).Copy(); aNames = Inputs.GetProperty("Quote Data Name List").split(","); aValues = Inputs.GetProperty("Quote Data Value List").split(","); /* Sanity check*/ if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for control data field names and values are of different lengths"); } /* Set Properties from arrays */ if (psReturn.GetType() == EntityName){ for(var k=0; k<aNames.length; k++) { if ((trim(aValues[k]).length > 0) || (trim(aValues[k]).length == 0 && bIgnoreEmptyValues == "N")) psReturn.SetProperty(trim(aNames[k]), trim(aValues[k])); } /* Check if RouterNotNeededFlag is there, if yes, add it to the properties */ if (Inputs.PropertyExists("RouterNotNeededFlag") && (Inputs.GetProperty("RouterNotNeededFlag") == "Y")) { propVal = Inputs.GetProperty("RouterNotNeededFlag"); psReturn.SetProperty("RouterNotNeededFlag", propVal); } } else{ // call AddQuoteData recursively for all entities in this message part // and then replace the current child with the method call output nChilds = psReturn.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = psReturn.GetChild(i); psSubRoutineOutput = null; psSubRoutineOutput = oApp.NewPropertySet(); Inputs.RemoveChild(0); Inputs.AddChild(psTemp); AddQuoteData(Inputs,psSubRoutineOutput,EntityName); psTemp = psSubRoutineOutput.GetChild(0); psReturn.RemoveChild(i); psReturn.InsertChildAt(psTemp,i); } } }//end if else { oApp.RaiseErrorText("Exactly one child hierarch containing the request message expected! Found: '" + nChilds + "' child hierarchies."); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddQuoteToEntity: END"); TracePropertySet(Outputs,Name()+" AddQuoteToEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddQuoteToEntity Error: "+sError); throw(e); } finally { psReturn = null; psTemp = null; psSubRoutineOutput = null; aNames = null; aValues = null; } }

Auto Order Entry API SCM
AddQuoteData
function AddQuoteData(Inputs, Outputs, EntityName) { /**************************************************************************************************** * Author : Raphaël Lesceux (TGDLERA4) * * Purpose : Upserts arbitrary fields in the Entity/Quote * * Prerequisites: Entity / Quote should exist * * Date : 2014-12-08 * *---------------------------------------------------------------------------------------------------* * Update : 2014-12-10 - add check for RouterNotNeededFlag * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var psTemp:PropertySet; var psSubRoutineOutput:PropertySet; var nChilds:Number; var propName:String; var propVal:String; var RouterNotNeededFlag:String; var aNames:Array; var aValues:Array; var bIgnoreEmptyValues; try { // error handling/trace setup Trace(Name()+" -> Method AddQuoteToEntity: START"); bIgnoreEmptyValues = "Y"; // per default do not add control data fields with no value nChilds = Inputs.GetChildCount(); if (nChilds == 1){ psReturn = oApp.NewPropertySet(); psReturn = Inputs.GetChild(0).Copy(); aNames = Inputs.GetProperty("Quote Data Name List").split(","); aValues = Inputs.GetProperty("Quote Data Value List").split(","); /* Sanity check*/ if (aNames.length != aValues.length){ oApp.RaiseErrorText("The two lists for control data field names and values are of different lengths"); } /* Set Properties from arrays */ if (psReturn.GetType() == EntityName){ for(var k=0; k<aNames.length; k++) { if ((trim(aValues[k]).length > 0) || (trim(aValues[k]).length == 0 && bIgnoreEmptyValues == "N")) psReturn.SetProperty(trim(aNames[k]), trim(aValues[k])); } /* Check if RouterNotNeededFlag is there, if yes, add it to the properties */ if (Inputs.PropertyExists("RouterNotNeededFlag") && (Inputs.GetProperty("RouterNotNeededFlag") == "Y")) { propVal = Inputs.GetProperty("RouterNotNeededFlag"); psReturn.SetProperty("RouterNotNeededFlag", propVal); } } else{ // call AddQuoteData recursively for all entities in this message part // and then replace the current child with the method call output nChilds = psReturn.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = psReturn.GetChild(i); psSubRoutineOutput = null; psSubRoutineOutput = oApp.NewPropertySet(); Inputs.RemoveChild(0); Inputs.AddChild(psTemp); AddQuoteData(Inputs,psSubRoutineOutput,EntityName); psTemp = psSubRoutineOutput.GetChild(0); psReturn.RemoveChild(i); psReturn.InsertChildAt(psTemp,i); } } }//end if else { oApp.RaiseErrorText("Exactly one child hierarch containing the request message expected! Found: '" + nChilds + "' child hierarchies."); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddQuoteToEntity: END"); TracePropertySet(Outputs,Name()+" AddQuoteToEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddQuoteToEntity Error: "+sError); throw(e); } finally { psReturn = null; psTemp = null; psSubRoutineOutput = null; aNames = null; aValues = null; } }

Auto Order Entry API SCM
CreateAttribute
function CreateAttribute(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instance of an attribute defined by the input fields * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psAttr:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateAttribute: START"); psAttr = oApp.NewPropertySet(); psAttr.SetType("Attribute"); psAttr.SetProperty("Name",Inputs.GetProperty("Name")); psAttr.SetProperty("Value",Inputs.GetProperty("Value")); //if Sequence is not null, add it to the product if(Inputs.GetProperty("Sequence")){ psAttr.SetProperty("Sequence",Inputs.GetProperty("Sequence")) }; Outputs.AddChild(psAttr); Trace(Name()+" -> Method CreateAttribute: END"); TracePropertySet(Outputs,Name()+" CreateAttribute Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateAttribute Error: "+sError); throw(e); } finally { psAttr = null; } }

Auto Order Entry API SCM
CreateAttribute
function CreateAttribute(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instance of an attribute defined by the input fields * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psAttr:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateAttribute: START"); psAttr = oApp.NewPropertySet(); psAttr.SetType("Attribute"); psAttr.SetProperty("Name",Inputs.GetProperty("Name")); psAttr.SetProperty("Value",Inputs.GetProperty("Value")); //if Sequence is not null, add it to the product if(Inputs.GetProperty("Sequence")){ psAttr.SetProperty("Sequence",Inputs.GetProperty("Sequence")) }; Outputs.AddChild(psAttr); Trace(Name()+" -> Method CreateAttribute: END"); TracePropertySet(Outputs,Name()+" CreateAttribute Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateAttribute Error: "+sError); throw(e); } finally { psAttr = null; } }

Auto Order Entry API SCM
CreateEntity
function CreateEntity(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instace of an arbitrary entity defined by the fields specified in the input * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method CreateEntity: START"); psReturn = oApp.NewPropertySet(); psReturn.SetType("Entity"); propName = ""; propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method CreateEntity: END"); TracePropertySet(Outputs,Name()+" CreateEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateEntity Error: "+sError); throw(e); } finally { psReturn = null; } }

Auto Order Entry API SCM
CreateEntity
function CreateEntity(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instace of an arbitrary entity defined by the fields specified in the input * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method CreateEntity: START"); psReturn = oApp.NewPropertySet(); psReturn.SetType("Entity"); propName = ""; propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method CreateEntity: END"); TracePropertySet(Outputs,Name()+" CreateEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateEntity Error: "+sError); throw(e); } finally { psReturn = null; } }

Auto Order Entry API SCM
CreateMsgBody
function CreateMsgBody(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Create a PropSet containing following empty childs: - Context * - Entities with childs: * - ServiceRequest * - ProductSet * * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psChild:PropertySet; var psTemp:PropertySet; var psMsg:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateMsgBody: START"); psMsg = oApp.NewPropertySet(); psMsg.SetType("RequestMsg"); psChild = oApp.NewPropertySet(); psChild.SetType("Context"); psMsg.AddChild(psChild); psChild = oApp.NewPropertySet(); psChild.SetType("Entities"); psTemp = oApp.NewPropertySet(); psTemp.SetType("ServiceRequest"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("ProductSet"); psChild.AddChild(psTemp); psMsg.AddChild(psChild); Outputs.AddChild(psMsg); Trace(Name()+" -> Method CreateMsgBody: END"); TracePropertySet(Outputs,Name()+" CreateMsgBody Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateMsgBody Error: "+sError); throw(e); } finally { psChild = null; psTemp = null; psMsg = null; } }

Auto Order Entry API SCM
CreateMsgBody
function CreateMsgBody(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Create a PropSet containing following empty childs: - Context * - Entities with childs: * - ServiceRequest * - ProductSet * * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psChild:PropertySet; var psTemp:PropertySet; var psMsg:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateMsgBody: START"); psMsg = oApp.NewPropertySet(); psMsg.SetType("RequestMsg"); psChild = oApp.NewPropertySet(); psChild.SetType("Context"); psMsg.AddChild(psChild); psChild = oApp.NewPropertySet(); psChild.SetType("Entities"); psTemp = oApp.NewPropertySet(); psTemp.SetType("ServiceRequest"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("ProductSet"); psChild.AddChild(psTemp); psMsg.AddChild(psChild); Outputs.AddChild(psMsg); Trace(Name()+" -> Method CreateMsgBody: END"); TracePropertySet(Outputs,Name()+" CreateMsgBody Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateMsgBody Error: "+sError); throw(e); } finally { psChild = null; psTemp = null; psMsg = null; } }

Auto Order Entry API SCM
CreateMsgBodyExtended
function CreateMsgBodyExtended(Inputs, Outputs) { /**************************************************************************************************** * Author : Marcus Fischer (TGDFIMA9) * * Purpose : Create a PropSet containing following empty childs: - Context * - Entities with childs: * - ServiceRequest - Quote * - ProductSet * * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psChild:PropertySet; var psTemp:PropertySet; var psMsg:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateMsgBody: START"); psMsg = oApp.NewPropertySet(); psMsg.SetType("RequestMsg"); psChild = oApp.NewPropertySet(); psChild.SetType("Context"); psMsg.AddChild(psChild); psChild = oApp.NewPropertySet(); psChild.SetType("Entities"); psTemp = oApp.NewPropertySet(); psTemp.SetType("ServiceRequest"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("Quote"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("ProductSet"); psChild.AddChild(psTemp); psMsg.AddChild(psChild); Outputs.AddChild(psMsg); Trace(Name()+" -> Method CreateMsgBody: END"); TracePropertySet(Outputs,Name()+" CreateMsgBody Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateMsgBody Error: "+sError); throw(e); } finally { psChild = null; psTemp = null; psMsg = null; } }

Auto Order Entry API SCM
CreateMsgBodyExtended
function CreateMsgBodyExtended(Inputs, Outputs) { /**************************************************************************************************** * Author : Marcus Fischer (TGDFIMA9) * * Purpose : Create a PropSet containing following empty childs: - Context * - Entities with childs: * - ServiceRequest - Quote * - ProductSet * * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psChild:PropertySet; var psTemp:PropertySet; var psMsg:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateMsgBody: START"); psMsg = oApp.NewPropertySet(); psMsg.SetType("RequestMsg"); psChild = oApp.NewPropertySet(); psChild.SetType("Context"); psMsg.AddChild(psChild); psChild = oApp.NewPropertySet(); psChild.SetType("Entities"); psTemp = oApp.NewPropertySet(); psTemp.SetType("ServiceRequest"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("Quote"); psChild.AddChild(psTemp); psTemp = oApp.NewPropertySet(); psTemp.SetType("ProductSet"); psChild.AddChild(psTemp); psMsg.AddChild(psChild); Outputs.AddChild(psMsg); Trace(Name()+" -> Method CreateMsgBody: END"); TracePropertySet(Outputs,Name()+" CreateMsgBody Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateMsgBody Error: "+sError); throw(e); } finally { psChild = null; psTemp = null; psMsg = null; } }

Auto Order Entry API SCM
CreateProduct
function CreateProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instance of an product defined by the input fields. * Product attributes have to be created and added separately by using * CreateAttribute and AddAttributeToProduct * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateProduct: START"); psProduct = oApp.NewPropertySet(); psProduct.SetType("Product"); psProduct.SetProperty("Name",Inputs.GetProperty("Name")); psProduct.SetProperty("Operation",Inputs.GetProperty("Operation")); //if AssetIntegrationId is not null, add it to the product if(Inputs.GetProperty("AssetIntegrationId")){ psProduct.SetProperty("AssetIntegrationId",Inputs.GetProperty("AssetIntegrationId")) }; if(Inputs.GetProperty("Type")){ psProduct.SetProperty("Type",Inputs.GetProperty("Type")) }; //TAAKOFR2 10062015 REQ_WP-753_SBL-41600:Bundle Processing - Adoption Module in Automatic Order Entry //new parameter Type added Outputs.AddChild(psProduct); Trace(Name()+" -> Method CreateProduct: END"); TracePropertySet(Outputs,Name()+" CreateProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateProduct Error: "+sError); throw(e); } finally { psProduct = null; } }

Auto Order Entry API SCM
CreateProduct
function CreateProduct(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates an instance of an product defined by the input fields. * Product attributes have to be created and added separately by using * CreateAttribute and AddAttributeToProduct * * Date : 2012-07-03 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psProduct:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CreateProduct: START"); psProduct = oApp.NewPropertySet(); psProduct.SetType("Product"); psProduct.SetProperty("Name",Inputs.GetProperty("Name")); psProduct.SetProperty("Operation",Inputs.GetProperty("Operation")); //if AssetIntegrationId is not null, add it to the product if(Inputs.GetProperty("AssetIntegrationId")){ psProduct.SetProperty("AssetIntegrationId",Inputs.GetProperty("AssetIntegrationId")) }; if(Inputs.GetProperty("Type")){ psProduct.SetProperty("Type",Inputs.GetProperty("Type")) }; //TAAKOFR2 10062015 REQ_WP-753_SBL-41600:Bundle Processing - Adoption Module in Automatic Order Entry //new parameter Type added Outputs.AddChild(psProduct); Trace(Name()+" -> Method CreateProduct: END"); TracePropertySet(Outputs,Name()+" CreateProduct Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CreateProduct Error: "+sError); throw(e); } finally { psProduct = null; } }

Auto Order Entry API SCM
MapFields
function MapFields(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates the AOE message with the help of an EAI Data Map * Fields with NULL values will be filtered out * * Date : 2013-11-15 * * * * Note : List naming convention: "<Entity Name> Name List" and rsp. "<Entity Name> Value List", * * where <Entity Name> does not contain any white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ /* declarations */ var psInput:PropertySet; var psOutput:PropertySet var psAoeMsg:PropertySet; var bsEaiDataMap:Service; var bsPrmAniUtil:Service; var bsXmlConverter:Service; var psEaiDummy:PropertySet; var sMapName:String; var sDataMapIO:String; var propName:String; var propVal:String; var aListNames:Array; var aListValues:Array; var aPropName:Array; var k:Number; try { // error handling/trace setup Trace(Name()+" -> Method MapFields: START"); /* init START */ sMapName = "AOE Message Creation SCM"; sDataMapIO = "AOE Generic Message SCM"; psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); psAoeMsg = oApp.NewPropertySet(); bsEaiDataMap = oApp.GetService("EAI Data Transformation Engine"); bsPrmAniUtil = oApp.GetService("PRM ANI Utility Service"); bsXmlConverter = oApp.GetService("EAI Integration Object to XML Hierarchy Converter"); propName = ""; aListNames = null; aListValues = null; aPropName = null; k = 0; /* init END */ /* create EAI Dummy IO */ psInput.SetProperty("Hierarchy Name","EAI Dummy SCM"); bsPrmAniUtil.InvokeMethod("CreateEmptyPropSet",psInput,psOutput); psEaiDummy = psOutput.GetChild(0); psInput.Reset(); psOutput.Reset(); psInput.SetProperty("MapName", sMapName); psInput.SetProperty("OutputIntObjectName", sDataMapIO); psInput.AddChild(psEaiDummy); /* copy input arguments to data map input arguments and transform lists */ propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); aPropName = propName.split(" "); if (aPropName.length != 3 || (aPropName[1] != "Name" && aPropName[1] != "Value") || aPropName[2] != "List"){ /* input property is not a list -> copy it to data map input */ psInput.SetProperty(propName, propVal);} else{ if (aPropName[1] == "Value"){ /* input property is a field value list -> do nothing */ } else{ /* input property is a field name list -> transform */ aListNames = []; aListValues = []; /* init array */ splitByChar(propVal,",", aListNames); /* vanilla function returns lenght = 1 even if input is null */ splitByChar(Inputs.GetProperty(aPropName[0] + " Value List"),",", aListValues); /* custom split function to ignore commas inside apostrophees -> allow values with comma*/ if (aListNames.length != aListValues.length){ Trace(Name()+" -> Method MapFields: Entity '" +aPropName[0]+ "' name list length = " + aListNames.length); Trace(Name()+" -> Method MapFields: Entity '" +aPropName[0]+ "' value list length = " + aListValues.length); oApp.RaiseErrorText("The '" + aPropName[0] + "' entity field name / value lists are of different lengths"); } else{ for(k=0; k<aListNames.length; k++) { /* set data map argument name prefix based on entity type */ switch (aPropName[0]){ case "C

Auto Order Entry API SCM
MapFields
function MapFields(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Creates the AOE message with the help of an EAI Data Map * Fields with NULL values will be filtered out * * Date : 2013-11-15 * * * * Note : List naming convention: "<Entity Name> Name List" and rsp. "<Entity Name> Value List", * * where <Entity Name> does not contain any white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ /* declarations */ var psInput:PropertySet; var psOutput:PropertySet var psAoeMsg:PropertySet; var bsEaiDataMap:Service; var bsPrmAniUtil:Service; var bsXmlConverter:Service; var psEaiDummy:PropertySet; var sMapName:String; var sDataMapIO:String; var propName:String; var propVal:String; var aListNames:Array; var aListValues:Array; var aPropName:Array; var k:Number; try { // error handling/trace setup Trace(Name()+" -> Method MapFields: START"); /* init START */ sMapName = "AOE Message Creation SCM"; sDataMapIO = "AOE Generic Message SCM"; psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); psAoeMsg = oApp.NewPropertySet(); bsEaiDataMap = oApp.GetService("EAI Data Transformation Engine"); bsPrmAniUtil = oApp.GetService("PRM ANI Utility Service"); bsXmlConverter = oApp.GetService("EAI Integration Object to XML Hierarchy Converter"); propName = ""; aListNames = null; aListValues = null; aPropName = null; k = 0; /* init END */ /* create EAI Dummy IO */ psInput.SetProperty("Hierarchy Name","EAI Dummy SCM"); bsPrmAniUtil.InvokeMethod("CreateEmptyPropSet",psInput,psOutput); psEaiDummy = psOutput.GetChild(0); psInput.Reset(); psOutput.Reset(); psInput.SetProperty("MapName", sMapName); psInput.SetProperty("OutputIntObjectName", sDataMapIO); psInput.AddChild(psEaiDummy); /* copy input arguments to data map input arguments and transform lists */ propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); aPropName = propName.split(" "); if (aPropName.length != 3 || (aPropName[1] != "Name" && aPropName[1] != "Value") || aPropName[2] != "List"){ /* input property is not a list -> copy it to data map input */ psInput.SetProperty(propName, propVal);} else{ if (aPropName[1] == "Value"){ /* input property is a field value list -> do nothing */ } else{ /* input property is a field name list -> transform */ aListNames = []; aListValues = []; /* init array */ splitByChar(propVal,",", aListNames); /* vanilla function returns lenght = 1 even if input is null */ splitByChar(Inputs.GetProperty(aPropName[0] + " Value List"),",", aListValues); /* custom split function to ignore commas inside apostrophees -> allow values with comma*/ if (aListNames.length != aListValues.length){ Trace(Name()+" -> Method MapFields: Entity '" +aPropName[0]+ "' name list length = " + aListNames.length); Trace(Name()+" -> Method MapFields: Entity '" +aPropName[0]+ "' value list length = " + aListValues.length); oApp.RaiseErrorText("The '" + aPropName[0] + "' entity field name / value lists are of different lengths"); } else{ for(k=0; k<aListNames.length; k++) { /* set data map argument name prefix based on entity type */ switch (aPropName[0]){ case "C

Auto Order Entry API SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Auto Order Entry API SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Auto Order Entry API SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Auto Order Entry API SCM" * * Author : Dan Dragan (TGDDRDA3) * * Purpose : * Date : 2012-07-03 * *-------------------------------------------------------------------------------------------------* * Update : 1) Dan Dragan 2013-08-28 added method AddAttributeListToProduct * * 2) Dan Dragan 2013-11-18 added method MapFields * * 3) Dan Dragan 2013-11-21 added method ValidateAoeMsgByExample * * 4) Raphael Lesceux 2014-12-08 added method AddQuoteData * **************************************************************************************************/ var iReturn = CancelOperation; var psTemp:PropertySet; var psAoeMsg:PropertySet; var psExampleAoeMsg:PropertySet; oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "CreateMsgBody": CreateMsgBody(Inputs, Outputs); break; case "CreateMsgBodyExtended": CreateMsgBodyExtended (Inputs, Outputs); break; case "CreateProduct": CreateProduct(Inputs, Outputs); break; case "CreateAttribute": CreateAttribute(Inputs, Outputs); break; case "CreateEntity": CreateEntity(Inputs, Outputs); break; case "AddProductToProductSet": AddProductToProductSet(Inputs, Outputs); break; case "AddAttributeToProduct": AddAttributeToProduct(Inputs, Outputs); break; case "AddChildEntity": AddChildEntity(Inputs, Outputs); break; case "AddContextData": UpsertDataToEntity(Inputs, Outputs,"Context"); break; case "AddControlData": AddControlData(Inputs, Outputs); break; case "AddSvcReqData": UpsertDataToEntity(Inputs, Outputs,"ServiceRequest"); break; /*MA_FI - 20140403 added for quote-entity case "AddQuoteData": UpsertDataToEntity(Inputs, Outputs,"Quote"); break; */ /* Added for March 2015 Release */ case "AddQuoteData": AddQuoteData(Inputs, Outputs,"Quote"); break; case "AddEntityToMsg": AddEntityToMsg(Inputs, Outputs); break; case "AddAttributeListToProduct": AddAttributeListToProduct(Inputs, Outputs); break; case "MapFields": MapFields(Inputs, Outputs); break; case "ValidateAoeMsgByExample": bsXmlUtil = oApp.GetService("XML Hierarchy Utilities SCM"); bsGenericRetention = oApp.GetService("Generic Retention SCM"); psAoeMsg = null; psExampleAoeMsg = null; for(var i=0; i < Inputs.GetChildCount(); i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "AOE Message"){ psAoeMsg = psTemp; } if (psTemp.GetType() == "Example Message"){ psExampleAoeMsg = psTemp; } } /* Init Outputs */ psTemp = oApp.NewPropertySet(); psTemp.SetType("Violating Entity List"); Outputs.SetProperty("Validation Code",""); Outputs.SetProperty("Validation Message",""); Outputs.SetProperty("NumViolatingEntites",0); Outputs.AddChild(psTemp); /* Validate */ if(Inputs.PropertyExists("Ignore Empty Entities")){ ValidateAoeMsgByExample(psAoeMsg, psExampleAoeMsg, 0, "", Inputs.GetProperty("Ignore Empty Entities"),Outputs); }else{ ValidateAoeMsgByExample(psAoeMsg, psExampleAoeMsg, 0, "", "Y",Outputs); } TracePropertySet(Outputs,"Outputs to ValidateAoeMsgByExample",0); break; default: iReturn = ContinueOperation; break; } } catch(e) { // Trace error and ... var sError = e.toString(); if (this.bIsTrace

Auto Order Entry API SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Auto Order Entry API SCM" * * Author : Dan Dragan (TGDDRDA3) * * Purpose : * Date : 2012-07-03 * *-------------------------------------------------------------------------------------------------* * Update : 1) Dan Dragan 2013-08-28 added method AddAttributeListToProduct * * 2) Dan Dragan 2013-11-18 added method MapFields * * 3) Dan Dragan 2013-11-21 added method ValidateAoeMsgByExample * * 4) Raphael Lesceux 2014-12-08 added method AddQuoteData * **************************************************************************************************/ var iReturn = CancelOperation; var psTemp:PropertySet; var psAoeMsg:PropertySet; var psExampleAoeMsg:PropertySet; oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "CreateMsgBody": CreateMsgBody(Inputs, Outputs); break; case "CreateMsgBodyExtended": CreateMsgBodyExtended (Inputs, Outputs); break; case "CreateProduct": CreateProduct(Inputs, Outputs); break; case "CreateAttribute": CreateAttribute(Inputs, Outputs); break; case "CreateEntity": CreateEntity(Inputs, Outputs); break; case "AddProductToProductSet": AddProductToProductSet(Inputs, Outputs); break; case "AddAttributeToProduct": AddAttributeToProduct(Inputs, Outputs); break; case "AddChildEntity": AddChildEntity(Inputs, Outputs); break; case "AddContextData": UpsertDataToEntity(Inputs, Outputs,"Context"); break; case "AddControlData": AddControlData(Inputs, Outputs); break; case "AddSvcReqData": UpsertDataToEntity(Inputs, Outputs,"ServiceRequest"); break; /*MA_FI - 20140403 added for quote-entity case "AddQuoteData": UpsertDataToEntity(Inputs, Outputs,"Quote"); break; */ /* Added for March 2015 Release */ case "AddQuoteData": AddQuoteData(Inputs, Outputs,"Quote"); break; case "AddEntityToMsg": AddEntityToMsg(Inputs, Outputs); break; case "AddAttributeListToProduct": AddAttributeListToProduct(Inputs, Outputs); break; case "MapFields": MapFields(Inputs, Outputs); break; case "ValidateAoeMsgByExample": bsXmlUtil = oApp.GetService("XML Hierarchy Utilities SCM"); bsGenericRetention = oApp.GetService("Generic Retention SCM"); psAoeMsg = null; psExampleAoeMsg = null; for(var i=0; i < Inputs.GetChildCount(); i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "AOE Message"){ psAoeMsg = psTemp; } if (psTemp.GetType() == "Example Message"){ psExampleAoeMsg = psTemp; } } /* Init Outputs */ psTemp = oApp.NewPropertySet(); psTemp.SetType("Violating Entity List"); Outputs.SetProperty("Validation Code",""); Outputs.SetProperty("Validation Message",""); Outputs.SetProperty("NumViolatingEntites",0); Outputs.AddChild(psTemp); /* Validate */ if(Inputs.PropertyExists("Ignore Empty Entities")){ ValidateAoeMsgByExample(psAoeMsg, psExampleAoeMsg, 0, "", Inputs.GetProperty("Ignore Empty Entities"),Outputs); }else{ ValidateAoeMsgByExample(psAoeMsg, psExampleAoeMsg, 0, "", "Y",Outputs); } TracePropertySet(Outputs,"Outputs to ValidateAoeMsgByExample",0); break; default: iReturn = ContinueOperation; break; } } catch(e) { // Trace error and ... var sError = e.toString(); if (this.bIsTrace

Auto Order Entry API SCM
Trace
function Trace(sTraceInfo) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : eliminates the need of the Trace Is On check in the BS methods when tracing out data * * Thus the code in the BS methods is easier to read and to maintain * * Input : String to be written to the trace file * * Output : - * * * * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ try { if (bIsTraceOn) oApp.Trace(sTraceInfo); } catch (e) { // no action } }

Auto Order Entry API SCM
Trace
function Trace(sTraceInfo) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : eliminates the need of the Trace Is On check in the BS methods when tracing out data * * Thus the code in the BS methods is easier to read and to maintain * * Input : String to be written to the trace file * * Output : - * * * * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ try { if (bIsTraceOn) oApp.Trace(sTraceInfo); } catch (e) { // no action } }

Auto Order Entry API SCM
TracePropertySet
function TracePropertySet (PropSet:PropertySet, sComment, Level) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // TracePropertySet // Input: Property Set, Comment, Layer // Output: none // Trigger: diverse functions of the bs could use this function // Date: July, 3rd 2012 // Author: Dennis Kiolbassa, adapted by Dan Dragan // Project: AllIP //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { if ((Level == "") || (typeof(Level) == "undefined")){ Level = 0; } var indent = ""; var x; for (x = 0; x < Level; x++){ indent += "\t"; } try { var psType = PropSet.GetType(); var psValue = PropSet.GetValue(); if (Level == 0) Trace(sComment); Trace((indent + "Type: " + psType + " Value: " + psValue)); } catch (e) { Trace((indent + "BAD DATA IN PROPERTY HEADER")); } var propName = PropSet.GetFirstProperty(); while (propName != "") { try { var propValue = PropSet.GetProperty(propName); } catch (e) { Trace((indent + "BAD DATA IN PROPERTY DATA")); } Trace((indent + propName + " = " + propValue)); propName = PropSet.GetNextProperty(); } var children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { Trace(( indent + "CHILD PROPERTY SET " + x)); TracePropertySet(PropSet.GetChild(x), sComment, (Level + 1)); } }

Auto Order Entry API SCM
TracePropertySet
function TracePropertySet (PropSet:PropertySet, sComment, Level) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // TracePropertySet // Input: Property Set, Comment, Layer // Output: none // Trigger: diverse functions of the bs could use this function // Date: July, 3rd 2012 // Author: Dennis Kiolbassa, adapted by Dan Dragan // Project: AllIP //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { if ((Level == "") || (typeof(Level) == "undefined")){ Level = 0; } var indent = ""; var x; for (x = 0; x < Level; x++){ indent += "\t"; } try { var psType = PropSet.GetType(); var psValue = PropSet.GetValue(); if (Level == 0) Trace(sComment); Trace((indent + "Type: " + psType + " Value: " + psValue)); } catch (e) { Trace((indent + "BAD DATA IN PROPERTY HEADER")); } var propName = PropSet.GetFirstProperty(); while (propName != "") { try { var propValue = PropSet.GetProperty(propName); } catch (e) { Trace((indent + "BAD DATA IN PROPERTY DATA")); } Trace((indent + propName + " = " + propValue)); propName = PropSet.GetNextProperty(); } var children = PropSet.GetChildCount(); for (x = 0; x < children; x++) { Trace(( indent + "CHILD PROPERTY SET " + x)); TracePropertySet(PropSet.GetChild(x), sComment, (Level + 1)); } }

Auto Order Entry API SCM
UpsertDataToEntity
function UpsertDataToEntity(Inputs, Outputs, EntityName) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Upserts arbitrary fields to an entity in the request message * * Prerequisites: The entity has to be unique in the message. * E.g. Context, ControlData, ServiceRequest * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var psTemp:PropertySet; var psSubRoutineOutput:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method AddDataToEntity: START"); nChilds = Inputs.GetChildCount(); if (nChilds == 1){ psReturn = oApp.NewPropertySet(); psReturn = Inputs.GetChild(0).Copy(); if (psReturn.GetType() == EntityName){ //upsert properties to output propName = ""; propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } } else{ // call UpsertDataToEntity recursively for all entities in this message part // and then replace the current child with the method call output nChilds = psReturn.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = psReturn.GetChild(i); psSubRoutineOutput = null; psSubRoutineOutput = oApp.NewPropertySet(); Inputs.RemoveChild(0); Inputs.AddChild(psTemp); UpsertDataToEntity(Inputs,psSubRoutineOutput,EntityName); psTemp = psSubRoutineOutput.GetChild(0); psReturn.RemoveChild(i); psReturn.InsertChildAt(psTemp,i); } } }//end if else { oApp.RaiseErrorText("Exactly one child hierarch containing the request message expected! Found: '" + nChilds + "' child hierarchies."); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddDataToEntity: END"); TracePropertySet(Outputs,Name()+" AddDataToEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddDataToEntity Error: "+sError); throw(e); } finally { psReturn = null; psTemp = null; psSubRoutineOutput = null; } }

Auto Order Entry API SCM
UpsertDataToEntity
function UpsertDataToEntity(Inputs, Outputs, EntityName) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Upserts arbitrary fields to an entity in the request message * * Prerequisites: The entity has to be unique in the message. * E.g. Context, ControlData, ServiceRequest * * Date : 2012-07-04 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psReturn:PropertySet; var psTemp:PropertySet; var psSubRoutineOutput:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method AddDataToEntity: START"); nChilds = Inputs.GetChildCount(); if (nChilds == 1){ psReturn = oApp.NewPropertySet(); psReturn = Inputs.GetChild(0).Copy(); if (psReturn.GetType() == EntityName){ //upsert properties to output propName = ""; propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } } else{ // call UpsertDataToEntity recursively for all entities in this message part // and then replace the current child with the method call output nChilds = psReturn.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = psReturn.GetChild(i); psSubRoutineOutput = null; psSubRoutineOutput = oApp.NewPropertySet(); Inputs.RemoveChild(0); Inputs.AddChild(psTemp); UpsertDataToEntity(Inputs,psSubRoutineOutput,EntityName); psTemp = psSubRoutineOutput.GetChild(0); psReturn.RemoveChild(i); psReturn.InsertChildAt(psTemp,i); } } }//end if else { oApp.RaiseErrorText("Exactly one child hierarch containing the request message expected! Found: '" + nChilds + "' child hierarchies."); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddDataToEntity: END"); TracePropertySet(Outputs,Name()+" AddDataToEntity Output",0); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddDataToEntity Error: "+sError); throw(e); } finally { psReturn = null; psTemp = null; psSubRoutineOutput = null; } }

Auto Order Entry API SCM
ValidateAoeMsgByExample
function ValidateAoeMsgByExample(psAoeMsg:PropertySet, psExampleMsg:PropertySet, iLayer:Number, sPath:String, sIgnEntyNoFields:String, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Verifies the structure of an AOE message to ensure that the required inputs are provided* * Date : 2013-11-21 * * Inputs : psAoeMsg: the AOE message to check the structure for * * psExampleMsg: example AOE message. All the fields in the example message * * have to be provided in the AOE message * * iLayer: indicator of the current recursion level * * sPath: hierarch types connected by slashes to build the path for the childs to * * search in the AOE message for * * sIgnEntyNoFields: exclude entites from validation which have no fields in the example * * message. Default = Y * * Outputs : * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var psInput:PropertySet; var psOutput:PropertySet; var psEntity:PropertySet; var propName:String; var sType; var i:Number; var j:Number; var nCount:Number; var nViolatingEntities:Number; var sValidEntity:String; try { /* error handling/trace setup */ Trace(Name()+" -> ValidateAoeMsgByExample(): START (Layer: " + iLayer+ ")"); if (psAoeMsg == null || psExampleMsg == null) { oApp.RaiseErrorText("Required input missing"); } /* init */ psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); propName = ""; sType = ""; i=0; j=0; nCount = 0; sValidEntity = "Y"; nViolatingEntities = ToNumber(Outputs.GetProperty("NumViolatingEntites")); /* processing */ psAoeMsg.SetType("XMLHierarchy"); /* type determined by the Get Childs By Path method */ if(iLayer == 0) {sPath = sPath + "XMLHierarchy";} /* Root has different type, all other entities must have the same type */ else {sPath = sPath + "/" + psExampleMsg.GetType()}; Trace(Name()+" -> ValidateAoeMsgByExample(): END (Layer: " + iLayer+ ")"); Trace(Name()+" -> ValidateAoeMsgByExample(): Path: " + sPath); if (psExampleMsg.GetFirstProperty() != ""){ /* Value for the field must be provided in the AOE message */ psInput.SetProperty("Path", sPath); psInput.AddChild(psAoeMsg); bsXmlUtil.InvokeMethod("Get Childs By Path",psInput,psOutput); nCount = ToNumber(psOutput.GetProperty("Count")); if (nCount == 0){ if (sIgnEntyNoFields == "Y"){ /* do nothing */ }else{ Outputs.SetProperty("NumViolatingEntites", nViolatingEntities + 1); psInput.Reset();psOutput.Reset(); psInput.SetProperty("Code","AOE_MSG_VALIDATION_02"); bsGenericRetention.InvokeMethod("Get Error Message", psInput, psOutput); Outputs.SetProperty("Validation Code","AOE_MSG_VALIDATION_02"); Outputs.SetProperty("Validation Message", Outputs.GetProperty("Validation Message") + psOutput.GetProperty("Result")); psInput.Reset(); /* reuse psInput prop set to add missing entity type to output*/ psInput.SetType(psExampleMsg.GetType()); propName = psExampleMsg.GetFirstProperty(); while(propName != ""){ psInput.SetProperty(propName,psExampleMsg.GetProperty(propName)); propName = psExampleMsg.GetNextProperty(); } Outputs.GetChild(0).AddChild(psInput); } } /* end entity not found in AOE message */ for(j=0;j<nCount;j++){ /* Check that each entity instance in the message provides values for the fields in the example message */ propName = psExampleMsg.GetFirstProperty();

Auto Order Entry API SCM
ValidateAoeMsgByExample
function ValidateAoeMsgByExample(psAoeMsg:PropertySet, psExampleMsg:PropertySet, iLayer:Number, sPath:String, sIgnEntyNoFields:String, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Verifies the structure of an AOE message to ensure that the required inputs are provided* * Date : 2013-11-21 * * Inputs : psAoeMsg: the AOE message to check the structure for * * psExampleMsg: example AOE message. All the fields in the example message * * have to be provided in the AOE message * * iLayer: indicator of the current recursion level * * sPath: hierarch types connected by slashes to build the path for the childs to * * search in the AOE message for * * sIgnEntyNoFields: exclude entites from validation which have no fields in the example * * message. Default = Y * * Outputs : * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var psInput:PropertySet; var psOutput:PropertySet; var psEntity:PropertySet; var propName:String; var sType; var i:Number; var j:Number; var nCount:Number; var nViolatingEntities:Number; var sValidEntity:String; try { /* error handling/trace setup */ Trace(Name()+" -> ValidateAoeMsgByExample(): START (Layer: " + iLayer+ ")"); if (psAoeMsg == null || psExampleMsg == null) { oApp.RaiseErrorText("Required input missing"); } /* init */ psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); propName = ""; sType = ""; i=0; j=0; nCount = 0; sValidEntity = "Y"; nViolatingEntities = ToNumber(Outputs.GetProperty("NumViolatingEntites")); /* processing */ psAoeMsg.SetType("XMLHierarchy"); /* type determined by the Get Childs By Path method */ if(iLayer == 0) {sPath = sPath + "XMLHierarchy";} /* Root has different type, all other entities must have the same type */ else {sPath = sPath + "/" + psExampleMsg.GetType()}; Trace(Name()+" -> ValidateAoeMsgByExample(): END (Layer: " + iLayer+ ")"); Trace(Name()+" -> ValidateAoeMsgByExample(): Path: " + sPath); if (psExampleMsg.GetFirstProperty() != ""){ /* Value for the field must be provided in the AOE message */ psInput.SetProperty("Path", sPath); psInput.AddChild(psAoeMsg); bsXmlUtil.InvokeMethod("Get Childs By Path",psInput,psOutput); nCount = ToNumber(psOutput.GetProperty("Count")); if (nCount == 0){ if (sIgnEntyNoFields == "Y"){ /* do nothing */ }else{ Outputs.SetProperty("NumViolatingEntites", nViolatingEntities + 1); psInput.Reset();psOutput.Reset(); psInput.SetProperty("Code","AOE_MSG_VALIDATION_02"); bsGenericRetention.InvokeMethod("Get Error Message", psInput, psOutput); Outputs.SetProperty("Validation Code","AOE_MSG_VALIDATION_02"); Outputs.SetProperty("Validation Message", Outputs.GetProperty("Validation Message") + psOutput.GetProperty("Result")); psInput.Reset(); /* reuse psInput prop set to add missing entity type to output*/ psInput.SetType(psExampleMsg.GetType()); propName = psExampleMsg.GetFirstProperty(); while(propName != ""){ psInput.SetProperty(propName,psExampleMsg.GetProperty(propName)); propName = psExampleMsg.GetNextProperty(); } Outputs.GetChild(0).AddChild(psInput); } } /* end entity not found in AOE message */ for(j=0;j<nCount;j++){ /* Check that each entity instance in the message provides values for the fields in the example message */ propName = psExampleMsg.GetFirstProperty();

Auto Order Entry API SCM
splitByChar
function splitByChar(sString:String, cSplitChar, aOutput:Array) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : splits a string based on a separator. Separators between apostrophees are ignored. * * Input : sString = String to be splitted * * cSplitChar = split character / string * * Output : aOutput = splitted input string * * * * Date : 2013-11-19 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ var i:Number; var sTemp:String; var bIgnore:Boolean; var chr; try { /* error handling/trace setup */ Trace(Name()+" -> Method splitByChar(): START"); /* init */ bIgnore = false; chr = ""; sTemp = ""; /* nothing to do, if inputs not provided */ if (sString == null || sString == "" || cSplitChar == null || cSplitChar == "") { Trace(Name()+" -> Method splitByChar(): END (output array length:" +aOutput.length + ")"); return; } Trace(Name()+" -> Method splitByChar() - input string: " + sString); /* split */ for(i=0; i<sString.length;i++){ chr = sString.charAt(i); if(chr == "'" || chr == "\"") { /* rather complicated negation logic, but simply negating does not work for some reason */ if (bIgnore == true) { bIgnore = false;} else {bIgnore = true;} }else{ if (chr == cSplitChar && bIgnore == false){ aOutput.push(sTemp); sTemp = ""; }else{ sTemp = sTemp + chr; } } } aOutput.push(sTemp); Trace(Name()+" -> Method splitByChar(): END (output array length:" +aOutput.length + ")"); } catch (e){ var sError = e.toString(); Trace(Name()+" -> Method splitByChar() Error: "+sError); throw(e); } }

Auto Order Entry API SCM
splitByChar
function splitByChar(sString:String, cSplitChar, aOutput:Array) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : splits a string based on a separator. Separators between apostrophees are ignored. * * Input : sString = String to be splitted * * cSplitChar = split character / string * * Output : aOutput = splitted input string * * * * Date : 2013-11-19 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ var i:Number; var sTemp:String; var bIgnore:Boolean; var chr; try { /* error handling/trace setup */ Trace(Name()+" -> Method splitByChar(): START"); /* init */ bIgnore = false; chr = ""; sTemp = ""; /* nothing to do, if inputs not provided */ if (sString == null || sString == "" || cSplitChar == null || cSplitChar == "") { Trace(Name()+" -> Method splitByChar(): END (output array length:" +aOutput.length + ")"); return; } Trace(Name()+" -> Method splitByChar() - input string: " + sString); /* split */ for(i=0; i<sString.length;i++){ chr = sString.charAt(i); if(chr == "'" || chr == "\"") { /* rather complicated negation logic, but simply negating does not work for some reason */ if (bIgnore == true) { bIgnore = false;} else {bIgnore = true;} }else{ if (chr == cSplitChar && bIgnore == false){ aOutput.push(sTemp); sTemp = ""; }else{ sTemp = sTemp + chr; } } } aOutput.push(sTemp); Trace(Name()+" -> Method splitByChar(): END (output array length:" +aOutput.length + ")"); } catch (e){ var sError = e.toString(); Trace(Name()+" -> Method splitByChar() Error: "+sError); throw(e); } }

Auto Order Entry API SCM
trim
function trim(sString:String) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes leading and tracing white spaces from a string * * Date : 2013-02-26 * * Inputs : The string to be trimed * * Outputs : The input string without leading and trailing white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var sLeftPattern; var sRightPattern; var sReturnString:String; try { sLeftPattern = /^\s*/; sRightPattern = /\s*$/; sReturnString = sString.replace(sLeftPattern,""); //Replace leading spaces with blank sReturnString = sReturnString.replace(sRightPattern,""); //Replace trailing spaces with blank return(sReturnString); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method trim() Error: "+sError); throw(e); } finally { } }

Auto Order Entry API SCM
trim
function trim(sString:String) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes leading and tracing white spaces from a string * * Date : 2013-02-26 * * Inputs : The string to be trimed * * Outputs : The input string without leading and trailing white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var sLeftPattern; var sRightPattern; var sReturnString:String; try { sLeftPattern = /^\s*/; sRightPattern = /\s*$/; sReturnString = sString.replace(sLeftPattern,""); //Replace leading spaces with blank sReturnString = sReturnString.replace(sRightPattern,""); //Replace trailing spaces with blank return(sReturnString); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method trim() Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Auto Order Entry Service SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

Auto Order Entry Service SCM
AddChildHierarchy
function AddChildHierarchy(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add a child property set to a parent property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psParent:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method AddChildHierarchy: START"); psReturn = oApp.NewPropertySet(); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psParent = psTemp; } if (psTemp.GetType() == "XMLChildHierarchy"){ psChild = psTemp; } } if ((psParent) && (psChild) && (sChildType)){ psReturn = psParent.Copy(); psTemp = psChild.Copy(); psTemp.SetType(sChildType); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddChildHierarchy: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddChildHierarchy Error: "+sError); throw(e); } finally { psParent = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
AddChildHierarchy
function AddChildHierarchy(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add a child property set to a parent property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psParent:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method AddChildHierarchy: START"); psReturn = oApp.NewPropertySet(); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psParent = psTemp; } if (psTemp.GetType() == "XMLChildHierarchy"){ psChild = psTemp; } } if ((psParent) && (psChild) && (sChildType)){ psReturn = psParent.Copy(); psTemp = psChild.Copy(); psTemp.SetType(sChildType); psReturn.AddChild(psTemp); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddChildHierarchy: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddChildHierarchy Error: "+sError); throw(e); } finally { psParent = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
AddPropertiesToPropSet
function AddPropertiesToPropSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add a properties to a property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psHierarchy:PropertySet; var psProperties:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method AddPropertiesToPropSet: START"); psReturn = oApp.NewPropertySet(); propName = ""; nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psHierarchy = psTemp; } if (psTemp.GetType() == "Additional Properties"){ psProperties = psTemp; } } if ((psHierarchy) && (psProperties)){ psReturn = psHierarchy.Copy(); propName = psProperties.GetFirstProperty(); while (propName != "") { propVal = psProperties.GetProperty(propName); // if a property with the same name already exists it will be updated psReturn.SetProperty(propName, propVal); propName = psProperties.GetNextProperty(); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddPropertiesToPropSet: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddPropertiesToPropSet Error: "+sError); throw(e); } finally { psHierarchy = null; psProperties = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
AddPropertiesToPropSet
function AddPropertiesToPropSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add a properties to a property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psHierarchy:PropertySet; var psProperties:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method AddPropertiesToPropSet: START"); psReturn = oApp.NewPropertySet(); propName = ""; nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psHierarchy = psTemp; } if (psTemp.GetType() == "Additional Properties"){ psProperties = psTemp; } } if ((psHierarchy) && (psProperties)){ psReturn = psHierarchy.Copy(); propName = psProperties.GetFirstProperty(); while (propName != "") { propVal = psProperties.GetProperty(propName); // if a property with the same name already exists it will be updated psReturn.SetProperty(propName, propVal); propName = psProperties.GetNextProperty(); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method AddPropertiesToPropSet: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddPropertiesToPropSet Error: "+sError); throw(e); } finally { psHierarchy = null; psProperties = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
AddToAllAssetList
function AddToAllAssetList(Inputs, Outputs) { /************************************************************************************************************************ * Author : Pavel Kamir (TAAKAPA3) * * Purpose : Fuction that adds child from a property set to AllAssetList * * Date : 2015-03-25 * *-----------------------------------------------------------------------------------------------------------------------* * Update : * *************************************************************************************************************************/ var psAllAssetList:PropertySet=TheApplication().NewPropertySet(); var psMoveAssets:PropertySet=TheApplication().NewPropertySet(); var iSISSelectNum:float=ToNumber(Inputs.GetProperty("SIS Select Num")); var sProdList:chars=""; var sSearchExp:chars=Inputs.GetProperty("UpDown STB CPE Search Exp"); var i:float; try { Trace(Name()+" -> Method AddToAllAssetList: START"); psAllAssetList.SetType("All Asset List"); if(Inputs.GetChild(0).GetType() == "All Asset List") { psAllAssetList = Inputs.GetChild(0); psMoveAssets = Inputs.GetChild(1); } else { psMoveAssets = Inputs.GetChild(0); psAllAssetList = Inputs.GetChild(1); } for(i=0;i<psMoveAssets.GetChildCount();i++) { if(ToNumber(Inputs.GetProperty("Stop Counter")) == 0 && Inputs.GetProperty("Stop Counter") != null && Inputs.GetProperty("Stop Counter") != "") { break; } if(Inputs.GetProperty("One Asset Per Product") == "Y") { if(sProdList.indexOf("|"+psMoveAssets.GetChild(i).GetProperty("Product Id")) < 0) { psAllAssetList.SetProperty(psMoveAssets.GetChild(i).GetProperty("Asset Id"), Inputs.GetProperty("Prod Prom Instance Id")); sProdList = sProdList + "|" + psMoveAssets.GetChild(i).GetProperty("Product Id") + "|"; iSISSelectNum = iSISSelectNum + 1; sSearchExp = sSearchExp + " OR [Id]= '"+psMoveAssets.GetChild(i).GetProperty("Asset Id")+"'"; } else { continue; } } else { psAllAssetList.SetProperty(psMoveAssets.GetChild(i).GetProperty("Asset Id"), Inputs.GetProperty("Prod Prom Instance Id")); sSearchExp = sSearchExp + " OR [Id]= '"+psMoveAssets.GetChild(i).GetProperty("Asset Id")+"'"; iSISSelectNum = iSISSelectNum + 1; } if(ToNumber(Inputs.GetProperty("Stop Counter")) == i+1 && Inputs.GetProperty("Stop Counter") != "" && Inputs.GetProperty("Stop Counter") != null) { break; } } Trace(Name()+" -> Method AddToAllAssetList: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddToAllAssetList Error: "+sError); throw(e); } finally { Outputs.SetProperty("SIS Select Num", iSISSelectNum); Outputs.SetProperty("UpDown STB CPE Search Exp", sSearchExp); Outputs.AddChild(psAllAssetList); psMoveAssets = null; psAllAssetList = null; } }

Auto Order Entry Service SCM
AddToAllAssetList
function AddToAllAssetList(Inputs, Outputs) { /************************************************************************************************************************ * Author : Pavel Kamir (TAAKAPA3) * * Purpose : Fuction that adds child from a property set to AllAssetList * * Date : 2015-03-25 * *-----------------------------------------------------------------------------------------------------------------------* * Update : * *************************************************************************************************************************/ var psAllAssetList:PropertySet=TheApplication().NewPropertySet(); var psMoveAssets:PropertySet=TheApplication().NewPropertySet(); var iSISSelectNum:float=ToNumber(Inputs.GetProperty("SIS Select Num")); var sProdList:chars=""; var sSearchExp:chars=Inputs.GetProperty("UpDown STB CPE Search Exp"); var i:float; try { Trace(Name()+" -> Method AddToAllAssetList: START"); psAllAssetList.SetType("All Asset List"); if(Inputs.GetChild(0).GetType() == "All Asset List") { psAllAssetList = Inputs.GetChild(0); psMoveAssets = Inputs.GetChild(1); } else { psMoveAssets = Inputs.GetChild(0); psAllAssetList = Inputs.GetChild(1); } for(i=0;i<psMoveAssets.GetChildCount();i++) { if(ToNumber(Inputs.GetProperty("Stop Counter")) == 0 && Inputs.GetProperty("Stop Counter") != null && Inputs.GetProperty("Stop Counter") != "") { break; } if(Inputs.GetProperty("One Asset Per Product") == "Y") { if(sProdList.indexOf("|"+psMoveAssets.GetChild(i).GetProperty("Product Id")) < 0) { psAllAssetList.SetProperty(psMoveAssets.GetChild(i).GetProperty("Asset Id"), Inputs.GetProperty("Prod Prom Instance Id")); sProdList = sProdList + "|" + psMoveAssets.GetChild(i).GetProperty("Product Id") + "|"; iSISSelectNum = iSISSelectNum + 1; sSearchExp = sSearchExp + " OR [Id]= '"+psMoveAssets.GetChild(i).GetProperty("Asset Id")+"'"; } else { continue; } } else { psAllAssetList.SetProperty(psMoveAssets.GetChild(i).GetProperty("Asset Id"), Inputs.GetProperty("Prod Prom Instance Id")); sSearchExp = sSearchExp + " OR [Id]= '"+psMoveAssets.GetChild(i).GetProperty("Asset Id")+"'"; iSISSelectNum = iSISSelectNum + 1; } if(ToNumber(Inputs.GetProperty("Stop Counter")) == i+1 && Inputs.GetProperty("Stop Counter") != "" && Inputs.GetProperty("Stop Counter") != null) { break; } } Trace(Name()+" -> Method AddToAllAssetList: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method AddToAllAssetList Error: "+sError); throw(e); } finally { Outputs.SetProperty("SIS Select Num", iSISSelectNum); Outputs.SetProperty("UpDown STB CPE Search Exp", sSearchExp); Outputs.AddChild(psAllAssetList); psMoveAssets = null; psAllAssetList = null; } }

Auto Order Entry Service SCM
BuildExpression
function BuildExpression(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Builds up a clause based on a list separated by an arbitrary sparator * * Date : 2012-12-11 * * * * E.g: List = "VoiP-N;Mobile-N;Internert-N" * * Operand = "Service Type" * * Operator = "=" (Default) * * JoinOperator = "OR" * * Delimiter = ";" (Default) * * * * Output = "[Service Type] = 'VoiP-N' OR [Service Type] = 'Mobile-N' OR * * [Service Type] = 'Internet-N'" * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var aTokens:Array; var sOperand:String; var sOperator:String; var sList:String; var sDelimiter:String; var sExpression:String; var sConnector:String; try { // error handling/trace setup Trace(Name()+" -> Method BuildExpression: START"); sList = Inputs.GetProperty("List") ; sDelimiter = Inputs.GetProperty("List Delimiter"); sOperand = Inputs.GetProperty("Operand"); sOperator = Inputs.GetProperty("Operator"); sConnector = Inputs.GetProperty("Join Operator"); sExpression = ""; if ((sList != null) && (sList !="")) { // default delimiter = ';' if ((sDelimiter == null) || (sDelimiter == "")) {sDelimiter = ";"} ; // format Operand and Operator if ((sOperand == null) || (sOperand == "")) {sOperand = ""} else {sOperand = "[" + sOperand + "]"+ sOperator;} aTokens = sList.split(sDelimiter); for(var i=0; i<aTokens.length - 1; i++){ sExpression = sExpression + sOperand + "'" +aTokens[i] + "' " + sConnector + " "; } sExpression = sExpression + sOperand + "'" + aTokens[aTokens.length-1] + "'"; Outputs.SetProperty("Expression", sExpression); } Trace(Name()+" -> Method BuildExpression: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method BuildExpression Error: "+sError); throw(e); } finally { aTokens = null; } }

Auto Order Entry Service SCM
BuildExpression
function BuildExpression(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Builds up a clause based on a list separated by an arbitrary sparator * * Date : 2012-12-11 * * * * E.g: List = "VoiP-N;Mobile-N;Internert-N" * * Operand = "Service Type" * * Operator = "=" (Default) * * JoinOperator = "OR" * * Delimiter = ";" (Default) * * * * Output = "[Service Type] = 'VoiP-N' OR [Service Type] = 'Mobile-N' OR * * [Service Type] = 'Internet-N'" * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var aTokens:Array; var sOperand:String; var sOperator:String; var sList:String; var sDelimiter:String; var sExpression:String; var sConnector:String; try { // error handling/trace setup Trace(Name()+" -> Method BuildExpression: START"); sList = Inputs.GetProperty("List") ; sDelimiter = Inputs.GetProperty("List Delimiter"); sOperand = Inputs.GetProperty("Operand"); sOperator = Inputs.GetProperty("Operator"); sConnector = Inputs.GetProperty("Join Operator"); sExpression = ""; if ((sList != null) && (sList !="")) { // default delimiter = ';' if ((sDelimiter == null) || (sDelimiter == "")) {sDelimiter = ";"} ; // format Operand and Operator if ((sOperand == null) || (sOperand == "")) {sOperand = ""} else {sOperand = "[" + sOperand + "]"+ sOperator;} aTokens = sList.split(sDelimiter); for(var i=0; i<aTokens.length - 1; i++){ sExpression = sExpression + sOperand + "'" +aTokens[i] + "' " + sConnector + " "; } sExpression = sExpression + sOperand + "'" + aTokens[aTokens.length-1] + "'"; Outputs.SetProperty("Expression", sExpression); } Trace(Name()+" -> Method BuildExpression: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method BuildExpression Error: "+sError); throw(e); } finally { aTokens = null; } }

Auto Order Entry Service SCM
CopyHierarchy
function CopyHierarchy(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returna a copy of the input hierarchy, with or without child hierarchies * * Date : 2012-11-22 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var propName:String; var propVal:String; var psHierarchy:PropertySet; var psReturn:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CopyHierarchy: START"); /*** init ***/ propName = ""; //initialization, just to be prepared for the case where there are no input properties psReturn = oApp.NewPropertySet(); psReturn.SetType("XMLHierarchy"); /*** get PropSet to be copied ***/ if (Inputs.GetChildCount() == 1){ psHierarchy = Inputs.GetChild(0); propName = psHierarchy.GetFirstProperty(); } else{ oApp.RaiseErrorText("Expected exactly one property set to be copied! Found: " + Inputs.GetChildCount()); } /*** copy properties to output PropSet ***/ while (propName != "") { propVal = psHierarchy.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = psHierarchy.GetNextProperty(); } /*** copy childs to output PropSet unless Copy Childs Flag is set to N/No ***/ if (Inputs.GetProperty("Copy Childs") == "N" || Inputs.GetProperty("Copy Childs") == "No"){ // do nothing } else { for(var i = 0; i < psHierarchy.GetChildCount(); i++){ psReturn.AddChild(psHierarchy.GetChild(i).Copy()); } } /*** add new PropSet to Output ***/ Outputs.AddChild(psReturn); Trace(Name()+" -> Method CopyHierarchy: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CopyHierarchy Error: "+sError); throw(e); } finally { psHierarchy = null; psReturn = null; } }

Auto Order Entry Service SCM
CopyHierarchy
function CopyHierarchy(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returna a copy of the input hierarchy, with or without child hierarchies * * Date : 2012-11-22 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var propName:String; var propVal:String; var psHierarchy:PropertySet; var psReturn:PropertySet; try { // error handling/trace setup Trace(Name()+" -> Method CopyHierarchy: START"); /*** init ***/ propName = ""; //initialization, just to be prepared for the case where there are no input properties psReturn = oApp.NewPropertySet(); psReturn.SetType("XMLHierarchy"); /*** get PropSet to be copied ***/ if (Inputs.GetChildCount() == 1){ psHierarchy = Inputs.GetChild(0); propName = psHierarchy.GetFirstProperty(); } else{ oApp.RaiseErrorText("Expected exactly one property set to be copied! Found: " + Inputs.GetChildCount()); } /*** copy properties to output PropSet ***/ while (propName != "") { propVal = psHierarchy.GetProperty(propName); psReturn.SetProperty(propName, propVal); propName = psHierarchy.GetNextProperty(); } /*** copy childs to output PropSet unless Copy Childs Flag is set to N/No ***/ if (Inputs.GetProperty("Copy Childs") == "N" || Inputs.GetProperty("Copy Childs") == "No"){ // do nothing } else { for(var i = 0; i < psHierarchy.GetChildCount(); i++){ psReturn.AddChild(psHierarchy.GetChild(i).Copy()); } } /*** add new PropSet to Output ***/ Outputs.AddChild(psReturn); Trace(Name()+" -> Method CopyHierarchy: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method CopyHierarchy Error: "+sError); throw(e); } finally { psHierarchy = null; psReturn = null; } }

Auto Order Entry Service SCM
GetChild
function GetChild(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returns a certain child property set of a parent property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; try { // error handling/trace setup Trace(Name()+" -> Method GetChild: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if ((psIn) && (nIndex)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.GetChild(nIndex).Copy(); psReturn.SetType("XMLHierarchy"); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method GetChild: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetChild Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
GetChild
function GetChild(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returns a certain child property set of a parent property set * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; try { // error handling/trace setup Trace(Name()+" -> Method GetChild: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if ((psIn) && (nIndex)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.GetChild(nIndex).Copy(); psReturn.SetType("XMLHierarchy"); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method GetChild: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetChild Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
GetChildCount
function GetChildCount(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returns the number of child property sets of a given hierarchy * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method GetChildCount: START"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if (psIn){ nChilds = psIn.GetChildCount(); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.SetProperty("Count", nChilds); Trace(Name()+" -> Method GetChildCount: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetChildCount Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; } }

Auto Order Entry Service SCM
GetChildCount
function GetChildCount(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Returns the number of child property sets of a given hierarchy * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psTemp:PropertySet; var nChilds:Number; try { // error handling/trace setup Trace(Name()+" -> Method GetChildCount: START"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if (psIn){ nChilds = psIn.GetChildCount(); } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.SetProperty("Count", nChilds); Trace(Name()+" -> Method GetChildCount: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetChildCount Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; } }

Auto Order Entry Service SCM
GetProfileAttributes
function GetProfileAttributes(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Gets the values of one or multiple profile attributes * * Date : 2012-07-11 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var sName:String; var sValue:String; try { // error handling/trace setup Trace(Name()+" -> Method GetProfileAttributes: START"); sName = ""; //initialization, just to be prepared for the case where there are no input properties sName = Inputs.GetFirstProperty(); while (sName != "") { sValue = oApp.GetProfileAttr(sName); Outputs.SetProperty(sName, sValue); sName = Inputs.GetNextProperty(); } Trace(Name()+" -> Method GetProfileAttributes: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetProfileAttributes Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
GetProfileAttributes
function GetProfileAttributes(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Gets the values of one or multiple profile attributes * * Date : 2012-07-11 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var sName:String; var sValue:String; try { // error handling/trace setup Trace(Name()+" -> Method GetProfileAttributes: START"); sName = ""; //initialization, just to be prepared for the case where there are no input properties sName = Inputs.GetFirstProperty(); while (sName != "") { sValue = oApp.GetProfileAttr(sName); Outputs.SetProperty(sName, sValue); sName = Inputs.GetNextProperty(); } Trace(Name()+" -> Method GetProfileAttributes: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method GetProfileAttributes Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
RemoveChildAt
function RemoveChildAt(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes a child property set from a parent property set based on the index of the child * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; try { // error handling/trace setup Trace(Name()+" -> Method RemoveChildAt: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if ((psIn) && (nIndex)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.Copy(); psReturn.RemoveChild(nIndex); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method RemoveChildAt: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method RemoveChildAt Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
RemoveChildAt
function RemoveChildAt(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes a child property set from a parent property set based on the index of the child * * Date : 2012-02-08 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; try { // error handling/trace setup Trace(Name()+" -> Method RemoveChildAt: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } } if ((psIn) && (nIndex)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.Copy(); psReturn.RemoveChild(nIndex); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method RemoveChildAt: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method RemoveChildAt Error: "+sError); throw(e); } finally { psIn = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
ReplaceChildAt
function ReplaceChildAt(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Replaces a child property set from a parent property set based on the index of the * * child * * Date : 2012-02-20 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method ReplaceChildAt: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } if (psTemp.GetType() == "XMLChildHierarchy"){ psChild = psTemp; } } if ((psIn) && (psChild) && (nIndex) && (sChildType)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.Copy(); psReturn.RemoveChild(nIndex); psChild.SetType(sChildType); psReturn.InsertChildAt(psChild,nIndex); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method ReplaceChildAt: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method ReplaceChildAt Error: "+sError); throw(e); } finally { psIn = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
ReplaceChildAt
function ReplaceChildAt(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Replaces a child property set from a parent property set based on the index of the * * child * * Date : 2012-02-20 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psIn:PropertySet; var psChild:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var nIndex:Number; var sChildType:String; try { // error handling/trace setup Trace(Name()+" -> Method ReplaceChildAt: START"); psReturn = oApp.NewPropertySet(); nIndex = parseFloat(Inputs.GetProperty("Index")); sChildType = Inputs.GetProperty("Child Type"); nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psIn = psTemp; } if (psTemp.GetType() == "XMLChildHierarchy"){ psChild = psTemp; } } if ((psIn) && (psChild) && (nIndex) && (sChildType)){ nChilds = psIn.GetChildCount(); if ((nIndex < 0) || (nIndex >= nChilds)) { oApp.RaiseErrorText("Index out of bound!"); } else { psReturn = psIn.Copy(); psReturn.RemoveChild(nIndex); psChild.SetType(sChildType); psReturn.InsertChildAt(psChild,nIndex); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method ReplaceChildAt: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method ReplaceChildAt Error: "+sError); throw(e); } finally { psIn = null; psChild = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
SISOM2Flat
function SISOM2Flat(Inputs,Outputs) { /************************************************************************************************************************ * Author : Frantisek Kozisek (TAAKOFR2) * * Purpose : Generic function for conversion of SIS OM Hierarchies data into flat Row Set * * * * Inputs: * * Siebel Message propset SIS OM Message * * Component Name property name of child type to be converted * * Parent Prop Name Property name of property from parent item which should be copied to Row * * Parent Prop New Name Property name of property in rowset for Parent Prop Name * * * * Outputs * * Row Set ... hierarchy child with retrurned rows * * * * * * * * Date : 2014-11-25 * *-----------------------------------------------------------------------------------------------------------------------* * Update : * *************************************************************************************************************************/ var psMsg:PropertySet=null; var sCompName:chars=Inputs.GetProperty("Component Name"); var sParPropName:chars=Inputs.GetProperty("Parent Prop Name"); var sParPropNameNew:chars=Inputs.GetProperty("Parent Prop Name New"); var psRowSet:PropertySet=TheApplication().NewPropertySet(); var i:float=0; psRowSet.SetType("Row Set"); if(Inputs.GetChildCount()>0) { // read Siebel message from input psMsg=Inputs.GetChild(0).Copy(); // got depth of Message if(psMsg.GetChildCount()>0) { for(i=0;i<psMsg.GetChildCount();i++) { SISOMHierarchy(psMsg.GetChild(i),sCompName,psRowSet,sParPropName,sParPropNameNew); } // for child } // if any child found } // If required message should be removed Outputs.AddChild(psRowSet); }

Auto Order Entry Service SCM
SISOM2Flat
function SISOM2Flat(Inputs,Outputs) { /************************************************************************************************************************ * Author : Frantisek Kozisek (TAAKOFR2) * * Purpose : Generic function for conversion of SIS OM Hierarchies data into flat Row Set * * * * Inputs: * * Siebel Message propset SIS OM Message * * Component Name property name of child type to be converted * * Parent Prop Name Property name of property from parent item which should be copied to Row * * Parent Prop New Name Property name of property in rowset for Parent Prop Name * * * * Outputs * * Row Set ... hierarchy child with retrurned rows * * * * * * * * Date : 2014-11-25 * *-----------------------------------------------------------------------------------------------------------------------* * Update : * *************************************************************************************************************************/ var psMsg:PropertySet=null; var sCompName:chars=Inputs.GetProperty("Component Name"); var sParPropName:chars=Inputs.GetProperty("Parent Prop Name"); var sParPropNameNew:chars=Inputs.GetProperty("Parent Prop Name New"); var psRowSet:PropertySet=TheApplication().NewPropertySet(); var i:float=0; psRowSet.SetType("Row Set"); if(Inputs.GetChildCount()>0) { // read Siebel message from input psMsg=Inputs.GetChild(0).Copy(); // got depth of Message if(psMsg.GetChildCount()>0) { for(i=0;i<psMsg.GetChildCount();i++) { SISOMHierarchy(psMsg.GetChild(i),sCompName,psRowSet,sParPropName,sParPropNameNew); } // for child } // if any child found } // If required message should be removed Outputs.AddChild(psRowSet); }

Auto Order Entry Service SCM
SISOMHierarchy
function SISOMHierarchy(psMsg:PropertySet,sCompName:chars, RowSet:PropertySet, sParPropName:chars,sParPropNameNew:chars) { /**************************************************************************************************** * Author : Frantisek Kozisek (TAAKOFR2) * * Purpose : hierarchical function to get all childens psMsg of type sCompName * * childrens without Subchildrens should be returend from * * * * Date : 2014-11-25 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var i:float; var iChild:float; for(i=psMsg.GetChildCount()-1;i>=0;i--) { if(psMsg.GetChild(i).GetType()==sCompName) { // we have found desired component type if(psMsg.GetChild(i).GetChildCount()>0) { for(iChild=psMsg.GetChild(i).GetChildCount()-1;iChild>=0;iChild--) { SISOMHierarchy(psMsg.GetChild(i).GetChild(iChild),sCompName,RowSet,sParPropName,sParPropNameNew); if(psMsg.GetChild(i).GetChild(iChild).GetType()==sCompName) { if(sParPropName!=null && sParPropName!="") { psMsg.GetChild(i).GetChild(iChild).SetProperty(sParPropNameNew,psMsg.GetChild(i).GetProperty(sParPropName)); } RowSet.AddChild(psMsg.GetChild(i).GetChild(iChild).Copy()); } psMsg.GetChild(i).RemoveChild(iChild); } } // Children found // copy found records into output if(sParPropName!=null && sParPropName!="") { psMsg.GetChild(i).SetProperty(sParPropNameNew,psMsg.GetProperty(sParPropName)); } RowSet.AddChild(psMsg.GetChild(i).Copy()); // remove child record from set, // in parent call will saved only objects different than searched type psMsg.RemoveChild(i); } else { // we have to parse childrens of other type SISOMHierarchy(psMsg.GetChild(i),sCompName,RowSet,sParPropName,sParPropNameNew); } } }

Auto Order Entry Service SCM
SISOMHierarchy
function SISOMHierarchy(psMsg:PropertySet,sCompName:chars, RowSet:PropertySet, sParPropName:chars,sParPropNameNew:chars) { /**************************************************************************************************** * Author : Frantisek Kozisek (TAAKOFR2) * * Purpose : hierarchical function to get all childens psMsg of type sCompName * * childrens without Subchildrens should be returend from * * * * Date : 2014-11-25 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var i:float; var iChild:float; for(i=psMsg.GetChildCount()-1;i>=0;i--) { if(psMsg.GetChild(i).GetType()==sCompName) { // we have found desired component type if(psMsg.GetChild(i).GetChildCount()>0) { for(iChild=psMsg.GetChild(i).GetChildCount()-1;iChild>=0;iChild--) { SISOMHierarchy(psMsg.GetChild(i).GetChild(iChild),sCompName,RowSet,sParPropName,sParPropNameNew); if(psMsg.GetChild(i).GetChild(iChild).GetType()==sCompName) { if(sParPropName!=null && sParPropName!="") { psMsg.GetChild(i).GetChild(iChild).SetProperty(sParPropNameNew,psMsg.GetChild(i).GetProperty(sParPropName)); } RowSet.AddChild(psMsg.GetChild(i).GetChild(iChild).Copy()); } psMsg.GetChild(i).RemoveChild(iChild); } } // Children found // copy found records into output if(sParPropName!=null && sParPropName!="") { psMsg.GetChild(i).SetProperty(sParPropNameNew,psMsg.GetProperty(sParPropName)); } RowSet.AddChild(psMsg.GetChild(i).Copy()); // remove child record from set, // in parent call will saved only objects different than searched type psMsg.RemoveChild(i); } else { // we have to parse childrens of other type SISOMHierarchy(psMsg.GetChild(i),sCompName,RowSet,sParPropName,sParPropNameNew); } } }

Auto Order Entry Service SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Auto Order Entry Service SCM
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

Auto Order Entry Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Auto Order Entry Service SCM" * * Author : Dan Dragan (TGDDRDA3) * * Purpose : - * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ var iReturn = CancelOperation; oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "AddChildHierarchy": AddChildHierarchy(Inputs, Outputs); break; case "AddPropertiesToPropSet": AddPropertiesToPropSet(Inputs, Outputs); break; case "CopyPropSet": CopyHierarchy(Inputs, Outputs); break; case "UpsertPropertiesToPropSet": UpsertPropertiesToPropSet(Inputs, Outputs); break; case "GetChildCount": GetChildCount(Inputs, Outputs); break; case "GetChild": GetChild(Inputs, Outputs); break; case "RemoveChildAt": RemoveChildAt(Inputs, Outputs); break; case "ReplaceChildAt": ReplaceChildAt(Inputs, Outputs); break; case "SetProfileAttributes": SetProfileAttributes(Inputs, Outputs); break; case "GetProfileAttributes": GetProfileAttributes(Inputs, Outputs); break; case "BuildExpression": BuildExpression(Inputs, Outputs); break; case "inList": inList(Inputs, Outputs); break; case "SISOM2Flat": SISOM2Flat(Inputs, Outputs); break; case "AddToAllAssetList": AddToAllAssetList(Inputs, Outputs); break; default: iReturn = ContinueOperation; break; } } catch(e) { // Trace error and ... var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(Name() + " -> Method Error: "+sError); // ... throw the error message back to the WF throw(e); } finally { this.oApp = null; } return (iReturn); }

Auto Order Entry Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Auto Order Entry Service SCM" * * Author : Dan Dragan (TGDDRDA3) * * Purpose : - * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ var iReturn = CancelOperation; oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; try { switch (MethodName) { case "AddChildHierarchy": AddChildHierarchy(Inputs, Outputs); break; case "AddPropertiesToPropSet": AddPropertiesToPropSet(Inputs, Outputs); break; case "CopyPropSet": CopyHierarchy(Inputs, Outputs); break; case "UpsertPropertiesToPropSet": UpsertPropertiesToPropSet(Inputs, Outputs); break; case "GetChildCount": GetChildCount(Inputs, Outputs); break; case "GetChild": GetChild(Inputs, Outputs); break; case "RemoveChildAt": RemoveChildAt(Inputs, Outputs); break; case "ReplaceChildAt": ReplaceChildAt(Inputs, Outputs); break; case "SetProfileAttributes": SetProfileAttributes(Inputs, Outputs); break; case "GetProfileAttributes": GetProfileAttributes(Inputs, Outputs); break; case "BuildExpression": BuildExpression(Inputs, Outputs); break; case "inList": inList(Inputs, Outputs); break; case "SISOM2Flat": SISOM2Flat(Inputs, Outputs); break; case "AddToAllAssetList": AddToAllAssetList(Inputs, Outputs); break; default: iReturn = ContinueOperation; break; } } catch(e) { // Trace error and ... var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(Name() + " -> Method Error: "+sError); // ... throw the error message back to the WF throw(e); } finally { this.oApp = null; } return (iReturn); }

Auto Order Entry Service SCM
SetProfileAttributes
function SetProfileAttributes(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Set the values of one or multiple profile attributes * * Date : 2012-07-11 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method SetProfileAttributes: START"); propName = ""; //initialization, just to be prepared for the case where there are no input properties propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); oApp.SetProfileAttr(propName,propVal); propName = Inputs.GetNextProperty(); } Trace(Name()+" -> Method SetProfileAttributes: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method SetProfileAttributes Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
SetProfileAttributes
function SetProfileAttributes(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Set the values of one or multiple profile attributes * * Date : 2012-07-11 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method SetProfileAttributes: START"); propName = ""; //initialization, just to be prepared for the case where there are no input properties propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); oApp.SetProfileAttr(propName,propVal); propName = Inputs.GetNextProperty(); } Trace(Name()+" -> Method SetProfileAttributes: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method SetProfileAttributes Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
Trace
function Trace(sTraceInfo) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : eliminates the need of the Trace Is On check in the BS methods when tracing out data * * Thus the code in the BS methods is easier to read and to maintain * * Input : String to be written to the trace file * * Output : - * * * * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ try { if (bIsTraceOn) oApp.Trace(sTraceInfo); } catch (e) { // no action } }

Auto Order Entry Service SCM
Trace
function Trace(sTraceInfo) { /************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : eliminates the need of the Trace Is On check in the BS methods when tracing out data * * Thus the code in the BS methods is easier to read and to maintain * * Input : String to be written to the trace file * * Output : - * * * * Date : 2012-02-08 * *-------------------------------------------------------------------------------------------------* * Update : * **************************************************************************************************/ try { if (bIsTraceOn) oApp.Trace(sTraceInfo); } catch (e) { // no action } }

Auto Order Entry Service SCM
UpsertPropertiesToPropSet
function UpsertPropertiesToPropSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add/Update properties to/off a property set * * Date : 2012-02-20 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psHierarchy:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method UpsertPropertiesToPropSet: START"); psReturn = oApp.NewPropertySet(); propName = ""; nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psHierarchy = psTemp; } } if (psHierarchy){ psReturn = psHierarchy.Copy(); propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); // if a property with the same name already exists it will be updated psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method UpsertPropertiesToPropSet: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method UpsertPropertiesToPropSet Error: "+sError); throw(e); } finally { psHierarchy = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
UpsertPropertiesToPropSet
function UpsertPropertiesToPropSet(Inputs, Outputs) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Add/Update properties to/off a property set * * Date : 2012-02-20 * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var psHierarchy:PropertySet; var psReturn:PropertySet; var psTemp:PropertySet; var nChilds:Number; var propName:String; var propVal:String; try { // error handling/trace setup Trace(Name()+" -> Method UpsertPropertiesToPropSet: START"); psReturn = oApp.NewPropertySet(); propName = ""; nChilds = Inputs.GetChildCount(); for(var i = 0; i < nChilds; i++) { psTemp = Inputs.GetChild(i); if (psTemp.GetType() == "XMLHierarchy"){ psHierarchy = psTemp; } } if (psHierarchy){ psReturn = psHierarchy.Copy(); propName = Inputs.GetFirstProperty(); while (propName != "") { propVal = Inputs.GetProperty(propName); // if a property with the same name already exists it will be updated psReturn.SetProperty(propName, propVal); propName = Inputs.GetNextProperty(); } } else { oApp.RaiseErrorText("Required Parameter missing!"); } Outputs.AddChild(psReturn); Trace(Name()+" -> Method UpsertPropertiesToPropSet: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method UpsertPropertiesToPropSet Error: "+sError); throw(e); } finally { psHierarchy = null; psTemp = null; psReturn = null; } }

Auto Order Entry Service SCM
inList
function inList(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Checks whether a value is part of list. Comma is used as default list delimiter * * If no list or value is provided (= NULL or ""), the the result is "N". * * The search is case sensitive. * * Date : 2013-07-11 * * * * E.g: List = "VoiP-N,Mobile-N,Internert-N" * * Value = "Mobile-N" * * * * Output: found = 'Y' * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var sList:String; var sDelimiter:String; var sValue:String; var sFound:String; var aValues:Array; try { // error handling/trace setup Trace(Name()+" -> Method inList: START"); sList = Inputs.GetProperty("List") ; sDelimiter = Inputs.GetProperty("List Delimiter"); sValue = Inputs.GetProperty("Value"); sFound = "N"; if ((sList != null) && (sList !="") && (sValue != null) &&(sValue != "")) { // default delimiter = ',' if ((sDelimiter == null) || (sDelimiter == "")) {sDelimiter = ","} ; aValues = sList.split(sDelimiter); for(var i=0; i<aValues.length; i++){ if(trim(aValues[i]).valueOf() == trim(sValue).valueOf()){ sFound = "Y"; Trace(Name() + "inList: Value '" + sValue + "' found in list: " + sList); break; }; } } Outputs.SetProperty("found", sFound); Trace(Name()+" -> Method inList: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method inList Error: "+sError); throw(e); } finally { aValues = null; } }

Auto Order Entry Service SCM
inList
function inList(Inputs:PropertySet, Outputs:PropertySet) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Checks whether a value is part of list. Comma is used as default list delimiter * * If no list or value is provided (= NULL or ""), the the result is "N". * * The search is case sensitive. * * Date : 2013-07-11 * * * * E.g: List = "VoiP-N,Mobile-N,Internert-N" * * Value = "Mobile-N" * * * * Output: found = 'Y' * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ // declarations var sList:String; var sDelimiter:String; var sValue:String; var sFound:String; var aValues:Array; try { // error handling/trace setup Trace(Name()+" -> Method inList: START"); sList = Inputs.GetProperty("List") ; sDelimiter = Inputs.GetProperty("List Delimiter"); sValue = Inputs.GetProperty("Value"); sFound = "N"; if ((sList != null) && (sList !="") && (sValue != null) &&(sValue != "")) { // default delimiter = ',' if ((sDelimiter == null) || (sDelimiter == "")) {sDelimiter = ","} ; aValues = sList.split(sDelimiter); for(var i=0; i<aValues.length; i++){ if(trim(aValues[i]).valueOf() == trim(sValue).valueOf()){ sFound = "Y"; Trace(Name() + "inList: Value '" + sValue + "' found in list: " + sList); break; }; } } Outputs.SetProperty("found", sFound); Trace(Name()+" -> Method inList: END"); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method inList Error: "+sError); throw(e); } finally { aValues = null; } }

Auto Order Entry Service SCM
trim
function trim(sString:String) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes leading and tracing white spaces from a string * * Date : 2013-02-26 * * Inputs : The string to be trimed * * Outputs : The input string without leading and trailing white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var sLeftPattern; var sRightPattern; var sReturnString:String; try { sLeftPattern = /^\s*/; sRightPattern = /\s*$/; sReturnString = sString.replace(sLeftPattern,""); //Replace leading spaces with blank sReturnString = sReturnString.replace(sRightPattern,""); //Replace trailing spaces with blank return(sReturnString); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method trim() Error: "+sError); throw(e); } finally { } }

Auto Order Entry Service SCM
trim
function trim(sString:String) { /**************************************************************************************************** * Author : Dan Dragan (TGDDRDA3) * * Purpose : Removes leading and tracing white spaces from a string * * Date : 2013-02-26 * * Inputs : The string to be trimed * * Outputs : The input string without leading and trailing white spaces * *---------------------------------------------------------------------------------------------------* * Update : * ****************************************************************************************************/ var sLeftPattern; var sRightPattern; var sReturnString:String; try { sLeftPattern = /^\s*/; sRightPattern = /\s*$/; sReturnString = sString.replace(sLeftPattern,""); //Replace leading spaces with blank sReturnString = sReturnString.replace(sRightPattern,""); //Replace trailing spaces with blank return(sReturnString); } catch(e) { var sError = e.toString(); Trace(Name()+" -> Method trim() Error: "+sError); throw(e); } finally { } }

BEP BS AIP SCM
(declarations)
var bFirst; var bDebug = true; var bIsTraceOn = false;

BEP BS AIP SCM
(declarations)
var bFirst; var bDebug = true; var bIsTraceOn = false;

BEP BS AIP SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-09 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { bIsTraceOn = TheApplication().isTraceON; if (bIsTraceOn) TheApplication().Trace(this.Name()+".Init() START"); Outputs.SetProperty("AIP Address Id",""); Outputs.SetProperty("AIP Availability Date",""); Outputs.SetProperty("AIP Business State",""); Outputs.SetProperty("AIP Capacity",""); Outputs.SetProperty("AIP Communication Date",""); Outputs.SetProperty("AIP Inhouse Allowed",""); Outputs.SetProperty("AIP Location Id",""); Outputs.SetProperty("AIP Quote Id",""); bFirst=true; } catch(e) { var sError = e.toString(); if (bIsTraceOn) TheApplication().Trace("BusinessService->Method Error: "+sError); throw(e); } finally { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Init() END"); } }

BEP BS AIP SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-09 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { bIsTraceOn = TheApplication().isTraceON; if (bIsTraceOn) TheApplication().Trace(this.Name()+".Init() START"); Outputs.SetProperty("AIP Address Id",""); Outputs.SetProperty("AIP Availability Date",""); Outputs.SetProperty("AIP Business State",""); Outputs.SetProperty("AIP Capacity",""); Outputs.SetProperty("AIP Communication Date",""); Outputs.SetProperty("AIP Inhouse Allowed",""); Outputs.SetProperty("AIP Location Id",""); Outputs.SetProperty("AIP Quote Id",""); bFirst=true; } catch(e) { var sError = e.toString(); if (bIsTraceOn) TheApplication().Trace("BusinessService->Method Error: "+sError); throw(e); } finally { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Init() END"); } }

BEP BS AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-18 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Query() START"); var sBEP = TheApplication().GetSharedGlobal("BEP"); var arrBEProws; var arrBEPFlds; if (sBEP.length > 0) { arrBEProws = sBEP.split(";"); for (var ix=0; ix < arrBEProws.length -1; ix++) { arrBEPFlds = arrBEProws[ix].split(","); var oPSOutputStruct:PropertySet = TheApplication().NewPropertySet(); oPSOutputStruct.SetProperty("AIP Availability Date",arrBEPFlds[0]); oPSOutputStruct.SetProperty("AIP Business State",arrBEPFlds[1]); oPSOutputStruct.SetProperty("AIP Capacity",arrBEPFlds[2]); oPSOutputStruct.SetProperty("AIP Communication Date",arrBEPFlds[3]); oPSOutputStruct.SetProperty("AIP Inhouse Allowed",arrBEPFlds[4]); oPSOutputStruct.SetProperty("AIP Location Id",arrBEPFlds[5]); Outputs.AddChild(oPSOutputStruct); oPSOutputStruct = null; } } } catch(e) { var sError = e.toString(); if (bIsTraceOn) TheApplication().Trace("BusinessService->Method Error: "+sError); throw(e); } finally { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Query() END"); } }

BEP BS AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-18 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Query() START"); var sBEP = TheApplication().GetSharedGlobal("BEP"); var arrBEProws; var arrBEPFlds; if (sBEP.length > 0) { arrBEProws = sBEP.split(";"); for (var ix=0; ix < arrBEProws.length -1; ix++) { arrBEPFlds = arrBEProws[ix].split(","); var oPSOutputStruct:PropertySet = TheApplication().NewPropertySet(); oPSOutputStruct.SetProperty("AIP Availability Date",arrBEPFlds[0]); oPSOutputStruct.SetProperty("AIP Business State",arrBEPFlds[1]); oPSOutputStruct.SetProperty("AIP Capacity",arrBEPFlds[2]); oPSOutputStruct.SetProperty("AIP Communication Date",arrBEPFlds[3]); oPSOutputStruct.SetProperty("AIP Inhouse Allowed",arrBEPFlds[4]); oPSOutputStruct.SetProperty("AIP Location Id",arrBEPFlds[5]); Outputs.AddChild(oPSOutputStruct); oPSOutputStruct = null; } } } catch(e) { var sError = e.toString(); if (bIsTraceOn) TheApplication().Trace("BusinessService->Method Error: "+sError); throw(e); } finally { if (bIsTraceOn) TheApplication().Trace(this.Name()+".Query() END"); } }

BEP BS AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-18 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query (Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

BEP BS AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Project: AIP // Authors: Eduard Constantin, TGDCOED1 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-06-18 E.S. Constantin 1 created // ---------------------------------------------------------------------------------------- // Update : 2011-02-02 - TGDCOED4 - Incorporated into Symphony //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query (Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

BS Generic SCS
(declarations)
//TGDSEAI1 23.03.2012 Defect 47894 Script Improvement, general variables and declarations var bIsTraceOn = TheApplication().isTraceON; //Logging variables var PARENT_LOG_ID = ""; //Counter of the process var ERROR_COUNT = 0; var PROCESSED_SR_COUNT = 0;

BS Generic SCS
(declarations)
//TGDSEAI1 23.03.2012 Defect 47894 Script Improvement, general variables and declarations var bIsTraceOn = TheApplication().isTraceON; //Logging variables var PARENT_LOG_ID = ""; //Counter of the process var ERROR_COUNT = 0; var PROCESSED_SR_COUNT = 0;

BS Generic SCS
AddToDate
function AddToDate(sourceDate, nDays, nHours, nMinutes, nSeconds, nsign) { // Parameters : // sourceDate : Date object // nDays, nHours , nMinutes , nSeconds : Integer numbers // nsign : Can have two values : 1 or -1 // 1 indicates to ADD to the sourceDate // -1 indicates to SUBTRACT from the sourceDate // Returns : A date object, after adding/subtracting // ndays,hNours,nMinutes // and nseconds to the sourceDate. var retDate = sourceDate; retDate.setDate(retDate.getDate()+nsign*nDays); retDate.setHours(retDate.getHours()+nsign*nHours); retDate.setMinutes(retDate.getMinutes()+nsign*nMinutes); retDate.setSeconds(retDate.getSeconds()+nsign*nSeconds); return (retDate) }

BS Generic SCS
AddToDate
function AddToDate(sourceDate, nDays, nHours, nMinutes, nSeconds, nsign) { // Parameters : // sourceDate : Date object // nDays, nHours , nMinutes , nSeconds : Integer numbers // nsign : Can have two values : 1 or -1 // 1 indicates to ADD to the sourceDate // -1 indicates to SUBTRACT from the sourceDate // Returns : A date object, after adding/subtracting // ndays,hNours,nMinutes // and nseconds to the sourceDate. var retDate = sourceDate; retDate.setDate(retDate.getDate()+nsign*nDays); retDate.setHours(retDate.getHours()+nsign*nHours); retDate.setMinutes(retDate.getMinutes()+nsign*nMinutes); retDate.setSeconds(retDate.getSeconds()+nsign*nSeconds); return (retDate) }

BS Generic SCS
ArchiveSearchLog
function ArchiveSearchLog() { /******************************************************* ** Name: ArchiveSearchLog ** Created: 16.03.2006 ** Created By: Petra Marty ** Description: Copy Log SR and delete Entry Afterwars ******************************************************/ try { var intNumberArchivedLogs; var boSearch, bcSearch, boArchive, bcArchive; // Migration Logging var boLog, bcLog, bcLogEvent, bcLogRecord; var objNow; var strLogEventDescText, strLogEntry; objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; strLogEntry = strLogEventDescText + "; "; // Create Log BCs boLog = TheApplication().GetBusObject("Log SCM"); bcLog = boLog.GetBusComp("Log SCM"); bcLogEvent = boLog.GetBusComp("Log Event SCM"); bcLogRecord = boLog.GetBusComp("Log Record SCM"); // Create Log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name","ARCHIVE_SEARCH_LOG_POS"); SetFieldValue("Type", "Siebel Workflow"); SetFieldValue("Desc Text","Copy POS Search Log into Archive"); WriteRecord(); } // Create Start Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Start"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } boSearch = TheApplication().GetBusObject("Search Log SI SCS"); bcSearch = boSearch.GetBusComp("Search Log SI SCS"); boArchive = TheApplication().GetBusObject("Search Archive SI SCS"); bcArchive = boArchive.GetBusComp("Search Archive SI SCS"); intNumberArchivedLogs = 0; with (bcSearch) { ClearToQuery(); SetViewMode(AllView); //look for all logs older than today SetSearchSpec("Created", "< Today ()-1"); ExecuteQuery(ForwardBackward); } while (bcSearch.FirstRecord()) // Loop { //Write Record to Archive with(bcArchive) { NewRecord(NewAfter); SetFieldValue("SIM", bcSearch.GetFieldValue("SIM")); SetFieldValue("MSISDN", bcSearch.GetFieldValue("MSISDN")); SetFieldValue("Success Flag", bcSearch.GetFieldValue("Success Flag")); SetFieldValue("Partner Id", bcSearch.GetFieldValue("Partner Id")); SetFieldValue("Search Date", bcSearch.GetFieldValue("Created")); SetFieldValue("User Id", bcSearch.GetFieldValue("Created By")); WriteRecord(); } bcSearch.DeleteRecord(); intNumberArchivedLogs ++; } // End while with(bcLogEvent) { // Event for Archived Logs strLogEventDescText = "Number Log Entries Archived: " + intNumberArchivedLogs ; NewRecord(NewAfter); SetFieldValue("Type", "Delete"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); //Event for Deleted Logs } objNow = new Date(); strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)" strLogEntry += strLogEventDescText + "; "; // Create Stop Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Stop"); SetFieldValue("Desc Text", strLogEventDescText); WriteRecord(); } } catch (e) { with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", e.toString()); WriteRecord(); } throw e; } finally { bcArchive = null; bcSearch = null; boArchive = null; boSearch = null; bcLogRecord = null; bcLogEvent = null; bcLog = null; boLog = null; objNow = null; } }

BS Generic SCS
ArchiveSearchLog
function ArchiveSearchLog() { /******************************************************* ** Name: ArchiveSearchLog ** Created: 16.03.2006 ** Created By: Petra Marty ** Description: Copy Log SR and delete Entry Afterwars ******************************************************/ try { var intNumberArchivedLogs; var boSearch, bcSearch, boArchive, bcArchive; // Migration Logging var boLog, bcLog, bcLogEvent, bcLogRecord; var objNow; var strLogEventDescText, strLogEntry; objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; strLogEntry = strLogEventDescText + "; "; // Create Log BCs boLog = TheApplication().GetBusObject("Log SCM"); bcLog = boLog.GetBusComp("Log SCM"); bcLogEvent = boLog.GetBusComp("Log Event SCM"); bcLogRecord = boLog.GetBusComp("Log Record SCM"); // Create Log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name","ARCHIVE_SEARCH_LOG_POS"); SetFieldValue("Type", "Siebel Workflow"); SetFieldValue("Desc Text","Copy POS Search Log into Archive"); WriteRecord(); } // Create Start Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Start"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } boSearch = TheApplication().GetBusObject("Search Log SI SCS"); bcSearch = boSearch.GetBusComp("Search Log SI SCS"); boArchive = TheApplication().GetBusObject("Search Archive SI SCS"); bcArchive = boArchive.GetBusComp("Search Archive SI SCS"); intNumberArchivedLogs = 0; with (bcSearch) { ClearToQuery(); SetViewMode(AllView); //look for all logs older than today SetSearchSpec("Created", "< Today ()-1"); ExecuteQuery(ForwardBackward); } while (bcSearch.FirstRecord()) // Loop { //Write Record to Archive with(bcArchive) { NewRecord(NewAfter); SetFieldValue("SIM", bcSearch.GetFieldValue("SIM")); SetFieldValue("MSISDN", bcSearch.GetFieldValue("MSISDN")); SetFieldValue("Success Flag", bcSearch.GetFieldValue("Success Flag")); SetFieldValue("Partner Id", bcSearch.GetFieldValue("Partner Id")); SetFieldValue("Search Date", bcSearch.GetFieldValue("Created")); SetFieldValue("User Id", bcSearch.GetFieldValue("Created By")); WriteRecord(); } bcSearch.DeleteRecord(); intNumberArchivedLogs ++; } // End while with(bcLogEvent) { // Event for Archived Logs strLogEventDescText = "Number Log Entries Archived: " + intNumberArchivedLogs ; NewRecord(NewAfter); SetFieldValue("Type", "Delete"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); //Event for Deleted Logs } objNow = new Date(); strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)" strLogEntry += strLogEventDescText + "; "; // Create Stop Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Stop"); SetFieldValue("Desc Text", strLogEventDescText); WriteRecord(); } } catch (e) { with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", e.toString()); WriteRecord(); } throw e; } finally { bcArchive = null; bcSearch = null; boArchive = null; boSearch = null; bcLogRecord = null; bcLogEvent = null; bcLog = null; boLog = null; objNow = null; } }

BS Generic SCS
DateToString
function DateToString(dDate) { // Parameters : // dDate : Date object // Returns : A string with the format "mm/dd/yyyy" or "mm/dd/yyyy hh:mm:ss" var sMonth = ToString(dDate.getMonth() + 1); if (sMonth.length == 1) {sMonth = "0" + sMonth;} var sDay = ToString(dDate.getDate()); if (sDay.length == 1) {sDay = "0" + sDay;} var sHours = ToString(dDate.getHours()); if (sHours.length == 1) {sHours = "0" + sHours;} var sMinutes = ToString(dDate.getMinutes()); if (sMinutes.length == 1) {sMinutes = "0" + sMinutes;} var sSeconds = ToString(dDate.getSeconds()); if (sSeconds.length == 1) {sSeconds = "0" + sSeconds;} if (sHours == "00" && sMinutes == "00" && sSeconds == "00") return (sMonth +"/"+ sDay +"/" + dDate.getFullYear()) else return (sMonth +"/"+ sDay +"/" + dDate.getFullYear() +" "+sHours+":"+sMinutes+":"+sSeconds); }

BS Generic SCS
DateToString
function DateToString(dDate) { // Parameters : // dDate : Date object // Returns : A string with the format "mm/dd/yyyy" or "mm/dd/yyyy hh:mm:ss" var sMonth = ToString(dDate.getMonth() + 1); if (sMonth.length == 1) {sMonth = "0" + sMonth;} var sDay = ToString(dDate.getDate()); if (sDay.length == 1) {sDay = "0" + sDay;} var sHours = ToString(dDate.getHours()); if (sHours.length == 1) {sHours = "0" + sHours;} var sMinutes = ToString(dDate.getMinutes()); if (sMinutes.length == 1) {sMinutes = "0" + sMinutes;} var sSeconds = ToString(dDate.getSeconds()); if (sSeconds.length == 1) {sSeconds = "0" + sSeconds;} if (sHours == "00" && sMinutes == "00" && sSeconds == "00") return (sMonth +"/"+ sDay +"/" + dDate.getFullYear()) else return (sMonth +"/"+ sDay +"/" + dDate.getFullYear() +" "+sHours+":"+sMinutes+":"+sSeconds); }

BS Generic SCS
DeleteArchiveLog
function DeleteArchiveLog() { /******************************************************* ** Name: DeleteArchiveLog ** Created: 17.03.2006 ** Created By: Petra Marty ** Description: Delete all entries in archive that are ** older than 6 Months ******************************************************/ try { var intNumberArchivedLogs; var boArchive, bcArchive; // Migration Logging var boLog, bcLog, bcLogEvent, bcLogRecord; var objNow; var strLogEventDescText, strLogEntry; objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; strLogEntry = strLogEventDescText + "; "; // Create Log BCs boLog = TheApplication().GetBusObject("Log SCM"); bcLog = boLog.GetBusComp("Log SCM"); bcLogEvent = boLog.GetBusComp("Log Event SCM"); bcLogRecord = boLog.GetBusComp("Log Record SCM"); // Create Log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name","DELETE_ARCHIVE_LOG_POS"); SetFieldValue("Type", "Siebel Workflow"); SetFieldValue("Desc Text","Delete POS Search Log from Archive"); WriteRecord(); } // Create Start Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Start"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } boArchive = TheApplication().GetBusObject("Search Archive SI SCS"); bcArchive = boArchive.GetBusComp("Search Archive SI SCS"); intNumberArchivedLogs = 0; with (bcArchive) { ClearToQuery(); SetViewMode(AllView); //Delete all entries in archive that are older than 6 Months = 183 days SetSearchSpec("Search Date", "< Today () -183"); ExecuteQuery(ForwardBackward); while (FirstRecord()) // Loop { //Delete Record from Archive DeleteRecord(); intNumberArchivedLogs ++; } // End while } with(bcLogEvent) { strLogEventDescText = "Number of archived Logs deleted: " + intNumberArchivedLogs ; NewRecord(NewAfter); SetFieldValue("Type", "Delete"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } objNow = new Date(); strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)" strLogEntry += strLogEventDescText + "; "; // Create Stop Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Stop"); SetFieldValue("Desc Text", strLogEventDescText); WriteRecord(); } } catch (e) { with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", e.toString()); WriteRecord(); } throw e; } finally { bcArchive = null; boArchive = null; bcLogRecord = null; bcLogEvent = null; bcLog = null; boLog = null; objNow = null; } }

BS Generic SCS
DeleteArchiveLog
function DeleteArchiveLog() { /******************************************************* ** Name: DeleteArchiveLog ** Created: 17.03.2006 ** Created By: Petra Marty ** Description: Delete all entries in archive that are ** older than 6 Months ******************************************************/ try { var intNumberArchivedLogs; var boArchive, bcArchive; // Migration Logging var boLog, bcLog, bcLogEvent, bcLogRecord; var objNow; var strLogEventDescText, strLogEntry; objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; strLogEntry = strLogEventDescText + "; "; // Create Log BCs boLog = TheApplication().GetBusObject("Log SCM"); bcLog = boLog.GetBusComp("Log SCM"); bcLogEvent = boLog.GetBusComp("Log Event SCM"); bcLogRecord = boLog.GetBusComp("Log Record SCM"); // Create Log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name","DELETE_ARCHIVE_LOG_POS"); SetFieldValue("Type", "Siebel Workflow"); SetFieldValue("Desc Text","Delete POS Search Log from Archive"); WriteRecord(); } // Create Start Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Start"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } boArchive = TheApplication().GetBusObject("Search Archive SI SCS"); bcArchive = boArchive.GetBusComp("Search Archive SI SCS"); intNumberArchivedLogs = 0; with (bcArchive) { ClearToQuery(); SetViewMode(AllView); //Delete all entries in archive that are older than 6 Months = 183 days SetSearchSpec("Search Date", "< Today () -183"); ExecuteQuery(ForwardBackward); while (FirstRecord()) // Loop { //Delete Record from Archive DeleteRecord(); intNumberArchivedLogs ++; } // End while } with(bcLogEvent) { strLogEventDescText = "Number of archived Logs deleted: " + intNumberArchivedLogs ; NewRecord(NewAfter); SetFieldValue("Type", "Delete"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } objNow = new Date(); strLogEventDescText = "End at " + objNow.toLocaleString() + " (Server Time)" strLogEntry += strLogEventDescText + "; "; // Create Stop Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Stop"); SetFieldValue("Desc Text", strLogEventDescText); WriteRecord(); } } catch (e) { with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", e.toString()); WriteRecord(); } throw e; } finally { bcArchive = null; boArchive = null; bcLogRecord = null; bcLogEvent = null; bcLog = null; boLog = null; objNow = null; } }

BS Generic SCS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var strErrCode = 0; var strErrMessage = ""; var strLogEntry = ""; // var SCSUpdated; try { switch (MethodName) { case "UpdateGenericSR": UpdateGenericSR(); break; case "ArchiveSearchLog": ArchiveSearchLog(); break; case "DeleteArchiveLog": DeleteArchiveLog(); break; // TGDPAANC 21.01.2014 added to test SR Update configuration case "TestSRUpdate": fTestSRUpdate(Inputs, Outputs); break default: throw {Code: "ERR_UNKNOWN_METHOD", P1: MethodName}; } } catch (e) { if (e.Code) { switch (e.Code) { case "ERR_UNKNOWN_METHOD": strErrCode = 1010; strErrMessage = "Unknown Method: " + e.P1; break; default: strErrCode = 1998; strErrMessage = "Unknown Error: " + e.Code; } } else { strErrCode = 1999; strErrMessage = e.toString(); } } finally { Outputs.SetProperty("Error Code SCM", strErrCode); Outputs.SetProperty("Error Message SCM", strErrMessage); } return (CancelOperation); }

BS Generic SCS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var strErrCode = 0; var strErrMessage = ""; var strLogEntry = ""; // var SCSUpdated; try { switch (MethodName) { case "UpdateGenericSR": UpdateGenericSR(); break; case "ArchiveSearchLog": ArchiveSearchLog(); break; case "DeleteArchiveLog": DeleteArchiveLog(); break; // TGDPAANC 21.01.2014 added to test SR Update configuration case "TestSRUpdate": fTestSRUpdate(Inputs, Outputs); break default: throw {Code: "ERR_UNKNOWN_METHOD", P1: MethodName}; } } catch (e) { if (e.Code) { switch (e.Code) { case "ERR_UNKNOWN_METHOD": strErrCode = 1010; strErrMessage = "Unknown Method: " + e.P1; break; default: strErrCode = 1998; strErrMessage = "Unknown Error: " + e.Code; } } else { strErrCode = 1999; strErrMessage = e.toString(); } } finally { Outputs.SetProperty("Error Code SCM", strErrCode); Outputs.SetProperty("Error Message SCM", strErrMessage); } return (CancelOperation); }

BS Generic SCS
UpdateGenericSR
function UpdateGenericSR() { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function UpdateGenericSR ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up, main function query for each update parameter ***************************************************************** ** Update: 19.06.2013 - TGDPAANC - Haydn project updates: ** Include SR Owner in query for SRs to update ** Update of N-stack SRs *****************************************************************/ //Variable declaration var boSRUpdateParam:BusObject; var bcSRUpdateParam:BusComp; var objNow:Date; var isRecordParam; var strPriority = ""; var strArea = ""; var strSubArea = ""; var strDetail = ""; var strTime = ""; var strSalesGroup = ""; var strStatusBefore = ""; var strStatusAfter = ""; var strAppName = ""; var strDescText = ""; var strLogEventDescText; var strSearchSpec = ""; var strOwner = ""; var intCounterSR = 0; var strQuoteCompleteCode = ""; var strSRNEOChannel = ""; try { // Create Start Log fStartLogging("UPDATE_GENERIC_SR","Siebel Workflow","Start SR Status Update"); //Log Start Event objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; fLogEvent("Start", strLogEventDescText); // BO/BC Declaration out of the loop boSRUpdateParam = TheApplication().GetBusObject("Admin SR Update Parameter SCM"); bcSRUpdateParam = boSRUpdateParam.GetBusComp("SR Update Parameter SCM"); //Query to get SR Update Parameters from were the search criteria is extracted. bcSRUpdateParam.SetViewMode(AllView); bcSRUpdateParam.ActivateField("Priority"); bcSRUpdateParam.ActivateField("SR Time"); bcSRUpdateParam.ActivateField("SR Area"); bcSRUpdateParam.ActivateField("SR Sub-Area"); bcSRUpdateParam.ActivateField("SR Detail"); //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U bcSRUpdateParam.ActivateField("Sales Group"); bcSRUpdateParam.ActivateField("Status Before"); bcSRUpdateParam.ActivateField("Status After"); bcSRUpdateParam.ActivateField("Log Application Name"); bcSRUpdateParam.ActivateField("Log Description Text"); bcSRUpdateParam.ActivateField("SR Owner Id SCM"); bcSRUpdateParam.ActivateField("Quote Completeness Code SCM"); bcSRUpdateParam.ActivateField("Neo Channel SCM"); bcSRUpdateParam.ClearToQuery(); bcSRUpdateParam.SetSortSpec("Priority (ASCENDING)"); bcSRUpdateParam.ExecuteQuery(ForwardBackward); isRecordParam = bcSRUpdateParam.FirstRecord(); while (isRecordParam) { try { //Get Field that will be used to build the SR Search Specification strPriority = bcSRUpdateParam.GetFieldValue("Priority"); strTime = bcSRUpdateParam.GetFieldValue("SR Time"); strArea = bcSRUpdateParam.GetFieldValue("SR Area"); strSubArea = bcSRUpdateParam.GetFieldValue("SR Sub-Area"); strDetail = bcSRUpdateParam.GetFieldValue("SR Detail"); strSalesGroup = bcSRUpdateParam.GetFieldValue("Sales Group"); strStatusBefore = bcSRUpdateParam.GetFieldValue("Status Before"); strStatusAfter = bcSRUpdateParam.GetFieldValue("Status After"); strAppName = bcSRUpdateParam.GetFieldValue("Log Application Name"); strDescText = bcSRUpdateParam.GetFieldValue("Log Description Text"); strOwner = bcSRUpdateParam.GetFieldValue("SR Owner Id SCM"); strQuoteCompleteCode = bcSRUpdateParam.GetFieldValue("Quote Completeness Code SCM"); strSRNEOChannel = bcSRUpdateParam.GetFieldValue("Neo Channel SCM"); //Get the search specification strSearchSpec = fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea,strDetail,strSalesGroup,strStatusBefore,strOwner, strQuoteCompleteCode, strSRNEOChannel); //Process SRs with search spec intCounterSR = fProcesSRs(strSearchSpec,strStatusAfter,strStatusBefore); //Generate event log strLogEventDescText = fGenerateEventDescText(intCounterSR, strSear

BS Generic SCS
UpdateGenericSR
function UpdateGenericSR() { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function UpdateGenericSR ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up, main function query for each update parameter ***************************************************************** ** Update: 19.06.2013 - TGDPAANC - Haydn project updates: ** Include SR Owner in query for SRs to update ** Update of N-stack SRs *****************************************************************/ //Variable declaration var boSRUpdateParam:BusObject; var bcSRUpdateParam:BusComp; var objNow:Date; var isRecordParam; var strPriority = ""; var strArea = ""; var strSubArea = ""; var strDetail = ""; var strTime = ""; var strSalesGroup = ""; var strStatusBefore = ""; var strStatusAfter = ""; var strAppName = ""; var strDescText = ""; var strLogEventDescText; var strSearchSpec = ""; var strOwner = ""; var intCounterSR = 0; var strQuoteCompleteCode = ""; var strSRNEOChannel = ""; try { // Create Start Log fStartLogging("UPDATE_GENERIC_SR","Siebel Workflow","Start SR Status Update"); //Log Start Event objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; fLogEvent("Start", strLogEventDescText); // BO/BC Declaration out of the loop boSRUpdateParam = TheApplication().GetBusObject("Admin SR Update Parameter SCM"); bcSRUpdateParam = boSRUpdateParam.GetBusComp("SR Update Parameter SCM"); //Query to get SR Update Parameters from were the search criteria is extracted. bcSRUpdateParam.SetViewMode(AllView); bcSRUpdateParam.ActivateField("Priority"); bcSRUpdateParam.ActivateField("SR Time"); bcSRUpdateParam.ActivateField("SR Area"); bcSRUpdateParam.ActivateField("SR Sub-Area"); bcSRUpdateParam.ActivateField("SR Detail"); //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U bcSRUpdateParam.ActivateField("Sales Group"); bcSRUpdateParam.ActivateField("Status Before"); bcSRUpdateParam.ActivateField("Status After"); bcSRUpdateParam.ActivateField("Log Application Name"); bcSRUpdateParam.ActivateField("Log Description Text"); bcSRUpdateParam.ActivateField("SR Owner Id SCM"); bcSRUpdateParam.ActivateField("Quote Completeness Code SCM"); bcSRUpdateParam.ActivateField("Neo Channel SCM"); bcSRUpdateParam.ClearToQuery(); bcSRUpdateParam.SetSortSpec("Priority (ASCENDING)"); bcSRUpdateParam.ExecuteQuery(ForwardBackward); isRecordParam = bcSRUpdateParam.FirstRecord(); while (isRecordParam) { try { //Get Field that will be used to build the SR Search Specification strPriority = bcSRUpdateParam.GetFieldValue("Priority"); strTime = bcSRUpdateParam.GetFieldValue("SR Time"); strArea = bcSRUpdateParam.GetFieldValue("SR Area"); strSubArea = bcSRUpdateParam.GetFieldValue("SR Sub-Area"); strDetail = bcSRUpdateParam.GetFieldValue("SR Detail"); strSalesGroup = bcSRUpdateParam.GetFieldValue("Sales Group"); strStatusBefore = bcSRUpdateParam.GetFieldValue("Status Before"); strStatusAfter = bcSRUpdateParam.GetFieldValue("Status After"); strAppName = bcSRUpdateParam.GetFieldValue("Log Application Name"); strDescText = bcSRUpdateParam.GetFieldValue("Log Description Text"); strOwner = bcSRUpdateParam.GetFieldValue("SR Owner Id SCM"); strQuoteCompleteCode = bcSRUpdateParam.GetFieldValue("Quote Completeness Code SCM"); strSRNEOChannel = bcSRUpdateParam.GetFieldValue("Neo Channel SCM"); //Get the search specification strSearchSpec = fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea,strDetail,strSalesGroup,strStatusBefore,strOwner, strQuoteCompleteCode, strSRNEOChannel); //Process SRs with search spec intCounterSR = fProcesSRs(strSearchSpec,strStatusAfter,strStatusBefore); //Generate event log strLogEventDescText = fGenerateEventDescText(intCounterSR, strSear

BS Generic SCS
fGenerateEventDescText
function fGenerateEventDescText(intCounterSR, strSearchSpec, strStatusAfter){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fGenerateEventDescText ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate event description *****************************************************************/ //Initialize variabled var strLogEventDescText = ""; try{ strLogEventDescText = "Number SR Updated: " + intCounterSR +" with criteria:" + strSearchSpec; strLogEventDescText = strLogEventDescText + " \n Status after Update " + strStatusAfter; } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fGenerateEventDescText: " + e.message); throw(e); } finally{ } return (strLogEventDescText); }

BS Generic SCS
fGenerateEventDescText
function fGenerateEventDescText(intCounterSR, strSearchSpec, strStatusAfter){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fGenerateEventDescText ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate event description *****************************************************************/ //Initialize variabled var strLogEventDescText = ""; try{ strLogEventDescText = "Number SR Updated: " + intCounterSR +" with criteria:" + strSearchSpec; strLogEventDescText = strLogEventDescText + " \n Status after Update " + strStatusAfter; } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fGenerateEventDescText: " + e.message); throw(e); } finally{ } return (strLogEventDescText); }

BS Generic SCS
fGenerateSRSearchSpec
function fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea, strDetail, strSalesGroup, strStatusBefore, strOwner, strQuoteCompleteCode, strSRNEOChannel){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fGenerateSRSearchSpec ** Created: 09.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate the search spec of the *****************************************************************/ //Variable declaration var dNew:Date; var dDate:Date; var strSearchSpec = ""; try{ dNew = new Date(); dDate = AddToDate(dNew, 0, strTime, 0, 0, -1); strSearchSpec = "([Created] < '" + DateToString(dDate) + "' AND [Status]= '" + strStatusBefore ; if (strArea != null && strArea != "") { strSearchSpec = strSearchSpec + "' AND [Area]= '" + strArea; } if (strSubArea != null && strSubArea != "") { strSearchSpec = strSearchSpec + "' AND [Sub-Area]= '" + strSubArea; } //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U if (strDetail != null && strDetail != "") { strSearchSpec = strSearchSpec + "' AND [Info Consult CD Not GUI SCM]= '" + strDetail; } if (strSalesGroup != null && strSalesGroup != "") { //strSearchSpec = strSearchSpec + "' AND [Salesgroup SCM]= '" + strSalesGroup; strSearchSpec = strSearchSpec + "' AND [Owner Salesgroup SCM]= '" + strSalesGroup; } if (strOwner != null && strOwner != "") { // TGDPAANC 19.06.2013 Haydn - added SR Owner strSearchSpec = strSearchSpec + "' AND [Owned By Id]= '" + strOwner; } if (strQuoteCompleteCode != null && strQuoteCompleteCode != "") { strSearchSpec = strSearchSpec + "' AND [Quote Completeness Code SCM]= '" + strQuoteCompleteCode; } if (strSRNEOChannel!= null && strSRNEOChannel!= "") { strSearchSpec = strSearchSpec + "' AND [Neo Channel SCM]= '" + strSRNEOChannel; } strSearchSpec = strSearchSpec + "')"; } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fGenerateSRSearchSpec Error: " + e.message); throw(e); } finally{ //Variable destruction dNew = null; dDate = null; } return (strSearchSpec); }

BS Generic SCS
fGenerateSRSearchSpec
function fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea, strDetail, strSalesGroup, strStatusBefore, strOwner, strQuoteCompleteCode, strSRNEOChannel){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fGenerateSRSearchSpec ** Created: 09.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate the search spec of the *****************************************************************/ //Variable declaration var dNew:Date; var dDate:Date; var strSearchSpec = ""; try{ dNew = new Date(); dDate = AddToDate(dNew, 0, strTime, 0, 0, -1); strSearchSpec = "([Created] < '" + DateToString(dDate) + "' AND [Status]= '" + strStatusBefore ; if (strArea != null && strArea != "") { strSearchSpec = strSearchSpec + "' AND [Area]= '" + strArea; } if (strSubArea != null && strSubArea != "") { strSearchSpec = strSearchSpec + "' AND [Sub-Area]= '" + strSubArea; } //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U if (strDetail != null && strDetail != "") { strSearchSpec = strSearchSpec + "' AND [Info Consult CD Not GUI SCM]= '" + strDetail; } if (strSalesGroup != null && strSalesGroup != "") { //strSearchSpec = strSearchSpec + "' AND [Salesgroup SCM]= '" + strSalesGroup; strSearchSpec = strSearchSpec + "' AND [Owner Salesgroup SCM]= '" + strSalesGroup; } if (strOwner != null && strOwner != "") { // TGDPAANC 19.06.2013 Haydn - added SR Owner strSearchSpec = strSearchSpec + "' AND [Owned By Id]= '" + strOwner; } if (strQuoteCompleteCode != null && strQuoteCompleteCode != "") { strSearchSpec = strSearchSpec + "' AND [Quote Completeness Code SCM]= '" + strQuoteCompleteCode; } if (strSRNEOChannel!= null && strSRNEOChannel!= "") { strSearchSpec = strSearchSpec + "' AND [Neo Channel SCM]= '" + strSRNEOChannel; } strSearchSpec = strSearchSpec + "')"; } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + ".fGenerateSRSearchSpec Error: " + e.message); throw(e); } finally{ //Variable destruction dNew = null; dDate = null; } return (strSearchSpec); }

BS Generic SCS
fLogError
function fLogError(errorCode, errorMessage, strSRID) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fStartLogging ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to error logging *****************************************************************/ //Variable declaration var boLog:BusObject; var bcLogError:BusComp; var strDescText; var strUserKey = "ErrNum:" + ERROR_COUNT; var strErroCode = "000"; var strErrorMessage = "Unexpected Technical Error"; try{ //Intialize BC/BO boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogError = boLog.GetBusComp("Log 2 Error SCM"); //Set the error code if the input exist otherwise leave standar value if(errorCode != null && errorCode !=""){ strErroCode = errorCode; } if(errorMessage != null && errorMessage != ""){ strErrorMessage = errorMessage; } //Set description default value strDescText = "Error Cd: " + strErroCode + "- Error Msg: " + strErrorMessage; //Set the desc text based on the input if(strSRID != null && strSRID !=""){ strDescText = "SR: " + strSRID + " Error Cd: " + strErroCode + "- Error Msg: " + strErrorMessage; strUserKey = strSRID; } //Ensure that the lenght of the description and user key and no longer than maximum if(strDescText.length > 1000){ strDescText = strDescText.substring(0,100); } if(strUserKey.length > 100){ strUserKey = strUserKey.substring(0,100); } //Insert new record with(bcLogError) { NewRecord(NewAfter); SetFieldValue("Log Id",PARENT_LOG_ID); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", strDescText); SetFieldValue("User Key", strUserKey); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogError: " + e.message); throw(e); } finally{ //Object destruction boLog = null; bcLogError = null } }

BS Generic SCS
fLogError
function fLogError(errorCode, errorMessage, strSRID) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fStartLogging ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to error logging *****************************************************************/ //Variable declaration var boLog:BusObject; var bcLogError:BusComp; var strDescText; var strUserKey = "ErrNum:" + ERROR_COUNT; var strErroCode = "000"; var strErrorMessage = "Unexpected Technical Error"; try{ //Intialize BC/BO boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogError = boLog.GetBusComp("Log 2 Error SCM"); //Set the error code if the input exist otherwise leave standar value if(errorCode != null && errorCode !=""){ strErroCode = errorCode; } if(errorMessage != null && errorMessage != ""){ strErrorMessage = errorMessage; } //Set description default value strDescText = "Error Cd: " + strErroCode + "- Error Msg: " + strErrorMessage; //Set the desc text based on the input if(strSRID != null && strSRID !=""){ strDescText = "SR: " + strSRID + " Error Cd: " + strErroCode + "- Error Msg: " + strErrorMessage; strUserKey = strSRID; } //Ensure that the lenght of the description and user key and no longer than maximum if(strDescText.length > 1000){ strDescText = strDescText.substring(0,100); } if(strUserKey.length > 100){ strUserKey = strUserKey.substring(0,100); } //Insert new record with(bcLogError) { NewRecord(NewAfter); SetFieldValue("Log Id",PARENT_LOG_ID); SetFieldValue("Type", "Error"); SetFieldValue("Desc Text", strDescText); SetFieldValue("User Key", strUserKey); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogError: " + e.message); throw(e); } finally{ //Object destruction boLog = null; bcLogError = null } }

BS Generic SCS
fLogEvent
function fLogEvent(strType, strDescText){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fLogEvent ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate log event *****************************************************************/ var boLog:BusObject; var bcLogEvent:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogEvent = boLog.GetBusComp("Log 2 Event SCM"); with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Log Id",PARENT_LOG_ID); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogEvent: " + e.message); throw(e); } finally{ boLog = null; bcLogEvent = null; } }

BS Generic SCS
fLogEvent
function fLogEvent(strType, strDescText){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fLogEvent ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to generate log event *****************************************************************/ var boLog:BusObject; var bcLogEvent:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLogEvent = boLog.GetBusComp("Log 2 Event SCM"); with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Log Id",PARENT_LOG_ID); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fLogEvent: " + e.message); throw(e); } finally{ boLog = null; bcLogEvent = null; } }

BS Generic SCS
fProcesSRs
function fProcesSRs(strSearchSpec, strStatusAfter, strStatusBefore){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fProcesSRs ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up. Function thats gets the search specification and process SRs ***************************************************************** ** Update: TGDPAANC Haydn 19.06.2013 - added n-stack SR cancellation + SR Owner criterium **************************************************************************************************************/ //Variable declaration var boServiceRequest:BusObject; var bcServiceRequest:BusComp; var bsWF:Service; var psIn:PropertySet; var psOut:PropertySet; var intCounterSR = 0; var isRecordSR; var strErrorCode; var strErrorMessage; try{ //Initioalize BC/BO out of the loop boServiceRequest = TheApplication().GetBusObject("Service Request"); bcServiceRequest = boServiceRequest.GetBusComp("Service Request"); //Execute the Query over SR bcServiceRequest.SetViewMode(AllView); bcServiceRequest.ActivateField("Status"); bcServiceRequest.ActivateField("Area"); bcServiceRequest.ActivateField("Sub-Area"); bcServiceRequest.ActivateField("Commit Time"); bcServiceRequest.ActivateField("Info Consult CD Not GUI SCM"); //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U bcServiceRequest.ActivateField("Owner Salesgroup SCM"); bcServiceRequest.ActivateField("Created"); bcServiceRequest.ActivateField("Billing Account Id"); bcServiceRequest.ActivateField("Order Id"); bcServiceRequest.ActivateField("Owned By Id"); bcServiceRequest.ActivateField("Order Stack SCM"); bcServiceRequest.ClearToQuery(); bcServiceRequest.SetSearchExpr(strSearchSpec); bcServiceRequest.ExecuteQuery(ForwardOnly); isRecordSR = bcServiceRequest.FirstRecord(); //While there is a SR Record process one by one while (isRecordSR) { if (bcServiceRequest.GetFieldValue("Sub-Area") == "New customer") { // do nothing. this SR should not be touched } else if (bcServiceRequest.GetFieldValue("Quote Id SCM") != null && bcServiceRequest.GetFieldValue("Quote Id SCM") != "") { // N-Stack SR => call WF "EAI Cancel All SCM" to cancel SR and related objects bsWF = TheApplication().GetService("Workflow Process Manager"); psIn = TheApplication().NewPropertySet(); psIn.SetProperty("Object Id", bcServiceRequest.GetFieldValue("Id")); // TGDPAANC 21.01.2014 - SR Status added as input argument psIn.SetProperty("SR Status New", strStatusAfter); // TAADAPE2 26.03.2015 - Added for SO 2534 to set the Cancel Status for the Housekeeping job psIn.SetProperty("SR Cancel Reason SCM", TheApplication().utils.SCM_RetrieveACV("SR_SYSTEM_CANCEL_REASON")); psIn.SetProperty("ProcessName", "EAI Cancel All SCM"); psOut = TheApplication().NewPropertySet(); bsWF.InvokeMethod("RunProcess", psIn, psOut); strErrorCode = psOut.GetProperty("Error Code"); strErrorMessage = psOut.GetProperty("Error Message"); if (strErrorMessage != null && strErrorMessage != "") { fLogError(strErrorCode, strErrorMessage, bcServiceRequest.GetFieldValue("Id")); } else { intCounterSR++; } } else { if (bcServiceRequest.GetFieldValue("Order Stack SCM") == "N") { // do nothing, just log fLogEvent("Skip Record", "N-stack Order! SR '" + bcServiceRequest.GetFieldValue("SR Number") + "' not processed. (Criteria: " + strSearchSpec + ")"); } else if (strStatusAfter == "Cancelled") { fUpdateSRandOrder(bcServiceRequest,"Cancelled", "Cancelled"); intCounterSR++; } else { if ((strStatusBefore == "Open") && (strStatusAfter == "Closed")) { fUpdateSRandOrder(bcServiceRequest,"Closed","Cancelled"); intCounterSR++; } else { bcService

BS Generic SCS
fProcesSRs
function fProcesSRs(strSearchSpec, strStatusAfter, strStatusBefore){ /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fProcesSRs ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up. Function thats gets the search specification and process SRs ***************************************************************** ** Update: TGDPAANC Haydn 19.06.2013 - added n-stack SR cancellation + SR Owner criterium **************************************************************************************************************/ //Variable declaration var boServiceRequest:BusObject; var bcServiceRequest:BusComp; var bsWF:Service; var psIn:PropertySet; var psOut:PropertySet; var intCounterSR = 0; var isRecordSR; var strErrorCode; var strErrorMessage; try{ //Initioalize BC/BO out of the loop boServiceRequest = TheApplication().GetBusObject("Service Request"); bcServiceRequest = boServiceRequest.GetBusComp("Service Request"); //Execute the Query over SR bcServiceRequest.SetViewMode(AllView); bcServiceRequest.ActivateField("Status"); bcServiceRequest.ActivateField("Area"); bcServiceRequest.ActivateField("Sub-Area"); bcServiceRequest.ActivateField("Commit Time"); bcServiceRequest.ActivateField("Info Consult CD Not GUI SCM"); //TGDBLRO4 25.07.2011: Nov11 BS_OP_00U bcServiceRequest.ActivateField("Owner Salesgroup SCM"); bcServiceRequest.ActivateField("Created"); bcServiceRequest.ActivateField("Billing Account Id"); bcServiceRequest.ActivateField("Order Id"); bcServiceRequest.ActivateField("Owned By Id"); bcServiceRequest.ActivateField("Order Stack SCM"); bcServiceRequest.ClearToQuery(); bcServiceRequest.SetSearchExpr(strSearchSpec); bcServiceRequest.ExecuteQuery(ForwardOnly); isRecordSR = bcServiceRequest.FirstRecord(); //While there is a SR Record process one by one while (isRecordSR) { if (bcServiceRequest.GetFieldValue("Sub-Area") == "New customer") { // do nothing. this SR should not be touched } else if (bcServiceRequest.GetFieldValue("Quote Id SCM") != null && bcServiceRequest.GetFieldValue("Quote Id SCM") != "") { // N-Stack SR => call WF "EAI Cancel All SCM" to cancel SR and related objects bsWF = TheApplication().GetService("Workflow Process Manager"); psIn = TheApplication().NewPropertySet(); psIn.SetProperty("Object Id", bcServiceRequest.GetFieldValue("Id")); // TGDPAANC 21.01.2014 - SR Status added as input argument psIn.SetProperty("SR Status New", strStatusAfter); // TAADAPE2 26.03.2015 - Added for SO 2534 to set the Cancel Status for the Housekeeping job psIn.SetProperty("SR Cancel Reason SCM", TheApplication().utils.SCM_RetrieveACV("SR_SYSTEM_CANCEL_REASON")); psIn.SetProperty("ProcessName", "EAI Cancel All SCM"); psOut = TheApplication().NewPropertySet(); bsWF.InvokeMethod("RunProcess", psIn, psOut); strErrorCode = psOut.GetProperty("Error Code"); strErrorMessage = psOut.GetProperty("Error Message"); if (strErrorMessage != null && strErrorMessage != "") { fLogError(strErrorCode, strErrorMessage, bcServiceRequest.GetFieldValue("Id")); } else { intCounterSR++; } } else { if (bcServiceRequest.GetFieldValue("Order Stack SCM") == "N") { // do nothing, just log fLogEvent("Skip Record", "N-stack Order! SR '" + bcServiceRequest.GetFieldValue("SR Number") + "' not processed. (Criteria: " + strSearchSpec + ")"); } else if (strStatusAfter == "Cancelled") { fUpdateSRandOrder(bcServiceRequest,"Cancelled", "Cancelled"); intCounterSR++; } else { if ((strStatusBefore == "Open") && (strStatusAfter == "Closed")) { fUpdateSRandOrder(bcServiceRequest,"Closed","Cancelled"); intCounterSR++; } else { bcService

BS Generic SCS
fStartLogging
function fStartLogging(strApplication, strType, strDescText) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fStartLogging ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to start logging *****************************************************************/ var boLog:BusObject; var bcLog:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLog = boLog.GetBusComp("Log 2 SCM"); //Create a parent log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name",strApplication); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); //Initialize parent log variable PARENT_LOG_ID = GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fStartLogging: " + e.message); throw(e); } finally{ //Variable destruction boLog = null; bcLog = null; } }

BS Generic SCS
fStartLogging
function fStartLogging(strApplication, strType, strDescText) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fStartLogging ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up function to start logging *****************************************************************/ var boLog:BusObject; var bcLog:BusComp; try{ boLog = TheApplication().GetBusObject("Log 2 SCM"); bcLog = boLog.GetBusComp("Log 2 SCM"); //Create a parent log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name",strApplication); SetFieldValue("Type", strType); SetFieldValue("Desc Text",strDescText); WriteRecord(); //Initialize parent log variable PARENT_LOG_ID = GetFieldValue("Id"); } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fStartLogging: " + e.message); throw(e); } finally{ //Variable destruction boLog = null; bcLog = null; } }

BS Generic SCS
fTestSRUpdate
function fTestSRUpdate(Inputs, Outputs) /************************************************************************************************** * Function: fTestSRUpdate * * Author : TGDPAANC * * Purpose : Executes update of all SRs satisfying criteria of single configuration row * * Date : 24.01.2014 * **************************************************************************************************/ { var boSRUpdateParam:BusObject; var bcSRUpdateParam:BusComp; var boSR:BusObject; var bcSR:BusComp; var oNow:Date; var strPriority = ""; var strArea = ""; var strSubArea = ""; var strDetail = ""; var strTime = ""; var strSalesGroup = ""; var strStatusBefore = ""; var strStatusAfter = ""; var strAppName = ""; var strDescText = ""; var strLogEventDescText; var strSearchSpec = ""; var strOwner = ""; var intCounterSR = 0; var strQuoteCompleteCode = ""; var strSRNEOChannel = ""; var strCurrentId = ""; var bExecuteTest = ""; try { // Get Inputs strCurrentId = Inputs.GetProperty("Id"); if (strCurrentId == "" || strCurrentId == null) { return; } bExecuteTest = Inputs.GetProperty("Execute"); // BO/BC Declaration out of the loop boSRUpdateParam = TheApplication().GetBusObject("Admin SR Update Parameter SCM"); bcSRUpdateParam = boSRUpdateParam.GetBusComp("SR Update Parameter SCM"); //Query to get SR Update Parameters from were the search criteria is extracted. bcSRUpdateParam.SetViewMode(AllView); bcSRUpdateParam.ActivateField("Priority"); bcSRUpdateParam.ActivateField("SR Time"); bcSRUpdateParam.ActivateField("SR Area"); bcSRUpdateParam.ActivateField("SR Sub-Area"); bcSRUpdateParam.ActivateField("SR Detail"); bcSRUpdateParam.ActivateField("Sales Group"); bcSRUpdateParam.ActivateField("Status Before"); bcSRUpdateParam.ActivateField("Status After"); bcSRUpdateParam.ActivateField("Log Application Name"); bcSRUpdateParam.ActivateField("Log Description Text"); bcSRUpdateParam.ActivateField("SR Owner Id SCM"); bcSRUpdateParam.ActivateField("Quote Completeness Code SCM"); bcSRUpdateParam.ActivateField("Neo Channel SCM"); bcSRUpdateParam.ClearToQuery(); bcSRUpdateParam.SetSearchSpec("Id", strCurrentId); bcSRUpdateParam.ExecuteQuery(ForwardBackward); if (bcSRUpdateParam.FirstRecord()) { //Get Fields that will be used to build the SR Search Specification strPriority = bcSRUpdateParam.GetFieldValue("Priority"); strTime = bcSRUpdateParam.GetFieldValue("SR Time"); strArea = bcSRUpdateParam.GetFieldValue("SR Area"); strSubArea = bcSRUpdateParam.GetFieldValue("SR Sub-Area"); strDetail = bcSRUpdateParam.GetFieldValue("SR Detail"); strSalesGroup = bcSRUpdateParam.GetFieldValue("Sales Group"); strStatusBefore = bcSRUpdateParam.GetFieldValue("Status Before"); strStatusAfter = bcSRUpdateParam.GetFieldValue("Status After"); strAppName = bcSRUpdateParam.GetFieldValue("Log Application Name"); strDescText = bcSRUpdateParam.GetFieldValue("Log Description Text"); strOwner = bcSRUpdateParam.GetFieldValue("SR Owner Id SCM"); strQuoteCompleteCode = bcSRUpdateParam.GetFieldValue("Quote Completeness Code SCM"); strSRNEOChannel = bcSRUpdateParam.GetFieldValue("Neo Channel SCM"); // Create search specification strSearchSpec = fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea,strDetail,strSalesGroup,strStatusBefore,strOwner, strQuoteCompleteCode, strSRNEOChannel); Outputs.SetProperty("SearchSpec", strSearchSpec); if(bIsTraceOn) TheApplication().Trace(this.Name() + " fTestSRUpdate: SearchSpec: " + strSearchSpec); if (bExecuteTest == "Y") { // Execute SR Update try { // Start logging fStartLogging("UPDATE_GENERIC_SR","Siebel Workflow","Start SR Status Update"); oNow = new Date();

BS Generic SCS
fTestSRUpdate
function fTestSRUpdate(Inputs, Outputs) /************************************************************************************************** * Function: fTestSRUpdate * * Author : TGDPAANC * * Purpose : Executes update of all SRs satisfying criteria of single configuration row * * Date : 24.01.2014 * **************************************************************************************************/ { var boSRUpdateParam:BusObject; var bcSRUpdateParam:BusComp; var boSR:BusObject; var bcSR:BusComp; var oNow:Date; var strPriority = ""; var strArea = ""; var strSubArea = ""; var strDetail = ""; var strTime = ""; var strSalesGroup = ""; var strStatusBefore = ""; var strStatusAfter = ""; var strAppName = ""; var strDescText = ""; var strLogEventDescText; var strSearchSpec = ""; var strOwner = ""; var intCounterSR = 0; var strQuoteCompleteCode = ""; var strSRNEOChannel = ""; var strCurrentId = ""; var bExecuteTest = ""; try { // Get Inputs strCurrentId = Inputs.GetProperty("Id"); if (strCurrentId == "" || strCurrentId == null) { return; } bExecuteTest = Inputs.GetProperty("Execute"); // BO/BC Declaration out of the loop boSRUpdateParam = TheApplication().GetBusObject("Admin SR Update Parameter SCM"); bcSRUpdateParam = boSRUpdateParam.GetBusComp("SR Update Parameter SCM"); //Query to get SR Update Parameters from were the search criteria is extracted. bcSRUpdateParam.SetViewMode(AllView); bcSRUpdateParam.ActivateField("Priority"); bcSRUpdateParam.ActivateField("SR Time"); bcSRUpdateParam.ActivateField("SR Area"); bcSRUpdateParam.ActivateField("SR Sub-Area"); bcSRUpdateParam.ActivateField("SR Detail"); bcSRUpdateParam.ActivateField("Sales Group"); bcSRUpdateParam.ActivateField("Status Before"); bcSRUpdateParam.ActivateField("Status After"); bcSRUpdateParam.ActivateField("Log Application Name"); bcSRUpdateParam.ActivateField("Log Description Text"); bcSRUpdateParam.ActivateField("SR Owner Id SCM"); bcSRUpdateParam.ActivateField("Quote Completeness Code SCM"); bcSRUpdateParam.ActivateField("Neo Channel SCM"); bcSRUpdateParam.ClearToQuery(); bcSRUpdateParam.SetSearchSpec("Id", strCurrentId); bcSRUpdateParam.ExecuteQuery(ForwardBackward); if (bcSRUpdateParam.FirstRecord()) { //Get Fields that will be used to build the SR Search Specification strPriority = bcSRUpdateParam.GetFieldValue("Priority"); strTime = bcSRUpdateParam.GetFieldValue("SR Time"); strArea = bcSRUpdateParam.GetFieldValue("SR Area"); strSubArea = bcSRUpdateParam.GetFieldValue("SR Sub-Area"); strDetail = bcSRUpdateParam.GetFieldValue("SR Detail"); strSalesGroup = bcSRUpdateParam.GetFieldValue("Sales Group"); strStatusBefore = bcSRUpdateParam.GetFieldValue("Status Before"); strStatusAfter = bcSRUpdateParam.GetFieldValue("Status After"); strAppName = bcSRUpdateParam.GetFieldValue("Log Application Name"); strDescText = bcSRUpdateParam.GetFieldValue("Log Description Text"); strOwner = bcSRUpdateParam.GetFieldValue("SR Owner Id SCM"); strQuoteCompleteCode = bcSRUpdateParam.GetFieldValue("Quote Completeness Code SCM"); strSRNEOChannel = bcSRUpdateParam.GetFieldValue("Neo Channel SCM"); // Create search specification strSearchSpec = fGenerateSRSearchSpec(strPriority, strTime, strArea, strSubArea,strDetail,strSalesGroup,strStatusBefore,strOwner, strQuoteCompleteCode, strSRNEOChannel); Outputs.SetProperty("SearchSpec", strSearchSpec); if(bIsTraceOn) TheApplication().Trace(this.Name() + " fTestSRUpdate: SearchSpec: " + strSearchSpec); if (bExecuteTest == "Y") { // Execute SR Update try { // Start logging fStartLogging("UPDATE_GENERIC_SR","Siebel Workflow","Start SR Status Update"); oNow = new Date();

BS Generic SCS
fUpdateSRandOrder
function fUpdateSRandOrder(bcServiceRequest:BusComp, strSRStatus, strOrderStatus) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fProcesSRs ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up. Function thats updates SR/Order status *****************************************************************/ //Varialbe declarations var psInputUpdate:PropertySet; var psOutputUpdate:PropertySet; var bsUpdate:Service; var strId = ""; try{ //Initialize Process Properties psInputUpdate = TheApplication().NewPropertySet(); psOutputUpdate = TheApplication().NewPropertySet(); //Intiialze BS bsUpdate = TheApplication().GetService("FE SR Update SCM"); strId = bcServiceRequest.GetFieldValue("Id"); psInputUpdate.SetProperty("SRId", strId); psInputUpdate.SetProperty("SRSubArea", bcServiceRequest.GetFieldValue("Sub-Area")); psInputUpdate.SetProperty("SRCommitTime", bcServiceRequest.GetFieldValue("Commit Time")); psInputUpdate.SetProperty("SRAccountId", bcServiceRequest.GetFieldValue("Account Id")); //BEGIN TGDSEAI1 09.03.2012 Defect 47894 in case of order cancel the order and SR otherswise only the SR if(bcServiceRequest.GetFieldValue("Order Id") != null && bcServiceRequest.GetFieldValue("Order Id") != "") { //Get Input Order Status psInputUpdate.SetProperty("SRStatus", strOrderStatus); //Call Order Cancellation bsUpdate.InvokeMethod("UpdateOrderStatus", psInputUpdate, psOutputUpdate); } psInputUpdate.SetProperty("SRStatus", strSRStatus); bsUpdate.InvokeMethod("UpdateSRStatus", psInputUpdate, psOutputUpdate); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fUpdateSRandOrder: " + e.message); //Log the error fLogError(e.errCode, e.message, strId); } finally{ //Variable destruction psInputUpdate = null; psOutputUpdate = null; bsUpdate = null; } }

BS Generic SCS
fUpdateSRandOrder
function fUpdateSRandOrder(bcServiceRequest:BusComp, strSRStatus, strOrderStatus) { /***************************************************************** ** Bussiness Service: BS Generic SCS ** Function fProcesSRs ** Created: 23.03.2011 ** Created By: TGDSEAI1 ** Description: Defect 47894 Code clean up. Function thats updates SR/Order status *****************************************************************/ //Varialbe declarations var psInputUpdate:PropertySet; var psOutputUpdate:PropertySet; var bsUpdate:Service; var strId = ""; try{ //Initialize Process Properties psInputUpdate = TheApplication().NewPropertySet(); psOutputUpdate = TheApplication().NewPropertySet(); //Intiialze BS bsUpdate = TheApplication().GetService("FE SR Update SCM"); strId = bcServiceRequest.GetFieldValue("Id"); psInputUpdate.SetProperty("SRId", strId); psInputUpdate.SetProperty("SRSubArea", bcServiceRequest.GetFieldValue("Sub-Area")); psInputUpdate.SetProperty("SRCommitTime", bcServiceRequest.GetFieldValue("Commit Time")); psInputUpdate.SetProperty("SRAccountId", bcServiceRequest.GetFieldValue("Account Id")); //BEGIN TGDSEAI1 09.03.2012 Defect 47894 in case of order cancel the order and SR otherswise only the SR if(bcServiceRequest.GetFieldValue("Order Id") != null && bcServiceRequest.GetFieldValue("Order Id") != "") { //Get Input Order Status psInputUpdate.SetProperty("SRStatus", strOrderStatus); //Call Order Cancellation bsUpdate.InvokeMethod("UpdateOrderStatus", psInputUpdate, psOutputUpdate); } psInputUpdate.SetProperty("SRStatus", strSRStatus); bsUpdate.InvokeMethod("UpdateSRStatus", psInputUpdate, psOutputUpdate); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error in fUpdateSRandOrder: " + e.message); //Log the error fLogError(e.errCode, e.message, strId); } finally{ //Variable destruction psInputUpdate = null; psOutputUpdate = null; bsUpdate = null; } }

BS Take Ownership SCM
SRTakeOwnership
function SRTakeOwnership (Inputs, Outputs) /************************************************************** ** Name: SRTakeOwnership ** Created: 20.12.2002 ** Created By: Jacob Aranya ** Description: This function changes the Status of SR and ** assigns it to the current user ** -------------------- Modifications -------------------- ** Date: 13.05.2003 ** Changed By: EM ** Description: Change bec. Tale Ownership ** is now possible in My SR View ** Date: 20.11.2003 ** Changed By: Thomas Roth ** Description: Maintains previous Search Expr ** Date: 03.12.2003 ** Changed By: Emmanuel Marxer ** Description: Added if statement, bec. error when no ** search spec specified **************************************************************/ { var boSrvReq; var bcSrvReq; var intCntr; var blRecord; var strValue; var strLoginId; var strSeachExpr; try { strLoginId = TheApplication().LoginId(); boSrvReq = TheApplication().ActiveBusObject(); if (boSrvReq.Name() != "Service Request") { boSrvReq = TheApplication().GetBusObject("Service Request"); } bcSrvReq = boSrvReq.GetBusComp("Service Request"); with (bcSrvReq) { // Copy current Search Expression before Query var strSearchExpr = GetSearchExpr(); ClearToQuery(); ActivateField("Tele2 Flag SCM"); ActivateField("Status"); ActivateField("Last Updated by"); ActivateField("Employee Type SCM"); SetSearchSpec("Tele2 Flag SCM", "Y"); SetSearchSpec("Last Updated by", strLoginId); ExecuteQuery(ForwardBackward); intCntr = 0; blRecord = FirstRecord(); while (blRecord) { intCntr++; if (GetFieldValue("Status") == "Open" && (GetFieldValue("Employee Type SCM") == "Teambox" || GetFieldValue("Employee Type SCM") == "Sales Teambox")) { // Todo Change Owner - Change Status - Change Tele2 Flag SCM ActivateField("Owned By Id"); ActivateField("Tele2 Flag SCM"); ActivateField("Status"); SetFieldValue("Owned By Id", TheApplication().LoginId()); SetFieldValue("Tele2 Flag SCM", "N"); SetFieldValue("Status", "Open"); WriteRecord(); } else { // Todo: Change Tele2 Flag SCM ActivateField("Tele2 Flag SCM"); SetFieldValue("Tele2 Flag SCM", "N"); WriteRecord(); } blRecord = NextRecord(); } // Re-Query with previous Search Expression // to keep original Filter ClearToQuery(); if (strSearchExpr != "") { SetSearchExpr(strSearchExpr); } SetSortSpec("Created(DESCENDING)"); ExecuteQuery(); } } catch ( e ) { var strErrorText = e.toString(); throw (e); } finally { bcSrvReq = null; boSrvReq = null; } }

BS Take Ownership SCM
SRTakeOwnership
function SRTakeOwnership (Inputs, Outputs) /************************************************************** ** Name: SRTakeOwnership ** Created: 20.12.2002 ** Created By: Jacob Aranya ** Description: This function changes the Status of SR and ** assigns it to the current user ** -------------------- Modifications -------------------- ** Date: 13.05.2003 ** Changed By: EM ** Description: Change bec. Tale Ownership ** is now possible in My SR View ** Date: 20.11.2003 ** Changed By: Thomas Roth ** Description: Maintains previous Search Expr ** Date: 03.12.2003 ** Changed By: Emmanuel Marxer ** Description: Added if statement, bec. error when no ** search spec specified **************************************************************/ { var boSrvReq; var bcSrvReq; var intCntr; var blRecord; var strValue; var strLoginId; var strSeachExpr; try { strLoginId = TheApplication().LoginId(); boSrvReq = TheApplication().ActiveBusObject(); if (boSrvReq.Name() != "Service Request") { boSrvReq = TheApplication().GetBusObject("Service Request"); } bcSrvReq = boSrvReq.GetBusComp("Service Request"); with (bcSrvReq) { // Copy current Search Expression before Query var strSearchExpr = GetSearchExpr(); ClearToQuery(); ActivateField("Tele2 Flag SCM"); ActivateField("Status"); ActivateField("Last Updated by"); ActivateField("Employee Type SCM"); SetSearchSpec("Tele2 Flag SCM", "Y"); SetSearchSpec("Last Updated by", strLoginId); ExecuteQuery(ForwardBackward); intCntr = 0; blRecord = FirstRecord(); while (blRecord) { intCntr++; if (GetFieldValue("Status") == "Open" && (GetFieldValue("Employee Type SCM") == "Teambox" || GetFieldValue("Employee Type SCM") == "Sales Teambox")) { // Todo Change Owner - Change Status - Change Tele2 Flag SCM ActivateField("Owned By Id"); ActivateField("Tele2 Flag SCM"); ActivateField("Status"); SetFieldValue("Owned By Id", TheApplication().LoginId()); SetFieldValue("Tele2 Flag SCM", "N"); SetFieldValue("Status", "Open"); WriteRecord(); } else { // Todo: Change Tele2 Flag SCM ActivateField("Tele2 Flag SCM"); SetFieldValue("Tele2 Flag SCM", "N"); WriteRecord(); } blRecord = NextRecord(); } // Re-Query with previous Search Expression // to keep original Filter ClearToQuery(); if (strSearchExpr != "") { SetSearchExpr(strSearchExpr); } SetSortSpec("Created(DESCENDING)"); ExecuteQuery(); } } catch ( e ) { var strErrorText = e.toString(); throw (e); } finally { bcSrvReq = null; boSrvReq = null; } }

BS Take Ownership SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var intReturn = ContinueOperation; switch (MethodName) { case "SRTakeOwnership": CanInvoke="TRUE"; intReturn = CancelOperation; break; default: intReturn = ContinueOperation; } return(intReturn); }

BS Take Ownership SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var intReturn = ContinueOperation; switch (MethodName) { case "SRTakeOwnership": CanInvoke="TRUE"; intReturn = CancelOperation; break; default: intReturn = ContinueOperation; } return(intReturn); }

BS Take Ownership SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var intRetVal = ContinueOperation; try { switch (MethodName) { case "SRTakeOwnership": SRTakeOwnership (Inputs, Outputs); intRetVal = CancelOperation; break; default: /* Methode nicht gefunden */ intRetVal = ContinueOperation; } return(intRetVal); } catch ( e ) { throw (e); } finally { } }

BS Take Ownership SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var intRetVal = ContinueOperation; try { switch (MethodName) { case "SRTakeOwnership": SRTakeOwnership (Inputs, Outputs); intRetVal = CancelOperation; break; default: /* Methode nicht gefunden */ intRetVal = ContinueOperation; } return(intRetVal); } catch ( e ) { throw (e); } finally { } }

Barring Contract Pick VBC SCM
(declarations)
// Global Variables var bIsTraceOn:bool = TheApplication().isTraceON; var iDefaultMaxLevel:Number = fGetNumericACV("DefaultBarringContractSearchDepth", 999); // these 4 variables are related to current bundle that was queried; results are stored in psBarrableAssets // sCurrentBundleId and iLastMaxLevel - input arguments for the query; values of the last query are stored // so that when the next Query request with the same values comes psBarrableAssets is used and no asset search is performed. var sCurrentBundleId:chars = ""; var sCurrentBundleName:chars = ""; var iLastMaxLevel:Number; var psBarrableAssets:PropertySet = TheApplication().NewPropertySet(); var psProductRelationships:PropertySet = TheApplication().NewPropertySet();

Barring Contract Pick VBC SCM
(declarations)
// Global Variables var bIsTraceOn:bool = TheApplication().isTraceON; var iDefaultMaxLevel:Number = fGetNumericACV("DefaultBarringContractSearchDepth", 999); // these 4 variables are related to current bundle that was queried; results are stored in psBarrableAssets // sCurrentBundleId and iLastMaxLevel - input arguments for the query; values of the last query are stored // so that when the next Query request with the same values comes psBarrableAssets is used and no asset search is performed. var sCurrentBundleId:chars = ""; var sCurrentBundleName:chars = ""; var iLastMaxLevel:Number; var psBarrableAssets:PropertySet = TheApplication().NewPropertySet(); var psProductRelationships:PropertySet = TheApplication().NewPropertySet();

Barring Contract Pick VBC SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) /************************************************************************************************** * Function: Init * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Init function for VBC * * Date : 2014-03-06 * **************************************************************************************************/ { try { // fGetAllPorts("", this.iDefaultMaxLevel); Outputs.SetProperty("MSISDN SCM",""); Outputs.SetProperty("Product Name",""); Outputs.SetProperty("Asset Id",""); Outputs.SetProperty("Integration Id",""); Outputs.SetProperty("Auto Type",""); Outputs.SetProperty("Bundle Name SCM",""); Outputs.SetProperty("Product Name GUI SCM", ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) /************************************************************************************************** * Function: Init * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Init function for VBC * * Date : 2014-03-06 * **************************************************************************************************/ { try { // fGetAllPorts("", this.iDefaultMaxLevel); Outputs.SetProperty("MSISDN SCM",""); Outputs.SetProperty("Product Name",""); Outputs.SetProperty("Asset Id",""); Outputs.SetProperty("Integration Id",""); Outputs.SetProperty("Auto Type",""); Outputs.SetProperty("Bundle Name SCM",""); Outputs.SetProperty("Product Name GUI SCM", ""); } catch(e){ if(bIsTraceOn)TheApplication().Trace(this.Name() + " Init Error: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) /************************************************************************************************** * Function: Query * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Query function for VBC * * Date : 2014-03-06 * **************************************************************************************************/ { var sBarringProductId:chars; var sBundleIntegrationId:chars; var sMSISDN:chars; var iMaxLevel; var iAssetCount:Number; var psTemp:PropertySet; try { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query - entering..."); sBarringProductId = Inputs.GetProperty("ProductId"); sBundleIntegrationId = Inputs.GetProperty("BundleIntegrationId"); if ((sBundleIntegrationId == null || sBundleIntegrationId == "") && (sBarringProductId == null || sBarringProductId == "")) { sBarringProductId = fGetSelectedBarringProduct(); } iMaxLevel = Inputs.GetProperty("MaxDepth"); iMaxLevel = iMaxLevel == "" ? this.iDefaultMaxLevel : ToNumber(iMaxLevel); fGetAllPorts(sBundleIntegrationId, iMaxLevel); Outputs.Reset(); iAssetCount = this.psBarrableAssets.GetChildCount(); for (var i = 0; i < iAssetCount; i++) { // Construct temporary property set corresponding with potential BC record psTemp = TheApplication().NewPropertySet(); sMSISDN = this.psBarrableAssets.GetChild(i).GetProperty("MSISDN SCM"); sMSISDN = sMSISDN == "" || sMSISDN == null ? this.psBarrableAssets.GetChild(i).GetProperty("Root MSISDN SCM") : sMSISDN; psTemp.SetProperty("MSISDN SCM", sMSISDN); psTemp.SetProperty("Product Name", this.psBarrableAssets.GetChild(i).GetProperty("Product Name")); psTemp.SetProperty("Integration Id", this.psBarrableAssets.GetChild(i).GetProperty("Integration Id")); psTemp.SetProperty("Asset Id", this.psBarrableAssets.GetChild(i).GetProperty("Asset Id")); psTemp.SetProperty("Auto Type", this.psBarrableAssets.GetChild(i).GetProperty("Auto Type")); psTemp.SetProperty("Bundle Name SCM", this.sCurrentBundleName); psTemp.SetProperty("Product Name GUI SCM", this.psBarrableAssets.GetChild(i).GetProperty("Root Product Description") + " - " + sMSISDN); // If temporary PS satisfies query criteria => add to Outputs // Query criteria: 1. Candidate Asset can have barring product (Product Id) as its child. // AND // 2. If search-spec is provided it must be evaluated positively on candidate record. if (fCheckAsset(psTemp, this.psBarrableAssets.GetChild(i).GetChild(0), sBarringProductId, Inputs)) { Outputs.AddChild(psTemp); } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty Outputs.Reset(); TheApplication().RaiseErrorText(e.message); return(Outputs); } finally { psTemp = null; } }

Barring Contract Pick VBC SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) /************************************************************************************************** * Function: Query * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Query function for VBC * * Date : 2014-03-06 * **************************************************************************************************/ { var sBarringProductId:chars; var sBundleIntegrationId:chars; var sMSISDN:chars; var iMaxLevel; var iAssetCount:Number; var psTemp:PropertySet; try { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query - entering..."); sBarringProductId = Inputs.GetProperty("ProductId"); sBundleIntegrationId = Inputs.GetProperty("BundleIntegrationId"); if ((sBundleIntegrationId == null || sBundleIntegrationId == "") && (sBarringProductId == null || sBarringProductId == "")) { sBarringProductId = fGetSelectedBarringProduct(); } iMaxLevel = Inputs.GetProperty("MaxDepth"); iMaxLevel = iMaxLevel == "" ? this.iDefaultMaxLevel : ToNumber(iMaxLevel); fGetAllPorts(sBundleIntegrationId, iMaxLevel); Outputs.Reset(); iAssetCount = this.psBarrableAssets.GetChildCount(); for (var i = 0; i < iAssetCount; i++) { // Construct temporary property set corresponding with potential BC record psTemp = TheApplication().NewPropertySet(); sMSISDN = this.psBarrableAssets.GetChild(i).GetProperty("MSISDN SCM"); sMSISDN = sMSISDN == "" || sMSISDN == null ? this.psBarrableAssets.GetChild(i).GetProperty("Root MSISDN SCM") : sMSISDN; psTemp.SetProperty("MSISDN SCM", sMSISDN); psTemp.SetProperty("Product Name", this.psBarrableAssets.GetChild(i).GetProperty("Product Name")); psTemp.SetProperty("Integration Id", this.psBarrableAssets.GetChild(i).GetProperty("Integration Id")); psTemp.SetProperty("Asset Id", this.psBarrableAssets.GetChild(i).GetProperty("Asset Id")); psTemp.SetProperty("Auto Type", this.psBarrableAssets.GetChild(i).GetProperty("Auto Type")); psTemp.SetProperty("Bundle Name SCM", this.sCurrentBundleName); psTemp.SetProperty("Product Name GUI SCM", this.psBarrableAssets.GetChild(i).GetProperty("Root Product Description") + " - " + sMSISDN); // If temporary PS satisfies query criteria => add to Outputs // Query criteria: 1. Candidate Asset can have barring product (Product Id) as its child. // AND // 2. If search-spec is provided it must be evaluated positively on candidate record. if (fCheckAsset(psTemp, this.psBarrableAssets.GetChild(i).GetChild(0), sBarringProductId, Inputs)) { Outputs.AddChild(psTemp); } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.message); //Set the Output to empty Outputs.Reset(); TheApplication().RaiseErrorText(e.message); return(Outputs); } finally { psTemp = null; } }

Barring Contract Pick VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { /************************************************************************************************** * Business Service: Barring Contract Pick VBC SCM * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Used by VBC to provide list of assets to-be-barred for pick in manual barring process * * Date : 2014-03-06 * **************************************************************************************************/ var sReturn = CancelOperation; try { switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; case "ValidateCardinality": fValidateCardinality(Inputs, Outputs); break; default: sReturn = ContinueOperation; break; } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } return(sReturn); }

Barring Contract Pick VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { /************************************************************************************************** * Business Service: Barring Contract Pick VBC SCM * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Used by VBC to provide list of assets to-be-barred for pick in manual barring process * * Date : 2014-03-06 * **************************************************************************************************/ var sReturn = CancelOperation; try { switch (MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; case "ValidateCardinality": fValidateCardinality(Inputs, Outputs); break; default: sReturn = ContinueOperation; break; } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: " + e.message); throw(e); } return(sReturn); }

Barring Contract Pick VBC SCM
fAddRelationship
function fAddRelationship(psPort:PropertySet, sParentProductId:chars) /************************************************************************************************** * Function: fAddRelationship * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Adds product relationship (port) to global structure psProductRelationships * * as a child of its Parent Product Id. This will be later used to validate cardinalities * * Date : 2014-04-15 * **************************************************************************************************/ { var index:Number; var sPortItemId:chars; var psParProd:PropertySet; try { index = fGetIndexByProp(this.psProductRelationships, "Parent Product Id", sParentProductId); if (index < 0) { psParProd = TheApplication().NewPropertySet(); psParProd.SetProperty("Parent Product Id", sParentProductId); this.psProductRelationships.AddChild(psParProd); } else { psParProd = this.psProductRelationships.GetChild(index); } index = fGetIndexByProp(psParProd, "Port Item Id", psPort.GetProperty("Port Item Id")); if (index < 0) { psParProd.AddChild(psPort); } } catch(e) { throw(e); } finally { psParProd = null; } }

Barring Contract Pick VBC SCM
fAddRelationship
function fAddRelationship(psPort:PropertySet, sParentProductId:chars) /************************************************************************************************** * Function: fAddRelationship * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Adds product relationship (port) to global structure psProductRelationships * * as a child of its Parent Product Id. This will be later used to validate cardinalities * * Date : 2014-04-15 * **************************************************************************************************/ { var index:Number; var sPortItemId:chars; var psParProd:PropertySet; try { index = fGetIndexByProp(this.psProductRelationships, "Parent Product Id", sParentProductId); if (index < 0) { psParProd = TheApplication().NewPropertySet(); psParProd.SetProperty("Parent Product Id", sParentProductId); this.psProductRelationships.AddChild(psParProd); } else { psParProd = this.psProductRelationships.GetChild(index); } index = fGetIndexByProp(psParProd, "Port Item Id", psPort.GetProperty("Port Item Id")); if (index < 0) { psParProd.AddChild(psPort); } } catch(e) { throw(e); } finally { psParProd = null; } }

Barring Contract Pick VBC SCM
fCheckAsset
function fCheckAsset(psRecord:PropertySet, psBarringProducts:PropertySet, sProductId:chars, Inputs:PropertySet) //function fCheckAsset(iAssetIndex:Number, sProductId:chars, Inputs:PropertySet) /************************************************************************************************** * Function: fCheckAsset * * Author : Andrej Palenik (TGDPAANC) * * Purpose : function used by Query method - returns boolean whether entry from psBarrableAsets * * identified by index can have barring option (sProductId) as a child * * Date : 2014-03-11 * * Update : 2014-03-27 - added search spec check ; input arguments reorganized * **************************************************************************************************/ { var iSearchSpecIndex:Number = -1; var bRetValue:bool = true; var iCount:Number; try { if (sProductId != "" && sProductId != null) { bRetValue = psBarringProducts.PropertyExists(sProductId) ? true : false ; } // if barring product not found for current record => return immediately if (!bRetValue) return false; // Search for search-spec child in Inputs iCount = Inputs.GetChildCount(); var i = 0; while (i < iCount) { if (Inputs.GetChild(i).GetType() == "search-spec") { iSearchSpecIndex = i; break; } i++; } // If search-spec was found -> evaluate it for current record if (iSearchSpecIndex >= 0) { bRetValue = bRetValue && ToBoolean(fEvaluateNode(psRecord, Inputs.GetChild(iSearchSpecIndex).GetChild(0))); } return bRetValue; } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fCheckAsset | Error: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
fCheckAsset
function fCheckAsset(psRecord:PropertySet, psBarringProducts:PropertySet, sProductId:chars, Inputs:PropertySet) //function fCheckAsset(iAssetIndex:Number, sProductId:chars, Inputs:PropertySet) /************************************************************************************************** * Function: fCheckAsset * * Author : Andrej Palenik (TGDPAANC) * * Purpose : function used by Query method - returns boolean whether entry from psBarrableAsets * * identified by index can have barring option (sProductId) as a child * * Date : 2014-03-11 * * Update : 2014-03-27 - added search spec check ; input arguments reorganized * **************************************************************************************************/ { var iSearchSpecIndex:Number = -1; var bRetValue:bool = true; var iCount:Number; try { if (sProductId != "" && sProductId != null) { bRetValue = psBarringProducts.PropertyExists(sProductId) ? true : false ; } // if barring product not found for current record => return immediately if (!bRetValue) return false; // Search for search-spec child in Inputs iCount = Inputs.GetChildCount(); var i = 0; while (i < iCount) { if (Inputs.GetChild(i).GetType() == "search-spec") { iSearchSpecIndex = i; break; } i++; } // If search-spec was found -> evaluate it for current record if (iSearchSpecIndex >= 0) { bRetValue = bRetValue && ToBoolean(fEvaluateNode(psRecord, Inputs.GetChild(iSearchSpecIndex).GetChild(0))); } return bRetValue; } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fCheckAsset | Error: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
fCheckCardinality
function fCheckCardinality(psBR:PropertySet, psResult:PropertySet) /************************************************************************************************** * Function: fCheckCardinality * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Function validates provided set of barring requests (psBR) based on BS-global struct: * * psProductRelationships from which PS with matching Parent Product Id is used * * Date : 2014-04-15 * **************************************************************************************************/ { var psPort:PropertySet = null; var psParProd:PropertySet = null; var psValidationResult:PropertySet = null; var sProdId:chars; var sBarringAction:chars; var sActionBarred:chars, sActionBar:chars; var iMinCardinality:Number; var iMaxCardinality:Number; var iProdCount:Number; var index:Number; var i,j; try { sActionBarred = TheApplication().InvokeMethod("LookupValue", "BARRING_ACTION_SCM", "Barred"); sActionBar = TheApplication().InvokeMethod("LookupValue", "BARRING_ACTION_SCM", "Bar"); index = fGetIndexByProp(this.psProductRelationships, "Parent Product Id", psBR.GetProperty("Parent Product Id")); if (index >= 0) { psParProd = this.psProductRelationships.GetChild(index); } // Initialize result property set - if validation fails for any port - psResult.Reset(); psResult.SetProperty("Result", "OK"); if (psParProd != null) { // Iterate over each port for (i = 0; i < psParProd.GetChildCount(); i++) { psPort = psParProd.GetChild(i); iMaxCardinality = ToNumber(psPort.GetProperty("MaxCardinality")); iMinCardinality = ToNumber(psPort.GetProperty("MinCardinality")); iProdCount = 0; // Iterate over each barring request for currnt for (j = 0; j < psBR.GetChildCount(); j++) { sProdId = psBR.GetChild(j).GetProperty("Product Id"); index = fGetIndexByProp(psPort, "Product Id", sProdId); if (index >= 0) { sBarringAction = psBR.GetChild(j).GetProperty("Barring Action SCM"); if (sBarringAction == sActionBar) { iProdCount += 1; } else if (sBarringAction == sActionBarred) { iProdCount += 1; } } } if (iProdCount < iMinCardinality || iProdCount > iMaxCardinality) { // cardinality violated psValidationResult = TheApplication().NewPropertySet(); psValidationResult.SetProperty("Min", iMinCardinality); psValidationResult.SetProperty("Max", iMaxCardinality); psValidationResult.SetProperty("Actual", iProdCount); psResult.SetProperty("Result", "NOK"); psResult.AddChild(psValidationResult) } } } else { if (bIsTraceOn) TheApplication().Trace(this.Name() + "Relationship for Parent Product not found. Skipping validation."); } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fCheckCardinality - Error: " + e.message); throw(e); } finally { } }

Barring Contract Pick VBC SCM
fCheckCardinality
function fCheckCardinality(psBR:PropertySet, psResult:PropertySet) /************************************************************************************************** * Function: fCheckCardinality * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Function validates provided set of barring requests (psBR) based on BS-global struct: * * psProductRelationships from which PS with matching Parent Product Id is used * * Date : 2014-04-15 * **************************************************************************************************/ { var psPort:PropertySet = null; var psParProd:PropertySet = null; var psValidationResult:PropertySet = null; var sProdId:chars; var sBarringAction:chars; var sActionBarred:chars, sActionBar:chars; var iMinCardinality:Number; var iMaxCardinality:Number; var iProdCount:Number; var index:Number; var i,j; try { sActionBarred = TheApplication().InvokeMethod("LookupValue", "BARRING_ACTION_SCM", "Barred"); sActionBar = TheApplication().InvokeMethod("LookupValue", "BARRING_ACTION_SCM", "Bar"); index = fGetIndexByProp(this.psProductRelationships, "Parent Product Id", psBR.GetProperty("Parent Product Id")); if (index >= 0) { psParProd = this.psProductRelationships.GetChild(index); } // Initialize result property set - if validation fails for any port - psResult.Reset(); psResult.SetProperty("Result", "OK"); if (psParProd != null) { // Iterate over each port for (i = 0; i < psParProd.GetChildCount(); i++) { psPort = psParProd.GetChild(i); iMaxCardinality = ToNumber(psPort.GetProperty("MaxCardinality")); iMinCardinality = ToNumber(psPort.GetProperty("MinCardinality")); iProdCount = 0; // Iterate over each barring request for currnt for (j = 0; j < psBR.GetChildCount(); j++) { sProdId = psBR.GetChild(j).GetProperty("Product Id"); index = fGetIndexByProp(psPort, "Product Id", sProdId); if (index >= 0) { sBarringAction = psBR.GetChild(j).GetProperty("Barring Action SCM"); if (sBarringAction == sActionBar) { iProdCount += 1; } else if (sBarringAction == sActionBarred) { iProdCount += 1; } } } if (iProdCount < iMinCardinality || iProdCount > iMaxCardinality) { // cardinality violated psValidationResult = TheApplication().NewPropertySet(); psValidationResult.SetProperty("Min", iMinCardinality); psValidationResult.SetProperty("Max", iMaxCardinality); psValidationResult.SetProperty("Actual", iProdCount); psResult.SetProperty("Result", "NOK"); psResult.AddChild(psValidationResult) } } } else { if (bIsTraceOn) TheApplication().Trace(this.Name() + "Relationship for Parent Product not found. Skipping validation."); } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fCheckCardinality - Error: " + e.message); throw(e); } finally { } }

Barring Contract Pick VBC SCM
fEvaluateNode
function fEvaluateNode(psRecord:PropertySet, psNode:PropertySet) { var sType:chars; var sValue:chars; var sNodeType:chars; var tmp1, tmp2; try { // get Type + Value of psNode sType = psNode.GetType(); sValue = psNode.GetValue(); // if the type is not 'node' - something's wrong if (sType != 'node') return false; // Get node-type sNodeType = psNode.GetProperty("node-type"); // switch for node-type (4 types: Binary Operator, Unary Operator, Identifier, Constant) switch (sNodeType) { case "Binary Operator": tmp1 = fEvaluateNode(psRecord, psNode.GetChild(0)); tmp2 = fEvaluateNode(psRecord, psNode.GetChild(1)); switch (sValue) { case "LIKE": case "NOT LIKE": var sTmpExpr = new String(tmp2); sTmpExpr = sTmpExpr.replace(/\*/g, ".*"); sTmpExpr = sTmpExpr.replace(/\?/g, "."); var rxPattern = new RegExp(sTmpExpr); var bRetVal = sValue == "LIKE" ? rxPattern.test(tmp1) : !rxPattern.test(tmp1); sTmpExpr = null; rxPattern = null; return bRetVal; break; case "SOUNDSLIKE": return false; /* ignored */ case "=": return tmp1 == tmp2; case "<>": return tmp1 != tmp2; case "<=": return ToNumber(tmp1) <= ToNumber(tmp2); case "<": return ToNumber(tmp1) < ToNumber(tmp2); case ">=": return ToNumber(tmp1) >= ToNumber(tmp2); case ">": return ToNumber(tmp1) > ToNumber(tmp2); case "AND": return ToBoolean(tmp1) && ToBoolean(tmp2); case "OR": return ToBoolean(tmp1) || ToBoolean(tmp2); case "+": try { return ToNumber(tmp1) + ToNumber(tmp2); } catch(e) { return ToString(tmp1) + ToString(tmp2); } case "-": return ToNumber(tmp1) - ToNumber(tmp2); /* not tested */ case "*": return ToNumber(tmp1) * ToNumber(tmp2); /* not tested */ case "/": return ToNumber(tmp1) / ToNumber(tmp2); /* not tested */ case "^": return ToNumber(tmp1) ^ ToNumber(tmp2); /* not tested */ default: if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: Unknown binary operator: " + sValue); return null; } break; case "Unary Operator": tmp1 = fEvaluateNode(psRecord, psNode.GetChild(0)) switch (sValue) { case "NOT": return !ToBoolean(tmp1); case "EXISTS": return true /* unused/ignored */ case "IS NULL": return tmp1 == "" || tmp1 == null ? true : false ; case "IS NOT NULL": return tmp1 == "" || tmp1 == null ? false : true ; default: if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: Unknown unary operator: " + sValue);

Barring Contract Pick VBC SCM
fEvaluateNode
function fEvaluateNode(psRecord:PropertySet, psNode:PropertySet) { var sType:chars; var sValue:chars; var sNodeType:chars; var tmp1, tmp2; try { // get Type + Value of psNode sType = psNode.GetType(); sValue = psNode.GetValue(); // if the type is not 'node' - something's wrong if (sType != 'node') return false; // Get node-type sNodeType = psNode.GetProperty("node-type"); // switch for node-type (4 types: Binary Operator, Unary Operator, Identifier, Constant) switch (sNodeType) { case "Binary Operator": tmp1 = fEvaluateNode(psRecord, psNode.GetChild(0)); tmp2 = fEvaluateNode(psRecord, psNode.GetChild(1)); switch (sValue) { case "LIKE": case "NOT LIKE": var sTmpExpr = new String(tmp2); sTmpExpr = sTmpExpr.replace(/\*/g, ".*"); sTmpExpr = sTmpExpr.replace(/\?/g, "."); var rxPattern = new RegExp(sTmpExpr); var bRetVal = sValue == "LIKE" ? rxPattern.test(tmp1) : !rxPattern.test(tmp1); sTmpExpr = null; rxPattern = null; return bRetVal; break; case "SOUNDSLIKE": return false; /* ignored */ case "=": return tmp1 == tmp2; case "<>": return tmp1 != tmp2; case "<=": return ToNumber(tmp1) <= ToNumber(tmp2); case "<": return ToNumber(tmp1) < ToNumber(tmp2); case ">=": return ToNumber(tmp1) >= ToNumber(tmp2); case ">": return ToNumber(tmp1) > ToNumber(tmp2); case "AND": return ToBoolean(tmp1) && ToBoolean(tmp2); case "OR": return ToBoolean(tmp1) || ToBoolean(tmp2); case "+": try { return ToNumber(tmp1) + ToNumber(tmp2); } catch(e) { return ToString(tmp1) + ToString(tmp2); } case "-": return ToNumber(tmp1) - ToNumber(tmp2); /* not tested */ case "*": return ToNumber(tmp1) * ToNumber(tmp2); /* not tested */ case "/": return ToNumber(tmp1) / ToNumber(tmp2); /* not tested */ case "^": return ToNumber(tmp1) ^ ToNumber(tmp2); /* not tested */ default: if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: Unknown binary operator: " + sValue); return null; } break; case "Unary Operator": tmp1 = fEvaluateNode(psRecord, psNode.GetChild(0)) switch (sValue) { case "NOT": return !ToBoolean(tmp1); case "EXISTS": return true /* unused/ignored */ case "IS NULL": return tmp1 == "" || tmp1 == null ? true : false ; case "IS NOT NULL": return tmp1 == "" || tmp1 == null ? false : true ; default: if(bIsTraceOn) TheApplication().Trace(this.Name() + " Error: Unknown unary operator: " + sValue);

Barring Contract Pick VBC SCM
fFindPort
function fFindPort(iAssetIndex, iRootAssetIndex, psAssets, psProducts, bsRCOIS, currentLevel, maxLevel) /************************************************************************************************** * Function: fFindPort * * Author : Andrej Palenik (TGDPAANC) * * Purpose : recursive function that takes list of assets (psAssets) and analyzes asset identified * * by (iAssetIndex) whether it can have any product from (psProducts) property set * * as its child by calling RCOIS service (bsRCOIS). * * iRootAssetIndex - index of the root asset; * * currentLevel - current level of descent in asset structure * * maxLevel - maximum level (used to limit the search for performance reasons) * * Date : 2014-03-11 * **************************************************************************************************/ { var psIn:PropertySet; var psOut:PropertySet; var psPort:PropertySet; var psPortDomain:PropertySet; var psProductList:PropertySet; var psAssetProduct:PropertySet; var sProductId:String; var sAssetId:String; var sParentProductId:String; var iPortsCount:Number; var iPortsDomainCount:Number; var i:Number; var j:Number; try { sParentProductId = psAssets.GetChild(iAssetIndex).GetProperty("Product Id"); sAssetId = psAssets.GetChild(iAssetIndex).GetProperty("Asset Id"); // Invoke RCOIS GetAllPorts psIn = TheApplication().NewPropertySet(); psIn.SetProperty("Product Id", sParentProductId); psIn.SetProperty("GetPortDomain", "Y"); psOut = TheApplication().NewPropertySet(); bsRCOIS.InvokeMethod("GetAllPorts", psIn, psOut); psProductList = null; psAssetProduct = null; i = 0; iPortsCount = psOut.GetChildCount(); while(i < iPortsCount) { psPort = psOut.GetChild(i); j = 0; iPortsDomainCount = psPort.GetChildCount(); while(j < iPortsDomainCount) { psPortDomain = psPort.GetChild(j); sProductId = psPortDomain.GetProperty("Product Id"); if ( psProducts.PropertyExists(sProductId) ) { if (psProductList == null) { psProductList = TheApplication().NewPropertySet(); } psProductList.SetProperty(sProductId, true); fAddRelationship(psPort, sParentProductId); } j++; } i++; } // If any barring product found -> remember current asset details (and list of related barring product) if (psProductList != null) { psAssetProduct = TheApplication().NewPropertySet(); psAssetProduct.SetProperty("Asset Id", sAssetId); psAssetProduct.SetProperty("MSISDN SCM", psAssets.GetChild(iAssetIndex).GetProperty("MSISDN SCM")); psAssetProduct.SetProperty("Root MSISDN SCM", psAssets.GetChild(iRootAssetIndex).GetProperty("MSISDN SCM")); psAssetProduct.SetProperty("Integration Id", psAssets.GetChild(iAssetIndex).GetProperty("Integration Id")); psAssetProduct.SetProperty("Product Name", psAssets.GetChild(iAssetIndex).GetProperty("Product Name SCM")); psAssetProduct.SetProperty("Root Product Description", psAssets.GetChild(iRootAssetIndex).GetProperty("Product Description Multilingual SCM")); psAssetProduct.SetProperty("Auto Type", psAssets.GetChild(iRootAssetIndex).GetProperty("Service Type")); psAssetProduct.AddChild(psProductList); this.psBarrableAssets.AddChild(psAssetProduct); } // IF MAX_DEPTH not reached - then iterate recursively over all children assets if (currentLevel <= maxLevel) { for (i = 0; i < psAssets.GetChildCount(); i++) { if (psAssets.GetChild(i).GetProperty("Parent Asset Id") == sAssetId) { fFindPort( i, iRootAssetIndex, psAssets, psProducts, bsRCOIS, currentLevel+1, maxLevel); } } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fFindPort() Error: " + e.message); throw(e); } finally { psI

Barring Contract Pick VBC SCM
fFindPort
function fFindPort(iAssetIndex, iRootAssetIndex, psAssets, psProducts, bsRCOIS, currentLevel, maxLevel) /************************************************************************************************** * Function: fFindPort * * Author : Andrej Palenik (TGDPAANC) * * Purpose : recursive function that takes list of assets (psAssets) and analyzes asset identified * * by (iAssetIndex) whether it can have any product from (psProducts) property set * * as its child by calling RCOIS service (bsRCOIS). * * iRootAssetIndex - index of the root asset; * * currentLevel - current level of descent in asset structure * * maxLevel - maximum level (used to limit the search for performance reasons) * * Date : 2014-03-11 * **************************************************************************************************/ { var psIn:PropertySet; var psOut:PropertySet; var psPort:PropertySet; var psPortDomain:PropertySet; var psProductList:PropertySet; var psAssetProduct:PropertySet; var sProductId:String; var sAssetId:String; var sParentProductId:String; var iPortsCount:Number; var iPortsDomainCount:Number; var i:Number; var j:Number; try { sParentProductId = psAssets.GetChild(iAssetIndex).GetProperty("Product Id"); sAssetId = psAssets.GetChild(iAssetIndex).GetProperty("Asset Id"); // Invoke RCOIS GetAllPorts psIn = TheApplication().NewPropertySet(); psIn.SetProperty("Product Id", sParentProductId); psIn.SetProperty("GetPortDomain", "Y"); psOut = TheApplication().NewPropertySet(); bsRCOIS.InvokeMethod("GetAllPorts", psIn, psOut); psProductList = null; psAssetProduct = null; i = 0; iPortsCount = psOut.GetChildCount(); while(i < iPortsCount) { psPort = psOut.GetChild(i); j = 0; iPortsDomainCount = psPort.GetChildCount(); while(j < iPortsDomainCount) { psPortDomain = psPort.GetChild(j); sProductId = psPortDomain.GetProperty("Product Id"); if ( psProducts.PropertyExists(sProductId) ) { if (psProductList == null) { psProductList = TheApplication().NewPropertySet(); } psProductList.SetProperty(sProductId, true); fAddRelationship(psPort, sParentProductId); } j++; } i++; } // If any barring product found -> remember current asset details (and list of related barring product) if (psProductList != null) { psAssetProduct = TheApplication().NewPropertySet(); psAssetProduct.SetProperty("Asset Id", sAssetId); psAssetProduct.SetProperty("MSISDN SCM", psAssets.GetChild(iAssetIndex).GetProperty("MSISDN SCM")); psAssetProduct.SetProperty("Root MSISDN SCM", psAssets.GetChild(iRootAssetIndex).GetProperty("MSISDN SCM")); psAssetProduct.SetProperty("Integration Id", psAssets.GetChild(iAssetIndex).GetProperty("Integration Id")); psAssetProduct.SetProperty("Product Name", psAssets.GetChild(iAssetIndex).GetProperty("Product Name SCM")); psAssetProduct.SetProperty("Root Product Description", psAssets.GetChild(iRootAssetIndex).GetProperty("Product Description Multilingual SCM")); psAssetProduct.SetProperty("Auto Type", psAssets.GetChild(iRootAssetIndex).GetProperty("Service Type")); psAssetProduct.AddChild(psProductList); this.psBarrableAssets.AddChild(psAssetProduct); } // IF MAX_DEPTH not reached - then iterate recursively over all children assets if (currentLevel <= maxLevel) { for (i = 0; i < psAssets.GetChildCount(); i++) { if (psAssets.GetChild(i).GetProperty("Parent Asset Id") == sAssetId) { fFindPort( i, iRootAssetIndex, psAssets, psProducts, bsRCOIS, currentLevel+1, maxLevel); } } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fFindPort() Error: " + e.message); throw(e); } finally { psI

Barring Contract Pick VBC SCM
fGetAllPorts
function fGetAllPorts(sBundleId, iMaxLevel) /************************************************************************************************** * Function: fGetAllPorts * * Author : Andrej Palenik (TGDPAANC) * * Purpose : obtains list of barrable assets within provided bundle * * Results are stored in global variable - psBarrableAssets * * * sBundleId - Integration Id of the Bundle to be analyzed * * iMaxLevel - determines how deep within asset structure to look for barrable assets * * 0 - only root components, 1 - assets one level below roots are analyzed, etc... * * Date : 2014-03-06 * **************************************************************************************************/ { var psAllAssets:PropertySet; var psBarringProducts:PropertySet; var oBSRCOIS:Service = null; var iRootCount:Number; var iRootIndex:Number; try { if (bIsTraceOn) TheApplication().Trace(this.Name() + " ENTERING fGetAllPorts()\tCurrent Bundle Id: " + sCurrentBundleId); // get Bundle Integration Id for current request if (sBundleId == null || sBundleId == "") sBundleId = fGetCurrentBundleId(); // Check conditions when to perform asset search // 1. Skip search of bundle assets when no Bundle Id was provided if (sBundleId == null || sBundleId == "") { if(bIsTraceOn) TheApplication().Trace(this.Name() + " INFO : Skipping initialization because no Bundle Id was provided..."); // 2. Skip search of bundle assets if search criteria have not changed (Bundle Id, MaxLevel) // Result is stored in global psBarrableAssets } else if (this.sCurrentBundleId == sBundleId && this.iLastMaxLevel == iMaxLevel) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " INFO : Skipping initialization... Criteria have not changed since last request."); // 3. Search of bundle assets is required } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Starting search of barrable assets for bundle (Bundle Integration Id : " + sBundleId + ")"); // Construct global property set that will store all pickable assets this.psBarrableAssets = TheApplication().NewPropertySet(); // set global search criteria bundle id, max level - in order to compute list of barrable assets only once // (e.g. user navigated to different SR, call from EAI, etc...) this.sCurrentBundleId = sBundleId; this.iLastMaxLevel = iMaxLevel; this.sCurrentBundleName = fGetBundleName(sCurrentBundleId); // Get all assets of current bundle psAllAssets = TheApplication().NewPropertySet(); fQueryAssets(sBundleId, psAllAssets); // Query for all barring products psBarringProducts = TheApplication().NewPropertySet(); fQueryBarringProducts(psBarringProducts); // Construct RCOIS BS oBSRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); // Loop through all root assets iRootCount = psAllAssets.GetChild(0).GetChildCount(); for (var i = 0; i < iRootCount; i++) { iRootIndex = fGetIndexByProp(psAllAssets.GetChild(0).GetChild(i).GetChild(0), "Asset Id", psAllAssets.GetChild(0).GetChild(i).GetProperty("Asset Id")) fFindPort( iRootIndex, iRootIndex, psAllAssets.GetChild(0).GetChild(i).GetChild(0), psBarringProducts, oBSRCOIS, 1, iMaxLevel ); } } } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fGetAllPorts Error: " + e.message); throw(e); } finally { oBSRCOIS = null; psAllAssets = null; psBarringProducts = null; } }

Barring Contract Pick VBC SCM
fGetAllPorts
function fGetAllPorts(sBundleId, iMaxLevel) /************************************************************************************************** * Function: fGetAllPorts * * Author : Andrej Palenik (TGDPAANC) * * Purpose : obtains list of barrable assets within provided bundle * * Results are stored in global variable - psBarrableAssets * * * sBundleId - Integration Id of the Bundle to be analyzed * * iMaxLevel - determines how deep within asset structure to look for barrable assets * * 0 - only root components, 1 - assets one level below roots are analyzed, etc... * * Date : 2014-03-06 * **************************************************************************************************/ { var psAllAssets:PropertySet; var psBarringProducts:PropertySet; var oBSRCOIS:Service = null; var iRootCount:Number; var iRootIndex:Number; try { if (bIsTraceOn) TheApplication().Trace(this.Name() + " ENTERING fGetAllPorts()\tCurrent Bundle Id: " + sCurrentBundleId); // get Bundle Integration Id for current request if (sBundleId == null || sBundleId == "") sBundleId = fGetCurrentBundleId(); // Check conditions when to perform asset search // 1. Skip search of bundle assets when no Bundle Id was provided if (sBundleId == null || sBundleId == "") { if(bIsTraceOn) TheApplication().Trace(this.Name() + " INFO : Skipping initialization because no Bundle Id was provided..."); // 2. Skip search of bundle assets if search criteria have not changed (Bundle Id, MaxLevel) // Result is stored in global psBarrableAssets } else if (this.sCurrentBundleId == sBundleId && this.iLastMaxLevel == iMaxLevel) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " INFO : Skipping initialization... Criteria have not changed since last request."); // 3. Search of bundle assets is required } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Starting search of barrable assets for bundle (Bundle Integration Id : " + sBundleId + ")"); // Construct global property set that will store all pickable assets this.psBarrableAssets = TheApplication().NewPropertySet(); // set global search criteria bundle id, max level - in order to compute list of barrable assets only once // (e.g. user navigated to different SR, call from EAI, etc...) this.sCurrentBundleId = sBundleId; this.iLastMaxLevel = iMaxLevel; this.sCurrentBundleName = fGetBundleName(sCurrentBundleId); // Get all assets of current bundle psAllAssets = TheApplication().NewPropertySet(); fQueryAssets(sBundleId, psAllAssets); // Query for all barring products psBarringProducts = TheApplication().NewPropertySet(); fQueryBarringProducts(psBarringProducts); // Construct RCOIS BS oBSRCOIS = TheApplication().GetService("Remote Complex Object Instance Service"); // Loop through all root assets iRootCount = psAllAssets.GetChild(0).GetChildCount(); for (var i = 0; i < iRootCount; i++) { iRootIndex = fGetIndexByProp(psAllAssets.GetChild(0).GetChild(i).GetChild(0), "Asset Id", psAllAssets.GetChild(0).GetChild(i).GetProperty("Asset Id")) fFindPort( iRootIndex, iRootIndex, psAllAssets.GetChild(0).GetChild(i).GetChild(0), psBarringProducts, oBSRCOIS, 1, iMaxLevel ); } } } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fGetAllPorts Error: " + e.message); throw(e); } finally { oBSRCOIS = null; psAllAssets = null; psBarringProducts = null; } }

Barring Contract Pick VBC SCM
fGetBundleName
function fGetBundleName(sBundleIntegrationId:chars) /************************************************************************************************** * Function: fGetBundleName * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Queries for Bundle Product Name based on provided Bundle Integration Id * * Date : 2014-03-06 * **************************************************************************************************/ { var oBC:BusComp; var sBundleName:chars = ""; try { oBC = TheApplication().GetBusObject("Barrable Asset Load SCM").GetBusComp("Asset Mgmt - Asset Options SCM"); oBC.ClearToQuery(); oBC.ActivateField("Product Description Calc SCM"); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Integration Id] = '" + sBundleIntegrationId + "'"); oBC.ExecuteQuery(ForwardOnly); if (oBC.FirstRecord) { sBundleName = oBC.GetFieldValue("Product Description Calc SCM"); } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetBundleName - Error: " + e.message); throw(e); } finally { oBC = null; } return sBundleName; }

Barring Contract Pick VBC SCM
fGetBundleName
function fGetBundleName(sBundleIntegrationId:chars) /************************************************************************************************** * Function: fGetBundleName * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Queries for Bundle Product Name based on provided Bundle Integration Id * * Date : 2014-03-06 * **************************************************************************************************/ { var oBC:BusComp; var sBundleName:chars = ""; try { oBC = TheApplication().GetBusObject("Barrable Asset Load SCM").GetBusComp("Asset Mgmt - Asset Options SCM"); oBC.ClearToQuery(); oBC.ActivateField("Product Description Calc SCM"); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Integration Id] = '" + sBundleIntegrationId + "'"); oBC.ExecuteQuery(ForwardOnly); if (oBC.FirstRecord) { sBundleName = oBC.GetFieldValue("Product Description Calc SCM"); } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetBundleName - Error: " + e.message); throw(e); } finally { oBC = null; } return sBundleName; }

Barring Contract Pick VBC SCM
fGetCurrentBundleId
function fGetCurrentBundleId() /************************************************************************************************** * Function: fGetCurrentBundleId * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Gets Integration Id from the current SR in context * * Date : 2014-03-06 * **************************************************************************************************/ { var oBCSR:BusComp; var sBundleId; try { oBCSR = TheApplication().ActiveBusObject().GetBusComp("Service Request"); sBundleId = oBCSR.GetFieldValue("Asset Integration Id"); if(bIsTraceOn)TheApplication().Trace(this.Name() + " Bundle Id = " + sBundleId); } catch(e) { throw(e); } finally { oBCSR = null; } return sBundleId; }

Barring Contract Pick VBC SCM
fGetCurrentBundleId
function fGetCurrentBundleId() /************************************************************************************************** * Function: fGetCurrentBundleId * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Gets Integration Id from the current SR in context * * Date : 2014-03-06 * **************************************************************************************************/ { var oBCSR:BusComp; var sBundleId; try { oBCSR = TheApplication().ActiveBusObject().GetBusComp("Service Request"); sBundleId = oBCSR.GetFieldValue("Asset Integration Id"); if(bIsTraceOn)TheApplication().Trace(this.Name() + " Bundle Id = " + sBundleId); } catch(e) { throw(e); } finally { oBCSR = null; } return sBundleId; }

Barring Contract Pick VBC SCM
fGetIndexByProp
function fGetIndexByProp(ps:PropertySet, sPropName:String, sValue:String) /************************************************************************************************** * Function: fGetIndexByProp * * Author : Andrej Palenik (TGDPAANC) * * Purpose : returns index of child PS based on child's property name and value * * Date : 2014-03-11 * **************************************************************************************************/ { try { var iCount = ps.GetChildCount(); for (var i = 0; i < iCount; i++) { if (ps.GetChild(i).GetProperty(sPropName) == sValue) return i; } return -1; } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetIndexByProp | ERROR: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
fGetIndexByProp
function fGetIndexByProp(ps:PropertySet, sPropName:String, sValue:String) /************************************************************************************************** * Function: fGetIndexByProp * * Author : Andrej Palenik (TGDPAANC) * * Purpose : returns index of child PS based on child's property name and value * * Date : 2014-03-11 * **************************************************************************************************/ { try { var iCount = ps.GetChildCount(); for (var i = 0; i < iCount; i++) { if (ps.GetChild(i).GetProperty(sPropName) == sValue) return i; } return -1; } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetIndexByProp | ERROR: " + e.message); throw(e); } }

Barring Contract Pick VBC SCM
fGetNumericACV
function fGetNumericACV(sCodeName:chars, iDefaultValue:Number):Number /************************************************************************************************** * Function: fGetNumericACV * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Reads ACV and tries to convert it to number otherwise * * Date : 2014-03-19 * **************************************************************************************************/ { var sValue:chars; var iValue:Number; try { sValue = TheApplication().utils.SCM_RetrieveACV(sCodeName); iValue = ToNumber(sValue); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetNumericACV - Conversion of value '" + sValue + "' to number failed. Error: " + e.message); return iDefaultValue; } return iValue; }

Barring Contract Pick VBC SCM
fGetNumericACV
function fGetNumericACV(sCodeName:chars, iDefaultValue:Number):Number /************************************************************************************************** * Function: fGetNumericACV * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Reads ACV and tries to convert it to number otherwise * * Date : 2014-03-19 * **************************************************************************************************/ { var sValue:chars; var iValue:Number; try { sValue = TheApplication().utils.SCM_RetrieveACV(sCodeName); iValue = ToNumber(sValue); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetNumericACV - Conversion of value '" + sValue + "' to number failed. Error: " + e.message); return iDefaultValue; } return iValue; }

Barring Contract Pick VBC SCM
fGetSelectedBarringProduct
function fGetSelectedBarringProduct() /************************************************************************************************** * Function: fGetSelectedBarringProduct * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Gets Barring Product Id from the current Barring Request in context * * Date : 2014-03-06 * **************************************************************************************************/ { var oBCBarringRequest:BusComp; var sProdId:String; try { oBCBarringRequest = TheApplication().ActiveBusObject().GetBusComp("SR Barring Request SCM"); sProdId = oBCBarringRequest.GetFieldValue("Product Id"); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetSelectedBarringProduct() Error: " + e.message); throw(e); } finally { oBCBarringRequest = null; } return sProdId; }

Barring Contract Pick VBC SCM
fGetSelectedBarringProduct
function fGetSelectedBarringProduct() /************************************************************************************************** * Function: fGetSelectedBarringProduct * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Gets Barring Product Id from the current Barring Request in context * * Date : 2014-03-06 * **************************************************************************************************/ { var oBCBarringRequest:BusComp; var sProdId:String; try { oBCBarringRequest = TheApplication().ActiveBusObject().GetBusComp("SR Barring Request SCM"); sProdId = oBCBarringRequest.GetFieldValue("Product Id"); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " fGetSelectedBarringProduct() Error: " + e.message); throw(e); } finally { oBCBarringRequest = null; } return sProdId; }

Barring Contract Pick VBC SCM
fQueryAssets
function fQueryAssets(sBundleIntegrationId:String, psAssets:PropertySet) /************************************************************************************************** * Function: fQueryAssets * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Obtains PS of all assets in bundle using EAI Siebel Adapter Query * * Date : 2014-03-07 * **************************************************************************************************/ { var oBSEAIAdapter:Service; var psIn:PropertySet; var psOut:PropertySet; var sSearchSpec:String; var sAssetIO:String; var sInactiveStr:String; try { // Create complex objects oBSEAIAdapter = TheApplication().GetService("EAI Siebel Adapter"); psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); sAssetIO = "Barrable Asset Load SCM"; // Set string values sInactiveStr = TheApplication().InvokeMethod("LookupValue", "IMPL_PHASE", "Inactive"); sSearchSpec = "[Header.Prod Prom Instance Id] = '" + sBundleIntegrationId; sSearchSpec = sSearchSpec + "' AND [Header.Status] <> '" + sInactiveStr; sSearchSpec = sSearchSpec + "' AND [Line Item.Status] <> '" + sInactiveStr; // Prepare input property set and perform query psIn.SetProperty("OutputIntObjectName", sAssetIO); psIn.SetProperty("SearchSpec", sSearchSpec); oBSEAIAdapter.InvokeMethod("Query", psIn, psOut); // Process output psAssets.AddChild(psOut.GetChild(0).GetChild(0)); } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fQueryAssets Error: " + e.message); throw(e); } finally { oBSEAIAdapter = null; psIn = null; psOut = null; } }

Barring Contract Pick VBC SCM
fQueryAssets
function fQueryAssets(sBundleIntegrationId:String, psAssets:PropertySet) /************************************************************************************************** * Function: fQueryAssets * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Obtains PS of all assets in bundle using EAI Siebel Adapter Query * * Date : 2014-03-07 * **************************************************************************************************/ { var oBSEAIAdapter:Service; var psIn:PropertySet; var psOut:PropertySet; var sSearchSpec:String; var sAssetIO:String; var sInactiveStr:String; try { // Create complex objects oBSEAIAdapter = TheApplication().GetService("EAI Siebel Adapter"); psIn = TheApplication().NewPropertySet(); psOut = TheApplication().NewPropertySet(); sAssetIO = "Barrable Asset Load SCM"; // Set string values sInactiveStr = TheApplication().InvokeMethod("LookupValue", "IMPL_PHASE", "Inactive"); sSearchSpec = "[Header.Prod Prom Instance Id] = '" + sBundleIntegrationId; sSearchSpec = sSearchSpec + "' AND [Header.Status] <> '" + sInactiveStr; sSearchSpec = sSearchSpec + "' AND [Line Item.Status] <> '" + sInactiveStr; // Prepare input property set and perform query psIn.SetProperty("OutputIntObjectName", sAssetIO); psIn.SetProperty("SearchSpec", sSearchSpec); oBSEAIAdapter.InvokeMethod("Query", psIn, psOut); // Process output psAssets.AddChild(psOut.GetChild(0).GetChild(0)); } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fQueryAssets Error: " + e.message); throw(e); } finally { oBSEAIAdapter = null; psIn = null; psOut = null; } }

Barring Contract Pick VBC SCM
fQueryBarringProducts
function fQueryBarringProducts(psBarringProducts:PropertySet) /************************************************************************************************** * Function: fQueryBarringProducts * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Obtains list of all Barring Set products * * Date : 2014-03-07 * **************************************************************************************************/ { var oBO:BusObject; var oBC:BusComp; var isRecord; try { oBO = TheApplication().GetBusObject("Internal Product Performance SCM"); oBC = oBO.GetBusComp("Internal Product Performance SCM"); oBC.ClearToQuery(); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Service Type] = 'Barring Set'"); oBC.ExecuteQuery(ForwardOnly); psBarringProducts.Reset(); isRecord = oBC.FirstRecord(); while (isRecord) { psBarringProducts.SetProperty(oBC.GetFieldValue("Id"), true); isRecord = oBC.NextRecord(); } } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fQueryBarringProducts Error: " + e.message); throw(e); } finally { oBO = null; oBC = null; } }

Barring Contract Pick VBC SCM
fQueryBarringProducts
function fQueryBarringProducts(psBarringProducts:PropertySet) /************************************************************************************************** * Function: fQueryBarringProducts * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Obtains list of all Barring Set products * * Date : 2014-03-07 * **************************************************************************************************/ { var oBO:BusObject; var oBC:BusComp; var isRecord; try { oBO = TheApplication().GetBusObject("Internal Product Performance SCM"); oBC = oBO.GetBusComp("Internal Product Performance SCM"); oBC.ClearToQuery(); oBC.SetViewMode(AllView); oBC.SetSearchExpr("[Service Type] = 'Barring Set'"); oBC.ExecuteQuery(ForwardOnly); psBarringProducts.Reset(); isRecord = oBC.FirstRecord(); while (isRecord) { psBarringProducts.SetProperty(oBC.GetFieldValue("Id"), true); isRecord = oBC.NextRecord(); } } catch(e) { if(bIsTraceOn)TheApplication().Trace(this.Name() + " fQueryBarringProducts Error: " + e.message); throw(e); } finally { oBO = null; oBC = null; } }

Barring Contract Pick VBC SCM
fValidateCardinality
function fValidateCardinality(Inputs, Outputs) /************************************************************************************************** * Function: fValidateCardinality * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Function to be invoked only on SR submission * * Error message raised if cardinality validation of barring requests on current SR fails * * Date : 2014-04-15 * **************************************************************************************************/ { var oBCBR:BusComp; var oBCSR:BusComp; var oBO:BusObject; var oBS:Service; var psBarringRequests:PropertySet; var psResult:PropertySet; var psIn:PropertySet; var psOut:PropertySet; var psTemp:PropertySet; var psTemp2:PropertySet; var sAssetId:chars; var sBarringAction:chars; var sBundleId:chars; var sContractName:chars; var sErrorMsg:chars; var sParProductId:chars; var sProductId:chars; var sSRId:chars; var bBRAdded:bool; var bIsRecord:bool; var i,j; var iMaxLevel; try { // 1/3 - prepare and fGetAllPorts sSRId = Inputs.GetProperty("ServiceRequestId"); sBundleId = Inputs.GetProperty("BundleId"); iMaxLevel = Inputs.GetProperty("MaxDepth"); iMaxLevel = iMaxLevel == "" ? this.iDefaultMaxLevel : ToNumber(iMaxLevel); oBS = null; oBO = TheApplication().ActiveBusObject(); oBCSR = oBO.GetBusComp("Service Request"); if (sSRId == "" || sSRId == null) { sSRId = oBCSR.GetFieldValue("Id"); } if (sBundleId == "" || sBundleId == null) { sBundleId = oBCSR.GetFieldValue("Asset Integration Id"); } if (sBundleId != null && sBundleId != "") { fGetAllPorts(sBundleId, this.iDefaultMaxLevel); } else { // Unable to validate - Bundle Id is not provided / could not be obtained from current context if(bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateCardinality - Unable to validate cardinality! Bundle Integration Id was not provided and could not be obtained from current context."); Outputs.SetProperty("Error Message", "Unable to validate! Bundle Integration Id was not provided and could not be obtained from current context."); return; } // 2/3 - read barring requests oBCBR = oBO.GetBusComp("SR Barring Request SCM"); oBCBR.ClearToQuery(); oBCBR.SetViewMode(AllView); oBCBR.SetSearchExpr("[Service Request Id] = '" + sSRId + "'"); oBCBR.ActivateField("Parent Product Id"); oBCBR.ActivateField("Barring Action SCM"); oBCBR.ActivateField("Product Id"); oBCBR.ActivateField("Contract Name Calc SCM"); oBCBR.ExecuteQuery(ForwardBackward); psBarringRequests = TheApplication().NewPropertySet(); bIsRecord = oBCBR.FirstRecord(); while (bIsRecord) { sAssetId = oBCBR.GetFieldValue("Asset Id"); sBarringAction = oBCBR.GetFieldValue("Barring Action SCM"); sContractName = oBCBR.GetFieldValue("Contract Name Calc SCM"); sParProductId = oBCBR.GetFieldValue("Parent Product Id"); sProductId = oBCBR.GetFieldValue("Product Id"); psTemp = TheApplication().NewPropertySet(); psTemp.SetProperty("Barring Action SCM", sBarringAction); psTemp.SetProperty("Product Id", sProductId); bBRAdded = false; for (i = 0; i < psBarringRequests.GetChildCount(); i++) { if (psBarringRequests.GetChild(i).GetProperty("Asset Id") == sAssetId) { psBarringRequests.GetChild(i).AddChild(psTemp); bBRAdded = true; break; } } if (!bBRAdded) { psTemp2 = TheApplication().NewPropertySet(); psTemp2.SetProperty("Asset Id", sAssetId); psTemp2.SetProperty("Contract Name", sContractName); psTemp2.SetProperty("Parent Product Id", sParProductId); psTemp2.AddChild(psTemp); psBarringRequests.AddChild(psTemp2); } bIsRecord = oBCBR.NextRecord(); } // 3/3 - check cardinaliti

Barring Contract Pick VBC SCM
fValidateCardinality
function fValidateCardinality(Inputs, Outputs) /************************************************************************************************** * Function: fValidateCardinality * * Author : Andrej Palenik (TGDPAANC) * * Purpose : Function to be invoked only on SR submission * * Error message raised if cardinality validation of barring requests on current SR fails * * Date : 2014-04-15 * **************************************************************************************************/ { var oBCBR:BusComp; var oBCSR:BusComp; var oBO:BusObject; var oBS:Service; var psBarringRequests:PropertySet; var psResult:PropertySet; var psIn:PropertySet; var psOut:PropertySet; var psTemp:PropertySet; var psTemp2:PropertySet; var sAssetId:chars; var sBarringAction:chars; var sBundleId:chars; var sContractName:chars; var sErrorMsg:chars; var sParProductId:chars; var sProductId:chars; var sSRId:chars; var bBRAdded:bool; var bIsRecord:bool; var i,j; var iMaxLevel; try { // 1/3 - prepare and fGetAllPorts sSRId = Inputs.GetProperty("ServiceRequestId"); sBundleId = Inputs.GetProperty("BundleId"); iMaxLevel = Inputs.GetProperty("MaxDepth"); iMaxLevel = iMaxLevel == "" ? this.iDefaultMaxLevel : ToNumber(iMaxLevel); oBS = null; oBO = TheApplication().ActiveBusObject(); oBCSR = oBO.GetBusComp("Service Request"); if (sSRId == "" || sSRId == null) { sSRId = oBCSR.GetFieldValue("Id"); } if (sBundleId == "" || sBundleId == null) { sBundleId = oBCSR.GetFieldValue("Asset Integration Id"); } if (sBundleId != null && sBundleId != "") { fGetAllPorts(sBundleId, this.iDefaultMaxLevel); } else { // Unable to validate - Bundle Id is not provided / could not be obtained from current context if(bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateCardinality - Unable to validate cardinality! Bundle Integration Id was not provided and could not be obtained from current context."); Outputs.SetProperty("Error Message", "Unable to validate! Bundle Integration Id was not provided and could not be obtained from current context."); return; } // 2/3 - read barring requests oBCBR = oBO.GetBusComp("SR Barring Request SCM"); oBCBR.ClearToQuery(); oBCBR.SetViewMode(AllView); oBCBR.SetSearchExpr("[Service Request Id] = '" + sSRId + "'"); oBCBR.ActivateField("Parent Product Id"); oBCBR.ActivateField("Barring Action SCM"); oBCBR.ActivateField("Product Id"); oBCBR.ActivateField("Contract Name Calc SCM"); oBCBR.ExecuteQuery(ForwardBackward); psBarringRequests = TheApplication().NewPropertySet(); bIsRecord = oBCBR.FirstRecord(); while (bIsRecord) { sAssetId = oBCBR.GetFieldValue("Asset Id"); sBarringAction = oBCBR.GetFieldValue("Barring Action SCM"); sContractName = oBCBR.GetFieldValue("Contract Name Calc SCM"); sParProductId = oBCBR.GetFieldValue("Parent Product Id"); sProductId = oBCBR.GetFieldValue("Product Id"); psTemp = TheApplication().NewPropertySet(); psTemp.SetProperty("Barring Action SCM", sBarringAction); psTemp.SetProperty("Product Id", sProductId); bBRAdded = false; for (i = 0; i < psBarringRequests.GetChildCount(); i++) { if (psBarringRequests.GetChild(i).GetProperty("Asset Id") == sAssetId) { psBarringRequests.GetChild(i).AddChild(psTemp); bBRAdded = true; break; } } if (!bBRAdded) { psTemp2 = TheApplication().NewPropertySet(); psTemp2.SetProperty("Asset Id", sAssetId); psTemp2.SetProperty("Contract Name", sContractName); psTemp2.SetProperty("Parent Product Id", sParProductId); psTemp2.AddChild(psTemp); psBarringRequests.AddChild(psTemp2); } bIsRecord = oBCBR.NextRecord(); } // 3/3 - check cardinaliti

Barring Request Processing Service AIP SCM
(declarations)
// declare global business services // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsRCOIS; // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsISS; // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsAIPProdUtils; // declare global property sets // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var psIn = TheApplication().NewPropertySet(); // used to store bs input parameters // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var psOut = TheApplication().NewPropertySet(); // used to store bs output parameters // declare global arrays // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var aCurrProduct = new Array(); // stores the attributes for the product currently under investigation // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var aBarringSets = new Array(); // stores all available barring sets // declare global variables var iReqBarrLvl; // requested barring level var sHeaderId; // quote header id var bAllAgentEnabled; //new for Oct12, used in Manual Barring var sBarringType; //new for May14

Barring Request Processing Service AIP SCM
(declarations)
// declare global business services // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsRCOIS; // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsISS; // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var bsAIPProdUtils; // declare global property sets // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var psIn = TheApplication().NewPropertySet(); // used to store bs input parameters // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var psOut = TheApplication().NewPropertySet(); // used to store bs output parameters // declare global arrays // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var aCurrProduct = new Array(); // stores the attributes for the product currently under investigation // TGDDERO7, 04.04.2011, Oracle/Siebel Code Review: var aBarringSets = new Array(); // stores all available barring sets // declare global variables var iReqBarrLvl; // requested barring level var sHeaderId; // quote header id var bAllAgentEnabled; //new for Oct12, used in Manual Barring var sBarringType; //new for May14

Barring Request Processing Service AIP SCM
ActivateBarringSets
function ActivateBarringSets(iBarrReqLvl, sProductId, psInstance) { /************************************************************************************************** * Function: ActivateBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Activate barring sets for given product if ther barring level is smaller or equal * * than the requested barring level and if the barring set not already exists. * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-23 - TGDBIIN1 - AllAgentEnabled introduced to handle Manual Barring * * Update : 2012-07-25 - TGDBIIN1 - Cleanup (Mail from René) * * Update : 2014-03-14 - TGDBIIN1 - changes for project Barring Enhancements, REQ-27403 * * Update : 2014-04-30 - TGDBIIN1 - changes for defect 83714 * **************************************************************************************************/ // TGDDERO7,04.04.2011, Oracle/Siebel Code Review: // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: START"); // declarations var psPortItems:PropertySet; var psDomainItems:PropertySet; var bUpdated = false; var sAddItemOutIntId; var sXAId; var bProdExists:bool; var sPropName:chars; var sPropVal:chars; var sName:chars; var sProductName:chars; var sPortItemId:chars; var sProdItemId:chars; var i = 0; var k = 0; var j = 0; var l = 0; var nPorts = 0; var nDomItems = 0; var nInstances = 0; var psPort:PropertySet; var psDomain:PropertySet; var psTemp:PropertySet; try { psPortItems = this.oApp.NewPropertySet(); psDomainItems = this.oApp.NewPropertySet(); // get ports and domain for given product this.psIn.Reset(); this.psIn.SetProperty("Product Id" , sProductId); this.psIn.SetProperty("GetPortDomain", "Y"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: GetAllPorts input: Product Id = " + sProductId); this.bsRCOIS.InvokeMethod("GetAllPorts", this.psIn, psPortItems); // loop through ports nPorts = psPortItems.GetChildCount() for(i = 0; i < nPorts; i++) { psPort = psPortItems.GetChild(i); sPropName = psPort.GetFirstProperty(); while(sPropName != "") { sPropVal = psPort.GetProperty(sPropName); if(sPropName == "Name") sName = sPropVal; if(sPropName == "Port Item Id") sPortItemId = sPropVal; // error handling if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Port Item: " + i + ", Property: " + sPropName + " = " + sPropVal); sPropName = psPort.GetNextProperty(); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Port Item: " + i + " -------------------------------------------------------"); // check if port is the correct one for barring sets if(sName == "Barring Set" && sPortItemId != "") { // correct port found, store port item id and port item name this.aCurrProduct["Port Item Id"] = sPortItemId; if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Found Barring Sets, port item id: " + sPortItemId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Loop through domain items"); // look for correct domain item psDomainItems = psPortItems.GetChild(i); nDomItems = psDomainItems.GetChildCount(); for(k = 0; k < nDomItems; k++) { psDomain = psDomainItems.GetChild(k); sPropN

Barring Request Processing Service AIP SCM
ActivateBarringSets
function ActivateBarringSets(iBarrReqLvl, sProductId, psInstance) { /************************************************************************************************** * Function: ActivateBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Activate barring sets for given product if ther barring level is smaller or equal * * than the requested barring level and if the barring set not already exists. * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-23 - TGDBIIN1 - AllAgentEnabled introduced to handle Manual Barring * * Update : 2012-07-25 - TGDBIIN1 - Cleanup (Mail from René) * * Update : 2014-03-14 - TGDBIIN1 - changes for project Barring Enhancements, REQ-27403 * * Update : 2014-04-30 - TGDBIIN1 - changes for defect 83714 * **************************************************************************************************/ // TGDDERO7,04.04.2011, Oracle/Siebel Code Review: // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: START"); // declarations var psPortItems:PropertySet; var psDomainItems:PropertySet; var bUpdated = false; var sAddItemOutIntId; var sXAId; var bProdExists:bool; var sPropName:chars; var sPropVal:chars; var sName:chars; var sProductName:chars; var sPortItemId:chars; var sProdItemId:chars; var i = 0; var k = 0; var j = 0; var l = 0; var nPorts = 0; var nDomItems = 0; var nInstances = 0; var psPort:PropertySet; var psDomain:PropertySet; var psTemp:PropertySet; try { psPortItems = this.oApp.NewPropertySet(); psDomainItems = this.oApp.NewPropertySet(); // get ports and domain for given product this.psIn.Reset(); this.psIn.SetProperty("Product Id" , sProductId); this.psIn.SetProperty("GetPortDomain", "Y"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: GetAllPorts input: Product Id = " + sProductId); this.bsRCOIS.InvokeMethod("GetAllPorts", this.psIn, psPortItems); // loop through ports nPorts = psPortItems.GetChildCount() for(i = 0; i < nPorts; i++) { psPort = psPortItems.GetChild(i); sPropName = psPort.GetFirstProperty(); while(sPropName != "") { sPropVal = psPort.GetProperty(sPropName); if(sPropName == "Name") sName = sPropVal; if(sPropName == "Port Item Id") sPortItemId = sPropVal; // error handling if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Port Item: " + i + ", Property: " + sPropName + " = " + sPropVal); sPropName = psPort.GetNextProperty(); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Port Item: " + i + " -------------------------------------------------------"); // check if port is the correct one for barring sets if(sName == "Barring Set" && sPortItemId != "") { // correct port found, store port item id and port item name this.aCurrProduct["Port Item Id"] = sPortItemId; if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Found Barring Sets, port item id: " + sPortItemId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ActivateBarringSets: Loop through domain items"); // look for correct domain item psDomainItems = psPortItems.GetChild(i); nDomItems = psDomainItems.GetChildCount(); for(k = 0; k < nDomItems; k++) { psDomain = psDomainItems.GetChild(k); sPropN

Barring Request Processing Service AIP SCM
CacheBarringSets
function CacheBarringSets() { /************************************************************************************************** * Function: CacheBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Stores all available barring sets in array aBarringSets * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var oBO, oBC; var iCount = 0; var bRecExists; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: START"); oBO = this.oApp.GetBusObject("Admin ISS Product Definition"); oBC = oBO.GetBusComp("Internal Product - ISS Admin"); // get barring products and related information and cache it oBC.ActivateField("AIP Barring Level Lookup"); oBC.SetViewMode(3); oBC.ClearToQuery(); oBC.SetSearchSpec("Service Type", "Barring Set"); oBC.ExecuteQuery(ForwardOnly); bRecExists = oBC.FirstRecord(); while(bRecExists) { // record found this.aBarringSets[iCount] = new Array(); // TGDDERO7: really create a new Array???? Ask Jochen. this.aBarringSets[iCount]["Product Id"] = oBC.GetFieldValue("Id"); this.aBarringSets[iCount]["Barring Level"] = oBC.GetFieldValue("AIP Barring Level Lookup"); this.aBarringSets[iCount]["Product Name"] = oBC.GetFieldValue("Name"); this.aBarringSets[iCount]["Configuration Model Id"] = oBC.GetFieldValue("Configuration Model Id"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: Cached record: " + iCount + ", Product = '" + this.aBarringSets[iCount]["Product Name"] + "', ID = '" + this.aBarringSets[iCount]["Product Id"] + "', Level = '" + this.aBarringSets[iCount]["Barring Level"] + "'"); iCount++; bRecExists = oBC.NextRecord(); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets Error: "+sError); throw(e); } finally { // clean up oBC = null; oBO = null; } }

Barring Request Processing Service AIP SCM
CacheBarringSets
function CacheBarringSets() { /************************************************************************************************** * Function: CacheBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Stores all available barring sets in array aBarringSets * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var oBO, oBC; var iCount = 0; var bRecExists; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: START"); oBO = this.oApp.GetBusObject("Admin ISS Product Definition"); oBC = oBO.GetBusComp("Internal Product - ISS Admin"); // get barring products and related information and cache it oBC.ActivateField("AIP Barring Level Lookup"); oBC.SetViewMode(3); oBC.ClearToQuery(); oBC.SetSearchSpec("Service Type", "Barring Set"); oBC.ExecuteQuery(ForwardOnly); bRecExists = oBC.FirstRecord(); while(bRecExists) { // record found this.aBarringSets[iCount] = new Array(); // TGDDERO7: really create a new Array???? Ask Jochen. this.aBarringSets[iCount]["Product Id"] = oBC.GetFieldValue("Id"); this.aBarringSets[iCount]["Barring Level"] = oBC.GetFieldValue("AIP Barring Level Lookup"); this.aBarringSets[iCount]["Product Name"] = oBC.GetFieldValue("Name"); this.aBarringSets[iCount]["Configuration Model Id"] = oBC.GetFieldValue("Configuration Model Id"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: Cached record: " + iCount + ", Product = '" + this.aBarringSets[iCount]["Product Name"] + "', ID = '" + this.aBarringSets[iCount]["Product Id"] + "', Level = '" + this.aBarringSets[iCount]["Barring Level"] + "'"); iCount++; bRecExists = oBC.NextRecord(); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CacheBarringSets Error: "+sError); throw(e); } finally { // clean up oBC = null; oBO = null; } }

Barring Request Processing Service AIP SCM
CloseCfgSession
function CloseCfgSession(sRootId) { /************************************************************************************************** * Function: CloseCfgSession in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Closes the configurator session and releases the instance * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession: START"); this.psIn.Reset(); this.psOut.Reset(); //this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntObjName", "SIS OM Quote"); this.psIn.SetProperty("ObjId" , sHeaderId); this.psIn.SetProperty("RootId" , sRootId); this.bsRCOIS.InvokeMethod("UnloadInstance", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
CloseCfgSession
function CloseCfgSession(sRootId) { /************************************************************************************************** * Function: CloseCfgSession in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Closes the configurator session and releases the instance * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession: START"); this.psIn.Reset(); this.psOut.Reset(); //this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntObjName", "SIS OM Quote"); this.psIn.SetProperty("ObjId" , sHeaderId); this.psIn.SetProperty("RootId" , sRootId); this.bsRCOIS.InvokeMethod("UnloadInstance", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CloseCfgSession Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
CreateDisconnectQuote
function CreateDisconnectQuote(Inputs, Outputs) { /************************************************************************************************** * Function: CreateDisconnectQuote in BusService "Toolkit BS AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Creates a disconnect quote for given account and bundle and stores the * * disconnect reason as well. * * Disconnect functionality has to be called from context of BC Asset Mgmt - Asset * * (Order Mgmt) * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sAccessId, sAssetId, sDisconnectReason, sDueDate, sQuoteId; // optional Inputs var sExtOrderIntId, sEndAdoptFlg; var oBO, oBCAccount, oBCAsset, oBCQuote; var bRecExists; var bBundleFound = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateDisconnectQuote: START"); sAccountId = Inputs.GetProperty("Account Id"); sAccessId = Inputs.GetProperty("Access Id"); sAssetId = Inputs.GetProperty("Asset Bundle Id"); sDisconnectReason = Inputs.GetProperty("Disconnect Reason"); sDueDate = Inputs.GetProperty("Disconnect Date"); sQuoteId = Inputs.GetProperty("Quote Id"); // optional Inputs sExtOrderIntId = Inputs.GetProperty("External Order Integration Id"); sEndAdoptFlg = Inputs.GetProperty("End Adoption Flag"); oBO = this.oApp.GetBusObject("Account"); oBCAccount = oBO.GetBusComp("Account"); oBCAsset = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); oBCQuote = oBO.GetBusComp("Quote"); // prepare query quote oBCQuote.ActivateField("AIP Deactivation Reason"); oBCQuote.SetViewMode(3); oBCQuote.ClearToQuery(); // prepare query account oBCAccount.SetViewMode(3); oBCAccount.ClearToQuery(); oBCAccount.SetSearchSpec("Id", sAccountId); // prepare query asset (since only one bundle per access is allowed it is sufficient to get all assets for one access) oBCAsset.SetViewMode(3); oBCAsset.ClearToQuery(); // execute querys oBCAccount.ExecuteQuery(ForwardOnly); bRecExists = oBCAsset.FirstRecord(); if (bRecExists) { // identify bundle record while(bRecExists && !bBundleFound) { // check for bundle record if (oBCAsset.GetFieldValue("Id") == sAssetId) { // bundle found, invoke disconnect method this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", sQuoteId); bBundleFound = true; oBCAsset.InvokeMethod("Barring_DisconnectProdSvc"); this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", ""); } bRecExists = oBCAsset.NextRecord(); } // update quote with disconnect reason code and disconnect date oBCQuote.ActivateField("AIP External Order Integration Id"); oBCQuote.ActivateField("AIP End Adoption Flag"); oBCQuote.SetSearchSpec("Id", sQuoteId); oBCQuote.ExecuteQuery(ForwardOnly); if(oBCQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateDisconnectQuote: Quote found"); oBCQuote.SetFieldValue("Due Date", sDueDate); oBCQuote.SetFieldValue("AIP Commitment Customer Deactivation Wish Date", sDueDate); oBCQuote.SetFieldValue("AIP Deactivation Reason", sDisconnectReason); oBCQuote.SetFieldValue("AIP End Adoption Flag", sEndAdoptFlg); oBCQuote.SetFieldValue("AIP External Order Integration Id", sExtOrderIntId); oBCQuote.WriteRecord(); }

Barring Request Processing Service AIP SCM
CreateDisconnectQuote
function CreateDisconnectQuote(Inputs, Outputs) { /************************************************************************************************** * Function: CreateDisconnectQuote in BusService "Toolkit BS AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Creates a disconnect quote for given account and bundle and stores the * * disconnect reason as well. * * Disconnect functionality has to be called from context of BC Asset Mgmt - Asset * * (Order Mgmt) * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sAccessId, sAssetId, sDisconnectReason, sDueDate, sQuoteId; // optional Inputs var sExtOrderIntId, sEndAdoptFlg; var oBO, oBCAccount, oBCAsset, oBCQuote; var bRecExists; var bBundleFound = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateDisconnectQuote: START"); sAccountId = Inputs.GetProperty("Account Id"); sAccessId = Inputs.GetProperty("Access Id"); sAssetId = Inputs.GetProperty("Asset Bundle Id"); sDisconnectReason = Inputs.GetProperty("Disconnect Reason"); sDueDate = Inputs.GetProperty("Disconnect Date"); sQuoteId = Inputs.GetProperty("Quote Id"); // optional Inputs sExtOrderIntId = Inputs.GetProperty("External Order Integration Id"); sEndAdoptFlg = Inputs.GetProperty("End Adoption Flag"); oBO = this.oApp.GetBusObject("Account"); oBCAccount = oBO.GetBusComp("Account"); oBCAsset = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); oBCQuote = oBO.GetBusComp("Quote"); // prepare query quote oBCQuote.ActivateField("AIP Deactivation Reason"); oBCQuote.SetViewMode(3); oBCQuote.ClearToQuery(); // prepare query account oBCAccount.SetViewMode(3); oBCAccount.ClearToQuery(); oBCAccount.SetSearchSpec("Id", sAccountId); // prepare query asset (since only one bundle per access is allowed it is sufficient to get all assets for one access) oBCAsset.SetViewMode(3); oBCAsset.ClearToQuery(); // execute querys oBCAccount.ExecuteQuery(ForwardOnly); bRecExists = oBCAsset.FirstRecord(); if (bRecExists) { // identify bundle record while(bRecExists && !bBundleFound) { // check for bundle record if (oBCAsset.GetFieldValue("Id") == sAssetId) { // bundle found, invoke disconnect method this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", sQuoteId); bBundleFound = true; oBCAsset.InvokeMethod("Barring_DisconnectProdSvc"); this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", ""); } bRecExists = oBCAsset.NextRecord(); } // update quote with disconnect reason code and disconnect date oBCQuote.ActivateField("AIP External Order Integration Id"); oBCQuote.ActivateField("AIP End Adoption Flag"); oBCQuote.SetSearchSpec("Id", sQuoteId); oBCQuote.ExecuteQuery(ForwardOnly); if(oBCQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateDisconnectQuote: Quote found"); oBCQuote.SetFieldValue("Due Date", sDueDate); oBCQuote.SetFieldValue("AIP Commitment Customer Deactivation Wish Date", sDueDate); oBCQuote.SetFieldValue("AIP Deactivation Reason", sDisconnectReason); oBCQuote.SetFieldValue("AIP End Adoption Flag", sEndAdoptFlg); oBCQuote.SetFieldValue("AIP External Order Integration Id", sExtOrderIntId); oBCQuote.WriteRecord(); }

Barring Request Processing Service AIP SCM
CreateModificationQuote
function CreateModificationQuote(Inputs, Outputs) { /************************************************************************************************** * Function: CreateModificationQuote in BusService "Toolkit BS AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Creates a modification quote for given account, access and bundle * * Modify functionality has to be called from context of BC Asset Mgmt - Asset * * (Order Mgmt) * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sAssetId, sDueDate, sQuoteId; var oBO, oBCAccount, oBCAsset, oBCQuote; var bRecExists; var bBundleFound = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: START"); sAccountId = Inputs.GetProperty("Account Id"); sAssetId = Inputs.GetProperty("Asset Bundle Id"); sDueDate = Inputs.GetProperty("Due Date"); sQuoteId = Inputs.GetProperty("Quote Id"); oBO = this.oApp.GetBusObject("Account"); oBCAccount = oBO.GetBusComp("Account"); oBCAsset = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); oBCQuote = oBO.GetBusComp("Quote"); // prepare query quote oBCQuote.SetViewMode(3); oBCQuote.ClearToQuery(); // prepare query account oBCAccount.SetViewMode(3); oBCAccount.ClearToQuery(); oBCAccount.SetSearchSpec("Id", sAccountId); // prepare query asset (since only one bundle per access is allowed it is sufficient to get all assets for one access) oBCAsset.SetViewMode(3); oBCAsset.ClearToQuery(); oBCAsset.SetSearchSpec("Id", sAssetId); // execute querys oBCAccount.ExecuteQuery(ForwardOnly); bRecExists = oBCAsset.FirstRecord(); if (bRecExists) { // identify bundle record while(bRecExists && !bBundleFound) { // check for bundle record if (oBCAsset.GetFieldValue("Id") == sAssetId) { // bundle found, invoke disconnect method this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", sQuoteId); bBundleFound = true; oBCAsset.InvokeMethod("Barring_ModifyProdSvc"); this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", ""); } bRecExists = oBCAsset.NextRecord(); } // update due date on quote oBCQuote.SetSearchSpec("Id", sQuoteId); oBCQuote.ExecuteQuery(ForwardOnly); if(oBCQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: Quote found"); oBCQuote.SetFieldValue("Due Date", sDueDate); oBCQuote.WriteRecord(); } } // end if bundle records found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote Error: "+sError); throw(e); } finally { // clean up oBCQuote = null; oBCAsset = null; oBCAccount = null; oBO = null; } }

Barring Request Processing Service AIP SCM
CreateModificationQuote
function CreateModificationQuote(Inputs, Outputs) { /************************************************************************************************** * Function: CreateModificationQuote in BusService "Toolkit BS AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Creates a modification quote for given account, access and bundle * * Modify functionality has to be called from context of BC Asset Mgmt - Asset * * (Order Mgmt) * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sAssetId, sDueDate, sQuoteId; var oBO, oBCAccount, oBCAsset, oBCQuote; var bRecExists; var bBundleFound = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: START"); sAccountId = Inputs.GetProperty("Account Id"); sAssetId = Inputs.GetProperty("Asset Bundle Id"); sDueDate = Inputs.GetProperty("Due Date"); sQuoteId = Inputs.GetProperty("Quote Id"); oBO = this.oApp.GetBusObject("Account"); oBCAccount = oBO.GetBusComp("Account"); oBCAsset = oBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); oBCQuote = oBO.GetBusComp("Quote"); // prepare query quote oBCQuote.SetViewMode(3); oBCQuote.ClearToQuery(); // prepare query account oBCAccount.SetViewMode(3); oBCAccount.ClearToQuery(); oBCAccount.SetSearchSpec("Id", sAccountId); // prepare query asset (since only one bundle per access is allowed it is sufficient to get all assets for one access) oBCAsset.SetViewMode(3); oBCAsset.ClearToQuery(); oBCAsset.SetSearchSpec("Id", sAssetId); // execute querys oBCAccount.ExecuteQuery(ForwardOnly); bRecExists = oBCAsset.FirstRecord(); if (bRecExists) { // identify bundle record while(bRecExists && !bBundleFound) { // check for bundle record if (oBCAsset.GetFieldValue("Id") == sAssetId) { // bundle found, invoke disconnect method this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", sQuoteId); bBundleFound = true; oBCAsset.InvokeMethod("Barring_ModifyProdSvc"); this.oApp.SetProfileAttr("QUOTE_ID_AIP_SCM", ""); } bRecExists = oBCAsset.NextRecord(); } // update due date on quote oBCQuote.SetSearchSpec("Id", sQuoteId); oBCQuote.ExecuteQuery(ForwardOnly); if(oBCQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: Quote found"); oBCQuote.SetFieldValue("Due Date", sDueDate); oBCQuote.WriteRecord(); } } // end if bundle records found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote: END"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> CreateModificationQuote Error: "+sError); throw(e); } finally { // clean up oBCQuote = null; oBCAsset = null; oBCAccount = null; oBO = null; } }

Barring Request Processing Service AIP SCM
IdentifyOpenQuotesAndOrders
function IdentifyOpenQuotesAndOrders(Inputs, Outputs) { /************************************************************************************************** * Function: IdentifyOpenQuotesAndOrders in BusService "Barring Request Processing Service AIP SCM"* * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Identifies for given customer and bundle if there are any open quotes or orders * * Open means: * * - Quote status: In Progress or On Hold * * - Order status: Failed, Open, Pending or Submitted * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sBundleProductId; var oBO, oBCHeader, oBCItem; var bRecExists = false; var isRecord = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: START"); sAccountId = Inputs.GetProperty("Account Id"); sBundleProductId = Inputs.GetProperty("Bundle Product Id"); // original script has been changed; input is "Asset.Integration Id" oBO = this.oApp.GetBusObject("MACD Performance Quote"); oBCHeader = oBO.GetBusComp("MACD Quote"); oBCItem = oBO.GetBusComp("MACD Quote Item"); // query quote oBCHeader.SetViewMode(3); oBCHeader.ClearToQuery(); oBCHeader.SetSearchExpr("([Status]='In Progress' OR [Status]='On Hold') AND [Account Id]='" + sAccountId + "'"); oBCHeader.ExecuteQuery(ForwardOnly); isRecord = oBCHeader.FirstRecord(); while (isRecord) { // query quote items oBCItem.SetViewMode(3); oBCItem.ClearToQuery(); oBCItem.SetSearchSpec("Asset Integration Id", sBundleProductId); oBCItem.ExecuteQuery(ForwardOnly); if (oBCItem.FirstRecord()) bRecExists = true; isRecord = oBCHeader.NextRecord(); } isRecord = null; oBCItem = null; oBCHeader = null; oBO = null; // query order oBO = this.oApp.GetBusObject("MACD Performance Order"); oBCHeader = oBO.GetBusComp("MACD Order Entry - Orders"); oBCItem = oBO.GetBusComp("MACD Order Entry - Line Items"); oBCHeader.SetViewMode(3); oBCHeader.ClearToQuery(); oBCHeader.SetSearchExpr("([Status]='Pending' OR [Status]='Failed' OR [Status]='Open' OR [Status]='Submitted') AND [Account Id]='" + sAccountId + "'"); oBCHeader.ExecuteQuery(ForwardOnly); isRecord = oBCHeader.FirstRecord(); while (isRecord) { // query order items oBCItem.ActivateField("Asset Integration Id"); oBCItem.SetViewMode(3); oBCItem.ClearToQuery(); oBCItem.SetSearchSpec("Asset Integration Id", sBundleProductId); // original script has been changed; input is "Asset.Integration Id" oBCItem.ExecuteQuery(ForwardBackward); if (oBCItem.FirstRecord()) bRecExists = true; isRecord = oBCHeader.NextRecord(); } isRecord = null; oBCItem = null; oBCHeader = null; oBO = null; Outputs.SetProperty("Records Exist", bRecExists); if (this.bIsTraceOn) { this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: Quotes/Orders identified: "+bRecExists); this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: END"); } } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> IdentifyopenQuotesAndOrders Error: "+sError); throw(e); } finally { // clean up oBCItem = null; oBCHeader = null; oBO = null; } }

Barring Request Processing Service AIP SCM
IdentifyOpenQuotesAndOrders
function IdentifyOpenQuotesAndOrders(Inputs, Outputs) { /************************************************************************************************** * Function: IdentifyOpenQuotesAndOrders in BusService "Barring Request Processing Service AIP SCM"* * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Identifies for given customer and bundle if there are any open quotes or orders * * Open means: * * - Quote status: In Progress or On Hold * * - Order status: Failed, Open, Pending or Submitted * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sAccountId, sBundleProductId; var oBO, oBCHeader, oBCItem; var bRecExists = false; var isRecord = false; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: START"); sAccountId = Inputs.GetProperty("Account Id"); sBundleProductId = Inputs.GetProperty("Bundle Product Id"); // original script has been changed; input is "Asset.Integration Id" oBO = this.oApp.GetBusObject("MACD Performance Quote"); oBCHeader = oBO.GetBusComp("MACD Quote"); oBCItem = oBO.GetBusComp("MACD Quote Item"); // query quote oBCHeader.SetViewMode(3); oBCHeader.ClearToQuery(); oBCHeader.SetSearchExpr("([Status]='In Progress' OR [Status]='On Hold') AND [Account Id]='" + sAccountId + "'"); oBCHeader.ExecuteQuery(ForwardOnly); isRecord = oBCHeader.FirstRecord(); while (isRecord) { // query quote items oBCItem.SetViewMode(3); oBCItem.ClearToQuery(); oBCItem.SetSearchSpec("Asset Integration Id", sBundleProductId); oBCItem.ExecuteQuery(ForwardOnly); if (oBCItem.FirstRecord()) bRecExists = true; isRecord = oBCHeader.NextRecord(); } isRecord = null; oBCItem = null; oBCHeader = null; oBO = null; // query order oBO = this.oApp.GetBusObject("MACD Performance Order"); oBCHeader = oBO.GetBusComp("MACD Order Entry - Orders"); oBCItem = oBO.GetBusComp("MACD Order Entry - Line Items"); oBCHeader.SetViewMode(3); oBCHeader.ClearToQuery(); oBCHeader.SetSearchExpr("([Status]='Pending' OR [Status]='Failed' OR [Status]='Open' OR [Status]='Submitted') AND [Account Id]='" + sAccountId + "'"); oBCHeader.ExecuteQuery(ForwardOnly); isRecord = oBCHeader.FirstRecord(); while (isRecord) { // query order items oBCItem.ActivateField("Asset Integration Id"); oBCItem.SetViewMode(3); oBCItem.ClearToQuery(); oBCItem.SetSearchSpec("Asset Integration Id", sBundleProductId); // original script has been changed; input is "Asset.Integration Id" oBCItem.ExecuteQuery(ForwardBackward); if (oBCItem.FirstRecord()) bRecExists = true; isRecord = oBCHeader.NextRecord(); } isRecord = null; oBCItem = null; oBCHeader = null; oBO = null; Outputs.SetProperty("Records Exist", bRecExists); if (this.bIsTraceOn) { this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: Quotes/Orders identified: "+bRecExists); this.oApp.Trace(this.Name()+" -> IdentifyOpenQuotesAndOrders: END"); } } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> IdentifyopenQuotesAndOrders Error: "+sError); throw(e); } finally { // clean up oBCItem = null; oBCHeader = null; oBO = null; } }

Barring Request Processing Service AIP SCM
InactivateBarringSets
function InactivateBarringSets(psInstance, iBarrReqLvl) { /************************************************************************************************** * Function: InactivateBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Inactivates all barring sets for the given product if their barring level is greater * * than the requested barring level and the "Agent Enabled" flag is not set. * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-04-23 - TGDBIIN1 - defect #51923 * * Update : 2012-09-05 - TGDBIIN1 - Inactivate BarringSets also in case of Manual Barring, * * if the Barring assets's AgentEnabled XA is 'Y' * * Update : 2013-06-11 - TGDBIIN1 - Don't process Barring QLIs which do not have AgentEnabled XA * * defined (defect #68747) * * Update : 2014-03-14 - TGDBIIN1 - changes added for project Barring Enhancements, REQ-27403 * * Update : 2014-04-14 - TGDBIIN1 - fix for defect #83519 * * Update : 2014-05-03 - TGDBIIN1 - fix for defect #83714 * **************************************************************************************************/ // declarations var bUpdated = false; //var bAgentEnabled = false; // new type and init value (#68747): var sAgentEnabled = ''; var i = 0; var k = 0; var j = 0; var nInstances = 0; var psChild = null; var psGrandChild = null; var nGrandChild = 0; var nChilds = 0; // old ->: var sAgentEnabledXA = ''; var sManualBarringXA = ''; var sCustomerBarringXA = ''; //20140922:TGDFIMA9 - added SO2319 var oBarringWF, psInputs, psOutputs; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: START"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Barring Set = '" + this.aCurrProduct["Name"] + "' found"); // check for agent enabled flag nInstances = psInstance.GetChildCount(); for (i = 0; i < nInstances; i++) { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Check Child Property Set: " + i); psChild = psInstance.GetChild(i); // look for attribute nChilds = psChild.GetChildCount(); for (k = 0; k < nChilds; k++) { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Check Grand Child Property Set: " + k); psGrandChild = psChild.GetChild(k); // old ->: if (psGrandChild.GetProperty("Name") == "AgentEnabled") if (psGrandChild.GetProperty("Name") == "BarringSetManualOperator") { // old ->: if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: AgentEnabled flag found"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: BarringSetManualOperator XA found"); // old ->: sAgentEnabledXA = psGrandChild.GetProperty("Value"); sManualBarringXA = psGrandChild.GetProperty("Value"); // old ->: if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: AgentEnabled flag, value: "+sAgentEnabledXA); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: BarringSetManualOperator XA, value: "+sManualBarringXA); // TGDBIIN1 2012-04-23: dirty fix: added Display values for AgentEnabled XA, as this is now translated. (Th

Barring Request Processing Service AIP SCM
InactivateBarringSets
function InactivateBarringSets(psInstance, iBarrReqLvl) { /************************************************************************************************** * Function: InactivateBarringSets in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Inactivates all barring sets for the given product if their barring level is greater * * than the requested barring level and the "Agent Enabled" flag is not set. * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-04-23 - TGDBIIN1 - defect #51923 * * Update : 2012-09-05 - TGDBIIN1 - Inactivate BarringSets also in case of Manual Barring, * * if the Barring assets's AgentEnabled XA is 'Y' * * Update : 2013-06-11 - TGDBIIN1 - Don't process Barring QLIs which do not have AgentEnabled XA * * defined (defect #68747) * * Update : 2014-03-14 - TGDBIIN1 - changes added for project Barring Enhancements, REQ-27403 * * Update : 2014-04-14 - TGDBIIN1 - fix for defect #83519 * * Update : 2014-05-03 - TGDBIIN1 - fix for defect #83714 * **************************************************************************************************/ // declarations var bUpdated = false; //var bAgentEnabled = false; // new type and init value (#68747): var sAgentEnabled = ''; var i = 0; var k = 0; var j = 0; var nInstances = 0; var psChild = null; var psGrandChild = null; var nGrandChild = 0; var nChilds = 0; // old ->: var sAgentEnabledXA = ''; var sManualBarringXA = ''; var sCustomerBarringXA = ''; //20140922:TGDFIMA9 - added SO2319 var oBarringWF, psInputs, psOutputs; try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: START"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Barring Set = '" + this.aCurrProduct["Name"] + "' found"); // check for agent enabled flag nInstances = psInstance.GetChildCount(); for (i = 0; i < nInstances; i++) { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Check Child Property Set: " + i); psChild = psInstance.GetChild(i); // look for attribute nChilds = psChild.GetChildCount(); for (k = 0; k < nChilds; k++) { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: Check Grand Child Property Set: " + k); psGrandChild = psChild.GetChild(k); // old ->: if (psGrandChild.GetProperty("Name") == "AgentEnabled") if (psGrandChild.GetProperty("Name") == "BarringSetManualOperator") { // old ->: if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: AgentEnabled flag found"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: BarringSetManualOperator XA found"); // old ->: sAgentEnabledXA = psGrandChild.GetProperty("Value"); sManualBarringXA = psGrandChild.GetProperty("Value"); // old ->: if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: AgentEnabled flag, value: "+sAgentEnabledXA); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InactivateBarringSets: BarringSetManualOperator XA, value: "+sManualBarringXA); // TGDBIIN1 2012-04-23: dirty fix: added Display values for AgentEnabled XA, as this is now translated. (Th

Barring Request Processing Service AIP SCM
InitializeConfigInstance
function InitializeConfigInstance(sRootId) { /************************************************************************************************** * Function: InitializeConfigInstance in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Loads the modification order with the bundle to update into the configurator memory * * to create an instance of it, if needed a configurator session is created in addition * * and returns the created instance * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-25 - TGDBIIN1 - Cleanup (Mail from René) * * Update : 2012-09-07 - TGDBIIN1 - added inputs "SearchSpec" and "RootId" for ISS.LoadEAI * **************************************************************************************************/ // declarations var bSessionReq; var psCfgInstance; try { bSessionReq = "N"; psCfgInstance = this.oApp.NewPropertySet(); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: START"); // LoadEAI loads an empty structure into memory (required for LoadInstance method) this.psIn.Reset(); this.psOut.Reset(); this.psIn.SetProperty("ParentObjectId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); this.psIn.SetProperty("SearchSpec", "[Header.Id] = '" + sHeaderId + "' AND [Line Item.Root Id] = '" + sRootId + "'"); //this.psIn.SetProperty("IntegrationObjectName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntegrationObjectName", "SIS OM Quote"); this.bsISS.InvokeMethod("LoadEAI", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Load EAI completed"); // load configurator instance based on the structure created before // and create configurator session if required with same input properties this.psIn.Reset(); this.psOut.Reset(); //this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntObjName", "SIS OM Quote"); this.psIn.SetProperty("ObjId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); this.psIn.SetProperty("TriggerEvent", "Y"); // only needed for bsAIPProdUtils this.psIn.SetProperty("AutoSync", "N"); this.psIn.SetProperty("ExternalScript", "Y"); this.psIn.SetProperty("SearchSpec", "[Header.Id] = '" + sHeaderId + "' AND [Line Item.Root Id] = '" + sRootId + "'"); // call handles also linked items this.bsAIPProdUtils.InvokeMethod("Cfg_LoadInstanceCreateSession", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Load Instance and Session completed"); // get configurator instance as property set this.psIn.Reset(); this.psIn.SetProperty("ObjId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Now calling RCOIS.GetInstance with properties: ObjId = '" + sHeaderId + "', RootId = '" + sRootId + "' ..."); this.bsRCOIS.InvokeMethod("GetInstance", this.psIn, psCfgInstance); if (this.bIsTraceOn) { this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Get Instance completed"); this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: END"); } return(psCfgInstance); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance Error: "+sError); throw(e); } finally { psCfgInstance = null; }

Barring Request Processing Service AIP SCM
InitializeConfigInstance
function InitializeConfigInstance(sRootId) { /************************************************************************************************** * Function: InitializeConfigInstance in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Loads the modification order with the bundle to update into the configurator memory * * to create an instance of it, if needed a configurator session is created in addition * * and returns the created instance * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-25 - TGDBIIN1 - Cleanup (Mail from René) * * Update : 2012-09-07 - TGDBIIN1 - added inputs "SearchSpec" and "RootId" for ISS.LoadEAI * **************************************************************************************************/ // declarations var bSessionReq; var psCfgInstance; try { bSessionReq = "N"; psCfgInstance = this.oApp.NewPropertySet(); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: START"); // LoadEAI loads an empty structure into memory (required for LoadInstance method) this.psIn.Reset(); this.psOut.Reset(); this.psIn.SetProperty("ParentObjectId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); this.psIn.SetProperty("SearchSpec", "[Header.Id] = '" + sHeaderId + "' AND [Line Item.Root Id] = '" + sRootId + "'"); //this.psIn.SetProperty("IntegrationObjectName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntegrationObjectName", "SIS OM Quote"); this.bsISS.InvokeMethod("LoadEAI", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Load EAI completed"); // load configurator instance based on the structure created before // and create configurator session if required with same input properties this.psIn.Reset(); this.psOut.Reset(); //this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("IntObjName", "SIS OM Quote"); this.psIn.SetProperty("ObjId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); this.psIn.SetProperty("TriggerEvent", "Y"); // only needed for bsAIPProdUtils this.psIn.SetProperty("AutoSync", "N"); this.psIn.SetProperty("ExternalScript", "Y"); this.psIn.SetProperty("SearchSpec", "[Header.Id] = '" + sHeaderId + "' AND [Line Item.Root Id] = '" + sRootId + "'"); // call handles also linked items this.bsAIPProdUtils.InvokeMethod("Cfg_LoadInstanceCreateSession", this.psIn, this.psOut); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Load Instance and Session completed"); // get configurator instance as property set this.psIn.Reset(); this.psIn.SetProperty("ObjId", sHeaderId); this.psIn.SetProperty("RootId", sRootId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Now calling RCOIS.GetInstance with properties: ObjId = '" + sHeaderId + "', RootId = '" + sRootId + "' ..."); this.bsRCOIS.InvokeMethod("GetInstance", this.psIn, psCfgInstance); if (this.bIsTraceOn) { this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: Get Instance completed"); this.oApp.Trace(this.Name()+" -> InitializeConfigInstance: END"); } return(psCfgInstance); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> InitializeConfigInstance Error: "+sError); throw(e); } finally { psCfgInstance = null; }

Barring Request Processing Service AIP SCM
ProcessBarringRequest
function ProcessBarringRequest(Inputs, Outputs) { /************************************************************************************************** * Function: ProcessBarringRequest in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : - Activation/deactivation of barring sets for a given bundle based on the barring * * level * * of the barring request * * - Query for open processes for quotes and orders for given bundle and account * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-23 - TGDBIIN1 - AllAgentEnabled added (Manual Barring) * * Update : 2014-04-30 - TGDBIIN1 - BarringType added (defect #83714) * * Update : 2014-09-09 - TGDFIMA9 - Added Asset Integration Id * **************************************************************************************************/ // declarations var bBarrUpdated = false; // determines if in current structure a barring set has bee var sRootId; // id of current root product var sRootAssetIntegrationId; //AssetIntId of current BundleComponent Asset - mafi var bRecExists; // determines loop through OLIsn updated var boQuote, bcQuote, bcQLI; var psCfgInstance; // stores the configurator instance try { boQuote = this.oApp.GetBusObject("MACD Performance Quote"); bcQuote = boQuote.GetBusComp("MACD Quote"); bcQLI = boQuote.GetBusComp("MACD Quote Item"); psCfgInstance = this.oApp.NewPropertySet(); // stores the configurator instance // populate global instances if not already existing if (!this.bsRCOIS) this.bsRCOIS = this.oApp.GetService("Remote Complex Object Instance Service"); if (!this.bsISS) this.bsISS = this.oApp.GetService("ISS Copy Service"); if (!this.bsAIPProdUtils) this.bsAIPProdUtils = this.oApp.GetService("Product Utilities AIP SCM"); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: START"); // get input parameters iReqBarrLvl = Inputs.GetProperty("Barring Level"); // requested barring level sHeaderId = Inputs.GetProperty("Header Id"); // quote id bAllAgentEnabled = Inputs.GetProperty("AllAgentEnabled"); // AllAgentEnabled Flag sBarringType = Inputs.GetProperty("Barring Type"); // Barring Type // query quote to be processed bcQuote.SetViewMode(3); bcQuote.ClearToQuery(); bcQuote.SetSearchSpec("Id", sHeaderId); bcQuote.ExecuteQuery(ForwardOnly); if(bcQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Quote found, ID: " + sHeaderId); // Barring Type if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Barring Type: " + sBarringType); // cache available barring sets this.CacheBarringSets(); // loop through root products for the given quote bcQLI.SetViewMode(3); bcQLI.ClearToQuery(); bcQLI.SetSearchExpr("[Root Quote Item Id] = [Id]"); // AND [Service Type] = 'Internet'"); bcQLI.ExecuteQuery(ForwardOnly); bRecExists = bcQLI.FirstRecord(); while(bRecExists) { // root quote line item record found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Root quote line item found, ID: " + bcQLI.GetFieldValue("Id")); // initialize configurator instance/session and returns psCfgInstance sRootId = bcQLI.GetFieldValue("Id"); s

Barring Request Processing Service AIP SCM
ProcessBarringRequest
function ProcessBarringRequest(Inputs, Outputs) { /************************************************************************************************** * Function: ProcessBarringRequest in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : - Activation/deactivation of barring sets for a given bundle based on the barring * * level * * of the barring request * * - Query for open processes for quotes and orders for given bundle and account * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2012-07-23 - TGDBIIN1 - AllAgentEnabled added (Manual Barring) * * Update : 2014-04-30 - TGDBIIN1 - BarringType added (defect #83714) * * Update : 2014-09-09 - TGDFIMA9 - Added Asset Integration Id * **************************************************************************************************/ // declarations var bBarrUpdated = false; // determines if in current structure a barring set has bee var sRootId; // id of current root product var sRootAssetIntegrationId; //AssetIntId of current BundleComponent Asset - mafi var bRecExists; // determines loop through OLIsn updated var boQuote, bcQuote, bcQLI; var psCfgInstance; // stores the configurator instance try { boQuote = this.oApp.GetBusObject("MACD Performance Quote"); bcQuote = boQuote.GetBusComp("MACD Quote"); bcQLI = boQuote.GetBusComp("MACD Quote Item"); psCfgInstance = this.oApp.NewPropertySet(); // stores the configurator instance // populate global instances if not already existing if (!this.bsRCOIS) this.bsRCOIS = this.oApp.GetService("Remote Complex Object Instance Service"); if (!this.bsISS) this.bsISS = this.oApp.GetService("ISS Copy Service"); if (!this.bsAIPProdUtils) this.bsAIPProdUtils = this.oApp.GetService("Product Utilities AIP SCM"); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: START"); // get input parameters iReqBarrLvl = Inputs.GetProperty("Barring Level"); // requested barring level sHeaderId = Inputs.GetProperty("Header Id"); // quote id bAllAgentEnabled = Inputs.GetProperty("AllAgentEnabled"); // AllAgentEnabled Flag sBarringType = Inputs.GetProperty("Barring Type"); // Barring Type // query quote to be processed bcQuote.SetViewMode(3); bcQuote.ClearToQuery(); bcQuote.SetSearchSpec("Id", sHeaderId); bcQuote.ExecuteQuery(ForwardOnly); if(bcQuote.FirstRecord()) { // quote found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Quote found, ID: " + sHeaderId); // Barring Type if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Barring Type: " + sBarringType); // cache available barring sets this.CacheBarringSets(); // loop through root products for the given quote bcQLI.SetViewMode(3); bcQLI.ClearToQuery(); bcQLI.SetSearchExpr("[Root Quote Item Id] = [Id]"); // AND [Service Type] = 'Internet'"); bcQLI.ExecuteQuery(ForwardOnly); bRecExists = bcQLI.FirstRecord(); while(bRecExists) { // root quote line item record found if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequest: Root quote line item found, ID: " + bcQLI.GetFieldValue("Id")); // initialize configurator instance/session and returns psCfgInstance sRootId = bcQLI.GetFieldValue("Id"); s

Barring Request Processing Service AIP SCM
ProcessBarringRequestForProduct
function ProcessBarringRequestForProduct(psInstance, iLvl) { /************************************************************************************************** * Function: ProcessBarringRequestForProduct in BusService "Barring Request Processing Service AIP SCM"* * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Recursive function to inactivate/activate barring sets for given product located at * * root position of psInstance property set and updates the action code of the parent * * product of the barring set. Function is called on all child property sets/products * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sPropName, sPropType; var bBarrUpdated = false; var bSyncNeeded = false; var sPropValue; var i = 0; var j = 0; var nChilds = 0; try { sPropName = psInstance.GetFirstProperty(); sPropType = psInstance.GetType(); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: START"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Check Property Set"); // only process current property set if it is of type "Line Item" // else check if child property set exists and start processing for it if (sPropType == "Line Item") { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Start processing Line Item"); // get information from current level of property set while(sPropName != "") { // look for integration id (= parent path) sPropValue = psInstance.GetProperty(sPropName); if(sPropName == "Product Id" || sPropName == "Name" || sPropName == "Service Type" || sPropName == "Integration Id") { this.aCurrProduct[sPropName] = sPropValue; if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Level: '" + iLvl + "',Property: '" + sPropName + "' = '" + this.aCurrProduct[sPropName] + "'"); } sPropName = psInstance.GetNextProperty(); } // inactivate barring sets in case current product is a barring set // requested barring level is global variable and set in function ProcessBarringRequest if(this.aCurrProduct["Service Type"] == "Barring Set") { // do not deactivate in case barring set is agent enabled if(this.InactivateBarringSets(psInstance, iReqBarrLvl)) bBarrUpdated = true; } // activate barring sets // requested barring level is global variable and set in function ProcessBarringRequest if(this.ActivateBarringSets(iReqBarrLvl, this.aCurrProduct["Product Id"], psInstance)) bBarrUpdated = true; // set sync if update has taken place if (bBarrUpdated) bSyncNeeded = true; // call ProcessBarringRequestForProduct function for all child property sets nChilds = psInstance.GetChildCount(); for(i = 0; i < nChilds; i++) { // set bBarrUpdated to true in case one update has taken place in child property set if(this.ProcessBarringRequestForProduct(psInstance.GetChild(i), iLvl + 1)) bSyncNeeded = true; } } // end if type = "Line Item" else { // type other than line item, check child property sets if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Property set not of type Line Item, check for child property sets"); nChilds = psInstance.GetChildCount(); for (j = 0; j < nChilds; j++) { if (this.ProcessBarringRequestForProdu

Barring Request Processing Service AIP SCM
ProcessBarringRequestForProduct
function ProcessBarringRequestForProduct(psInstance, iLvl) { /************************************************************************************************** * Function: ProcessBarringRequestForProduct in BusService "Barring Request Processing Service AIP SCM"* * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Recursive function to inactivate/activate barring sets for given product located at * * root position of psInstance property set and updates the action code of the parent * * product of the barring set. Function is called on all child property sets/products * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * **************************************************************************************************/ // declarations var sPropName, sPropType; var bBarrUpdated = false; var bSyncNeeded = false; var sPropValue; var i = 0; var j = 0; var nChilds = 0; try { sPropName = psInstance.GetFirstProperty(); sPropType = psInstance.GetType(); // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: START"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Check Property Set"); // only process current property set if it is of type "Line Item" // else check if child property set exists and start processing for it if (sPropType == "Line Item") { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Start processing Line Item"); // get information from current level of property set while(sPropName != "") { // look for integration id (= parent path) sPropValue = psInstance.GetProperty(sPropName); if(sPropName == "Product Id" || sPropName == "Name" || sPropName == "Service Type" || sPropName == "Integration Id") { this.aCurrProduct[sPropName] = sPropValue; if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Level: '" + iLvl + "',Property: '" + sPropName + "' = '" + this.aCurrProduct[sPropName] + "'"); } sPropName = psInstance.GetNextProperty(); } // inactivate barring sets in case current product is a barring set // requested barring level is global variable and set in function ProcessBarringRequest if(this.aCurrProduct["Service Type"] == "Barring Set") { // do not deactivate in case barring set is agent enabled if(this.InactivateBarringSets(psInstance, iReqBarrLvl)) bBarrUpdated = true; } // activate barring sets // requested barring level is global variable and set in function ProcessBarringRequest if(this.ActivateBarringSets(iReqBarrLvl, this.aCurrProduct["Product Id"], psInstance)) bBarrUpdated = true; // set sync if update has taken place if (bBarrUpdated) bSyncNeeded = true; // call ProcessBarringRequestForProduct function for all child property sets nChilds = psInstance.GetChildCount(); for(i = 0; i < nChilds; i++) { // set bBarrUpdated to true in case one update has taken place in child property set if(this.ProcessBarringRequestForProduct(psInstance.GetChild(i), iLvl + 1)) bSyncNeeded = true; } } // end if type = "Line Item" else { // type other than line item, check child property sets if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> ProcessBarringRequestForProduct: Property set not of type Line Item, check for child property sets"); nChilds = psInstance.GetChildCount(); for (j = 0; j < nChilds; j++) { if (this.ProcessBarringRequestForProdu

Barring Request Processing Service AIP SCM
SaveCfgSession
function SaveCfgSession(sRootId) { /************************************************************************************************** * Function: SaveCfgSession in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Saves the configurator instance back to the database * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2014-09-09 - TGDFIMA9 - Added Delta Calculation before Sync Instance * **************************************************************************************************/ try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SaveCfgSession: START"); var oCurrentConfig; var psInputsInstance:PropertySet; var psOutputsInstance:PropertySet; var psOutputsCurrentConfig:PropertySet; var oSyncWF; var psInputsSyncWF:PropertySet; var psOutputsSyncWF:PropertySet; this.psIn.Reset(); this.psOut.Reset(); psInputsInstance = this.oApp.NewPropertySet(); psOutputsInstance = this.oApp.NewPropertySet(); psOutputsCurrentConfig = this.oApp.NewPropertySet(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> HeaderId:" + sHeaderId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> RootItemId:" + sRootId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> RootAssetIntegrationId:" + this.aCurrProduct["RootAssetIntegrationId"]); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Get CurrentInstance: Start"); //Get Current Config-Instance oCurrentConfig=this.oApp.GetService("FE Configurator API SCM"); psInputsInstance.SetProperty("Root Quote Item Id",sRootId); psInputsInstance.SetProperty("Quote Id",sHeaderId); oCurrentConfig.InvokeMethod("Get Instance",psInputsInstance,psOutputsInstance); psOutputsCurrentConfig = psOutputsInstance.GetChild("Instance"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Get Current Instance: End"); //try to call auto order entry wf directly if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Calling Delta/Sync WF: Start"); oSyncWF = this.oApp.GetService("Workflow Process Manager"); psInputsSyncWF = this.oApp.NewPropertySet(); psOutputsSyncWF = this.oApp.NewPropertySet(); psInputsSyncWF.SetProperty("ProcessName","Auto Order Entry - ABO Synchronize Configurator Session WF SCM"); psInputsSyncWF.SetProperty("Object Id",sHeaderId); //Quote Header Id psInputsSyncWF.SetProperty("Root Line Item Id", sRootId); //QLI of Bundle Product current in process psInputsSyncWF.SetProperty("Root Asset Integration Id", this.aCurrProduct["RootAssetIntegrationId"]); //Asset Integration Id of Bundle Component current in process psOutputsCurrentConfig.SetType("Quote Line Item"); psInputsSyncWF.AddChild(psOutputsCurrentConfig); psInputsSyncWF.SetProperty("Generate AssetIntegId Flag", "Y"); oSyncWF.InvokeMethod("RunProcess",psInputsSyncWF,psOutputsSyncWF); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Calling Delta/Sync WF: End"); /* this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("ObjId" , sHeaderId); this.psIn.SetProperty("RootId" , sRootId); this.bsRCOIS.InvokeMethod("SyncInstance", this.psIn, this.psOut); */ if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SaveCfgSession: END"); } catch(e) { var sError = e.toString(); if (this.bIsT

Barring Request Processing Service AIP SCM
SaveCfgSession
function SaveCfgSession(sRootId) { /************************************************************************************************** * Function: SaveCfgSession in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : Saves the configurator instance back to the database * * * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-04 - TGDDERO7 - Oracle/Siebel Code Review * * Update : 2014-09-09 - TGDFIMA9 - Added Delta Calculation before Sync Instance * **************************************************************************************************/ try { // error handling/trace setup if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SaveCfgSession: START"); var oCurrentConfig; var psInputsInstance:PropertySet; var psOutputsInstance:PropertySet; var psOutputsCurrentConfig:PropertySet; var oSyncWF; var psInputsSyncWF:PropertySet; var psOutputsSyncWF:PropertySet; this.psIn.Reset(); this.psOut.Reset(); psInputsInstance = this.oApp.NewPropertySet(); psOutputsInstance = this.oApp.NewPropertySet(); psOutputsCurrentConfig = this.oApp.NewPropertySet(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> HeaderId:" + sHeaderId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> RootItemId:" + sRootId); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> RootAssetIntegrationId:" + this.aCurrProduct["RootAssetIntegrationId"]); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Get CurrentInstance: Start"); //Get Current Config-Instance oCurrentConfig=this.oApp.GetService("FE Configurator API SCM"); psInputsInstance.SetProperty("Root Quote Item Id",sRootId); psInputsInstance.SetProperty("Quote Id",sHeaderId); oCurrentConfig.InvokeMethod("Get Instance",psInputsInstance,psOutputsInstance); psOutputsCurrentConfig = psOutputsInstance.GetChild("Instance"); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Get Current Instance: End"); //try to call auto order entry wf directly if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Calling Delta/Sync WF: Start"); oSyncWF = this.oApp.GetService("Workflow Process Manager"); psInputsSyncWF = this.oApp.NewPropertySet(); psOutputsSyncWF = this.oApp.NewPropertySet(); psInputsSyncWF.SetProperty("ProcessName","Auto Order Entry - ABO Synchronize Configurator Session WF SCM"); psInputsSyncWF.SetProperty("Object Id",sHeaderId); //Quote Header Id psInputsSyncWF.SetProperty("Root Line Item Id", sRootId); //QLI of Bundle Product current in process psInputsSyncWF.SetProperty("Root Asset Integration Id", this.aCurrProduct["RootAssetIntegrationId"]); //Asset Integration Id of Bundle Component current in process psOutputsCurrentConfig.SetType("Quote Line Item"); psInputsSyncWF.AddChild(psOutputsCurrentConfig); psInputsSyncWF.SetProperty("Generate AssetIntegId Flag", "Y"); oSyncWF.InvokeMethod("RunProcess",psInputsSyncWF,psOutputsSyncWF); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> Calling Delta/Sync WF: End"); /* this.psIn.SetProperty("IntObjName", "7.7 Quote Integration Object"); this.psIn.SetProperty("ObjId" , sHeaderId); this.psIn.SetProperty("RootId" , sRootId); this.bsRCOIS.InvokeMethod("SyncInstance", this.psIn, this.psOut); */ if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SaveCfgSession: END"); } catch(e) { var sError = e.toString(); if (this.bIsT

Barring Request Processing Service AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : - Activation/deactivation of barring sets for a given bundle based on the barring * * level * * of the barring request * * - Query for open processes for quotes and orders for given bundle and account * * - Creates a disconnect quote * * - Creates a modification quote * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-01 - TGDDERO7 - Incorporated Siebel Code Review Points * * Update : 2012-07-24 - TGDBIIN1 - Oct12: added object instantiations (Manual Barring) * **************************************************************************************************/ var iReturn = CancelOperation; try { if (!this.oApp) this.oApp = TheApplication(); this.bIsTraceOn = this.oApp.isTraceON; if (!this.bsRCOIS) this.bsRCOIS = this.oApp.GetService("Remote Complex Object Instance Service"); if (!this.bsISS) this.bsISS = this.oApp.GetService("ISS Copy Service"); if (!this.bsAIPProdUtils) this.bsAIPProdUtils = this.oApp.GetService("Product Utilities AIP SCM"); // 2012-07-23 TGDBIIN1 Oct12: instance of eCfg API-BS, used in function "ActivateBarringSets": if (!this.bsCfgAPI) this.bsCfgAPI = this.oApp.GetService("FE Configurator API SCM"); if (!this.psIn) this.psIn = this.oApp.NewPropertySet(); if (!this.psOut) this.psOut = this.oApp.NewPropertySet(); // 2012-07-23 TGDBIIN1 Oct12: three new propertysets for bsCfgAPI in function "ActivateBarringSets": if (!this.psInAttr) this.psInAttr = this.oApp.NewPropertySet(); if (!this.psOutAttr) this.psOutAttr = this.oApp.NewPropertySet(); if (!this.psAddItemOut) this.psAddItemOut = this.oApp.NewPropertySet(); // 2014-05-01 TGDBIIN1 May14: three new propertysets for bsCfgAPI in function "SetBarringQLIAttributes": if (!this.psInQLI) this.psInQLI = this.oApp.NewPropertySet(); if (!this.psOutQLI) this.psOutQLI = this.oApp.NewPropertySet(); if (!this.aCurrProduct) this.aCurrProduct = new Array(); // stores the attributes for the product currently under investigation if (!this.aBarringSets) this.aBarringSets = new Array(); // stores all available barring sets switch (MethodName) { case "ProcessBarringSets": ProcessBarringRequest(Inputs, Outputs); break; case "OpenQuotesOrOrdersExist": IdentifyOpenQuotesAndOrders(Inputs, Outputs); break; case "CreateDisconnectQuote": CreateDisconnectQuote(Inputs, Outputs); break; case "CreateModificationQuote": CreateModificationQuote(Inputs, Outputs); break; default: iReturn = ContinueOperation; break; } } catch(e) { // throw the error message back to the WF throw(e); } finally { this.aCurrProduct = null; this.aBarringSets = null; this.bsRCOIS = null; this.bsCfgAPI = null; this.bsISS = null; this.bsAIPProdUtils = null; this.psIn = null; this.psOut = null; this.psInAttr = null; this.psOutAttr = null; this.psAddItemOut = null; this.psInQLI = null; this.psOutQLI = null; this.oApp = 0; this.oApp = null; } return (iReturn); }

Barring Request Processing Service AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /************************************************************************************************** * Function: Service_PreInvokeMethod in BusService "Barring Request Processing Service AIP SCM" * * Author : Jochen Greulich (TGDGRJO7) * * Purpose : - Activation/deactivation of barring sets for a given bundle based on the barring * * level * * of the barring request * * - Query for open processes for quotes and orders for given bundle and account * * - Creates a disconnect quote * * - Creates a modification quote * * Date : 2011-02-02 * *-------------------------------------------------------------------------------------------------* * Update : 2011-02-02 - TGDGRJO7 - created * * Update : 2011-04-01 - TGDDERO7 - Incorporated Siebel Code Review Points * * Update : 2012-07-24 - TGDBIIN1 - Oct12: added object instantiations (Manual Barring) * **************************************************************************************************/ var iReturn = CancelOperation; try { if (!this.oApp) this.oApp = TheApplication(); this.bIsTraceOn = this.oApp.isTraceON; if (!this.bsRCOIS) this.bsRCOIS = this.oApp.GetService("Remote Complex Object Instance Service"); if (!this.bsISS) this.bsISS = this.oApp.GetService("ISS Copy Service"); if (!this.bsAIPProdUtils) this.bsAIPProdUtils = this.oApp.GetService("Product Utilities AIP SCM"); // 2012-07-23 TGDBIIN1 Oct12: instance of eCfg API-BS, used in function "ActivateBarringSets": if (!this.bsCfgAPI) this.bsCfgAPI = this.oApp.GetService("FE Configurator API SCM"); if (!this.psIn) this.psIn = this.oApp.NewPropertySet(); if (!this.psOut) this.psOut = this.oApp.NewPropertySet(); // 2012-07-23 TGDBIIN1 Oct12: three new propertysets for bsCfgAPI in function "ActivateBarringSets": if (!this.psInAttr) this.psInAttr = this.oApp.NewPropertySet(); if (!this.psOutAttr) this.psOutAttr = this.oApp.NewPropertySet(); if (!this.psAddItemOut) this.psAddItemOut = this.oApp.NewPropertySet(); // 2014-05-01 TGDBIIN1 May14: three new propertysets for bsCfgAPI in function "SetBarringQLIAttributes": if (!this.psInQLI) this.psInQLI = this.oApp.NewPropertySet(); if (!this.psOutQLI) this.psOutQLI = this.oApp.NewPropertySet(); if (!this.aCurrProduct) this.aCurrProduct = new Array(); // stores the attributes for the product currently under investigation if (!this.aBarringSets) this.aBarringSets = new Array(); // stores all available barring sets switch (MethodName) { case "ProcessBarringSets": ProcessBarringRequest(Inputs, Outputs); break; case "OpenQuotesOrOrdersExist": IdentifyOpenQuotesAndOrders(Inputs, Outputs); break; case "CreateDisconnectQuote": CreateDisconnectQuote(Inputs, Outputs); break; case "CreateModificationQuote": CreateModificationQuote(Inputs, Outputs); break; default: iReturn = ContinueOperation; break; } } catch(e) { // throw the error message back to the WF throw(e); } finally { this.aCurrProduct = null; this.aBarringSets = null; this.bsRCOIS = null; this.bsCfgAPI = null; this.bsISS = null; this.bsAIPProdUtils = null; this.psIn = null; this.psOut = null; this.psInAttr = null; this.psOutAttr = null; this.psAddItemOut = null; this.psInQLI = null; this.psOutQLI = null; this.oApp = 0; this.oApp = null; } return (iReturn); }

Barring Request Processing Service AIP SCM
SetBarringQLIAttribute
function SetBarringQLIAttribute(sFieldName, sFieldValue, sItemIntId, sRootItemId) { /************************************************************************************************** * Function: SetBarringQLIAttribute in BusService "Barring Request Processing Service AIP SCM" * * Author : Ingo Bischel (TGDBIIN1) * * Purpose : Set Field value of a Barring Set QLI in accordance to the Barring Request issued * * (defect #83714) * * Date : 2014-05-01 * *-------------------------------------------------------------------------------------------------* * Update : 2014-05-01 - TGDBIIN1 - created * **************************************************************************************************/ try { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute: Start"); this.psInQLI.Reset(); this.psOutQLI.Reset(); this.psAddItemOut = this.psOut; this.psAddItemOut.SetType("Instance"); this.psInQLI.AddChild(this.psAddItemOut); this.psInQLI.SetProperty("Path", sItemIntId); this.psInQLI.SetProperty("Value", sFieldValue); this.psInQLI.SetProperty("FieldName", sFieldName); this.psInQLI.SetProperty("ObjId", sHeaderId); this.psInQLI.SetProperty("RootId", sRootItemId); //tracePropertySet(psInQLI,"psInQLI: ",0); this.bsRCOIS.InvokeMethod("SetFieldValue", this.psInQLI, this.psOutQLI); //tracePropertySet(psOutQLI,"psOutQLI: ",0); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute: End"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
SetBarringQLIAttribute
function SetBarringQLIAttribute(sFieldName, sFieldValue, sItemIntId, sRootItemId) { /************************************************************************************************** * Function: SetBarringQLIAttribute in BusService "Barring Request Processing Service AIP SCM" * * Author : Ingo Bischel (TGDBIIN1) * * Purpose : Set Field value of a Barring Set QLI in accordance to the Barring Request issued * * (defect #83714) * * Date : 2014-05-01 * *-------------------------------------------------------------------------------------------------* * Update : 2014-05-01 - TGDBIIN1 - created * **************************************************************************************************/ try { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute: Start"); this.psInQLI.Reset(); this.psOutQLI.Reset(); this.psAddItemOut = this.psOut; this.psAddItemOut.SetType("Instance"); this.psInQLI.AddChild(this.psAddItemOut); this.psInQLI.SetProperty("Path", sItemIntId); this.psInQLI.SetProperty("Value", sFieldValue); this.psInQLI.SetProperty("FieldName", sFieldName); this.psInQLI.SetProperty("ObjId", sHeaderId); this.psInQLI.SetProperty("RootId", sRootItemId); //tracePropertySet(psInQLI,"psInQLI: ",0); this.bsRCOIS.InvokeMethod("SetFieldValue", this.psInQLI, this.psOutQLI); //tracePropertySet(psOutQLI,"psOutQLI: ",0); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute: End"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringQLIAttribute Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
SetBarringTypeXA
function SetBarringTypeXA() { /************************************************************************************************** * Function: SetBarringTypeXA in BusService "Barring Request Processing Service AIP SCM" * * Author : Ingo Bischel (TGDBIIN1) * * Purpose : Set XA Attributes of a Barring Set QLI in accordance to the Barring Type issued * * (defect #83714) * * Date : 2014-05-01 * *-------------------------------------------------------------------------------------------------* * Update : 2014-05-01 - TGDBIIN1 - created * **************************************************************************************************/ var sXAName; var sAddItemOutIntId; var sXAId; try { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: Start"); this.psInAttr.Reset(); this.psOutAttr.Reset(); this.psAddItemOut = this.psOut; this.psAddItemOut.SetType("Instance"); // tracePropertySet(psAddItemOut,"psAddItemOut: ",0); // resolve XA name: if (sBarringType == "ProcessCreditLimitBarring") { sXAName = "BarringSetCreditLimit"; } else if (sBarringType == "ProcessDunningBarringRequest") { sXAName = "BarringSetDunning"; } else { sXAName = "INVALIDBARRINGTYPE"; } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: Name of Barring Set XA resolved to: '"+sXAName+"'"); // first call "Get Attribute" of bsCfgAPI to get values for "XA Id" and "Property Type Code"...: this.psInAttr.SetProperty("Attribute Name", sXAName); sAddItemOutIntId = this.psOut.GetProperty("Integration Id1"); this.psInAttr.SetProperty("Attribute Parent Int Id", sAddItemOutIntId); this.psInAttr.AddChild(this.psAddItemOut); // tracePropertySet(psInAttr,"psInAttr: ",0); this.bsCfgAPI.InvokeMethod("Get Attribute", this.psInAttr, this.psOutAttr); // tracePropertySet(psOutAttr,"psOutAttr: ",0); // ¨...then call RCOIS, method "SetAttribute" to set BarringSetCreditLimit or BarringSetDunning to 'Bar', but only if "XA Id" is not NULL: sXAId = this.psOutAttr.GetProperty("XA Id"); if (sXAId != "") { this.psInAttr.Reset(); this.psInAttr.SetProperty("ObjId", this.aCurrProduct["ObjId"]); this.psInAttr.SetProperty("RootId", this.aCurrProduct["RootId"]); this.psInAttr.SetProperty("Path", sAddItemOutIntId); this.psInAttr.SetProperty("Value", "Bar"); this.psInAttr.SetProperty("Name", sXAName); this.psInAttr.SetProperty("XA Id", sXAId); this.psInAttr.SetProperty("Property Type Code", this.psOutAttr.GetProperty("Property Type")); this.bsRCOIS.InvokeMethod("SetAttribute", this.psInAttr, this.psOutAttr); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: BarringType XA '"+sXAName+"' set to value 'Bar'"); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: End"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
SetBarringTypeXA
function SetBarringTypeXA() { /************************************************************************************************** * Function: SetBarringTypeXA in BusService "Barring Request Processing Service AIP SCM" * * Author : Ingo Bischel (TGDBIIN1) * * Purpose : Set XA Attributes of a Barring Set QLI in accordance to the Barring Type issued * * (defect #83714) * * Date : 2014-05-01 * *-------------------------------------------------------------------------------------------------* * Update : 2014-05-01 - TGDBIIN1 - created * **************************************************************************************************/ var sXAName; var sAddItemOutIntId; var sXAId; try { if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: Start"); this.psInAttr.Reset(); this.psOutAttr.Reset(); this.psAddItemOut = this.psOut; this.psAddItemOut.SetType("Instance"); // tracePropertySet(psAddItemOut,"psAddItemOut: ",0); // resolve XA name: if (sBarringType == "ProcessCreditLimitBarring") { sXAName = "BarringSetCreditLimit"; } else if (sBarringType == "ProcessDunningBarringRequest") { sXAName = "BarringSetDunning"; } else { sXAName = "INVALIDBARRINGTYPE"; } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: Name of Barring Set XA resolved to: '"+sXAName+"'"); // first call "Get Attribute" of bsCfgAPI to get values for "XA Id" and "Property Type Code"...: this.psInAttr.SetProperty("Attribute Name", sXAName); sAddItemOutIntId = this.psOut.GetProperty("Integration Id1"); this.psInAttr.SetProperty("Attribute Parent Int Id", sAddItemOutIntId); this.psInAttr.AddChild(this.psAddItemOut); // tracePropertySet(psInAttr,"psInAttr: ",0); this.bsCfgAPI.InvokeMethod("Get Attribute", this.psInAttr, this.psOutAttr); // tracePropertySet(psOutAttr,"psOutAttr: ",0); // ¨...then call RCOIS, method "SetAttribute" to set BarringSetCreditLimit or BarringSetDunning to 'Bar', but only if "XA Id" is not NULL: sXAId = this.psOutAttr.GetProperty("XA Id"); if (sXAId != "") { this.psInAttr.Reset(); this.psInAttr.SetProperty("ObjId", this.aCurrProduct["ObjId"]); this.psInAttr.SetProperty("RootId", this.aCurrProduct["RootId"]); this.psInAttr.SetProperty("Path", sAddItemOutIntId); this.psInAttr.SetProperty("Value", "Bar"); this.psInAttr.SetProperty("Name", sXAName); this.psInAttr.SetProperty("XA Id", sXAId); this.psInAttr.SetProperty("Property Type Code", this.psOutAttr.GetProperty("Property Type")); this.bsRCOIS.InvokeMethod("SetAttribute", this.psInAttr, this.psOutAttr); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: BarringType XA '"+sXAName+"' set to value 'Bar'"); } if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA: End"); } catch(e) { var sError = e.toString(); if (this.bIsTraceOn) this.oApp.Trace(this.Name()+" -> SetBarringTypeXA Error: "+sError); throw(e); } finally { // clean up } }

Barring Request Processing Service AIP SCM
tracePropertySet
function tracePropertySet (psInputs:PropertySet, sComment, iLayer) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // tracePropertySet // Input: Property Set, Comment, Layer // Output: none // Trigger: diverse functions of the bs could use this function // Date: February, 2nd 2011 // Author: Dennis Kiolbassa // Project: OneCRM R4 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (this.bIsTraceOn) this.oApp.Trace("Barring Request Processing Service AIP SCM: tracePropertySet: Start: "+sComment); var propName; var propVal; var propCount; var sSpace =""; for (var l = 0; l < iLayer; l++) sSpace += "\t"; try { if (this.bIsTraceOn) this.oApp.Trace(sSpace+"Start: "+psInputs.GetType()); propCount = psInputs.GetPropertyCount(); if (propCount > 0) { propName = psInputs.GetFirstProperty(); while (propName != null && propName != "") { propVal = psInputs.GetProperty(propName); if (this.bIsTraceOn) this.oApp.Trace(sSpace+" Property: "+propName+" ==> "+propVal); propName = psInputs.GetNextProperty(); } } if (this.bIsTraceOn) this.oApp.Trace(sSpace+"End: "+psInputs.GetType()); if(psInputs.GetChildCount() > 0) { iLayer++; for (var counter = 0; counter < psInputs.GetChildCount(); counter++) { tracePropertySet(psInputs.GetChild(counter), sSpace+"----- next Child: "+iLayer+" -----", iLayer); }//for }//if if (this.bIsTraceOn) this.oApp.Trace(sComment+" #End#"); }//try catch(e) { if (this.bIsTraceOn) this.oApp.Trace("Barring Request Processing Service AIP SCM: Property Trace END WITH ERROR: "+e.toString()); throw(e); } }

Barring Request Processing Service AIP SCM
tracePropertySet
function tracePropertySet (psInputs:PropertySet, sComment, iLayer) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // tracePropertySet // Input: Property Set, Comment, Layer // Output: none // Trigger: diverse functions of the bs could use this function // Date: February, 2nd 2011 // Author: Dennis Kiolbassa // Project: OneCRM R4 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (this.bIsTraceOn) this.oApp.Trace("Barring Request Processing Service AIP SCM: tracePropertySet: Start: "+sComment); var propName; var propVal; var propCount; var sSpace =""; for (var l = 0; l < iLayer; l++) sSpace += "\t"; try { if (this.bIsTraceOn) this.oApp.Trace(sSpace+"Start: "+psInputs.GetType()); propCount = psInputs.GetPropertyCount(); if (propCount > 0) { propName = psInputs.GetFirstProperty(); while (propName != null && propName != "") { propVal = psInputs.GetProperty(propName); if (this.bIsTraceOn) this.oApp.Trace(sSpace+" Property: "+propName+" ==> "+propVal); propName = psInputs.GetNextProperty(); } } if (this.bIsTraceOn) this.oApp.Trace(sSpace+"End: "+psInputs.GetType()); if(psInputs.GetChildCount() > 0) { iLayer++; for (var counter = 0; counter < psInputs.GetChildCount(); counter++) { tracePropertySet(psInputs.GetChild(counter), sSpace+"----- next Child: "+iLayer+" -----", iLayer); }//for }//if if (this.bIsTraceOn) this.oApp.Trace(sComment+" #End#"); }//try catch(e) { if (this.bIsTraceOn) this.oApp.Trace("Barring Request Processing Service AIP SCM: Property Trace END WITH ERROR: "+e.toString()); throw(e); } }

Batch Export Custom Objects SCM
(declarations)
var oApp; var sLogFile = ""; var bIsTraceOn; var sLogin;

Batch Export Custom Objects SCM
(declarations)
var oApp; var sLogFile = ""; var bIsTraceOn; var sLogin;

Batch Export Custom Objects SCM
AddToWorkspace
function AddToWorkspace(Inputs, Outputs) { var vBO:BusObject = oApp.GetBusObject("Admin ISS Joint Workspace Definition"); var vWorkSpaceBC:BusComp = vBO.GetBusComp("ISS Joint Workspace BusComp"); var vWorkObjBC:BusComp = vBO.GetBusComp("ISS Joint Workspace Object BusComp"); var vWorkDeltaBC:BusComp = vBO.GetBusComp("Delta JWS Items SCM"); var cWorkspaceId:chars = ""; var cVODId:chars = ""; var cObjectName:chars = ""; var cObjectType:chars = ""; var cAdditionalParam:chars = ""; var cDeltaSearchSpec:chars = ""; var bRecordFound = false; try { cWorkspaceId = oApp.GetProfileAttr("Active JWS Id"); cVODId = Inputs.GetProperty("VOD Id"); cObjectName = Inputs.GetProperty("ObjectName"); cObjectType = Inputs.GetProperty("ObjectType"); cAdditionalParam=Inputs.GetProperty("AdditionalParam"); cDeltaSearchSpec = "[Object Name SCM] = '"+cObjectName+"' AND [Obj Type SCM] = '"+cObjectType+"'"; if(cAdditionalParam != "") cDeltaSearchSpec = cDeltaSearchSpec + " AND [Additional Search Spec] = '"+cAdditionalParam+"'"; if(cWorkspaceId != "") { vWorkSpaceBC.SetViewMode(AllView); vWorkSpaceBC.ActivateField("Name"); vWorkSpaceBC.ClearToQuery(); vWorkSpaceBC.SetSearchExpr("[Id] = '"+cWorkspaceId+"'"); //Activating VOD Object Fields vWorkObjBC.ActivateField("VOD Type"); vWorkObjBC.SetSearchExpr("[VOD Id] = '"+cVODId+"'"); vWorkDeltaBC.SetSearchExpr(cDeltaSearchSpec); vWorkSpaceBC.ExecuteQuery(ForwardOnly); if(vWorkSpaceBC.FirstRecord()) { if(vWorkObjBC.FirstRecord()) { with(vWorkDeltaBC) { if(!FirstRecord()) { NewRecord(NewAfter); SetFieldValue("Object Name SCM", cObjectName); SetFieldValue("Obj Type SCM", cObjectType); if(cAdditionalParam != "") SetFieldValue("Additional Search Spec", cAdditionalParam); WriteRecord(); } } }//end if(vWorkObjBC.FirstRecord()) else TheApplication().RaiseErrorText("Please add the VOD Object in your active workspace"); }//end if(vWorkSpaceBC.FirstRecord()) }//end if(cWorkspaceId != "") else TheApplication().RaiseErrorText("No active workspace found"); }//end try finally { vWorkDeltaBC = null; vWorkObjBC = null; vWorkSpaceBC = null; vBO = null; } }

Batch Export Custom Objects SCM
ApplyLog
function ApplyLog(Inputs) { /************************************************************************************************** * Function: ApplyLog * * Author : Nishant Singhal (TAASINI2) * * Purpose : To parse the RS and write the log into the log file * * Date : 2016-04-14 * **************************************************************************************************/ try { var nChildren = 0; var psRowSet; var psRow; var sType; var iCount = 0; var sProductLine = ""; var sProductLineId = ""; var sProdId = ""; var sProdName = ""; var sOpr = ""; var sTempString = ""; var sPropval = ""; var iRowPropCount = 0; var sPropName = ""; var psRowName = ""; var psRowNameOLD = ""; if(Inputs.GetChildCount() > 0) { sTempString = "Write Imported Data:\n"; psRowSet = Inputs.GetChild(0); sType = psRowSet.GetType(); nChildren = psRowSet.GetChildCount(); for (iCount = 0; iCount < nChildren; iCount++) { psRow = psRowSet.GetChild(iCount); psRowName = psRow.GetType(); iRowPropCount = psRow.GetPropertyCount(); if(iRowPropCount > 0) { sPropName = psRow.GetFirstProperty(); if(psRowName != psRowNameOLD) sTempString = sTempString + "\nPS_TYPE;"; sPropval = psRowName+";"; while(sPropName != "" && sPropName != null) { if(psRowName != psRowNameOLD) { sTempString = sTempString + sPropName+";"; sPropval = sPropval+psRow.GetProperty(sPropName)+";"; } else sPropval = sPropval+psRow.GetProperty(sPropName)+";"; sPropName = psRow.GetNextProperty(); }//end while block }//end if(iRowPropCount > 0) psRowNameOLD = psRowName; sTempString = sTempString+"\n"+sPropval; sPropval = ""; } // end for child in psRowSet Write2Log(sTempString); } // end if (Inputs.GetChildCount() > 0) }//End try finally { psRow = null; psRowSet = null; } }

Batch Export Custom Objects SCM
ApplyLog
function ApplyLog(Inputs) { /************************************************************************************************** * Function: ApplyLog * * Author : Nishant Singhal (TAASINI2) * * Purpose : To parse the RS and write the log into the log file * * Date : 2016-04-14 * **************************************************************************************************/ try { var nChildren = 0; var psRowSet; var psRow; var sType; var iCount = 0; var sProductLine = ""; var sProductLineId = ""; var sProdId = ""; var sProdName = ""; var sOpr = ""; var sTempString = ""; var sPropval = ""; var iRowPropCount = 0; var sPropName = ""; var psRowName = ""; var psRowNameOLD = ""; if(Inputs.GetChildCount() > 0) { sTempString = "Write Imported Data:\n"; psRowSet = Inputs.GetChild(0); sType = psRowSet.GetType(); nChildren = psRowSet.GetChildCount(); for (iCount = 0; iCount < nChildren; iCount++) { psRow = psRowSet.GetChild(iCount); psRowName = psRow.GetType(); iRowPropCount = psRow.GetPropertyCount(); if(iRowPropCount > 0) { sPropName = psRow.GetFirstProperty(); if(psRowName != psRowNameOLD) sTempString = sTempString + "\nPS_TYPE;"; sPropval = psRowName+";"; while(sPropName != "" && sPropName != null) { if(psRowName != psRowNameOLD) { sTempString = sTempString + sPropName+";"; sPropval = sPropval+psRow.GetProperty(sPropName)+";"; } else sPropval = sPropval+psRow.GetProperty(sPropName)+";"; sPropName = psRow.GetNextProperty(); }//end while block }//end if(iRowPropCount > 0) psRowNameOLD = psRowName; sTempString = sTempString+"\n"+sPropval; sPropval = ""; } // end for child in psRowSet Write2Log(sTempString); } // end if (Inputs.GetChildCount() > 0) }//End try finally { psRow = null; psRowSet = null; } }

Batch Export Custom Objects SCM
ApplyUpdateLog
function ApplyUpdateLog(Inputs) { /************************************************************************************************** * Function: ApplyLog * * Author : Nishant Singhal (TAASINI2) * * Purpose : To parse the RS and write the log into the log file * * Date : 2016-04-14 * **************************************************************************************************/ try { var vBO:BusObject = oApp.GetBusObject("ISS Promotion XA Update SCM"); var vBC:BusComp = vBO.GetBusComp("ISS Promotion Items for EAI"); var nChildren = 0; var psRowSet; var psRow; var sType; var iCount = 0; var sProdId = ""; var sProdName = ""; var sPath = ""; var sOpr; var sTempString = ""; var sPropval = ""; var iRowPropCount = 0; var sPropName = ""; var bRecFound = false; var sIntId = ""; var sOldIntId = ""; var cSearchSpec:chars; if(Inputs.GetChildCount() > 0) { sTempString = "Write Updated Data:\n"; psRowSet = Inputs.GetChild(0); sType = psRowSet.GetType(); nChildren = psRowSet.GetChildCount(); for (iCount = 0; iCount < nChildren; iCount++) { sOpr = ""; sOldIntId = ""; psRow = psRowSet.GetChild(iCount); sProdId = psRow.GetProperty("Promotion Id"); sProdName = psRow.GetProperty("Promotion Name"); sPath = psRow.GetProperty("Prom Item Path SCM"); sIntId = psRow.GetProperty("Integration Id"); if(sProdId != "" && sPath != "" && sIntId != "") { with(vBC) { cSearchSpec = "[Promotion Id] = '"+sProdId+"' AND [Prom Item Path SCM] = '"+sPath+"'"; SetViewMode(AllView); ActivateField("Integration Id"); ClearToQuery(); SetSearchExpr(cSearchSpec); //TAASINI2: Found special characters in product name. Therefore, Replaced searchspec to SearchExpr. //SetSearchSpec("Promotion Id", sProdId); //SetSearchSpec("Prom Item Path SCM", sPath); ExecuteQuery(ForwardOnly); bRecFound = FirstRecord(); if(bRecFound) { sOldIntId = GetFieldValue("Integration Id"); if(sOldIntId != sIntId) { SetFieldValue("Integration Id", sIntId); WriteRecord(); sOpr = "Update"; } } else sOpr = "NOTFOUND"; }//end with(vBC) if(iCount == 0) { sTempString = sTempString + "Promotion Name,UpdatedPath,Old Integration Id,New IntegrationId,Operation"; if(sOpr != "") sPropval = sPropval+sProdName+","+sPath+","+sOldIntId+","+sIntId+","+sOpr+"\n"; }//end if(iCount == 0) else if(sOpr != "") sPropval = sPropval+sProdName+","+sPath+","+sOldIntId+","+sIntId+","+sOpr+"\n"; }//end if(sProdId != "" && sPath != "" && sIntId != "" } // end for child in psRowSet sTempString = sTempString+"\n"+sPropval; Write2Log(sTempString); } // end if (Inputs.GetChildCount() > 0) }//End try finally { vBC = null; vBO = null; psRow = null; psRowSet = null; } }

Batch Export Custom Objects SCM
ApplyUpdateLog
function ApplyUpdateLog(Inputs) { /************************************************************************************************** * Function: ApplyLog * * Author : Nishant Singhal (TAASINI2) * * Purpose : To parse the RS and write the log into the log file * * Date : 2016-04-14 * **************************************************************************************************/ try { var vBO:BusObject = oApp.GetBusObject("ISS Promotion XA Update SCM"); var vBC:BusComp = vBO.GetBusComp("ISS Promotion Items for EAI"); var nChildren = 0; var psRowSet; var psRow; var sType; var iCount = 0; var sProdId = ""; var sProdName = ""; var sPath = ""; var sOpr; var sTempString = ""; var sPropval = ""; var iRowPropCount = 0; var sPropName = ""; var bRecFound = false; var sIntId = ""; var sOldIntId = ""; if(Inputs.GetChildCount() > 0) { sTempString = "Write Updated Data:\n"; psRowSet = Inputs.GetChild(0); sType = psRowSet.GetType(); nChildren = psRowSet.GetChildCount(); for (iCount = 0; iCount < nChildren; iCount++) { sOpr = ""; sOldIntId = ""; psRow = psRowSet.GetChild(iCount); sProdId = psRow.GetProperty("Promotion Id"); sProdName = psRow.GetProperty("Promotion Name"); sPath = psRow.GetProperty("Prom Item Path SCM"); sIntId = psRow.GetProperty("Integration Id"); if(sProdId != "" && sPath != "" && sIntId != "") { with(vBC) { SetViewMode(AllView); ActivateField("Integration Id"); ClearToQuery(); SetSearchSpec("Promotion Id", sProdId); SetSearchSpec("Prom Item Path SCM", sPath); ExecuteQuery(ForwardOnly); bRecFound = FirstRecord(); if(bRecFound) { sOldIntId = GetFieldValue("Integration Id"); if(sOldIntId != sIntId) { SetFieldValue("Integration Id", sIntId); WriteRecord(); sOpr = "Update"; } } else sOpr = "NOTFOUND"; }//end with(vBC) if(iCount == 0) { sTempString = sTempString + "Promotion Name,UpdatedPath,Old Integration Id,New IntegrationId,Operation"; if(sOpr != "") sPropval = sPropval+sProdName+","+sPath+","+sOldIntId+","+sIntId+","+sOpr+"\n"; }//end if(iCount == 0) else if(sOpr != "") sPropval = sPropval+sProdName+","+sPath+","+sOldIntId+","+sIntId+","+sOpr+"\n"; }//end if(sProdId != "" && sPath != "" && sIntId != "" } // end for child in psRowSet sTempString = sTempString+"\n"+sPropval; Write2Log(sTempString); } // end if (Inputs.GetChildCount() > 0) }//End try finally { vBC = null; vBO = null; psRow = null; psRowSet = null; } }

Batch Export Custom Objects SCM
BatchExportADMProjects
function BatchExportADMProjects(vWorkSpace, vCountRecords) { var fp; var strProject; var strExportDir = oApp.utils.SCM_RetrieveACV("ADM Batch Export Dir"); var strProjectsFile = oApp.utils.SCM_RetrieveACV("ADM Batch Export Project List File"); sLogFile = oApp.utils.SCM_RetrieveACV("ADM Batch Export Log File"); /*if (strExportDir == null || strExportDir == "") strExportDir = "/tmp/";*/ if (strExportDir == null || strExportDir == "") strExportDir = "C:\\Siebel81\\15.0.0.0.0\\Client\\TEMP\\"; if (strProjectsFile == null || strProjectsFile == "") strProjectsFile = strExportDir + "BatchExportADMDataTypes.txt"; if (sLogFile == null || sLogFile == "") sLogFile = strExportDir + "BatchExportADMDataTypes_log.log"; var strADMPrefix = ""; var vADMFilter = ""; Clib.strftime(strADMPrefix, "%Y%m%d_%H%M%S", Clib.localtime(Clib.time())); var bsUDA = oApp.GetService("UDA Service"); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var nCount = 0; var nError = 0; var nSuccess = 0; Write2Log("Starting Batch Export ADM Data Types from List..."); try { fp = Clib.fopen(strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); Write2Log("Exporting ADM Data Type '" + strProject + "'..."); vADMFilter = ""; if(strProject == "Joint Workspace Definition SCM") vADMFilter = "[ISS Joint Workspace BusComp.Name] = '"+vWorkSpace+"'"; if(strProject == "Workspace Product Compatibility SCM") vADMFilter = "[Product Compatibility.Workspace Name] = '"+vWorkSpace+"'"; if(strProject == "Workspace Product Eligibility SCM") vADMFilter = "[Product Eligibility BusComp.Workspace Name] = '"+vWorkSpace+"'"; if(strProject == "Workspace Score Policy SCM") vADMFilter = "[Score Policy Rules Imp Exp SCM.Workspace Name SCM] = '"+vWorkSpace+"'"; psIn.SetProperty("ADMDataType", strProject); psIn.SetProperty("ADMEAIMethod", "Upsert"); psIn.SetProperty("ADMFilter", vADMFilter); psIn.SetProperty("ADMPrefix", vCountRecords); psIn.SetProperty("ADMPath", strExportDir); // psIn.SetProperty("ADMProject", strProject); // not used here try { bsUDA.InvokeMethod("BatchExport", psIn, psOut); } catch (e) { nError++; Write2Log("Error occured exporting ADM Project '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished exporting ADM Project '" + strProject + "' successfully."); } } Write2Log("Finished processing Batch Export of ADM Data Types."); Write2Log("Total number of ADM Data Types: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of ADM Data Types:\n" + e.toString()); } finally { psIn = null; psOut = null; bsUDA = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
BatchExportADMProjects
function BatchExportADMProjects(vWorkSpace, vCountRecords, cIsDebug) { var fp; var strProject; var strExportDir = oApp.utils.SCM_RetrieveACV("ADM Batch Export Dir"); var strProjectsFile = oApp.utils.SCM_RetrieveACV("ADM Batch Export Project List File"); var strImportFileNmae = "CUSTOMJWS_ADM_Files.txt"; var strExportFileName = ""; sLogFile = oApp.utils.SCM_RetrieveACV("ADM Batch Export Log File"); if (strExportDir == null || strExportDir == "") { //TAASINI2: Hard Coded the debug path for now. if(cIsDebug == "Y") strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; else strExportDir = "/tmp/"; } //if (strProjectsFile == null || strProjectsFile == "") //TAASINI2: always overwriting the ACV values for custom JWS. strProjectsFile = strExportDir + "CUSTOMJWSDataTypes.txt"; //if (sLogFile == null || sLogFile == "") sLogFile = strExportDir + "CUSTOMJWSDataTypes.log"; var strADMPrefix = ""; var vADMFilter = ""; Clib.strftime(strADMPrefix, "%Y%m%d_%H%M%S", Clib.localtime(Clib.time())); var bsUDA = oApp.GetService("UDA Service"); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var nCount = 0; var nError = 0; var nSuccess = 0; Write2Log("Starting Batch Export ADM Data Types from List..."); try { fp = Clib.fopen(strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); Write2Log("Exporting ADM Data Type '" + strProject + "'..."); vADMFilter = ""; if(strProject == "Joint Workspace Definition SCM") { vADMFilter = "[ISS Joint Workspace BusComp.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_0_Joint_Workspace_Definition_SCM.xml"; } if(strProject == "Workspace Product Compatibility SCM") { vADMFilter = "[Product Compatibility.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_0_Workspace_Product_Compatibility_SCM.xml"; } if(strProject == "Workspace Product Eligibility SCM") { vADMFilter = "[Product Eligibility BusComp.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_0_Workspace_Product_Eligibility_SCM.xml"; } if(strProject == "Workspace Score Policy SCM") { vADMFilter = "[Score Policy Rules Imp Exp SCM.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_0_Workspace_Score_Policy_SCM.xml"; } psIn.SetProperty("ADMDataType", strProject); psIn.SetProperty("ADMEAIMethod", "Upsert"); psIn.SetProperty("ADMFilter", vADMFilter); psIn.SetProperty("ADMPrefix", vCountRecords); psIn.SetProperty("ADMPath", strExportDir); // psIn.SetProperty("ADMProject", strProject); // not used here try { bsUDA.InvokeMethod("BatchExport", psIn, psOut); LogData(strExportFileName+"\n", strExportDir+strImportFileNmae, "at"); } catch (e) { nError++; Write2Log("Error occured exporting ADM Project '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished exporting ADM Project '" + strProject + "' successfully."); } } Write2Log("Finished processing Batch Export of ADM Data Types."); Write2Log("Total number of ADM Data Types: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of ADM Data Types:\n" + e.toString()); } finally { psIn = null; psOut = null; bsUDA = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
BatchExportCustomDeltaObjects
function BatchExportCustomDeltaObjects(vWorkSpace, vCountRecords, cIsDebug, strExportDir) { var fp; var strProject; var strProjectsFile; var sBSExportXML:Service= oApp.GetService("EAI XML Write to File"); var oDelInp:PropertySet = oApp.NewPropertySet(); var oDelOup:PropertySet = oApp.NewPropertySet(); var oXMLOup:PropertySet = oApp.NewPropertySet(); var strImportFileNmae = "CustomJointWS_ADM_Files.txt"; var strExportFileName = ""; var bsUDA = oApp.GetService("EAI Siebel Adapter"); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var nCount = 0; var nError = 0; var nSuccess = 0; //TAASINI2: always overwriting & hardcoded the values for custom JWS. strProjectsFile = strExportDir + "CustomJointWSDataTypes.txt"; sLogFile = strExportDir + "CustomJointWSDataTypesExport.log"; var strADMPrefix = ""; var vADMFilter = ""; Clib.strftime(strADMPrefix, "%Y%m%d_%H%M%S", Clib.localtime(Clib.time())); Write2Log("Starting Batch Export of custom Delta objects from List for workspace: " +vWorkSpace+"..."); try { fp = Clib.fopen(strProjectsFile,"rt"); if ( fp == null) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else if (vCountRecords == "") Write2Log("Error: Workspace '" + strProjectsFile + "' has not been deployed. Deployed Sequence is null..."); else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); Write2Log("Exporting ADM Data Type '" + strProject + "'..."); vADMFilter = ""; switch(strProject) { case "Joint Workspace Definition SCM": vADMFilter = "[ISS Joint Workspace BusComp.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_Joint_Workspace_Definition_SCM.xml" ; break; case "Product Compatibility SCM": vADMFilter = "[Product Compatibility.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_Workspace_Product_Compatibility_SCM.xml"; break; case "Product Eligibility SCM": vADMFilter = "[Product Eligibility BusComp.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_Workspace_Product_Eligibility_SCM.xml"; break; case "Workspace Score Policy SCM": vADMFilter = "[Score Policy Rules Imp Exp SCM.Workspace Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_Workspace_Score_Policy_SCM.xml"; break; case "Workspace Delta Product Export": vADMFilter = "[Name] = '"+vWorkSpace+"'"; strExportFileName = vCountRecords + "_DeltaWorkspaceSCM.xml"; break; default: break; } psIn.SetProperty("OutputIntObjectName", strProject); psIn.SetProperty("SearchSpec", vADMFilter); try { if(vADMFilter != "") { if(strProject == "Workspace Delta Product Export") { oDelInp.SetProperty("DeploymentFilter", vADMFilter); oDelInp.SetProperty("Debug", cIsDebug); oDelOup = DeltaExport(oDelInp, oDelOup); oDelOup.SetProperty("FileName", strExportDir+strExportFileName); sBSExportXML.InvokeMethod("WritePropSet", oDelOup, oXMLOup); } else { bsUDA.InvokeMethod("Query", psIn, oDelOup); oDelOup.SetProperty("FileName", strExportDir+strExportFileName); sBSExportXML.InvokeMethod("WriteEAIMsg", oDelOup, oXMLOup); } }//end if(vADMFilter != "") LogData(strExportFileName+"\n", strExportDir+strImportFileNmae, "at"); }//end try catch (e) { nError++; Write2Log("Error occured exporting ADM Project '" + strProject + "':\n" + e.toString() ); }//end catch (e) finally { nSuccess++; Write2Log("Finished exporting ADM Project '" + strProject + "' successfully."); oDelOup.Reset(); psIn.Reset(); oXMLOup.Reset(); }//end finally }//end finally Write2Log("Finished p

Batch Export Custom Objects SCM
DeltaExport
function DeltaExport(Inputs, Outputs) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // DeltaExport: // This method will return the Output propertySet which contain the complete XML // Output: Outputs // Trigger: Service_PreInvokeMethod // Date: 03.06.2016 // Author: Nishant Singhal // Project: Import Delta Workspace //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var cDebug:chars = Inputs.GetProperty("Debug"); var cWorkSpaceName:chars = Inputs.GetProperty("DeploymentFilter"); var cAddObjectSet:chars = "N"; var vBO:BusObject = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); var vWorkSpaceBC:BusComp = vBO.GetBusComp("ISS Joint Workspace BusComp"); var vWorkObjBC:BusComp = vBO.GetBusComp("ISS Joint Workspace Object BusComp"); var vWorkDeltaBC:BusComp = vBO.GetBusComp("Delta JWS Items SCM"); var strExportDir = oApp.GetProfileAttr("Path PMC Cascade Log"); var sSearchSpec:chars = ""; var bRecordExist = false; var bDeltaExist = false; var sDeltaObjName:chars = ""; var sDeltaObjType:chars = ""; var sParObjType:chars = ""; var sParObjTypeLIC:chars= ""; var sICName:chars = ""; var sICSeq:chars = ""; var sICField:chars = ""; var VODObjNum:chars = ""; var VODObjName:chars = ""; var cAddSearch:chars = ""; var sVODSearchSpec:chars; var sLatestVersion:chars; var cExportFileName:chars="" var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service = oApp.GetService("EAI XML Write to File"); var pOuWSContent:PropertySet= oApp.NewPropertySet(); var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var Data:PropertySet = oApp.NewPropertySet(); //var psWrapper:PropertySet = oApp.NewPropertySet(); var psObjSet:PropertySet = oApp.NewPropertySet(); var psObjSetObj:PropertySet = oApp.NewPropertySet(); var vJWSName = ""; var vGetTime = Clib.time(); var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } if(sLogFile == "") { sLogFile = strExportDir + "ExportDeltaVOD.log"; cAddObjectSet = "Y"; } Write2Log("Starting Batch Delta VOD from List..."); Write2Log("Warning: All Components exported through this process will be Updated/Inserted into Target Environment..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { Write2Log("Reading the Delta Objects for the Workspace:'" + cWorkSpaceName + "'...."); vWorkSpaceBC.SetViewMode(AllView); vWorkSpaceBC.ActivateField("Name"); vWorkSpaceBC.ClearToQuery(); //vWorkSpaceBC.SetSearchSpec("Name", cWorkSpaceName); vWorkSpaceBC.SetSearchExpr(cWorkSpaceName); //Activating VOD Object Fields vWorkObjBC.ActivateField("VOD Object Number"); vWorkObjBC.ActivateField("VOD Type"); vWorkObjBC.ActivateField("Type CD"); vWorkObjBC.ActivateField("VOD Name"); //Activating Delta Object Fields vWorkDeltaBC.ActivateField("Object Name SCM"); vWorkDeltaBC.ActivateField("Obj Type SCM"); vWorkDeltaBC.ActivateField("IC Name SCM"); vWorkDeltaBC.ActivateField("IC Field SCM"); vWorkDeltaBC.ActivateField("Additional Search Spec"); //Applying the Sort Spec vWorkDeltaBC.SetSortSpec("IC Sequence SCM"); vWorkSpaceBC.ExecuteQuery(ForwardOnly); if(vWorkSpaceBC.FirstRecord()) { vJWSName = vWorkSpaceBC.GetFieldValue("Name"); with(vWorkObjBC) { bRecordExist = FirstRecord(); while(bRecordExist) { sLatestVersion = ""; VODObjNum = GetFieldValue("VOD Object Number"); sParObjType = GetFieldValue("VOD Type"); sParObjTypeLIC=GetFieldValue("Type CD"); VODObjName = GetFieldValue("VOD Name"); sLatestVersion = GetLatestVersionNum(VODObjNum, sParObjType); oApp.SetProfileAttr("VODImpExpSpec", sLatestVersion); nCount++; with(vWorkDeltaBC) { bDeltaExist = FirstRecord(); while(bDeltaExis

Batch Export Custom Objects SCM
DeltaImport
function DeltaImport(Inputs, Outputs) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // DeltaImport: // This method will Import the Delta workspace XML // Output: N/A // Trigger: Service_PreInvokeMethod // Date: 03.06.2016 // Author: Nishant Singhal // Project: Import Delta Workspace //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var cDebug:chars = Inputs.GetProperty("Debug"); var strExportDir = oApp.GetProfileAttr("Path PMC Cascade Log"); var sParObjType:chars = ""; var cVODType:chars = ""; var sICName:chars = ""; var sICSeq:chars = ""; var VODObjNum:chars = ""; var VODName:chars = ""; var sLatestVersion:chars; var cExportFileName:chars="" var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service= oApp.GetService("EAI Data Transformation Engine"); var psOut:PropertySet = oApp.NewPropertySet(); var psIn:PropertySet = oApp.NewPropertySet(); var psInpMsg:PropertySet= oApp.NewPropertySet(); var psData:PropertySet = oApp.NewPropertySet(); var psVRDMsg:PropertySet= oApp.NewPropertySet(); var psEAIOP:PropertySet = oApp.NewPropertySet(); var vJWSName = ""; var nError = 0; var nSuccess = 0; var nChildren = 0; var nLoopCount = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } if(sLogFile == "") sLogFile = strExportDir + "ImportDeltaVOD.log"; Write2Log("Starting Batch Delta VOD load from List..."); Write2Log("Warning: All Components exported through this process will be Updated/Inserted into Target Environment..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+GetSysDate()+"'"); try { Write2Log("Reading the file...."); if(Inputs.GetChildCount() > 0) { // psInpMsg = Inputs.GetChild(0); psData = Inputs.GetChild(0); // if(psInpMsg.GetChildCount() > 0) // { // psData = psInpMsg.GetChild(0); if(psData.PropertyExists("JWSName")) { //TAASINI2: Changed the dynamic name to Static Name. vJWSName = psData.GetProperty("JWSName"); // vJWSName = psData.GetProperty("JWSName")+" "+sLogin+ " " +GetSysDate(); } else vJWSName = "DeltaJWSImport "+sLogin+ " " +GetSysDate(); Write2Log("Workspace: '"+vJWSName+"' will be generated in the target system. Kindly review this JWS"); fnProcessWorkspace(vJWSName, VODName, cVODType); nChildren = psData.GetChildCount(); for (nLoopCount = 0; nLoopCount < nChildren; nLoopCount++) { psVRDMsg = psData.GetChild(nLoopCount); if(psVRDMsg.GetChildCount() > 0) { if(psVRDMsg.GetChild(0).GetChildCount() > 0) { VODObjNum = psVRDMsg.GetChild(0).GetChild(0).GetProperty("VOD Object Num"); sParObjType = psVRDMsg.GetChild(0).GetChild(0).GetProperty("VOD Type"); VODName = psVRDMsg.GetChild(0).GetChild(0).GetProperty("VOD Name"); cVODType = oApp.InvokeMethod("LookupValue", "ISS_VOD_TYPE", sParObjType); }//end if(psVRDMsg.GetChild(0).GetChildCount() > 0) }//end if(psVRDMsg.GetChildCount() > 0) try { sLatestVersion = ToNumber(GetLatestVersionNum(VODObjNum, sParObjType)) + 1; if(ToNumber(sLatestVersion) > 1) { oApp.SetProfileAttr("VODImpExpSpec", "0"); oApp.SetProfileAttr("VODImpExpVersion", sLatestVersion); Write2Log("Upserting VOD '" + VODName + "'.. VOD Type '"+ cVODType+"'.."); psIn.AddChild(psVRDMsg); psIn.SetProperty("MapName", cVODType + " Delta Import SCM"); psIn.SetProperty("Version", sLatestVersion); fnProcessWorkspace(vJWSName, VODName, cVODType); sBSExportXML.InvokeMethod("Execute", psIn, psOut); bsUDA.InvokeMethod("Upsert", psOut, psEAIOP); } else { nError++; nSuccess--; Write2Log("RELEASED_VERSION_NOT_FOUND FOR VOD OBJECT: " + VODName); } } catch (e) { nError++; Write2Log("Error occured during child vord components import:\n" + e.toString() ); } finally { nSucce

Batch Export Custom Objects SCM
ExportBundleComponents
function ExportBundleComponents(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cIntObjNam:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "BundleComponentsExport.txt"; var sImportFile = "BundleComponentsImport.txt"; var cExportFileName = ""; var sSearchSpec:chars = ""; var oStringArray:Array; var vHeaderLine = ""; var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service= oApp.GetService("EAI XML Write to File"); var pOuWSContent = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\15.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "BundleComponentsExportlog.log"; Write2Log("Starting Batch Export Bundle Components from List..."); if(cIntObjNam == "Insert") { vHeaderLine = "InsertRootStructure"; Write2Log("Warning: All Components exported through this process will be inserted into Target Environment..."); } else { vHeaderLine = "UpdateRootStructure"; Write2Log("Warning: Promotion Item Integration Id will be updated into Target Environment..."); } Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { LogData(vHeaderLine+"\n", strExportDir+sImportFile, "wt"); while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); oStringArray = strProject.split("|"); if(oStringArray.length == 3) { if(oStringArray[0] != "" && oStringArray[1] != "" && oStringArray[2] != "") { Write2Log("Exporting bundle(s) '" + oStringArray[0] + "'...with..'" + oStringArray[2] + "'....'" + oStringArray[1] + "'..."); // sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; if(oStringArray[2] == "COMPONENT") sSearchSpec = "(([ISS Promotion.Name] = '"+oStringArray[0]+"') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; if(oStringArray[2] == "AGGREGATE") sSearchSpec = "(([ISS Promotion.Name] = '"+oStringArray[0]+"') AND ([ISS Promotion Items for Import.Product Line] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; psIn.SetProperty("OutputIntObjectName", "ISS Promotion SCM"); psIn.SetProperty("SearchSpec", sSearchSpec); try { UpdateProductPath(oStringArray[0]); bsUDA.InvokeMethod("Query", psIn, psOut); cExportFileName = "SiebelBundle-"+oStringArray[0]+"-"+vHeaderLine+"-"+oStringArray[1]+vGetTime+".xml"; psOut.SetProperty("FileName", strExportDir+cExportFileName); sBSExportXML.InvokeMethod("WriteEAIMsg", psOut, pOuWSContent); LogData(oStringArray[0]+"|"+cExportFileName+"\n", strExportDir+sImportFile, "at"); cExportFileName = ""; psOut.Reset(); pOuWSContent.Reset(); psIn.Reset(); sSearchSpec = ""; } catch (e) { nError++; Write2Log("Error occured exporting Bundle Components '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished exporting Bundle Components '" + strProject + "' successfully."); } } else Write2Log("Error: Promotion Name/Root Components is not provided: '"+strProject+"'"); }

Batch Export Custom Objects SCM
ExportBundleComponents
function ExportBundleComponents(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cIntObjNam:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "BundleComponentsExport.txt"; var sImportFile = "BundleComponentsImport.txt"; var cExportFileName = ""; var sSearchSpec:chars = ""; var oStringArray:Array; var vHeaderLine = ""; var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service= oApp.GetService("EAI XML Write to File"); var pOuWSContent = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "BundleComponentsExportlog.log"; Write2Log("Starting Batch Export Bundle Components from List..."); if(cIntObjNam == "Insert") { vHeaderLine = "InsertRootStructure"; Write2Log("Warning: All Components exported through this process will be inserted into Target Environment..."); } else { vHeaderLine = "UpdateRootStructure"; Write2Log("Warning: Promotion Item Integration Id will be updated into Target Environment..."); } Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { LogData(vHeaderLine+"\n", strExportDir+sImportFile, "wt"); while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); oStringArray = strProject.split("|"); if(oStringArray.length == 3) { if(oStringArray[0] != "" && oStringArray[1] != "" && oStringArray[2] != "") { Write2Log("Exporting bundle(s) '" + oStringArray[0] + "'...with..'" + oStringArray[2] + "'....'" + oStringArray[1] + "'..."); // sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; sSearchSpec = "([ISS Promotion.Name] = 'XXXXXXXX')"; if(oStringArray[2] == "COMPONENT") sSearchSpec = "(([ISS Promotion.Name] = '"+oStringArray[0]+"') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; if(oStringArray[2] == "AGGREGATE") sSearchSpec = "(([ISS Promotion.Name] = '"+oStringArray[0]+"') AND ([ISS Promotion Items for Import.Product Line] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; psIn.SetProperty("OutputIntObjectName", "ISS Promotion SCM"); psIn.SetProperty("SearchSpec", sSearchSpec); try { if(oStringArray[2] != "AGGREGATE" && oStringArray[2] != "COMPONENT") oApp.RaiseErrorText("Wrong input argument (3) Export Type: "+oStringArray[2]); //TAASINI2: Added this if condition to stop exporting Aggregates for Update Process. if(vHeaderLine == "UpdateRootStructure" && oStringArray[2] == "AGGREGATE") oApp.RaiseErrorText("Export ID Correction is not supported with Bundle Aggregates. Please use Export New Components"); UpdateProductPath(oStringArray[0]); bsUDA.InvokeMethod("Query", psIn, psOut); cExportFileName = "SiebelBundle-"+oStringArray[0]+"-"+vHeaderLine+"-"+oStringArray[1]+vGetTime+".xml"; psOut.SetProperty("FileName", strExportDir+cExportFileName); sBSExportXML.InvokeMethod("WriteEAIMsg", psOut, pOuWSContent); LogData(oStringArray[0]+"|"+cExportFileName+"\n", strExportDir+sImportFile, "at"); cExportFileName = "";

Batch Export Custom Objects SCM
ExportClassStructure
function ExportClassStructure(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cIntObjNam:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "ExportClassStructure.txt"; var sImportFile = "ImportClassStructure.txt"; var cExportFileName = ""; var sSearchSpec:chars = ""; var oStringArray:Array; var vHeaderLine = ""; var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service= oApp.GetService("EAI XML Write to File"); var pOuWSContent = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "ExportClassStructure.log"; Write2Log("Starting Batch Export Class Structure from List..."); if(cIntObjNam == "Insert") { vHeaderLine = "InsertClassStructure"; Write2Log("Warning: All Components exported through this process will be inserted into Target Environment..."); } else { vHeaderLine = "UpdateClassStructure"; Write2Log("Warning: Promotion Item Integration Id will be updated into Target Environment..."); } Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { LogData(vHeaderLine+"\n", strExportDir+sImportFile, "wt"); while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); oStringArray = strProject.split("|"); if(oStringArray.length == 2) { if(oStringArray[0] != "" && oStringArray[1] != "") { Write2Log("Exporting class(s) '" + oStringArray[0] + "'...with child relationship '" + oStringArray[1] + "'..."); // sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; sSearchSpec = "([SWI ISS Class Definition BusComp.VOD Name] = '"+oStringArray[0]+"') AND ([SWI ISS Product Structure Admin BusComp.Item Name] = '"+oStringArray[1]+"')"; psIn.SetProperty("OutputIntObjectName", "SWI Admin ISS Product Class Structure"); psIn.SetProperty("SearchSpec", sSearchSpec); try { // UpdateProductPath(oStringArray[0]); bsUDA.InvokeMethod("Query", psIn, psOut); cExportFileName = "ProductClass-"+oStringArray[0]+"-"+vHeaderLine+"-"+oStringArray[1]+vGetTime+".xml"; psOut.SetProperty("FileName", strExportDir+cExportFileName); sBSExportXML.InvokeMethod("WriteEAIMsg", psOut, pOuWSContent); LogData(oStringArray[0]+"|"+cExportFileName+"\n", strExportDir+sImportFile, "at"); cExportFileName = ""; psOut.Reset(); pOuWSContent.Reset(); psIn.Reset(); sSearchSpec = ""; } catch (e) { nError++; Write2Log("Error occured exporting Class Relationships '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished exporting Class Relationships '" + strProject + "' successfully."); } } else Write2Log("Error: Class/Relationships is not provided: '"+strProject+"'"); } else Write2Log("Error: Arguments not defined correctly for: '"+strProject+"'"); } Write2Log("Finished processing Batch Export of Class Relationships."); Write2Log("Total number of Class Relationships: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Exp

Batch Export Custom Objects SCM
ExportClassStructure
function ExportClassStructure(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cIntObjNam:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "ExportClassStructure.txt"; var sImportFile = "ImportClassStructure.txt"; var cExportFileName = ""; var sSearchSpec:chars = ""; var oStringArray:Array; var vHeaderLine = ""; var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var sBSExportXML:Service= oApp.GetService("EAI XML Write to File"); var pOuWSContent = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\15.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "ExportClassStructure.log"; Write2Log("Starting Batch Export Class Structure from List..."); if(cIntObjNam == "Insert") { vHeaderLine = "InsertClassStructure"; Write2Log("Warning: All Components exported through this process will be inserted into Target Environment..."); } else { vHeaderLine = "UpdateClassStructure"; Write2Log("Warning: Promotion Item Integration Id will be updated into Target Environment..."); } Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null ) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { LogData(vHeaderLine+"\n", strExportDir+sImportFile, "wt"); while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); oStringArray = strProject.split("|"); if(oStringArray.length == 2) { if(oStringArray[0] != "" && oStringArray[1] != "") { Write2Log("Exporting class(s) '" + oStringArray[0] + "'...with child relationship '" + oStringArray[1] + "'..."); // sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; sSearchSpec = "([SWI ISS Class Definition BusComp.VOD Name] = '"+oStringArray[0]+"') AND ([SWI ISS Product Structure Admin BusComp.Item Name] = '"+oStringArray[1]+"')"; psIn.SetProperty("OutputIntObjectName", "SWI Admin ISS Product Class Structure"); psIn.SetProperty("SearchSpec", sSearchSpec); try { // UpdateProductPath(oStringArray[0]); bsUDA.InvokeMethod("Query", psIn, psOut); cExportFileName = "ProductClass-"+oStringArray[0]+"-"+vHeaderLine+"-"+oStringArray[1]+vGetTime+".xml"; psOut.SetProperty("FileName", strExportDir+cExportFileName); sBSExportXML.InvokeMethod("WriteEAIMsg", psOut, pOuWSContent); LogData(oStringArray[0]+"|"+cExportFileName+"\n", strExportDir+sImportFile, "at"); cExportFileName = ""; psOut.Reset(); pOuWSContent.Reset(); psIn.Reset(); sSearchSpec = ""; } catch (e) { nError++; Write2Log("Error occured exporting Class Relationships '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished exporting Class Relationships '" + strProject + "' successfully."); } } else Write2Log("Error: Class/Relationships is not provided: '"+strProject+"'"); } else Write2Log("Error: Arguments not defined correctly for: '"+strProject+"'"); } Write2Log("Finished processing Batch Export of Class Relationships."); Write2Log("Total number of Class Relationships: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Exp

Batch Export Custom Objects SCM
ExportCustomObjects
function ExportCustomObjects(cIsDebug, cDeltaJWS) { try { var vBO:BusObject = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); var vBC:BusComp = vBO.GetBusComp("ISS Joint Workspace BusComp"); var strImportFileNmae = "CustomJointWS_ADM_Files.txt"; var vTargetJWS:Array; var vExportedSearchSpec = ""; var vTarJWSCount = 0; var strExportDir = oApp.utils.SCM_RetrieveACV("ADM Batch Export Dir"); if (strExportDir == null || strExportDir == "") { //TAASINI2: Hard Coded the debug path for now. if(cIsDebug == "Y") strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; else strExportDir = "/tmp/"; } if(cDeltaJWS != "") { vTargetJWS = cDeltaJWS.split("|"); for(vTarJWSCount = 0; vTarJWSCount < vTargetJWS.length ; vTarJWSCount++) { if(vTargetJWS[vTarJWSCount] != "") { if(vExportedSearchSpec != "") vExportedSearchSpec = vExportedSearchSpec + " OR [Name] = '"+vTargetJWS[vTarJWSCount]+"'"; else vExportedSearchSpec = "[Name] = '"+vTargetJWS[vTarJWSCount]+"'"; }//end if(vTargetJWS[vTarJWSCount] != "") }//end for(vTarJWSCount = 0; vTarJWSCount < vTargetJWS.length ; vTarJWSCount++) }//ebd if(cDeltaJWS != "") else vExportedSearchSpec = "[Exported Flag SCM] = 'N' AND [Deployed Seq Num SCM] IS NOT NULL"; var vRecordFound = false; var vWorkSpace = ""; var vCountRecords = 0; var cDepSeq = ""; //overwrite the text file LogData("", strExportDir+strImportFileNmae, "wt"); with(vBC) { ClearToQuery(); ActivateField("Name"); ActivateField("Exported Flag SCM"); ActivateField("Deployed Seq Num SCM"); SetViewMode(AllView); SetSearchExpr(vExportedSearchSpec); ExecuteQuery(ForwardOnly); vRecordFound = FirstRecord(); while(vRecordFound) { vCountRecords++; vWorkSpace = GetFieldValue("Name"); cDepSeq = GetFieldValue("Deployed Seq Num SCM"); // BatchExportADMProjects(vWorkSpace, cDepSeq, cIsDebug); BatchExportCustomDeltaObjects(vWorkSpace, cDepSeq, cIsDebug, strExportDir) SetFieldValue("Exported Flag SCM", "Y"); WriteRecord(); vWorkSpace = ""; cDepSeq = ""; vRecordFound = NextRecord(); } }//end with } finally { vTargetJWS = null; vBC = null; vBO = null; } }

Batch Export Custom Objects SCM
ExportCustomObjects
function ExportCustomObjects() { try { var vBO:BusObject = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); var vBC:BusComp = vBO.GetBusComp("ISS Joint Workspace BusComp"); var vExportedSearchSpec = "[Exported Flag SCM] = 'N' AND [Deployed Seq Num SCM] IS NOT NULL"; var vRecordFound = false; var vWorkSpace = ""; var vCountRecords = 0; with(vBC) { ClearToQuery(); ActivateField("Name"); ActivateField("Exported Flag SCM"); SetViewMode(AllView); SetSearchExpr(vExportedSearchSpec); ExecuteQuery(ForwardOnly); vRecordFound = FirstRecord(); while(vRecordFound) { vCountRecords++; vWorkSpace = GetFieldValue("Name"); BatchExportADMProjects(vWorkSpace, vCountRecords); //SetFieldValue("Exported Flag SCM", "Y"); WriteRecord(); vRecordFound = NextRecord(); } }//end with } finally { vBC = null; vBO = null; } }

Batch Export Custom Objects SCM
GetLatestVersionNum
function GetLatestVersionNum(VODObjNum, sParObjType) { var vBO:BusObject = TheApplication().GetBusObject("ISS VOD Loader"); var vVODVersionBC:BusComp = vBO.GetBusComp("ISS VOD Versions"); //TAASINI2: Released Flag = "N" to find out the workspace version of th VORD object var sSearchExpr:chars = "[VOD Key] = '"+VODObjNum+"' AND [Released Flag] = 'N' AND [VOD Type] = '"+sParObjType+"'"; var sVersionNum:chars = ""; try { with(vVODVersionBC) { SetViewMode(AllView); ActivateField("Version"); ClearToQuery(); SetSearchExpr(sSearchExpr); ExecuteQuery(ForwardOnly); if(FirstRecord()) sVersionNum = GetFieldValue("Version") - 1; return sVersionNum; } } catch (e) { Write2Log("Error occured during in finding the latest version:\n" + e.toString()); } finally { vVODVersionBC = null; vBO = null; } }

Batch Export Custom Objects SCM
GetSysDate
function GetSysDate() { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // GetSysDate: // This method will return the Sysdate as String // Output: csysDate // Trigger: fnProcessWorkspace // Date: 03.06.2016 // Author: Nishant Singhal // Project: Import Delta Workspace //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oApp:Application; var cMonth:chars; var cDay:chars; var cYear:chars; var cHour:chars; var cMinute:chars; var cSecond:chars; var csysDate:chars; var dDate:Date; try { oApp = TheApplication(); dDate = new Date(); cMonth = ToString(dDate.getMonth() + 1); cDay = ToString(dDate.getDate()); cYear = ToString(dDate.getFullYear()); cHour = ToString(dDate.getHours()); cMinute = ToString(dDate.getMinutes()); cSecond = ToString(dDate.getSeconds()); csysDate = cMonth+"/"+cDay+"/"+cYear+" "+cHour+":"+cMinute+":"+cSecond; if (bIsTraceOn) oApp.Trace("GetSysDate: " + csysDate);//TAASINI2:04.09.2015:Updated variable name from sysDate to csysDate return csysDate; } catch(e) { if (bIsTraceOn) oApp.Trace("Product Master List Service SCM: GetSysDate Error"+ e.toString()); }//end catch finally { dDate = null; cSecond = null; cMinute = null; cHour = null; cYear = null; cDay = null; oApp = null; } }

Batch Export Custom Objects SCM
ImportBundleComponents
function ImportBundleComponents(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cInsertORUpdate:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "BundleComponentsImport.txt"; var sSearchSpec:chars = ""; var bsUDA = oApp.GetService("Workflow Process Manager"); var oFlatUpsertResult = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var oStringArray:Array; var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "BundleComponentsImportlog.log"; Write2Log("Starting Batch Import Bundle Components from List..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null || cInsertORUpdate == "") { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); if(nCount == 1) { if((cInsertORUpdate == "Insert" && strProject != "InsertRootStructure") || (cInsertORUpdate == "Update" && strProject != "UpdateRootStructure")) oApp.RaiseErrorText("MethodNotSupported"); } //sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; oStringArray = strProject.split("|"); if(oStringArray.length == 2) { Write2Log("Importing bundle(s) from the file:'" + strProject + "'..."); psIn.SetProperty("ProcessName", "Batch Import Bundle Components SCM"); psIn.SetProperty("InsertORUpdate", cInsertORUpdate); psIn.SetProperty("FileName", strExportDir+oStringArray[1]); psIn.SetProperty("BundleORClass", "Bundle"); try { UpdateProductPath(oStringArray[0]); fnExportContents(oStringArray[0], "Product Definition", cDebug); bsUDA.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetChildCount() > 0) oFlatUpsertResult.AddChild(psOut.GetChild(0)); if(cInsertORUpdate == "Insert") ApplyLog(oFlatUpsertResult); else ApplyUpdateLog(oFlatUpsertResult); oFlatUpsertResult.Reset(); } catch (e) { nError++; Write2Log("Error occured Importing Bundle Components '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished importing Bundle Components '" + strProject + "' successfully."); } } }//end while loop Write2Log("Finished processing Batch Export of Bundle Components."); Write2Log("Total number of Lines Processed: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of Bundle Components:\n" + e.toString()); } finally { oFlatUpsertResult = null; psIn = null; psOut = null; bsUDA = null; oStringArray = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
ImportBundleComponents
function ImportBundleComponents(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cInsertORUpdate:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "BundleComponentsImport.txt"; var sSearchSpec:chars = ""; var bsUDA = oApp.GetService("Workflow Process Manager"); var oFlatUpsertResult = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var oStringArray:Array; var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\15.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "BundleComponentsImportlog.log"; Write2Log("Starting Batch Import Bundle Components from List..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null || cInsertORUpdate == "") { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); if(nCount == 1) { if((cInsertORUpdate == "Insert" && strProject != "InsertRootStructure") || (cInsertORUpdate == "Update" && strProject != "UpdateRootStructure")) oApp.RaiseErrorText("MethodNotSupported"); } //sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; oStringArray = strProject.split("|"); if(oStringArray.length == 2) { Write2Log("Importing bundle(s) from the file:'" + strProject + "'..."); psIn.SetProperty("ProcessName", "Batch Import Bundle Components SCM"); psIn.SetProperty("InsertORUpdate", cInsertORUpdate); psIn.SetProperty("FileName", strExportDir+oStringArray[1]); psIn.SetProperty("BundleORClass", "Bundle"); try { UpdateProductPath(oStringArray[0]); fnExportContents(oStringArray[0], "Product Definition", cDebug); bsUDA.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetChildCount() > 0) oFlatUpsertResult.AddChild(psOut.GetChild(0)); if(cInsertORUpdate == "Insert") ApplyLog(oFlatUpsertResult); else ApplyUpdateLog(oFlatUpsertResult); oFlatUpsertResult.Reset(); } catch (e) { nError++; Write2Log("Error occured Importing Bundle Components '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished importing Bundle Components '" + strProject + "' successfully."); } } }//end while loop Write2Log("Finished processing Batch Export of Bundle Components."); Write2Log("Total number of Lines Processed: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of Bundle Components:\n" + e.toString()); } finally { oFlatUpsertResult = null; psIn = null; psOut = null; bsUDA = null; oStringArray = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
ImportClassStructure
function ImportClassStructure(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cInsertORUpdate:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "ImportClassStructure.txt"; var sSearchSpec:chars = ""; var bsUDA = oApp.GetService("Workflow Process Manager"); var oFlatUpsertResult = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var oStringArray:Array; var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "ImportClassStructure.log"; Write2Log("Starting Batch Import Class Relationships from List..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if (fp == null || cInsertORUpdate == "") { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); if(nCount == 1) { if((cInsertORUpdate == "Insert" && strProject != "InsertClassStructure") || (cInsertORUpdate == "Update" && strProject != "UpdateClassStructure")) oApp.RaiseErrorText("MethodNotSupported"); } //sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; oStringArray = strProject.split("|"); if(oStringArray.length == 2) { Write2Log("Importing class(s) from the file:'" + strProject + "'..."); psIn.SetProperty("ProcessName", "Batch Import Bundle Components SCM"); psIn.SetProperty("InsertORUpdate", cInsertORUpdate); psIn.SetProperty("BundleORClass", "Class"); psIn.SetProperty("FileName", strExportDir+oStringArray[1]); try { // UpdateProductPath(oStringArray[0]); fnExportContents(oStringArray[0], "Product Class Definition", cDebug); bsUDA.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetChildCount() > 0) oFlatUpsertResult.AddChild(psOut.GetChild(0)); if(cInsertORUpdate == "Insert") ApplyLog(oFlatUpsertResult); else ApplyUpdateLog(oFlatUpsertResult); oFlatUpsertResult.Reset(); } catch (e) { nError++; Write2Log("Error occured Importing Class Relationships '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished importing Class Relationships '" + strProject + "' successfully."); } } }//end while loop Write2Log("Finished processing Batch Export of Class Relationships."); Write2Log("Total number of Lines Processed: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of Bundle Components:\n" + e.toString()); } finally { oFlatUpsertResult = null; psIn = null; psOut = null; bsUDA = null; oStringArray = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
ImportClassStructure
function ImportClassStructure(Inputs, Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cInsertORUpdate:chars = Inputs.GetProperty("InsertORUpdate"); var strExportDir = "/tmp/"; var strProjectsFile = "ImportClassStructure.txt"; var sSearchSpec:chars = ""; var bsUDA = oApp.GetService("Workflow Process Manager"); var oFlatUpsertResult = oApp.NewPropertySet(); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var vGetTime = Clib.time(); var oStringArray:Array; var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\15.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "ImportClassStructure.log"; Write2Log("Starting Batch Import Class Relationships from List..."); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if (fp == null || cInsertORUpdate == "") { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); if(nCount == 1) { if((cInsertORUpdate == "Insert" && strProject != "InsertClassStructure") || (cInsertORUpdate == "Update" && strProject != "UpdateClassStructure")) oApp.RaiseErrorText("MethodNotSupported"); } //sSearchSpec = "(([ISS Promotion.Name] LIKE '"+oStringArray[0]+"*') AND ([ISS Promotion Items for Import.Product Name] LIKE '"+oStringArray[1]+"' OR [ISS Promotion Items for Import.Parent Promotion Item Id] IS NOT NULL))"; oStringArray = strProject.split("|"); if(oStringArray.length == 2) { Write2Log("Importing class(s) from the file:'" + strProject + "'..."); psIn.SetProperty("ProcessName", "Batch Import Bundle Components SCM"); psIn.SetProperty("InsertORUpdate", cInsertORUpdate); psIn.SetProperty("BundleORClass", "Class"); psIn.SetProperty("FileName", strExportDir+oStringArray[1]); try { // UpdateProductPath(oStringArray[0]); fnExportContents(oStringArray[0], "Product Class Definition", cDebug); bsUDA.InvokeMethod("RunProcess", psIn, psOut); if(psOut.GetChildCount() > 0) oFlatUpsertResult.AddChild(psOut.GetChild(0)); if(cInsertORUpdate == "Insert") ApplyLog(oFlatUpsertResult); else ApplyUpdateLog(oFlatUpsertResult); oFlatUpsertResult.Reset(); } catch (e) { nError++; Write2Log("Error occured Importing Class Relationships '" + strProject + "':\n" + e.toString() ); } finally { nSuccess++; Write2Log("Finished importing Class Relationships '" + strProject + "' successfully."); } } }//end while loop Write2Log("Finished processing Batch Export of Class Relationships."); Write2Log("Total number of Lines Processed: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); } } catch (e) { Write2Log("Error occured during Batch Export of Bundle Components:\n" + e.toString()); } finally { oFlatUpsertResult = null; psIn = null; psOut = null; bsUDA = null; oStringArray = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
ImportCustomObjects
function ImportCustomObjects(Inputs,Outputs) { var fp; var strProject; var cDebug:chars = Inputs.GetProperty("Debug"); var cAutoDeploy:chars = Inputs.GetProperty("AutoDeploy"); var cDeltaJWS:chars = Inputs.GetProperty("DeltaJWS"); var strProjectsFile = "CustomJointWS_ADM_Files.txt"; var strExportDir = "/tmp/"; var sSearchSpec:chars = ""; var bsUDA:Service = oApp.GetService("EAI Siebel Adapter"); var bsXMLRead:Service = oApp.GetService("EAI XML Read from File"); var bsDepCustJWS:Service= oApp.GetService("Deploy Custom JWS Rules SCM"); var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var psCustom:PropertySet= oApp.NewPropertySet(); var vGetTime = Clib.time(); var vTarJWSCount = 0; var vTargetJWS:Array; var nCount = 0; var nError = 0; var nSuccess = 0; if (cDebug == "Y") { strExportDir = "C:\\Siebel81\\16.0.0.0.0\\Client\\TEMP\\"; } sLogFile = strExportDir + "CustomJointWSDataTypesImport.log"; Write2Log("Starting Batch Import JWS Objects Components from List...strProjectsFile"); Write2Log("LoginId: '"+sLogin+"'| Time: '"+vGetTime+"'"); try { fp = Clib.fopen(strExportDir+strProjectsFile,"rt"); if ( fp == null) { Write2Log("Error opening file '" + strProjectsFile + "' for reading."); } else { while ( null != (strProject = Clib.fgets(fp)) ) { nCount++; strProject = oApp.utils.allTrim(strProject); Write2Log("Importing file:'" + strProject + "'..."); try { psIn.SetProperty("FileName", strExportDir+strProject); if(strProject.indexOf("DeltaWorkspaceSCM") >= 0) { bsXMLRead.InvokeMethod("ReadPropSet", psIn, psOut); DeltaImport(psOut, psCustom); } else { bsXMLRead.InvokeMethod("ReadEAIMsg", psIn, psOut); bsUDA.InvokeMethod("Upsert", psOut, psCustom); } }//end try catch (e) { nError++; Write2Log("Error occured Importing Custom JWS Objects in '" + strProject + "':\n" + e.toString() ); } finally { psOut.Reset(); psIn.Reset(); psCustom.Reset(); nSuccess++; Write2Log("Finished importing custom JWS Components '" + strProject + "' successfully."); } }//end while loop Write2Log("Finished processing Batch Export of Bundle Components."); Write2Log("Total number of Lines Processed: " + nCount); Write2Log("Successfully processed: " + nSuccess); Write2Log("Finished with error: " + nError); }//end else if(cDeltaJWS != "" && cAutoDeploy != "") { psOut.Reset(); psIn.Reset(); vTargetJWS = cDeltaJWS.split("|"); for(vTarJWSCount = 0; vTarJWSCount < vTargetJWS.length ; vTarJWSCount++) { if(vTargetJWS[vTarJWSCount] != "") { try { psIn.SetProperty("JWSId", vTargetJWS[vTarJWSCount]); if(cAutoDeploy == "Y") bsDepCustJWS.InvokeMethod("DeployCustomRules", psIn, psOut); if(cAutoDeploy == "N") bsDepCustJWS.InvokeMethod("ResetCustomRulesStatus", psIn, psOut); } catch (e) { nError++; Write2Log("Error occured in deploying Custom JWS Objects in '" + vTargetJWS[vTarJWSCount] + "':\n" + e.toString() ); } finally { psOut.Reset(); psIn.Reset(); nSuccess++; Write2Log("Finished Deploying custom JWS Objects in '" + vTargetJWS[vTarJWSCount] + "' successfully."); } }//end if(vTargetJWS[vTarJWSCount] != "") }//end for(vTarJWSCount = 0; vTarJWSCount < vTargetJWS.length ; vTarJWSCount++) }//ebd if(cDeltaJWS != "") }//end try catch (e) { Write2Log("Error occured Importing Custom JWS Objects:\n" + e.toString()); } finally { vTargetJWS = null; vGetTime = null; psCustom = null; psIn = null; psOut = null; bsUDA = null; bsXMLRead = null; bsDepCustJWS = null; Clib.fclose(fp); fp = null; } }

Batch Export Custom Objects SCM
LogData
function LogData(TempString, FilePath, FileMode) { try { if(FileMode == "" || FileMode == null) FileMode = "at"; var file = Clib.fopen(FilePath, FileMode); Clib.fputs(TempString, file); Clib.fclose(file); } finally { file = null; } }

Batch Export Custom Objects SCM
LogData
function LogData(TempString, FilePath, FileMode) { try { if(FileMode == "" || FileMode == null) FileMode = "at"; var file = Clib.fopen(FilePath, FileMode); Clib.fputs(TempString, file); Clib.fclose(file); } finally { file = null; } }

Batch Export Custom Objects SCM
ProcessChildrenSearchExpr
function ProcessChildrenSearchExpr(vBusObj, vBusComp, cParSearchSpec, sVODSearchExpr, cICName, cICF) { var vBO:BusObject = oApp.GetBusObject(vBusObj); var vBC:BusComp = vBO.GetBusComp(vBusComp); var cUIGroupExist = false; var vOrigId = ""; cParSearchSpec = cParSearchSpec + " AND [Last Version] = '999999999'"; var cLocalSearchSpec = ""; try { with(vBC) { SetViewMode(AllView); ActivateField("Orig Id"); ClearToQuery(); SetSearchExpr(cParSearchSpec); ExecuteQuery(ForwardOnly); cUIGroupExist = FirstRecord(); while(cUIGroupExist) { vOrigId = GetFieldValue("Orig Id"); if(cLocalSearchSpec == "") cLocalSearchSpec= "["+cICName+"."+cICF+"] ='"+vOrigId+"'"; else cLocalSearchSpec= cLocalSearchSpec + " OR ["+cICName+"."+cICF+"] ='"+vOrigId+"'"; cUIGroupExist = NextRecord(); } } if(cLocalSearchSpec != "") sVODSearchExpr = sVODSearchExpr + " AND ("+cLocalSearchSpec+")"; return(sVODSearchExpr); } finally { vBC = null; vBO = null; } }

Batch Export Custom Objects SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { try { oApp = TheApplication(); var utils = oApp.GetService("Application Utilities Service SCM"); utils.Application_Start("SCMDEBUG"); bIsTraceOn = oApp.isTraceON; sLogin = oApp.LoginName(); switch (MethodName) { case "ExportCustomWorkspaceObjects": ExportCustomObjects(Inputs.GetProperty("Debug"), Inputs.GetProperty("DeltaJWS")); return(CancelOperation); break; case "ExportBundleComponents": ExportBundleComponents(Inputs, Outputs); return(CancelOperation); break; case "ImportBundleComponents": ImportBundleComponents(Inputs,Outputs); return(CancelOperation); break; case "ExportClassStructure": ExportClassStructure(Inputs,Outputs); return(CancelOperation); break; case "ImportClassStructure": ImportClassStructure(Inputs,Outputs); return(CancelOperation); break; case "DeltaExportObjects": Outputs = DeltaExport(Inputs,Outputs); return(CancelOperation); break; case "DeltaImportObjects": DeltaImport(Inputs,Outputs); return(CancelOperation); break; case "AddToWorkspace": AddToWorkspace(Inputs,Outputs); return(CancelOperation); break; case "ImportCustomWorkspaceObjects": ImportCustomObjects(Inputs,Outputs); return(CancelOperation); break; default: break; }//end Switch } finally { utils = null; oApp = null; } return (ContinueOperation); }

Batch Export Custom Objects SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { try { oApp = TheApplication(); var utils = oApp.GetService("Application Utilities Service SCM"); utils.Application_Start("SCMDEBUG"); bIsTraceOn = oApp.isTraceON; sLogin = oApp.LoginName(); switch (MethodName) { case "ExportCustomWorkspaceObjects": ExportCustomObjects(); return(CancelOperation); break; case "ExportBundleComponents": ExportBundleComponents(Inputs, Outputs); return(CancelOperation); break; case "ImportBundleComponents": ImportBundleComponents(Inputs,Outputs); return(CancelOperation); break; case "ExportClassStructure": ExportClassStructure(Inputs,Outputs); return(CancelOperation); break; case "ImportClassStructure": ImportClassStructure(Inputs,Outputs); return(CancelOperation); break; default: break; }//end Switch } finally { oApp = null; } return (ContinueOperation); }

Batch Export Custom Objects SCM
UpdateProductPath
function UpdateProductPath(PromotionName) { /***************************************************************************** * Function: UpdatePath in BusService "Update Prom Item Path SCM" * * Author : Nishant Singhal (TAASINI2) * * Purpose : To update the promotion items product path * * Date : 2016-04-15 * *****************************************************************************/ var sBoName:BusObject = oApp.GetBusObject("SWI ISS Promotion"); var sBcName:BusComp = sBoName.GetBusComp("SWI ISS Promotion"); var vSearchSpec:String = ""; var vRowId:chars = ""; var vRecExist = false; var vBS:Service = oApp.GetService("Update Prom Item Path SCM"); var oInp:PropertySet = oApp.NewPropertySet(); var oOup:PropertySet = oApp.NewPropertySet(); try { with (sBcName) { SetViewMode(AllView); ActivateField("Name"); ClearToQuery(); SetSearchExpr("[Name] = '"+PromotionName+"'"); ExecuteQuery(ForwardOnly); vRecExist = FirstRecord(); if(vRecExist) { vRowId = GetFieldValue("Id"); if(vRowId != "") vSearchSpec = "[Promotion Id] = '"+vRowId+"'"; }//end while(vRecExist) else TheApplication().RaiseErrorText("Promotion Definition Not Found. Please check Application Data"); oInp.SetProperty("PromotionSearchSpec", vSearchSpec); vBS.InvokeMethod("UpdatePath", oInp, oOup); }//end with (sBcName) }//end try finally { oInp = null; oOup = null; vBS = null; sBcName = null; sBoName = null; } }

Batch Export Custom Objects SCM
UpdateProductPath
function UpdateProductPath(PromotionName) { /***************************************************************************** * Function: UpdatePath in BusService "Update Prom Item Path SCM" * * Author : Nishant Singhal (TAASINI2) * * Purpose : To update the promotion items product path * * Date : 2016-04-15 * *****************************************************************************/ var sBoName:BusObject = oApp.GetBusObject("SWI ISS Promotion"); var sBcName:BusComp = sBoName.GetBusComp("SWI ISS Promotion"); var vSearchSpec:String = ""; var vRowId:chars = ""; var vRecExist = false; var vBS:Service = oApp.GetService("Update Prom Item Path SCM"); var oInp:PropertySet = oApp.NewPropertySet(); var oOup:PropertySet = oApp.NewPropertySet(); try { with (sBcName) { SetViewMode(AllView); ActivateField("Name"); ClearToQuery(); SetSearchExpr("[Name] = '"+PromotionName+"'"); ExecuteQuery(ForwardOnly); vRecExist = FirstRecord(); while(vRecExist) { vRowId = GetFieldValue("Id"); if(vRowId != "") { if(vSearchSpec != "") vSearchSpec = "[Promotion Id] = '"+vRowId+"' AND "+ vSearchSpec; else vSearchSpec = "[Promotion Id] = '"+vRowId+"'"; }//end if(vRowId != "") vRecExist = NextRecord(); }//end while(vRecExist) oInp.SetProperty("PromotionSearchSpec", vSearchSpec); vBS.InvokeMethod("UpdatePath", oInp, oOup); }//end with (sBcName) }//end try finally { oInp = null; oOup = null; vBS = null; sBcName = null; sBoName = null; } }

Batch Export Custom Objects SCM
Write2Log
function Write2Log(sLogText) { if (sLogFile != "") { if (oApp.utils) oApp.utils.Write2Log(sLogFile, sLogText); } }

Batch Export Custom Objects SCM
Write2Log
function Write2Log(sLogText) { if (sLogFile != "") { if (oApp.utils) oApp.utils.Write2Log(sLogFile, sLogText); } }

Batch Export Custom Objects SCM
fnBuildSearchSpec
function fnBuildSearchSpec(VODObjNum, sParObjTypeLIC, sDeltaObjName, sICName, sICField, sAddSearch) { var vBO:BusObject = oApp.GetBusObject("List Of Values"); var vLOVBC:BusComp = vBO.GetBusComp("List Of Values SCM"); var cAppLang:chars = oApp.InvokeMethod("Language"); var sLOVSearchSpec:chars = "[Type] = 'ISS_VOD_ITEM_TYPE_SCM' AND [Active] = 'Y' AND [Parent] = '"+sParObjTypeLIC+"' AND [Language] = '"+cAppLang+"'"; var sVODSearchExpr:chars = "[VOD ImpExp BC.VOD Object Num] = '"+VODObjNum+"'"; var sVersionNum:chars = ""; var bRecordFound = false; var sLIC:chars = ""; var oFieldArray:Array; var cReplace = "N"; var cICNameNAddSearch = ""; if(sAddSearch != "") cICNameNAddSearch = ":Y"; try { with(vLOVBC) { switch(sICName+cICNameNAddSearch) { case "Object UI Option ImpExp BC:Y": sLOVSearchSpec = sLOVSearchSpec + " AND [Name] <> 'Object UI Group ImpExp BC' AND [Name] <> 'Object UI Group Items ImpExp BC'"; break; case "Object Port ImpExp BCY:": sLOVSearchSpec = sLOVSearchSpec + " AND [Name] <> 'Object Port Domain ImpExp BC'"; break; case "Product Billing Deal AIP SCM": sLOVSearchSpec = sLOVSearchSpec + " AND [Name] <> 'Object Product ImpExp BC'"; break; default: break; }//end switch(sICName) SetViewMode(AllView); ActivateField("Name"); ClearToQuery(); SetSearchExpr(sLOVSearchSpec); ExecuteQuery(ForwardOnly); bRecordFound = FirstRecord(); while(bRecordFound) { sLIC = GetFieldValue("Name"); if(sLIC == sICName) { sVODSearchExpr = sVODSearchExpr + " AND ["+sLIC+"."+sICField+"] ='"+sDeltaObjName+"'"; if(sAddSearch != "") { oFieldArray = sAddSearch.split(";"); if(oFieldArray.length == 2) sVODSearchExpr = sVODSearchExpr + " AND ["+sLIC+"."+oFieldArray[0]+"] ='"+oFieldArray[1]+"'"; if(sICName == "Object Rules ImpExp BC") sVODSearchExpr = sVODSearchExpr + " AND [Object Rule Nodes ImpExp BC.Rule Spec Id] ='"+oFieldArray[1]+"'"; else sVODSearchExpr = sVODSearchExpr + " AND [Object Rule Nodes ImpExp BC.Id] ='XXXXXXX'"; if(sICName == "Object UI Option ImpExp BC") { sVODSearchExpr = sVODSearchExpr+ " AND [Object UI Group ImpExp BC.Parent Option Orig Id] = '"+oFieldArray[1]+"'"; sVODSearchExpr = ProcessChildrenSearchExpr("ISS CP Loader", "Cfg ISS UI Groups", "[Parent Option Id] = '"+oFieldArray[1]+"'", sVODSearchExpr, "Object UI Group Items ImpExp BC", "Parent Group Orig Id"); } if(sICName == "Object Port ImpExp BC") sVODSearchExpr = sVODSearchExpr+ " AND [Object Port Domain ImpExp BC.Parent Port Orig Id] = '"+oFieldArray[1]+"'"; }//end if(sAddSearch != "") } else sVODSearchExpr = sVODSearchExpr + " AND ["+sLIC+".Id] ='XXXXXXX'"; bRecordFound = NextRecord(); } return sVODSearchExpr; } } catch (e) { Write2Log("Error occured building the search spec for VOD:\n" + e.toString()); } finally { oFieldArray = null; vLOVBC = null; vBO = null; } }

Batch Export Custom Objects SCM
fnExportContents
function fnExportContents(sPromoSearchSpec, sVODType, vDebug) { /******************************************************************************** * Description: This method is used to create a backup of promotions to be updated * ----------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ----------------------------------------------- * 2016-04-14 TAASINI2 created **********************************************************************************/ try { var vWSBO:BusObject = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); var vWSBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace BusComp"); var vWSPickBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace Object BusComp"); var oVordBC:BusComp = null; var vTargetProms = 0; var vUndoRecord = "N"; if(sPromoSearchSpec != "") { var vWSRowID = ""; var vTempString = ""; var now = new Date(); var timeStamp = now.toGMTString() + " " + now.getUTCMilliseconds(); with(vWSBC) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Name", "Automatic Updater Testing"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { vTempString = "----------------------------------------------------------------------------------------------\n"; vTempString = vTempString + "Start: VOD Backup log. Object Type:"+sVODType+"\n Log_Time:" + timeStamp + "\n"; vTempString = vTempString + "--VOD added into the backup Workspace:"+"\n"; with(vWSPickBC) { while(FirstRecord()) DeleteRecord(); NewRecord(NewAfter); oVordBC = GetPicklistBusComp("VOD Name"); with(oVordBC) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Name", sPromoSearchSpec); SetSearchSpec("Type", sVODType); ExecuteQuery(ForwardOnly); if (FirstRecord()) { Pick(); } else vUndoRecord = "Y"; } if(vUndoRecord == "Y") UndoRecord(); else { WriteRecord(); vTempString = vTempString + sPromoSearchSpec +"\n"; vTargetProms = vTargetProms + 1; } }//end with(vWSPickBC) vWSRowID = GetFieldValue("Id"); vTempString = vTempString + "--" + vTargetProms+ " Target VODs added\n\n"; var sBS = TheApplication().GetService("Promotion Relations Update SCM"); var pIn = TheApplication().NewPropertySet(); var pOu = TheApplication().NewPropertySet(); pIn.SetProperty("Workspacerow_id", vWSRowID); pIn.SetProperty("TempString", vTempString); pIn.SetProperty("WriteLog", "N"); pIn.SetProperty("Debug", vDebug); sBS.InvokeMethod("ExportWSContentsBS", pIn, pOu); Write2Log(pOu.GetProperty("TempString")); }//end if(FirstRecord()) else TheApplication().RaiseErrorText("Automatic Updater Testing Workspace Not Found. Please create the workspace first."); }//end with(vWSBC) }//end if sPromoSearchSpec != "" }//end try finally { now = null; pIn = null; pOu = null; sBS = null; oVordBC = null; vWSPickBC = null; vWSBC = null; vWSBO = null; } }

Batch Export Custom Objects SCM
fnExportContents
function fnExportContents(sPromoSearchSpec, sVODType, vDebug) { /******************************************************************************** * Description: This method is used to create a backup of promotions to be updated * ----------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ----------------------------------------------- * 2016-04-14 TAASINI2 created **********************************************************************************/ try { var vWSBO:BusObject = TheApplication().GetBusObject("Admin ISS Joint Workspace Definition"); var vWSBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace BusComp"); var vWSPickBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace Object BusComp"); var oVordBC:BusComp = null; var vTargetProms = 0; var vUndoRecord = "N"; if(sPromoSearchSpec != "") { var vWSRowID = ""; var vTempString = ""; var now = new Date(); var timeStamp = now.toGMTString() + " " + now.getUTCMilliseconds(); with(vWSBC) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Name", "Automatic Updater Testing"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { vTempString = "----------------------------------------------------------------------------------------------\n"; vTempString = vTempString + "Start: VOD Backup log. Object Type:"+sVODType+"\n Log_Time:" + timeStamp + "\n"; vTempString = vTempString + "--VOD added into the backup Workspace:"+"\n"; with(vWSPickBC) { while(FirstRecord()) DeleteRecord(); NewRecord(NewAfter); oVordBC = GetPicklistBusComp("VOD Name"); with(oVordBC) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Name", sPromoSearchSpec); SetSearchSpec("Type", sVODType); ExecuteQuery(ForwardOnly); if (FirstRecord()) { Pick(); } else vUndoRecord = "Y"; } if(vUndoRecord == "Y") UndoRecord(); else { WriteRecord(); vTempString = vTempString + sPromoSearchSpec +"\n"; vTargetProms = vTargetProms + 1; } }//end with(vWSPickBC) vWSRowID = GetFieldValue("Id"); vTempString = vTempString + "--" + vTargetProms+ " Target VODs added\n\n"; var sBS = TheApplication().GetService("Promotion Relations Update SCM"); var pIn = TheApplication().NewPropertySet(); var pOu = TheApplication().NewPropertySet(); pIn.SetProperty("Workspacerow_id", vWSRowID); pIn.SetProperty("TempString", vTempString); pIn.SetProperty("WriteLog", "N"); pIn.SetProperty("Debug", vDebug); sBS.InvokeMethod("ExportWSContentsBS", pIn, pOu); Write2Log(pOu.GetProperty("TempString")); }//end if(FirstRecord()) else TheApplication().RaiseErrorText("Automatic Updater Testing Workspace Not Found. Please create the workspace first."); }//end with(vWSBC) }//end if sPromoSearchSpec != "" }//end try finally { now = null; pIn = null; pOu = null; sBS = null; oVordBC = null; vWSPickBC = null; vWSBC = null; vWSBO = null; } }

Batch Export Custom Objects SCM
fnProcessWorkspace
function fnProcessWorkspace(vJWSName, VODName, cVODType) { /******************************************************************************** * Description: This method is used to create a backup of promotions to be updated * ----------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ----------------------------------------------- * 2016-04-14 TAASINI2 created **********************************************************************************/ try { var vWSBO:BusObject = oApp.GetBusObject("Admin ISS Joint Workspace Definition"); var vWSBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace BusComp"); var vWSPickBC:BusComp = vWSBO.GetBusComp("ISS Joint Workspace Object BusComp"); var oVordBC:BusComp = null; var now = Clib.time(); // var timeStamp = now.toGMTString() + " " + now.getUTCMilliseconds(); var oBS:Service = oApp.GetService("EAI Toolkit BS AIP SCM"); var oINP:PropertySet = oApp.NewPropertySet(); var oOUP:PropertySet = oApp.NewPropertySet(); var cLockedFlg = ""; var cLockedBy = ""; if(vJWSName != "") { with(vWSBC) { SetViewMode(AllView); vWSPickBC.ActivateField("VOD Locked Flg"); vWSPickBC.ActivateField("VOD Locked By"); ClearToQuery(); SetSearchSpec("Name", vJWSName); if(VODName != "" && cVODType != "") { vWSPickBC.SetSearchSpec("VOD Name", VODName); vWSPickBC.SetSearchSpec("VOD Type", cVODType); } ExecuteQuery(ForwardOnly); if(!FirstRecord()) { NewRecord(NewAfter); SetFieldValue("Name", vJWSName); WriteRecord(); } else { if(VODName != "" && cVODType != "") { with(vWSPickBC) { if(!FirstRecord()) { NewRecord(NewAfter); oVordBC = GetPicklistBusComp("VOD Name"); with(oVordBC) { SetViewMode(AllView); ClearToQuery(); SetSearchExpr("[Name] = '"+VODName+"' AND [Type] = '"+cVODType+"'"); ExecuteQuery(ForwardOnly); if (FirstRecord()) Pick(); }//end with(oVordBC) WriteRecord(); }//end if(!FirstRecord()) cLockedFlg = GetFieldValue("VOD Locked Flg"); cLockedBy = GetFieldValue("VOD Locked By"); if(cLockedBy != sLogin && cLockedFlg == "Y") TheApplication().RaiseErrorText("Locked By Some Other User......Can't Update the VOD: "+VODName); if(cLockedFlg == "N" || cLockedFlg == "") { oINP.SetProperty("BusObject", "VOD ImpExp BO"); oINP.SetProperty("BusComp", "VOD ImpExp BC"); oINP.SetProperty("SearchSpec", "[VOD Name] = '"+VODName+"' AND [VOD Type] = '"+cVODType+"'"); oINP.SetProperty("Locked By", sLogin); oINP.SetProperty("Locked Flag", "Y"); oINP.SetProperty("Locked Date", GetSysDate()); oBS.InvokeMethod("UpdateRecord", oINP, oOUP); } }//end with(vWSPickBC) }//END if(VODName != "" && cVODType != "") }//else (FirstRecord()) }//end with(vWSBC) }//end if sPromoSearchSpec != "" }//end try finally { oOUP = null; oINP = null; oBS = null; now = null; oVordBC = null; vWSPickBC = null; vWSBC = null; vWSBO = null; } }

Billing Inquiry Service SCM
(declarations)
var oApp : Application; var bIsTraceOn:bool; var ACV_URL_CUC = "Bill Inquiry URL for CUC"; var ACV_URL_SHOP = "Bill Inquiry URL for SHOP"; var ACV_ENV_ENC = "Bill Inquiry URL Encrypt"; var ACV_ENV_PWD = "Bill Inquiry URL Password"; var FLD_BI_URL = "Billing Inquiry URL"; var FLD_ACCT_ID = "Account Id"; var FLD_ASSET_ID = "Asset Id"; var MODE_ACCOUNT = "Account"; var MODE_ASSET = "Asset"; var MODE_BP = "BP"; var APP_CUC = "Siebel Power Communications"; var GROUP_CUC = "CC"; var GROUP_SHOP = "SHOP";

Billing Inquiry Service SCM
(declarations)
var oApp : Application; var bIsTraceOn:bool; var ACV_URL_CUC = "Bill Inquiry URL for CUC"; var ACV_URL_SHOP = "Bill Inquiry URL for SHOP"; var ACV_ENV_ENC = "Bill Inquiry URL Encrypt"; var ACV_ENV_PWD = "Bill Inquiry URL Password"; var FLD_BI_URL = "Billing Inquiry URL"; var FLD_ACCT_ID = "Account Id"; var FLD_ASSET_ID = "Asset Id"; var MODE_ACCOUNT = "Account"; var MODE_ASSET = "Asset"; var MODE_BP = "BP"; var APP_CUC = "Siebel Power Communications"; var GROUP_CUC = "CC"; var GROUP_SHOP = "SHOP";

Billing Inquiry Service SCM
Init
function Init (Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2008 ** Descr: VBC field initialization ***************************************************************************************************/ Outputs.SetProperty(FLD_BI_URL, ""); }

Billing Inquiry Service SCM
Init
function Init (Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2008 ** Descr: VBC field initialization ***************************************************************************************************/ Outputs.SetProperty(FLD_BI_URL, ""); }

Billing Inquiry Service SCM
Query
function Query(Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: VBC data collection ***************************************************************************************************/ var psRecord; var sAssetId; var sAcctId; var sBPId; var sMode; var sURL; var sAppName; var sHTML; try { sAcctId = ""; sAssetId = ""; sBPId = ""; sMode = Inputs.GetProperty("Parameters"); if(sMode != MODE_ACCOUNT && sMode != MODE_ASSET && sMode != MODE_BP) { oApp.RaiseErrorText(Name() + ".Query: VBC Service Parameters must be set to " + "either '" + MODE_ACCOUNT + "' or '" + MODE_ASSET + "' or '" + MODE_BP + "'"); } sAppName = oApp.GetProfileAttr("Me.ApplicationName"); if(sMode == MODE_ACCOUNT) { sAcctId = Inputs.GetChild(0).GetProperty("Account Id"); } if(sMode == MODE_ASSET) { sAssetId = Inputs.GetChild(0).GetProperty("Asset Id"); } if(sMode == MODE_BP) { sAssetId = Inputs.GetChild(0).GetProperty("BP Id"); } if(bIsTraceOn) oApp.Trace(Name() + ".Query: sAssetId = " + sAssetId); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sAcctId = " + sAcctId); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sBPId = " + sBPId); sURL = getBillingInquiryURL(sAcctId, sAssetId, null, sAppName, sMode); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sURL=" + sURL); sHTML = "<IFRAME SRC='" + sURL + "' allowTransparency='true' height='2000' width='100%'></IFRAME>"; if(bIsTraceOn) oApp.Trace(Name() + ".Query: HTML=" + sHTML); psRecord = oApp.NewPropertySet(); psRecord.SetProperty(FLD_BI_URL, sHTML); //2010-10-18 TGDHURO9 Defect 27960 psRecord.SetProperty(FLD_BI_URL + "2", sURL); Outputs.AddChild(psRecord); } finally { psRecord = null; } }

Billing Inquiry Service SCM
Query
function Query(Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: VBC data collection ***************************************************************************************************/ var psRecord; var sAssetId; var sAcctId; var sBPId; var sMode; var sURL; var sAppName; var sHTML; try { sAcctId = ""; sAssetId = ""; sBPId = ""; sMode = Inputs.GetProperty("Parameters"); if(sMode != MODE_ACCOUNT && sMode != MODE_ASSET && sMode != MODE_BP) { oApp.RaiseErrorText(Name() + ".Query: VBC Service Parameters must be set to " + "either '" + MODE_ACCOUNT + "' or '" + MODE_ASSET + "' or '" + MODE_BP + "'"); } sAppName = oApp.GetProfileAttr("Me.ApplicationName"); if(sMode == MODE_ACCOUNT) { sAcctId = Inputs.GetChild(0).GetProperty("Account Id"); } if(sMode == MODE_ASSET) { sAssetId = Inputs.GetChild(0).GetProperty("Asset Id"); } if(sMode == MODE_BP) { sAssetId = Inputs.GetChild(0).GetProperty("BP Id"); } if(bIsTraceOn) oApp.Trace(Name() + ".Query: sAssetId = " + sAssetId); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sAcctId = " + sAcctId); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sBPId = " + sBPId); sURL = getBillingInquiryURL(sAcctId, sAssetId, null, sAppName, sMode); if(bIsTraceOn) oApp.Trace(Name() + ".Query: sURL=" + sURL); sHTML = "<IFRAME SRC='" + sURL + "' allowTransparency='true' height='2000' width='100%'></IFRAME>"; if(bIsTraceOn) oApp.Trace(Name() + ".Query: HTML=" + sHTML); psRecord = oApp.NewPropertySet(); psRecord.SetProperty(FLD_BI_URL, sHTML); //2010-10-18 TGDHURO9 Defect 27960 psRecord.SetProperty(FLD_BI_URL + "2", sURL); Outputs.AddChild(psRecord); } finally { psRecord = null; } }

Billing Inquiry Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: method invocation ***************************************************************************************************/ try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; case "getBIQUrl": getBIQUrl(Inputs, Outputs); break; default: //unknown if(bIsTraceOn) oApp.Trace(Name() + " MethodName unknown = " + MethodName); break; } } finally { oApp = null; } return (CancelOperation); }

Billing Inquiry Service SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: method invocation ***************************************************************************************************/ try { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch(MethodName) { case "Init": Init(Inputs, Outputs); break; case "Query": Query(Inputs, Outputs); break; case "getBIQUrl": getBIQUrl(Inputs, Outputs); break; default: //unknown if(bIsTraceOn) oApp.Trace(Name() + " MethodName unknown = " + MethodName); break; } } finally { oApp = null; } return (CancelOperation); }

Billing Inquiry Service SCM
getBIQUrl
function getBIQUrl(Inputs, Outputs) { /*************************************************************************************************** ** Author: TGDSTKA9 ** Date: 26.07.2012 ** Descr: Preparation for GetURL to call extrnal system BIQ ** ** Call of external system BIQ from ** Post Solvency Activity Form Applet SCM ** Post Solvency Activity History Form Applet SCM ** via ** 1. BrowserScript (Applet) "function fPostSolvencyCallBIQ(objApplet)" which is calling ** 2. BrowserScript of BS "FE Call External Programs SCM" (Browser side) having "function fPostSolvencyCallBIQ(inputPropSet)" which is calling ** 3. ServerScript of BS "FE Call External Programs Support SCM" (Server side) having "function fPostSolvencyCallBIQ(inputPropSet)" which is calling ** 4. ServerScript of BS "Billing Inquiry Service SCM" having function fPostSolvencyCallBIQ(Inputs, Outputs) ***************************************************************************************************/ var sURL:chars = ""; var sAcctId:chars; var sAssetId:chars; var sBPId:chars; try { if(Inputs.PropertyExists("Account Id")) sAcctId = Inputs.GetProperty("Account Id"); if(Inputs.PropertyExists("Asset Id")) sAssetId = Inputs.GetProperty("Asset Id"); if(Inputs.PropertyExists("BP Id")) sBPId = Inputs.GetProperty("BP Id"); sURL = getBillingInquiryURL(sAcctId, sAssetId, sBPId, oApp.GetProfileAttr("Me.ApplicationName")); if(bIsTraceOn) oApp.Trace(Name() + ".getBIQUrl: sURL=" + sURL); Outputs.SetProperty(FLD_BI_URL, sURL); } catch (e) { if (bIsTraceOn) oApp.Trace(this.Name() + " .getBIQUrl ERROR: " + e.toString()); throw(e); } }

Billing Inquiry Service SCM
getBIQUrl
function getBIQUrl(Inputs, Outputs) { /*************************************************************************************************** ** Author: TGDSTKA9 ** Date: 26.07.2012 ** Descr: Preparation for GetURL to call extrnal system BIQ ** ** Call of external system BIQ from ** Post Solvency Activity Form Applet SCM ** Post Solvency Activity History Form Applet SCM ** via ** 1. BrowserScript (Applet) "function fPostSolvencyCallBIQ(objApplet)" which is calling ** 2. BrowserScript of BS "FE Call External Programs SCM" (Browser side) having "function fPostSolvencyCallBIQ(inputPropSet)" which is calling ** 3. ServerScript of BS "FE Call External Programs Support SCM" (Server side) having "function fPostSolvencyCallBIQ(inputPropSet)" which is calling ** 4. ServerScript of BS "Billing Inquiry Service SCM" having function fPostSolvencyCallBIQ(Inputs, Outputs) ***************************************************************************************************/ var sURL:chars = ""; var sAcctId:chars; var sAssetId:chars; var sBPId:chars; try { if(Inputs.PropertyExists("Account Id")) sAcctId = Inputs.GetProperty("Account Id"); if(Inputs.PropertyExists("Asset Id")) sAssetId = Inputs.GetProperty("Asset Id"); if(Inputs.PropertyExists("BP Id")) sBPId = Inputs.GetProperty("BP Id"); sURL = getBillingInquiryURL(sAcctId, sAssetId, sBPId, oApp.GetProfileAttr("Me.ApplicationName")); if(bIsTraceOn) oApp.Trace(Name() + ".getBIQUrl: sURL=" + sURL); Outputs.SetProperty(FLD_BI_URL, sURL); } catch (e) { if (bIsTraceOn) oApp.Trace(this.Name() + " .getBIQUrl ERROR: " + e.toString()); throw(e); } }

Billing Inquiry Service SCM
getBillingInquiryURL
function getBillingInquiryURL(sAccountId, sAssetId, sBPId, sAppName) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: Builds and returns URL for billing inquiry ** Returns: fully-qualified URL ** ** History: ** Date Who Remark ** 15.10.2010 tgdhuro9 Defect 27960 CR387 Symphony is not transfering proper Contract details to BIQ ** special treatment of parameter "subscriptionId", see code below. ** 25.10.2010 tgdhuro9 mask '+'-sign in URL. ** 26.10.2010 tgdhuro9 phew, mark also ':' with %3A ** 18.02.2011 TGDSEAI1 CR513 added new parameter with agent role on the URL ** 10.03.2011 TGDHAKA8 CR552 adding two new role parameter to URL, changing token call ** 07.04.2011 TGDHURO9 CR552 use the billing-to relation ship for the account nr. ** 20.11.2012 TGDSTRE0 SO1151 + script cleanup ** 25.02.2013 TGDHEJA1 SO1361 + script cleanup ** 31.01.2014 TGDPIVR1 Defect 79696: Use Subscription Id if it is not null ***************************************************************************************************/ var oBO : BusObject; var oBC : BusComp; var oBS : Service; var psInput : PropertySet; var psOutput: PropertySet; var sUrl : chars; var sSCN : chars = ""; var sAsset : chars = ""; var sAssetNr: chars; var sSubId: chars; var sMSISDN : chars; var sBP : chars = ""; var sBPNr : chars; var sLang : chars; var sLangApp: chars; var sRoleEmp: chars; try { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: sAccountId=" + sAccountId + ", sAssetId=" + sAssetId + ", sBPId=" + sBPId + ", sAppName=" + sAppName); sUrl = oApp.GetProfileAttr(sAppName == APP_CUC ? ACV_URL_CUC : ACV_URL_SHOP); if(sUrl == "") oApp.RaiseErrorText("Admin Code '" + ACV_URL_CUC + "'/'" + ACV_URL_SHOP + "' is not defined !"); sRoleEmp = oApp.GetProfileAttr("Employee Type SCM") == "Extern" ? "2" : "1"; sLangApp = oApp.InvokeMethod("LANGUAGE"); switch (sLangApp) { case "FRA": sLang = "FR"; break; case "ITA": sLang = "IT"; break; case "ENU": sLang = "EN"; break; default: sLang = "DE"; break; } if (sBPId != null && sBPId.length > 0) { //++ Billing Profile mode ++++++++++++++++++++++++++++++++++++++++++ // TGDMAEM1 17.2.2013: Fix for defect 64584 - use EAI BC oBO = oApp.GetBusObject("EAI Billing Profile SCM"); oBC = oBO.GetBusComp("Com Invoice Profile SCM"); oBC.SetViewMode(AllView); // TGDMAEM1 17.2.2013: Fix for defect 64584 - use field from new bc. was "Account Nr SCM" oBC.ActivateField("Account Nr"); oBC.ActivateField("Name"); oBC.ClearToQuery(); oBC.SetSearchExpr("[Id] = '" + sBPId + "'"); oBC.ExecuteQuery(ForwardOnly); if (isRecord(oBC)) { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: BP found"); // TGDMAEM1 17.2.2013: Fix for defect 64584 - use field from new bc. was "Account Nr SCM" //TGDPIVR1 31.01.2014: Using field without Picklist. sSCN = oBC.GetFieldValue("Account Nr"); sBPNr = oBC.GetFieldValue("Name"); sBP = "&billProfileId=" + sBPNr.replace(/:/g, "%3A"); } } else { if (sAssetId != null && sAssetId.length > 0) { //++ Asset mode ++++++++++++++++++++++++++++++++++++++++++ oBO = oApp.GetBusObject("Asset Management"); oBC = oBO.GetBusComp("Asset Mgmt - Asset"); oBC.SetViewMode(AllView); oBC.ActivateField("Kundennummer SCM"); oBC.ActivateField("MSISDN SCM"); oBC.ActivateField("Asset Number"); oBC.ActivateField("Subscription Id SCM"); oBC.ClearToQuery(); oBC.SetSearchExpr("[Id] = '" + sAssetId + "'"); oBC.ExecuteQuery(ForwardOnly); if (isRecord(oBC)) { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: Asset found"); sSCN = oBC.GetFieldValue("Kundennummer SCM"); sMSISDN = oBC.GetFieldValue("MSISDN SCM"); sAssetNr = oBC.GetFieldValue("Asset Number"); sSubId = oBC.GetFieldValue("Subscription Id SCM"

Billing Inquiry Service SCM
getBillingInquiryURL
function getBillingInquiryURL(sAccountId, sAssetId, sBPId, sAppName) { /*************************************************************************************************** ** Author: Karin Haack ** Date: 22.03.2010 ** Descr: Builds and returns URL for billing inquiry ** Returns: fully-qualified URL ** ** History: ** Date Who Remark ** 15.10.2010 tgdhuro9 Defect 27960 CR387 Symphony is not transfering proper Contract details to BIQ ** special treatment of parameter "subscriptionId", see code below. ** 25.10.2010 tgdhuro9 mask '+'-sign in URL. ** 26.10.2010 tgdhuro9 phew, mark also ':' with %3A ** 18.02.2011 TGDSEAI1 CR513 added new parameter with agent role on the URL ** 10.03.2011 TGDHAKA8 CR552 adding two new role parameter to URL, changing token call ** 07.04.2011 TGDHURO9 CR552 use the billing-to relation ship for the account nr. ** 20.11.2012 TGDSTRE0 SO1151 + script cleanup ** 25.02.2013 TGDHEJA1 SO1361 + script cleanup ** 31.01.2014 TGDPIVR1 Defect 79696: Use Subscription Id if it is not null ***************************************************************************************************/ var oBO : BusObject; var oBC : BusComp; var oBS : Service; var psInput : PropertySet; var psOutput: PropertySet; var sUrl : chars; var sSCN : chars = ""; var sAsset : chars = ""; var sAssetNr: chars; var sSubId: chars; var sMSISDN : chars; var sBP : chars = ""; var sBPNr : chars; var sLang : chars; var sLangApp: chars; var sRoleEmp: chars; try { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: sAccountId=" + sAccountId + ", sAssetId=" + sAssetId + ", sBPId=" + sBPId + ", sAppName=" + sAppName); sUrl = oApp.GetProfileAttr(sAppName == APP_CUC ? ACV_URL_CUC : ACV_URL_SHOP); if(sUrl == "") oApp.RaiseErrorText("Admin Code '" + ACV_URL_CUC + "'/'" + ACV_URL_SHOP + "' is not defined !"); sRoleEmp = oApp.GetProfileAttr("Employee Type SCM") == "Extern" ? "2" : "1"; sLangApp = oApp.InvokeMethod("LANGUAGE"); switch (sLangApp) { case "FRA": sLang = "FR"; break; case "ITA": sLang = "IT"; break; case "ENU": sLang = "EN"; break; default: sLang = "DE"; break; } if (sBPId != null && sBPId.length > 0) { //++ Billing Profile mode ++++++++++++++++++++++++++++++++++++++++++ // TGDMAEM1 17.2.2013: Fix for defect 64584 - use EAI BC oBO = oApp.GetBusObject("EAI Billing Profile SCM"); oBC = oBO.GetBusComp("Com Invoice Profile SCM"); oBC.SetViewMode(AllView); // TGDMAEM1 17.2.2013: Fix for defect 64584 - use field from new bc. was "Account Nr SCM" oBC.ActivateField("Account Nr"); oBC.ActivateField("Name"); oBC.ClearToQuery(); oBC.SetSearchExpr("[Id] = '" + sBPId + "'"); oBC.ExecuteQuery(ForwardOnly); if (isRecord(oBC)) { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: BP found"); // TGDMAEM1 17.2.2013: Fix for defect 64584 - use field from new bc. was "Account Nr SCM" //TGDPIVR1 31.01.2014: Using field without Picklist. sSCN = oBC.GetFieldValue("Account Nr"); sBPNr = oBC.GetFieldValue("Name"); sBP = "&billProfileId=" + sBPNr.replace(/:/g, "%3A"); } } else { if (sAssetId != null && sAssetId.length > 0) { //++ Asset mode ++++++++++++++++++++++++++++++++++++++++++ oBO = oApp.GetBusObject("Asset Management"); oBC = oBO.GetBusComp("Asset Mgmt - Asset"); oBC.SetViewMode(AllView); oBC.ActivateField("Kundennummer SCM"); oBC.ActivateField("MSISDN SCM"); oBC.ActivateField("Asset Number"); oBC.ActivateField("Subscription Id SCM"); oBC.ClearToQuery(); oBC.SetSearchExpr("[Id] = '" + sAssetId + "'"); oBC.ExecuteQuery(ForwardOnly); if (isRecord(oBC)) { if(bIsTraceOn) oApp.Trace(Name() + ".getBillingInquiryURL: Asset found"); sSCN = oBC.GetFieldValue("Kundennummer SCM"); sMSISDN = oBC.GetFieldValue("MSISDN SCM"); sAssetNr = oBC.GetFieldValue("Asset Number"); sSubId = oBC.GetFieldValue("Subscription Id SCM"

Billing Inquiry Service SCM
isRecord
function isRecord(oBC) { var sId; try { sId = oBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".isRecord found = " + sId); return(true); } catch(e) { return (false); } }

Billing Inquiry Service SCM
isRecord
function isRecord(oBC) { var sId; try { sId = oBC.GetFieldValue("Id"); if(bIsTraceOn) oApp.Trace(Name() + ".isRecord found = " + sId); return(true); } catch(e) { return (false); } }

Blocking Conditions SCM
(declarations)
var bIsTraceOn:bool = TheApplication().isTraceON;

Blocking Conditions SCM
(declarations)
var bIsTraceOn:bool = TheApplication().isTraceON;

Blocking Conditions SCM
Init
function Init (Inputs, Outputs) { Outputs.SetProperty("Blocking Condition Message",""); Outputs.SetProperty("Id",""); }

Blocking Conditions SCM
Init
function Init (Inputs, Outputs) { Outputs.SetProperty("Blocking Condition Message",""); Outputs.SetProperty("Id",""); }

Blocking Conditions SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************** * Function: Display the Blocking Conditions of customer from OMS * Author : Victor Baturov // Revision Date Who Ver Comments // ------------- --- --- -------- **************************************************************************************************/ var oPSOutputs:PropertySet,oPSWFInputs:PropertySet, oPSWFOutputs:PropertySet ; var oApp:Application; var sAccountId, sCSUPhoneNr, sBlockCondMess=""; var bsCallWF:Service; var oBO; var oBC; try { if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Start QueryV2 "); oApp = TheApplication(); oPSOutputs = oApp.NewPropertySet(); oPSWFInputs = oApp.NewPropertySet(); oPSWFOutputs = oApp.NewPropertySet(); if(oApp.GetProfileAttr("GetBlockingConditions")=="GetBlockingConditions") // WF call { oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Customer Status & Technology VBC SCM"); oBC.ActivateField("SubscriberNumber"); sCSUPhoneNr = oBC.GetFieldValue("SubscriberNumber"); sAccountId = oApp.GetProfileAttr("AccountId"); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Account - " + sAccountId); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Nr - " + sCSUPhoneNr); oPSWFInputs.SetProperty("Account Id", sAccountId); oPSWFInputs.SetProperty("PhoneNumber", sCSUPhoneNr); oPSWFInputs.SetProperty("ProcessName", "Get Blocking Condition SCM"); bsCallWF = oApp.GetService("Workflow Process Manager"); bsCallWF.InvokeMethod("RunProcess",oPSWFInputs, oPSWFOutputs ); // End of WF call sBlockCondMess = oPSWFOutputs.GetProperty("Translated Blocking Conditions"); } oPSOutputs.SetProperty("Blocking Condition Message",sBlockCondMess); oPSOutputs.SetProperty("Id","1"); Outputs.AddChild(oPSOutputs.Copy()); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : End Query"); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.errCode + " Message: "+ e.message); } finally { oApp.SetProfileAttr("GetBlockingConditions",""); oPSOutputs = null; oPSWFInputs = null; oPSWFOutputs = null; bsCallWF = null; oBC = null; oBO = null; oApp = null; } }

Blocking Conditions SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************** * Function: Display the Blocking Conditions of customer from OMS * Author : Victor Baturov // Revision Date Who Ver Comments // ------------- --- --- -------- **************************************************************************************************/ var oPSOutputs:PropertySet,oPSWFInputs:PropertySet, oPSWFOutputs:PropertySet ; var oApp:Application; var sAccountId, sCSUPhoneNr, sBlockCondMess=""; var bsCallWF:Service; var oBO; var oBC; try { if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Start QueryV2 "); oApp = TheApplication(); oPSOutputs = oApp.NewPropertySet(); oPSWFInputs = oApp.NewPropertySet(); oPSWFOutputs = oApp.NewPropertySet(); if(oApp.GetProfileAttr("GetBlockingConditions")=="GetBlockingConditions") // WF call { oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp("Customer Status & Technology VBC SCM"); oBC.ActivateField("SubscriberNumber"); sCSUPhoneNr = oBC.GetFieldValue("SubscriberNumber"); sAccountId = oApp.GetProfileAttr("AccountId"); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Account - " + sAccountId); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : Nr - " + sCSUPhoneNr); oPSWFInputs.SetProperty("Account Id", sAccountId); oPSWFInputs.SetProperty("PhoneNumber", sCSUPhoneNr); oPSWFInputs.SetProperty("ProcessName", "Get Blocking Condition SCM"); bsCallWF = oApp.GetService("Workflow Process Manager"); bsCallWF.InvokeMethod("RunProcess",oPSWFInputs, oPSWFOutputs ); // End of WF call sBlockCondMess = oPSWFOutputs.GetProperty("Translated Blocking Conditions"); } oPSOutputs.SetProperty("Blocking Condition Message",sBlockCondMess); oPSOutputs.SetProperty("Id","1"); Outputs.AddChild(oPSOutputs.Copy()); if(bIsTraceOn) TheApplication().Trace(this.Name() + " : End Query"); } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + " Query method. Error: " + e.errCode + " Message: "+ e.message); } finally { oApp.SetProfileAttr("GetBlockingConditions",""); oPSOutputs = null; oPSWFInputs = null; oPSWFOutputs = null; bsCallWF = null; oBC = null; oBO = null; oApp = null; } }

Blocking Conditions SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { /***************************************************************** ** Bussiness Service: Blocking Conditions SCM ** Created: 24.08.2012 ** Created By: TGDBAVI8 ** Description: BS for the VBC Blockung Conditions *****************************************************************/ switch (MethodName) { case "Init": Init(Inputs,Outputs); break; case "Query": Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

Blocking Conditions SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { /***************************************************************** ** Bussiness Service: Blocking Conditions SCM ** Created: 24.08.2012 ** Created By: TGDBAVI8 ** Description: BS for the VBC Blockung Conditions *****************************************************************/ switch (MethodName) { case "Init": Init(Inputs,Outputs); break; case "Query": Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

Browser Button Validation SCM
CreateTT
function CreateTT(Inputs, Outputs){ /******************************************************* ** Created 18.12.2008 ** Created By: TGDESIS1 ** Description: Method to call CreateTT ** *******************************************************/ var systemAct = Inputs.GetProperty("System");// System ID var sActivityId = Inputs.GetProperty("Object Id");// Activity ID; var bs_oms_interface; var inputDetail; var outputDetail; var PSOutput; try{ bs_oms_interface = TheApplication().GetService("Workflow Process Manager"); inputDetail = TheApplication().NewPropertySet(); outputDetail = TheApplication().NewPropertySet(); inputDetail.SetProperty("ProcessName", "EAI Create Trouble Ticket SCM"); inputDetail.SetProperty("Worklog Activity ID",sActivityId); bs_oms_interface.InvokeMethod("RunProcess", inputDetail, outputDetail); }catch(e){ TheApplication().Trace(this.Name()+" Error: " + e.toString()); throw(e); }finally{ systemAct = null; sActivityId = null; inputDetail = null; outputDetail=null; bs_oms_interface = null; PSOutput= null; } }

Browser Button Validation SCM
CreateTT
function CreateTT(Inputs, Outputs){ /******************************************************* ** Created 18.12.2008 ** Created By: TGDESIS1 ** Description: Method to call CreateTT ** *******************************************************/ var systemAct = Inputs.GetProperty("System");// System ID var sActivityId = Inputs.GetProperty("Object Id");// Activity ID; var bs_oms_interface; var inputDetail; var outputDetail; var PSOutput; try{ bs_oms_interface = TheApplication().GetService("Workflow Process Manager"); inputDetail = TheApplication().NewPropertySet(); outputDetail = TheApplication().NewPropertySet(); inputDetail.SetProperty("ProcessName", "EAI Create Trouble Ticket SCM"); inputDetail.SetProperty("Worklog Activity ID",sActivityId); bs_oms_interface.InvokeMethod("RunProcess", inputDetail, outputDetail); }catch(e){ TheApplication().Trace(this.Name()+" Error: " + e.toString()); throw(e); }finally{ systemAct = null; sActivityId = null; inputDetail = null; outputDetail=null; bs_oms_interface = null; PSOutput= null; } }

Browser Button Validation SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { /******************************************************* * Method: Service_PreCanInvokeMethod * Business Service: Browser Button Validation SCM * * SCM 03.12.2008 TGDESIS1 * * Description: Pre Can Invoke * *******************************************************/ try{ switch(MethodName){ case "CreateTT": CanInvoke="TRUE"; return ("CancelOperation"); break; default: return ("ContinueOperation"); break; } }catch(e){ throw(e); } finally{} }

Browser Button Validation SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { /******************************************************* * Method: Service_PreCanInvokeMethod * Business Service: Browser Button Validation SCM * * SCM 03.12.2008 TGDESIS1 * * Description: Pre Can Invoke * *******************************************************/ try{ switch(MethodName){ case "CreateTT": CanInvoke="TRUE"; return ("CancelOperation"); break; default: return ("ContinueOperation"); break; } }catch(e){ throw(e); } finally{} }

Browser Button Validation SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /******************************************************* * Method: Service_PreInvokeMethod * Business Service: Browser Button Validation SCM * * SCM 03.12.2008 TGDESIS1 * * Description: Pre Invoke * *******************************************************/ try{ var output; switch(MethodName){ case "CreateTT": //output = TheApplication().NewPropertySet(); CreateTT(Inputs, Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } }catch(e){ TheApplication().Trace(this.Name()+" Error: " + e.toString()); throw(e); } finally{ output = null; } }

Browser Button Validation SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /******************************************************* * Method: Service_PreInvokeMethod * Business Service: Browser Button Validation SCM * * SCM 03.12.2008 TGDESIS1 * * Description: Pre Invoke * *******************************************************/ try{ var output; switch(MethodName){ case "CreateTT": //output = TheApplication().NewPropertySet(); CreateTT(Inputs, Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } }catch(e){ TheApplication().Trace(this.Name()+" Error: " + e.toString()); throw(e); } finally{ output = null; } }

C4 Call Correspondence
(declarations)
var oApp; var c4ServerVersion; var c4ClientVersion; var cSysId; var cServerPort; var cClientPort; var cServerIP; var cClientIP; var cModus; var cTemplateDefined="false"; var cDefaultClientMode; var cDefaultCallTech; var cDefaultAdapterURL; var cDefaultURLEndpoint; var cDocServerURLEndpoint; var cAppSrvProtocol; var cTempPath = ""; var cDebugMode = "false"; var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 Call Correspondence
(declarations)
var oApp; var c4ServerVersion; var c4ClientVersion; var cSysId; var cServerPort; var cClientPort; var cServerIP; var cClientIP; var cModus; var cTemplateDefined="false"; var cDefaultClientMode; var cDefaultCallTech; var cDefaultAdapterURL; var cDefaultURLEndpoint; var cDocServerURLEndpoint; var cAppSrvProtocol; var cTempPath = ""; var cDebugMode = "false"; var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 Call Correspondence
AddApplicationContext
function AddApplicationContext(psApplication, psAppContext) { var psProperty; try { AddProperties(psApplication, "BusObject" , "Application", psAppContext.GetProperty("BO")); AddProperties(psApplication, "BusComp" , "Application", psAppContext.GetProperty("BC")); AddProperties(psApplication, "ViewName" , "Application", psAppContext.GetProperty("View")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddApplicationContext"; } throw(e); } finally { psProperty=null; } }

C4 Call Correspondence
AddApplicationContext
function AddApplicationContext(psApplication, psAppContext) { var psProperty; try { AddProperties(psApplication, "BusObject" , "Application", psAppContext.GetProperty("BO")); AddProperties(psApplication, "BusComp" , "Application", psAppContext.GetProperty("BC")); AddProperties(psApplication, "ViewName" , "Application", psAppContext.GetProperty("View")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddApplicationContext"; } throw(e); } finally { psProperty=null; } }

C4 Call Correspondence
AddCentralPrinter
function AddCentralPrinter(psInputs) { var iCount; var iMax; var psPrinter; try { psPrinter = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "centralprint") { psPrinter = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } return (psPrinter); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddCentralPrinter"; } throw(e); } finally { } }

C4 Call Correspondence
AddCentralPrinter
function AddCentralPrinter(psInputs) { var iCount; var iMax; var psPrinter; try { psPrinter = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "centralprint") { psPrinter = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } return (psPrinter); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddCentralPrinter"; } throw(e); } finally { } }

C4 Call Correspondence
AddDocument
function AddDocument(psParent, psIO) { var iCount; var iMax; var psListOfAtt; var psAtt; var psAttachment; var cContentId; var cXML; var cText; try { psListOfAtt = oApp.NewPropertySet(); psListOfAtt.SetType("Attachments"); iCount = 0; iMax = psParent.GetChildCount(); while (iCount<iMax) { psAttachment = psParent.GetChild(iCount); cContentId = psAttachment.GetProperty("Attachment Id"); cXML = GetDocument(psIO, cContentId); cText = ExtractBase64String(cXML); psAtt = oApp.NewPropertySet(); psAtt.SetType("Attachment"); psAtt.SetProperty("FileName", psAttachment.GetProperty("FileName")); psAtt.SetProperty("FileExt", psAttachment.GetProperty("FileExt")); psAtt.SetProperty("Usage", psAttachment.GetProperty("Usage")); psAtt.SetValue(cText) psListOfAtt.AddChild(psAtt); psAttachment.SetValue(cText); iCount++; } return(psListOfAtt); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddDocument"; } throw(e); } finally { psAtt = null; psAttachment = null; } }

C4 Call Correspondence
AddDocument
function AddDocument(psParent, psIO) { var iCount; var iMax; var psListOfAtt; var psAtt; var psAttachment; var cContentId; var cXML; var cText; try { psListOfAtt = oApp.NewPropertySet(); psListOfAtt.SetType("Attachments"); iCount = 0; iMax = psParent.GetChildCount(); while (iCount<iMax) { psAttachment = psParent.GetChild(iCount); cContentId = psAttachment.GetProperty("Attachment Id"); cXML = GetDocument(psIO, cContentId); cText = ExtractBase64String(cXML); psAtt = oApp.NewPropertySet(); psAtt.SetType("Attachment"); psAtt.SetProperty("FileName", psAttachment.GetProperty("FileName")); psAtt.SetProperty("FileExt", psAttachment.GetProperty("FileExt")); psAtt.SetProperty("Usage", psAttachment.GetProperty("Usage")); psAtt.SetValue(cText) psListOfAtt.AddChild(psAtt); psAttachment.SetValue(cText); iCount++; } return(psListOfAtt); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddDocument"; } throw(e); } finally { psAtt = null; psAttachment = null; } }

C4 Call Correspondence
AddEditorSettings
function AddEditorSettings(psInputs) { var psEditorSettings; var psSetting; var iCount; var iMax; var cType; var cEnabled; var cActionPlan; var bEditorSettingFound; try { bEditorSettingFound = false; iCount=0; iMax = psInputs.GetChildCount(); psEditorSettings = null; cActionPlan = ""; if (iMax>0) { psEditorSettings = oApp.NewPropertySet(); psEditorSettings.SetType("editorsettings"); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "editorsetting") { bEditorSettingFound = true; cType = psInputs.GetChild(iCount).GetProperty("Type").toLowerCase(); cEnabled = psInputs.GetChild(iCount).GetProperty("Enabled").toLowerCase(); if (psInputs.GetChild(iCount).PropertyExists("ActionPlan")) { cActionPlan = psInputs.GetChild(iCount).GetProperty("ActionPlan").toLowerCase(); } else { cActionPlan = ""; } if (cEnabled !="false") { cEnabled = true; } else { cEnabled = false; } psSetting = oApp.NewPropertySet(); psSetting.SetType("clientoperator"); psSetting.SetProperty("type", cType); psSetting.SetProperty("enabled", cEnabled); if (cActionPlan != null && cActionPlan != "") { psSetting.SetProperty("actionplan", cActionPlan); } psEditorSettings.AddChild(psSetting); } iCount++; } } if (!bEditorSettingFound) { psEditorSettings = null; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddEditorSettings"; } throw(e); } finally { psSetting = null; return(psEditorSettings); } }

C4 Call Correspondence
AddEditorSettings
function AddEditorSettings(psInputs) { var psEditorSettings; var psSetting; var iCount; var iMax; var cType; var cEnabled; var cActionPlan; var bEditorSettingFound; try { bEditorSettingFound = false; iCount=0; iMax = psInputs.GetChildCount(); psEditorSettings = null; cActionPlan = ""; if (iMax>0) { psEditorSettings = oApp.NewPropertySet(); psEditorSettings.SetType("editorsettings"); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "editorsetting") { bEditorSettingFound = true; cType = psInputs.GetChild(iCount).GetProperty("Type").toLowerCase(); cEnabled = psInputs.GetChild(iCount).GetProperty("Enabled").toLowerCase(); if (psInputs.GetChild(iCount).PropertyExists("ActionPlan")) { cActionPlan = psInputs.GetChild(iCount).GetProperty("ActionPlan").toLowerCase(); } else { cActionPlan = ""; } if (cEnabled !="false") { cEnabled = true; } else { cEnabled = false; } psSetting = oApp.NewPropertySet(); psSetting.SetType("clientoperator"); psSetting.SetProperty("type", cType); psSetting.SetProperty("enabled", cEnabled); if (cActionPlan != null && cActionPlan != "") { psSetting.SetProperty("actionplan", cActionPlan); } psEditorSettings.AddChild(psSetting); } iCount++; } } if (!bEditorSettingFound) { psEditorSettings = null; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddEditorSettings"; } throw(e); } finally { psSetting = null; return(psEditorSettings); } }

C4 Call Correspondence
AddEmailInfo
function AddEmailInfo(psInputs) { var iCount; var iMax; var psEmail; try { psEmail = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "email") { psEmail = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddEmailInfo"; } throw(e); } finally { return (psEmail); } }

C4 Call Correspondence
AddEmailInfo
function AddEmailInfo(psInputs) { var iCount; var iMax; var psEmail; try { psEmail = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "email") { psEmail = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddEmailInfo"; } throw(e); } finally { return (psEmail); } }

C4 Call Correspondence
AddFaxInfo
function AddFaxInfo(psInputs) { var iCount; var iMax; var psFax; try { psFax = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "fax") { psFax = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddFaxInfo"; } throw(e); } finally { return (psFax); } }

C4 Call Correspondence
AddFaxInfo
function AddFaxInfo(psInputs) { var iCount; var iMax; var psFax; try { psFax = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "fax") { psFax = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddFaxInfo"; } throw(e); } finally { return (psFax); } }

C4 Call Correspondence
AddFilter
function AddFilter(psInputs) { var psFilter; var psCriteria; var iCount; var iMax; var bCriteriafound; try { bCriteriafound = false; iCount=0; iMax = psInputs.GetChildCount(); psFilter = null; if (iMax>0) { psFilter = oApp.NewPropertySet(); psFilter.SetType("filter"); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "criteria") { bCriteriafound = true; psCriteria = psInputs.GetChild(iCount).Copy(); psFilter.AddChild(psCriteria); } iCount++; } } if (!bCriteriafound) { psFilter = null; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddFilter"; } throw(e); } finally { psCriteria = null; return(psFilter); } }

C4 Call Correspondence
AddFilter
function AddFilter(psInputs) { var psFilter; var psCriteria; var iCount; var iMax; var bCriteriafound; try { bCriteriafound = false; iCount=0; iMax = psInputs.GetChildCount(); psFilter = null; if (iMax>0) { psFilter = oApp.NewPropertySet(); psFilter.SetType("filter"); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "criteria") { bCriteriafound = true; psCriteria = psInputs.GetChild(iCount).Copy(); psFilter.AddChild(psCriteria); } iCount++; } } if (!bCriteriafound) { psFilter = null; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddFilter"; } throw(e); } finally { psCriteria = null; return(psFilter); } }

C4 Call Correspondence
AddLocalPrinter
function AddLocalPrinter(psInputs) { var iCount; var iMax; var psPrinter; try { psPrinter = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "localprint") { psPrinter = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddLocalPrinter"; } throw(e); } finally { return (psPrinter); } }

C4 Call Correspondence
AddLocalPrinter
function AddLocalPrinter(psInputs) { var iCount; var iMax; var psPrinter; try { psPrinter = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "localprint") { psPrinter = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddLocalPrinter"; } throw(e); } finally { return (psPrinter); } }

C4 Call Correspondence
AddProperties
function AddProperties(psApplication, cName, cContext, cValue) { var psProperty; try { if (cValue != null && cValue != "") { psProperty=oApp.NewPropertySet(); psProperty.SetType("property"); psProperty.SetProperty("name", cName); psProperty.SetProperty("context", cContext); psProperty.SetValue(cValue); psApplication.AddChild(psProperty); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddProperties"; } throw(e); } finally { psProperty = null; } }

C4 Call Correspondence
AddProperties
function AddProperties(psApplication, cName, cContext, cValue) { var psProperty; try { if (cValue != null && cValue != "") { psProperty=oApp.NewPropertySet(); psProperty.SetType("property"); psProperty.SetProperty("name", cName); psProperty.SetProperty("context", cContext); psProperty.SetValue(cValue); psApplication.AddChild(psProperty); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddProperties"; } throw(e); } finally { psProperty = null; } }

C4 Call Correspondence
AddProperty
function AddProperty(psInputs,cPropId,cPropValue) { var psPropertySet; try { psPropertySet = oApp.NewPropertySet(); psPropertySet.SetProperty("propid", cPropId); psPropertySet.SetProperty("propvalue", cPropValue); psInputs.AddChild(psPropertySet); } catch(e) { throw(e); } finally { psPropertySet = null; } }

C4 Call Correspondence
AddProperty
function AddProperty(psInputs,cPropId,cPropValue) { var psPropertySet; try { psPropertySet = oApp.NewPropertySet(); psPropertySet.SetProperty("propid", cPropId); psPropertySet.SetProperty("propvalue", cPropValue); psInputs.AddChild(psPropertySet); } catch(e) { throw(e); } finally { psPropertySet = null; } }

C4 Call Correspondence
AddReferenceInfo
function AddReferenceInfo(psInputs) { var iCount; var iMax; var psReference; try { psReference = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "contextinfo") { psReference = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddReferenceInfo"; } throw(e); } finally { return (psReference); } }

C4 Call Correspondence
AddReferenceInfo
function AddReferenceInfo(psInputs) { var iCount; var iMax; var psReference; try { psReference = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "contextinfo") { psReference = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddReferenceInfo"; } throw(e); } finally { return (psReference); } }

C4 Call Correspondence
AddSMSInfo
function AddSMSInfo(psInputs) { var iCount; var iMax; var psSMS; try { psSMS = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "sms") { psSMS = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddSMSInfo"; } throw(e); } finally { return (psSMS); } }

C4 Call Correspondence
AddSMSInfo
function AddSMSInfo(psInputs) { var iCount; var iMax; var psSMS; try { psSMS = ""; iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { if (psInputs.GetChild(iCount).GetType() == "sms") { psSMS = psInputs.GetChild(iCount); iCount = iMax; } iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddSMSInfo"; } throw(e); } finally { return (psSMS); } }

C4 Call Correspondence
AddSiebelObjectToStandardData
function AddSiebelObjectToStandardData(psAppContext, psUserContext) { var psInputs; var psOutputs; var pSiebel; try { psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("boid", "31376599-7400-428b-a6d6-672b12aa98ac"); AddProperty(psInputs, "31817f44-a1d8-4cff-a6bd-1ab7a6f30f92", psUserContext.GetProperty("LoginID")); AddProperty(psInputs, "4d6fcbec-c8f7-423f-adb0-413fe6ed3bf2", psUserContext.GetProperty("Login")); AddProperty(psInputs, "b3379723-1352-4706-aaaa-52e96f4a8c32", psUserContext.GetProperty("PositionID")); AddProperty(psInputs, "daa0fd5d-3e23-4a12-a091-7efff1e79ca3", psUserContext.GetProperty("Position")); AddProperty(psInputs, "e3d63644-ffb9-4425-9a89-9be9da2b4e28", psUserContext.GetProperty("DivisionID")); AddProperty(psInputs, "e04aab6a-7d64-4c43-8718-ea96956364de", psUserContext.GetProperty("Division")); AddProperty(psInputs, "2458e6f4-9c6f-4e27-aff7-8c21e070c2eb", psUserContext.GetProperty("OrganizationID")); AddProperty(psInputs, "ece028d5-35f9-4be1-975a-1b93b00a70dd", psUserContext.GetProperty("Organization")); AddProperty(psInputs, "a62de3f8-0987-40cf-9b2d-961ff7ab175d", psAppContext.GetProperty("BO")); AddProperty(psInputs, "5c45cf46-7b69-463c-8f48-4215b0b3e4b1", psAppContext.GetProperty("BC")); AddProperty(psInputs, "f3dc3054-2b4f-4204-8c4a-46897108ad14", psAppContext.GetProperty("View")); C4BuildBusObj(psInputs, psOutputs); if (psOutputs.GetProperty("uniqueid") != null && psOutputs.GetProperty("uniqueid") != "" && psOutputs.GetChildCount()>0) { pSiebel = psOutputs.GetChild(0); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddSiebelObjectToStandardData"; } throw(e); } finally { psInputs = null; psOutputs = null; return(pSiebel); } }

C4 Call Correspondence
AddSiebelObjectToStandardData
function AddSiebelObjectToStandardData(psAppContext, psUserContext) { var psInputs; var psOutputs; var pSiebel; try { psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("boid", "31376599-7400-428b-a6d6-672b12aa98ac"); AddProperty(psInputs, "31817f44-a1d8-4cff-a6bd-1ab7a6f30f92", psUserContext.GetProperty("LoginID")); AddProperty(psInputs, "4d6fcbec-c8f7-423f-adb0-413fe6ed3bf2", psUserContext.GetProperty("Login")); AddProperty(psInputs, "b3379723-1352-4706-aaaa-52e96f4a8c32", psUserContext.GetProperty("PositionID")); AddProperty(psInputs, "daa0fd5d-3e23-4a12-a091-7efff1e79ca3", psUserContext.GetProperty("Position")); AddProperty(psInputs, "e3d63644-ffb9-4425-9a89-9be9da2b4e28", psUserContext.GetProperty("DivisionID")); AddProperty(psInputs, "e04aab6a-7d64-4c43-8718-ea96956364de", psUserContext.GetProperty("Division")); AddProperty(psInputs, "2458e6f4-9c6f-4e27-aff7-8c21e070c2eb", psUserContext.GetProperty("OrganizationID")); AddProperty(psInputs, "ece028d5-35f9-4be1-975a-1b93b00a70dd", psUserContext.GetProperty("Organization")); AddProperty(psInputs, "a62de3f8-0987-40cf-9b2d-961ff7ab175d", psAppContext.GetProperty("BO")); AddProperty(psInputs, "5c45cf46-7b69-463c-8f48-4215b0b3e4b1", psAppContext.GetProperty("BC")); AddProperty(psInputs, "f3dc3054-2b4f-4204-8c4a-46897108ad14", psAppContext.GetProperty("View")); C4BuildBusObj(psInputs, psOutputs); if (psOutputs.GetProperty("uniqueid") != null && psOutputs.GetProperty("uniqueid") != "" && psOutputs.GetChildCount()>0) { pSiebel = psOutputs.GetChild(0); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddSiebelObjectToStandardData"; } throw(e); } finally { psInputs = null; psOutputs = null; return(pSiebel); } }

C4 Call Correspondence
AddUsageToAttachment
function AddUsageToAttachment(psAttachment, cType) { try { switch (cType.toLowerCase()) { case "required": psAttachment.SetProperty("Usage", "required"); break; case "recommended": psAttachment.SetProperty("Usage", "recommended"); break; case "usable": psAttachment.SetProperty("Usage", "usable"); break; default: psAttachment.SetProperty("Usage", "required"); break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddUsageToAttachment"; } throw(e); } finally { } }

C4 Call Correspondence
AddUsageToAttachment
function AddUsageToAttachment(psAttachment, cType) { try { switch (cType.toLowerCase()) { case "required": psAttachment.SetProperty("Usage", "required"); break; case "recommended": psAttachment.SetProperty("Usage", "recommended"); break; case "usable": psAttachment.SetProperty("Usage", "usable"); break; default: psAttachment.SetProperty("Usage", "required"); break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddUsageToAttachment"; } throw(e); } finally { } }

C4 Call Correspondence
AddUserContext
function AddUserContext(psApplication, psUserContext) { var psProperty; try { AddProperties(psApplication, "LoginID" , "User", psUserContext.GetProperty("LoginID")); AddProperties(psApplication, "Login" , "User", psUserContext.GetProperty("Login")); //TGDCEJO3 14.09.2010: C4 performance issue //AddProperties(psApplication, "PositionID" , "User", psUserContext.GetProperty("PositionID")); AddProperties(psApplication, "PositionID" , "User", "0-5220"); //TGDCEJO3 14.09.2010: C4 performance issue //AddProperties(psApplication, "Position" , "User", psUserContext.GetProperty("Position")); AddProperties(psApplication, "Position" , "User", "Siebel Administrator"); AddProperties(psApplication, "DivisionID" , "User", psUserContext.GetProperty("DivisionID")); AddProperties(psApplication, "Division" , "User", psUserContext.GetProperty("Division")); AddProperties(psApplication, "OrganizationID" , "User", psUserContext.GetProperty("OrganizationID")); AddProperties(psApplication, "Organization" , "User", psUserContext.GetProperty("Organization")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddUserContext"; } throw(e); } finally { psProperty=null; } }

C4 Call Correspondence
AddUserContext
function AddUserContext(psApplication, psUserContext) { var psProperty; try { AddProperties(psApplication, "LoginID" , "User", psUserContext.GetProperty("LoginID")); AddProperties(psApplication, "Login" , "User", psUserContext.GetProperty("Login")); //TGDCEJO3 14.09.2010: C4 performance issue //AddProperties(psApplication, "PositionID" , "User", psUserContext.GetProperty("PositionID")); AddProperties(psApplication, "PositionID" , "User", "0-5220"); //TGDCEJO3 14.09.2010: C4 performance issue //AddProperties(psApplication, "Position" , "User", psUserContext.GetProperty("Position")); AddProperties(psApplication, "Position" , "User", "Siebel Administrator"); AddProperties(psApplication, "DivisionID" , "User", psUserContext.GetProperty("DivisionID")); AddProperties(psApplication, "Division" , "User", psUserContext.GetProperty("Division")); AddProperties(psApplication, "OrganizationID" , "User", psUserContext.GetProperty("OrganizationID")); AddProperties(psApplication, "Organization" , "User", psUserContext.GetProperty("Organization")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="AddUserContext"; } throw(e); } finally { psProperty=null; } }

C4 Call Correspondence
BuildProcessing
function BuildProcessing(psInputs) { var psProcessing; var psTemplate; var psPreferredChannel; var psServerProcessingOption; var psProcessMode; var bTemplateFound; var psFilter; try { psProcessing=oApp.NewPropertySet(); psProcessing.SetType("processing"); psTemplate = oApp.NewPropertySet(); psTemplate.SetType("template"); if (psInputs.PropertyExists("TemplateGUID")) { psTemplate.SetProperty("type", "GUID"); psTemplate.SetValue(psInputs.GetProperty("TemplateGUID")); psProcessing.AddChild(psTemplate); bTemplateFound = true; cTemplateDefined = "true"; } else { if (psInputs.PropertyExists("TemplateName")) { psTemplate.SetProperty("type", "Name"); psTemplate.SetValue(psInputs.GetProperty("TemplateName")); psProcessing.AddChild(psTemplate); bTemplateFound = true; cTemplateDefined = "true"; } else { bTemplateFound = false; cTemplateDefined = "false"; } } if (psInputs.PropertyExists("PreferredChannel")) { psPreferredChannel = oApp.NewPropertySet(); psPreferredChannel.SetType("preferredchannel"); psPreferredChannel.SetValue(psInputs.GetProperty("PreferredChannel")); psProcessing.AddChild(psPreferredChannel); } if (psInputs.PropertyExists("ServerProcessingOptions")) { psServerProcessingOption = oApp.NewPropertySet(); psServerProcessingOption.SetType("serverprocessingoptions"); psServerProcessingOption.SetValue(psInputs.GetProperty("ServerProcessingOptions")); psProcessing.AddChild(psServerProcessingOption); } psFilter = AddFilter(psInputs); if (psFilter != null && psFilter.GetChildCount()>0) { psProcessing.AddChild(psFilter); } if (psInputs.PropertyExists("ProcessMode")) { psProcessMode = oApp.NewPropertySet(); psProcessMode.SetType("processmode"); if (psInputs.GetProperty("ProcessMode") == "synchron" || psInputs.GetProperty("ProcessMode") == "synchronous") { psProcessMode.SetValue("synchronous"); } else { psProcessMode.SetValue("asynchronous"); switch (psInputs.GetProperty("Priority").toLowerCase()) { case "top": psProcessMode.SetProperty("priority", "top"); break; case "high": psProcessMode.SetProperty("priority", "high"); break; case "medium": psProcessMode.SetProperty("priority", "medium"); break; case "low": psProcessMode.SetProperty("priority", "low"); break; default: psProcessMode.SetProperty("priority", "medium"); break; } } psProcessing.AddChild(psProcessMode); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildProcessing"; } throw(e); } finally { psTemplate =null; psPreferredChannel = null; psServerProcessingOption = null; psFilter = null; psProcessMode = null; return(psProcessing); } }

C4 Call Correspondence
BuildProcessing
function BuildProcessing(psInputs) { var psProcessing; var psTemplate; var psPreferredChannel; var psServerProcessingOption; var psProcessMode; var bTemplateFound; var psFilter; try { psProcessing=oApp.NewPropertySet(); psProcessing.SetType("processing"); psTemplate = oApp.NewPropertySet(); psTemplate.SetType("template"); if (psInputs.PropertyExists("TemplateGUID")) { psTemplate.SetProperty("type", "GUID"); psTemplate.SetValue(psInputs.GetProperty("TemplateGUID")); psProcessing.AddChild(psTemplate); bTemplateFound = true; cTemplateDefined = "true"; } else { if (psInputs.PropertyExists("TemplateName")) { psTemplate.SetProperty("type", "Name"); psTemplate.SetValue(psInputs.GetProperty("TemplateName")); psProcessing.AddChild(psTemplate); bTemplateFound = true; cTemplateDefined = "true"; } else { bTemplateFound = false; cTemplateDefined = "false"; } } if (psInputs.PropertyExists("PreferredChannel")) { psPreferredChannel = oApp.NewPropertySet(); psPreferredChannel.SetType("preferredchannel"); psPreferredChannel.SetValue(psInputs.GetProperty("PreferredChannel")); psProcessing.AddChild(psPreferredChannel); } if (psInputs.PropertyExists("ServerProcessingOptions")) { psServerProcessingOption = oApp.NewPropertySet(); psServerProcessingOption.SetType("serverprocessingoptions"); psServerProcessingOption.SetValue(psInputs.GetProperty("ServerProcessingOptions")); psProcessing.AddChild(psServerProcessingOption); } psFilter = AddFilter(psInputs); if (psFilter != null && psFilter.GetChildCount()>0) { psProcessing.AddChild(psFilter); } if (psInputs.PropertyExists("ProcessMode")) { psProcessMode = oApp.NewPropertySet(); psProcessMode.SetType("processmode"); if (psInputs.GetProperty("ProcessMode") == "synchron" || psInputs.GetProperty("ProcessMode") == "synchronous") { psProcessMode.SetValue("synchronous"); } else { psProcessMode.SetValue("asynchronous"); switch (psInputs.GetProperty("Priority").toLowerCase()) { case "top": psProcessMode.SetProperty("priority", "top"); break; case "high": psProcessMode.SetProperty("priority", "high"); break; case "medium": psProcessMode.SetProperty("priority", "medium"); break; case "low": psProcessMode.SetProperty("priority", "low"); break; default: psProcessMode.SetProperty("priority", "medium"); break; } } psProcessing.AddChild(psProcessMode); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildProcessing"; } throw(e); } finally { psTemplate =null; psPreferredChannel = null; psServerProcessingOption = null; psFilter = null; psProcessMode = null; return(psProcessing); } }

C4 Call Correspondence
BuildProcessingGeneral
function BuildProcessingGeneral(psInputs, psProcessing) { var psOrganization; var psRole; var psFormModus; var psFormat; var psWatermark; var psAdapter; var psActionPlan; var psChannel; var psEditorSettings; var psReferenceInfo; var psEmail; var psFax; var psLocalPrint; var psCentralPrint; var psSMS; var psEditorFormat; try { psProcessing.SetType("processing"); if (psInputs.PropertyExists("Channel")) { psChannel = oApp.NewPropertySet(); psChannel.SetType("channel"); psChannel.SetValue(psInputs.GetProperty("Channel")); psProcessing.AddChild(psChannel); } SetEditorAndModus(psInputs, psProcessing); if (psInputs.PropertyExists("Adapter")) { psAdapter = oApp.NewPropertySet(); psAdapter.SetType("adapter"); psAdapter.SetValue(psInputs.GetProperty("Adapter")); psProcessing.AddChild(psAdapter); } if (psInputs.PropertyExists("ActionPlan")) { psActionPlan = oApp.NewPropertySet(); psActionPlan.SetType("actionplan"); psActionPlan.SetValue(psInputs.GetProperty("ActionPlan")); psProcessing.AddChild(psActionPlan); } if (psInputs.PropertyExists("FormModus")) { psFormModus = oApp.NewPropertySet(); psFormModus.SetType("FormModus"); psProcessing.AddChild(psFormModus); if (psInputs.GetProperty("FormModus").toLowerCase() == "off") { psFormModus.SetValue("off"); } else { psFormModus.SetValue("on"); } } if (psInputs.PropertyExists("Organization")) { psOrganization = oApp.NewPropertySet(); psOrganization.SetType("organization"); psOrganization.SetValue(psInputs.GetProperty("Organization")); psProcessing.AddChild(psOrganization); } if (psInputs.PropertyExists("Role")) { psRole = oApp.NewPropertySet(); psRole.SetType("role"); psRole.SetValue(psInputs.GetProperty("Role")); psProcessing.AddChild(psRole); } psFormat = oApp.NewPropertySet(); psFormat.SetType("format"); if (psInputs.PropertyExists("Format")) { psFormat.SetValue(psInputs.GetProperty("Format").toLowerCase()); psProcessing.AddChild(psFormat); } if (psInputs.PropertyExists("Watermark")) { psWatermark = oApp.NewPropertySet(); psWatermark.SetType("watermark"); psWatermark.SetValue(psInputs.GetProperty("Watermark")); psProcessing.AddChild(psWatermark); } if (psInputs.PropertyExists("EditorFormat")) { psEditorFormat = oApp.NewPropertySet(); psEditorFormat.SetType("editorformat"); psEditorFormat.SetValue(psInputs.GetProperty("EditorFormat")); psProcessing.AddChild(psEditorFormat); } psEditorSettings = AddEditorSettings(psInputs); if (psEditorSettings != null && psEditorSettings != "") { psProcessing.AddChild(psEditorSettings); } psEmail = AddEmailInfo(psInputs); if (psEmail != null && psEmail != "") { psProcessing.AddChild(psEmail); } psFax = AddFaxInfo(psInputs); if (psFax != null && psFax != "") { psProcessing.AddChild(psFax); } psLocalPrint = AddLocalPrinter(psInputs); if (psLocalPrint != null && psLocalPrint != "") { psProcessing.AddChild(psLocalPrint); } psCentralPrint = AddCentralPrinter(psInputs); if (psCentralPrint != null && psCentralPrint != "") { psProcessing.AddChild(psCentralPrint); } psSMS = AddSMSInfo(psInputs); if (psSMS != null && psSMS != "") { psProcessing.AddChild(psSMS); } psReferenceInfo = AddReferenceInfo(psInputs); if (psReferenceInfo != null && psReferenceInfo != "") { psProcessing.AddChild(psReferenceInfo); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildProcessingGeneral"; } throw(e); } finally { psChannel = null; psAdapter = null; psActionPlan = null; psFormModus = null; psOrganization = null; psRole = null; psFormat = null; psWatermark = null; psEditorFormat = nu

C4 Call Correspondence
BuildProcessingGeneral
function BuildProcessingGeneral(psInputs, psProcessing) { var psOrganization; var psRole; var psFormModus; var psFormat; var psWatermark; var psAdapter; var psActionPlan; var psChannel; var psEditorSettings; var psReferenceInfo; var psEmail; var psFax; var psLocalPrint; var psCentralPrint; var psSMS; var psEditorFormat; try { psProcessing.SetType("processing"); if (psInputs.PropertyExists("Channel")) { psChannel = oApp.NewPropertySet(); psChannel.SetType("channel"); psChannel.SetValue(psInputs.GetProperty("Channel")); psProcessing.AddChild(psChannel); } SetEditorAndModus(psInputs, psProcessing); if (psInputs.PropertyExists("Adapter")) { psAdapter = oApp.NewPropertySet(); psAdapter.SetType("adapter"); psAdapter.SetValue(psInputs.GetProperty("Adapter")); psProcessing.AddChild(psAdapter); } if (psInputs.PropertyExists("ActionPlan")) { psActionPlan = oApp.NewPropertySet(); psActionPlan.SetType("actionplan"); psActionPlan.SetValue(psInputs.GetProperty("ActionPlan")); psProcessing.AddChild(psActionPlan); } if (psInputs.PropertyExists("FormModus")) { psFormModus = oApp.NewPropertySet(); psFormModus.SetType("FormModus"); psProcessing.AddChild(psFormModus); if (psInputs.GetProperty("FormModus").toLowerCase() == "off") { psFormModus.SetValue("off"); } else { psFormModus.SetValue("on"); } } if (psInputs.PropertyExists("Organization")) { psOrganization = oApp.NewPropertySet(); psOrganization.SetType("organization"); psOrganization.SetValue(psInputs.GetProperty("Organization")); psProcessing.AddChild(psOrganization); } if (psInputs.PropertyExists("Role")) { psRole = oApp.NewPropertySet(); psRole.SetType("role"); psRole.SetValue(psInputs.GetProperty("Role")); psProcessing.AddChild(psRole); } psFormat = oApp.NewPropertySet(); psFormat.SetType("format"); if (psInputs.PropertyExists("Format")) { psFormat.SetValue(psInputs.GetProperty("Format").toLowerCase()); psProcessing.AddChild(psFormat); } if (psInputs.PropertyExists("Watermark")) { psWatermark = oApp.NewPropertySet(); psWatermark.SetType("watermark"); psWatermark.SetValue(psInputs.GetProperty("Watermark")); psProcessing.AddChild(psWatermark); } if (psInputs.PropertyExists("EditorFormat")) { psEditorFormat = oApp.NewPropertySet(); psEditorFormat.SetType("editorformat"); psEditorFormat.SetValue(psInputs.GetProperty("EditorFormat")); psProcessing.AddChild(psEditorFormat); } psEditorSettings = AddEditorSettings(psInputs); if (psEditorSettings != null && psEditorSettings != "") { psProcessing.AddChild(psEditorSettings); } psEmail = AddEmailInfo(psInputs); if (psEmail != null && psEmail != "") { psProcessing.AddChild(psEmail); } psFax = AddFaxInfo(psInputs); if (psFax != null && psFax != "") { psProcessing.AddChild(psFax); } psLocalPrint = AddLocalPrinter(psInputs); if (psLocalPrint != null && psLocalPrint != "") { psProcessing.AddChild(psLocalPrint); } psCentralPrint = AddCentralPrinter(psInputs); if (psCentralPrint != null && psCentralPrint != "") { psProcessing.AddChild(psCentralPrint); } psSMS = AddSMSInfo(psInputs); if (psSMS != null && psSMS != "") { psProcessing.AddChild(psSMS); } psReferenceInfo = AddReferenceInfo(psInputs); if (psReferenceInfo != null && psReferenceInfo != "") { psProcessing.AddChild(psReferenceInfo); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildProcessingGeneral"; } throw(e); } finally { psChannel = null; psAdapter = null; psActionPlan = null; psFormModus = null; psOrganization = null; psRole = null; psFormat = null; psWatermark = null; psEditorFormat = nu

C4 Call Correspondence
BuildProcessingReopen
function BuildProcessingReopen(psInputs) { var psProcessing; var psActionPlan; var psEditor; var psFormat; var psWatermark; try { psProcessing=oApp.NewPropertySet(); psProcessing.SetType("processing"); psActionPlan = oApp.NewPropertySet(); psActionPlan.SetType("actionplan"); if (psInputs.PropertyExists("ActionPlan")) { psActionPlan.SetValue(psInputs.GetProperty("ActionPlan")); psProcessing.AddChild(psActionPlan); } if (psInputs.PropertyExists("Watermark")) { psWatermark = oApp.NewPropertySet(); psWatermark.SetType("watermark"); psWatermark.SetValue(psInputs.GetProperty("Watermark")); psProcessing.AddChild(psWatermark); } psEditor = oApp.NewPropertySet(); psEditor.SetType("editor"); if (psInputs.PropertyExists("Editor")) { if (psInputs.GetProperty("Editor").toLowerCase() == "false") { psEditor.SetValue("false"); } else { psEditor.SetValue("true"); } psProcessing.AddChild(psEditor); } psFormat = oApp.NewPropertySet(); psFormat.SetType("format"); if (psInputs.PropertyExists("Format")) { psFormat.SetValue(psInputs.GetProperty("Format").toLowerCase()); psProcessing.AddChild(psFormat); } } catch(e) { throw(e); } finally { return(psProcessing); } }

C4 Call Correspondence
BuildProcessingReopen
function BuildProcessingReopen(psInputs) { var psProcessing; var psActionPlan; var psEditor; var psFormat; var psWatermark; try { psProcessing=oApp.NewPropertySet(); psProcessing.SetType("processing"); psActionPlan = oApp.NewPropertySet(); psActionPlan.SetType("actionplan"); if (psInputs.PropertyExists("ActionPlan")) { psActionPlan.SetValue(psInputs.GetProperty("ActionPlan")); psProcessing.AddChild(psActionPlan); } if (psInputs.PropertyExists("Watermark")) { psWatermark = oApp.NewPropertySet(); psWatermark.SetType("watermark"); psWatermark.SetValue(psInputs.GetProperty("Watermark")); psProcessing.AddChild(psWatermark); } psEditor = oApp.NewPropertySet(); psEditor.SetType("editor"); if (psInputs.PropertyExists("Editor")) { if (psInputs.GetProperty("Editor").toLowerCase() == "false") { psEditor.SetValue("false"); } else { psEditor.SetValue("true"); } psProcessing.AddChild(psEditor); } psFormat = oApp.NewPropertySet(); psFormat.SetType("format"); if (psInputs.PropertyExists("Format")) { psFormat.SetValue(psInputs.GetProperty("Format").toLowerCase()); psProcessing.AddChild(psFormat); } } catch(e) { throw(e); } finally { return(psProcessing); } }

C4 Call Correspondence
BuildQuery
function BuildQuery(psAppContext, psInputs) { var oBO; var oBC; var psQuery; var psProperty; var psValue; var bIsRecord; var iCount; var iMaxChild; var psChild; try { psQuery = oApp.NewPropertySet(); psQuery.SetType("query"); psQuery.SetProperty("type", "value"); psProperty = oApp.NewPropertySet(); psProperty.SetType("property"); psProperty.SetProperty("name", "Id"); psProperty.SetProperty("type", "Siebel Field"); psProperty.SetProperty("operator", "equal"); psQuery.AddChild(psProperty); if (psInputs.PropertyExists("BusObject") && psInputs.PropertyExists("BusComp")) { iCount = 0; iMaxChild = psInputs.GetChildCount(); if (iMaxChild >0) { while (iCount<iMaxChild) { psChild = psInputs.GetChild(iCount); if (psChild.GetType()=="Id") { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(psChild.GetValue()); psProperty.AddChild(psValue); } iCount++; } } else { if (psInputs.PropertyExists("Id")) { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(psInputs.GetProperty("Id")); psProperty.AddChild(psValue); } else { } } } else { oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp(psAppContext.GetProperty("BC")); bIsRecord = oBC.FirstSelected(); while (bIsRecord) { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(oBC.GetFieldValue("Id")); psProperty.AddChild(psValue); bIsRecord = oBC.NextSelected(); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildQuery"; } throw(e); } finally { oBC = null; oBO = null; psValue = null; psProperty = null; return(psQuery); } }

C4 Call Correspondence
BuildQuery
function BuildQuery(psAppContext, psInputs) { var oBO; var oBC; var psQuery; var psProperty; var psValue; var bIsRecord; var iCount; var iMaxChild; var psChild; try { psQuery = oApp.NewPropertySet(); psQuery.SetType("query"); psQuery.SetProperty("type", "value"); psProperty = oApp.NewPropertySet(); psProperty.SetType("property"); psProperty.SetProperty("name", "Id"); psProperty.SetProperty("type", "Siebel Field"); psProperty.SetProperty("operator", "equal"); psQuery.AddChild(psProperty); if (psInputs.PropertyExists("BusObject") && psInputs.PropertyExists("BusComp")) { iCount = 0; iMaxChild = psInputs.GetChildCount(); if (iMaxChild >0) { while (iCount<iMaxChild) { psChild = psInputs.GetChild(iCount); if (psChild.GetType()=="Id") { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(psChild.GetValue()); psProperty.AddChild(psValue); } iCount++; } } else { if (psInputs.PropertyExists("Id")) { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(psInputs.GetProperty("Id")); psProperty.AddChild(psValue); } else { } } } else { oBO = oApp.ActiveBusObject(); oBC = oBO.GetBusComp(psAppContext.GetProperty("BC")); bIsRecord = oBC.FirstSelected(); while (bIsRecord) { psValue = oApp.NewPropertySet(); psValue.SetType("value"); psValue.SetValue(oBC.GetFieldValue("Id")); psProperty.AddChild(psValue); bIsRecord = oBC.NextSelected(); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildQuery"; } throw(e); } finally { oBC = null; oBO = null; psValue = null; psProperty = null; return(psQuery); } }

C4 Call Correspondence
BuildRelation
function BuildRelation(cRelid, cSource, cDestination, psInputs) { var oService; var psOutputs; var cErrorCode; try { oService = oApp.GetService("C4 Call Correspondence"); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("relid", cRelid); psInputs.SetProperty("source", cSource); psInputs.SetProperty("destination", cDestination); //Relation will be assigned to Input PropertySet oService.InvokeMethod("C4BuildRelation", psInputs, psOutputs); cErrorCode = psOutputs.GetProperty("ErrorMessage"); psInputs.RemoveProperty("relid"); psInputs.RemoveProperty("source"); psInputs.RemoveProperty("destination"); } catch(e) { throw(e); } finally { oService = null; psOutputs = null; return(cErrorCode); } }

C4 Call Correspondence
BuildRelation
function BuildRelation(cRelid, cSource, cDestination, psInputs) { var oService; var psOutputs; var cErrorCode; try { oService = oApp.GetService("C4 Call Correspondence"); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("relid", cRelid); psInputs.SetProperty("source", cSource); psInputs.SetProperty("destination", cDestination); //Relation will be assigned to Input PropertySet oService.InvokeMethod("C4BuildRelation", psInputs, psOutputs); cErrorCode = psOutputs.GetProperty("ErrorMessage"); psInputs.RemoveProperty("relid"); psInputs.RemoveProperty("source"); psInputs.RemoveProperty("destination"); } catch(e) { throw(e); } finally { oService = null; psOutputs = null; return(cErrorCode); } }

C4 Call Correspondence
BuildReopen
function BuildReopen(psAppContext, psUserContext, psAttachment, psProcessing, psEnclosures) { var psStartUp; var psApplication; var cXML; try { cXML = ""; psStartUp=oApp.NewPropertySet(); psStartUp.SetType("startup"); psStartUp.SetProperty("serverversion", c4ServerVersion); psStartUp.SetProperty("clientversion", c4ClientVersion); psStartUp.SetProperty("server", cServerIP); psStartUp.SetProperty("port", cServerPort); psApplication=oApp.NewPropertySet(); psApplication.SetType("application"); psApplication.SetProperty("sysid", cSysId); psStartUp.AddChild(psApplication); AddUserContext(psApplication, psUserContext); AddApplicationContext(psApplication, psAppContext); psStartUp.AddChild(psProcessing); psStartUp.AddChild(psAttachment); if (psEnclosures != null && psEnclosures.GetChildCount()>0) { psStartUp.AddChild(psEnclosures); } cXML = ConvertToXML(psStartUp); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildReopen"; } throw(e); } finally { psApplication= null; psStartUp = null; return(cXML); } }

C4 Call Correspondence
BuildReopen
function BuildReopen(psAppContext, psUserContext, psAttachment, psProcessing, psEnclosures) { var psStartUp; var psApplication; var cXML; try { cXML = ""; psStartUp=oApp.NewPropertySet(); psStartUp.SetType("startup"); psStartUp.SetProperty("serverversion", c4ServerVersion); psStartUp.SetProperty("clientversion", c4ClientVersion); psStartUp.SetProperty("server", cServerIP); psStartUp.SetProperty("port", cServerPort); psApplication=oApp.NewPropertySet(); psApplication.SetType("application"); psApplication.SetProperty("sysid", cSysId); psStartUp.AddChild(psApplication); AddUserContext(psApplication, psUserContext); AddApplicationContext(psApplication, psAppContext); psStartUp.AddChild(psProcessing); psStartUp.AddChild(psAttachment); if (psEnclosures != null && psEnclosures.GetChildCount()>0) { psStartUp.AddChild(psEnclosures); } cXML = ConvertToXML(psStartUp); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildReopen"; } throw(e); } finally { psApplication= null; psStartUp = null; return(cXML); } }

C4 Call Correspondence
BuildStandardData
function BuildStandardData(psInputs, psAppContext, psUserContext) { var psStandardData; var psData; var psSiebel; var iCount; var iMax; var bDataFound; try { bDataFound = false; psStandardData = oApp.NewPropertySet(); psStandardData.SetType("standarddata"); psData = oApp.NewPropertySet(); psData.SetType("data"); psStandardData.AddChild(psData); iCount = 0; iMax = psInputs.GetChildCount(); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "object") { bDataFound = true; psData.AddChild(psInputs.GetChild(iCount)); } if (psInputs.GetChild(iCount).GetType() == "relationtype") { psData.AddChild(psInputs.GetChild(iCount)); } iCount++; } if (!bDataFound) { psStandardData = null; } else { psSiebel = AddSiebelObjectToStandardData(psAppContext, psUserContext); if (psSiebel != null && psSiebel != "") { psData.AddChild(psSiebel); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildStandardData"; } throw(e); } finally { psSiebel = null; psData = null; return(psStandardData); } }

C4 Call Correspondence
BuildStandardData
function BuildStandardData(psInputs, psAppContext, psUserContext) { var psStandardData; var psData; var psSiebel; var iCount; var iMax; var bDataFound; try { bDataFound = false; psStandardData = oApp.NewPropertySet(); psStandardData.SetType("standarddata"); psData = oApp.NewPropertySet(); psData.SetType("data"); psStandardData.AddChild(psData); iCount = 0; iMax = psInputs.GetChildCount(); while (iCount<iMax) { if (psInputs.GetChild(iCount).GetType() == "object") { bDataFound = true; psData.AddChild(psInputs.GetChild(iCount)); } if (psInputs.GetChild(iCount).GetType() == "relationtype") { psData.AddChild(psInputs.GetChild(iCount)); } iCount++; } if (!bDataFound) { psStandardData = null; } else { psSiebel = AddSiebelObjectToStandardData(psAppContext, psUserContext); if (psSiebel != null && psSiebel != "") { psData.AddChild(psSiebel); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildStandardData"; } throw(e); } finally { psSiebel = null; psData = null; return(psStandardData); } }

C4 Call Correspondence
BuildStartUp
function BuildStartUp(psAppContext, psUserContext, psQuery, psProcessing, psEnclosures, psStandardData, psInputs) { var psStartUp; var psApplication; var cXML; var iCount; var iMax; try { cXML = ""; psStartUp=oApp.NewPropertySet(); psStartUp.SetType("startup"); psStartUp.SetProperty("serverversion", c4ServerVersion); psStartUp.SetProperty("clientversion", c4ClientVersion); psStartUp.SetProperty("server", cServerIP); psStartUp.SetProperty("port", cServerPort); //TGDREIN1 - 02.09.2013: Added for NESA Nov'13: if (psInputs.GetProperty("TenantName") != "") psStartUp.SetProperty("tenantname", psInputs.GetProperty("TenantName")); psApplication=oApp.NewPropertySet(); psApplication.SetType("application"); psApplication.SetProperty("sysid", cSysId); psStartUp.AddChild(psApplication); AddUserContext(psApplication, psUserContext); AddApplicationContext(psApplication, psAppContext) if (psProcessing.GetChildCount()>0) { psStartUp.AddChild(psProcessing); } if (psEnclosures != null && psEnclosures.GetChildCount()>0) { psStartUp.AddChild(psEnclosures); } if (psStandardData != null && psStandardData != "" && psStandardData.GetChildCount()>0) { psStartUp.AddChild(psStandardData); } else { psStartUp.AddChild(psQuery); } // cXML = ConvertToXML(psStartUp); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildStartUp"; } throw(e); } finally { /* psApplication = null; psStartUp = null;*/ return(psStartUp); } }

C4 Call Correspondence
BuildStartUp
function BuildStartUp(psAppContext, psUserContext, psQuery, psProcessing, psEnclosures, psStandardData, psInputs) { var psStartUp; var psApplication; var cXML; var iCount; var iMax; try { cXML = ""; psStartUp=oApp.NewPropertySet(); psStartUp.SetType("startup"); psStartUp.SetProperty("serverversion", c4ServerVersion); psStartUp.SetProperty("clientversion", c4ClientVersion); psStartUp.SetProperty("server", cServerIP); psStartUp.SetProperty("port", cServerPort); //TGDREIN1 - 02.09.2013: Added for NESA Nov'13: if (psInputs.GetProperty("TenantName") != "") psStartUp.SetProperty("tenantname", psInputs.GetProperty("TenantName")); psApplication=oApp.NewPropertySet(); psApplication.SetType("application"); psApplication.SetProperty("sysid", cSysId); psStartUp.AddChild(psApplication); AddUserContext(psApplication, psUserContext); AddApplicationContext(psApplication, psAppContext) if (psProcessing.GetChildCount()>0) { psStartUp.AddChild(psProcessing); } if (psEnclosures != null && psEnclosures.GetChildCount()>0) { psStartUp.AddChild(psEnclosures); } if (psStandardData != null && psStandardData != "" && psStandardData.GetChildCount()>0) { psStartUp.AddChild(psStandardData); } else { psStartUp.AddChild(psQuery); } // cXML = ConvertToXML(psStartUp); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="BuildStartUp"; } throw(e); } finally { /* psApplication = null; psStartUp = null;*/ return(psStartUp); } }

C4 Call Correspondence
C4BuildBusObj
function C4BuildBusObj(psInputs, psOutputs) { var cUniqueID; var cBoid; var iCount; var iMax; var psChild; var psObject; var psProp; var cPropId; var cPropValue; var bPropertyFound; try { bPropertyFound = false; cUniqueID = GetUniqueID(); cBoid = psInputs.GetProperty("boid"); iCount = 0; iMax = psInputs.GetChildCount(); psObject = oApp.NewPropertySet(); psObject.SetType("object"); psObject.SetProperty("uniqueid", cUniqueID); psObject.SetProperty("boid", cBoid); while (iCount < iMax) { psChild = psInputs.GetChild(iCount); cPropId = psChild.GetProperty("propid"); cPropValue = psChild.GetProperty("propvalue"); if (cPropId != "" && cPropValue != "" && cPropId != null && cPropValue != null) { bPropertyFound = true; psProp = oApp.NewPropertySet(); psProp.SetType("property"); psProp.SetProperty("propid", cPropId); psProp.SetValue(cPropValue); psObject.AddChild(psProp); } iCount++; } if (bPropertyFound) { psOutputs.AddChild(psObject); psOutputs.SetProperty("uniqueid", cUniqueID); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4BuildBusObj"; } throw(e); } finally { psChild = null; psObject = null; psProp = null; } }

C4 Call Correspondence
C4BuildBusObj
function C4BuildBusObj(psInputs, psOutputs) { var cUniqueID; var cBoid; var iCount; var iMax; var psChild; var psObject; var psProp; var cPropId; var cPropValue; var bPropertyFound; try { bPropertyFound = false; cUniqueID = GetUniqueID(); cBoid = psInputs.GetProperty("boid"); iCount = 0; iMax = psInputs.GetChildCount(); psObject = oApp.NewPropertySet(); psObject.SetType("object"); psObject.SetProperty("uniqueid", cUniqueID); psObject.SetProperty("boid", cBoid); while (iCount < iMax) { psChild = psInputs.GetChild(iCount); cPropId = psChild.GetProperty("propid"); cPropValue = psChild.GetProperty("propvalue"); if (cPropId != "" && cPropValue != "" && cPropId != null && cPropValue != null) { bPropertyFound = true; psProp = oApp.NewPropertySet(); psProp.SetType("property"); psProp.SetProperty("propid", cPropId); psProp.SetValue(cPropValue); psObject.AddChild(psProp); } iCount++; } if (bPropertyFound) { psOutputs.AddChild(psObject); psOutputs.SetProperty("uniqueid", cUniqueID); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4BuildBusObj"; } throw(e); } finally { psChild = null; psObject = null; psProp = null; } }

C4 Call Correspondence
C4BuildRelation
function C4BuildRelation(psInputs, psOutputs) { var cRelid; var cDestination; var cSource; var psRelationType; var psRelation; var iCount; var iMax; var bRelationTypeFound; try { bRelationTypeFound = false; cRelid = psInputs.GetProperty("relid"); cDestination = psInputs.GetProperty("destination"); cSource = psInputs.GetProperty("source"); if (cRelid != null && cRelid != "" && cSource != null && cSource != "" && cDestination != null && cDestination != "") { iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax && !bRelationTypeFound) { if (psInputs.GetChild(iCount).GetType() == "relationtype") { if (psInputs.GetChild(iCount).GetProperty("relid") == cRelid) { psRelationType = psInputs.GetChild(iCount); bRelationTypeFound = true } } iCount++; } if (!bRelationTypeFound) { psRelationType = oApp.NewPropertySet(); psRelationType.SetType("relationtype"); psRelationType.SetProperty("relid", cRelid); psInputs.AddChild(psRelationType); } psRelation = oApp.NewPropertySet(); psRelation.SetType("relation"); psRelation.SetProperty("source", cSource); psRelation.SetProperty("destination", cDestination); psRelationType.AddChild(psRelation); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4BuildRelation"; } throw(e); } finally { psRelationType = null; psRelation = null; } }

C4 Call Correspondence
C4BuildRelation
function C4BuildRelation(psInputs, psOutputs) { var cRelid; var cDestination; var cSource; var psRelationType; var psRelation; var iCount; var iMax; var bRelationTypeFound; try { bRelationTypeFound = false; cRelid = psInputs.GetProperty("relid"); cDestination = psInputs.GetProperty("destination"); cSource = psInputs.GetProperty("source"); if (cRelid != null && cRelid != "" && cSource != null && cSource != "" && cDestination != null && cDestination != "") { iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax && !bRelationTypeFound) { if (psInputs.GetChild(iCount).GetType() == "relationtype") { if (psInputs.GetChild(iCount).GetProperty("relid") == cRelid) { psRelationType = psInputs.GetChild(iCount); bRelationTypeFound = true } } iCount++; } if (!bRelationTypeFound) { psRelationType = oApp.NewPropertySet(); psRelationType.SetType("relationtype"); psRelationType.SetProperty("relid", cRelid); psInputs.AddChild(psRelationType); } psRelation = oApp.NewPropertySet(); psRelation.SetType("relation"); psRelation.SetProperty("source", cSource); psRelation.SetProperty("destination", cDestination); psRelationType.AddChild(psRelation); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4BuildRelation"; } throw(e); } finally { psRelationType = null; psRelation = null; } }

C4 Call Correspondence
C4Correspondence
function C4Correspondence(psInputs, psOutputs) { var cType; var cXML; var cURL; var cHTML; try { cXML = ""; cType = "value"; Init(); try { psInputs = CallEvent(psInputs, "PreC4Correspondence"); } catch(e) { //dont stop execution in case the event is not skripted propertly } switch (cType) { case "value": C4CorrespondenceByValue(psInputs); cXML = psInputs.GetValue(); if (psInputs.PropertyExists("URL")) { cURL = psInputs.GetProperty("URL"); psOutputs.SetProperty("URL", cURL); } break; case "query": cXML=C4CorrespondenceByQuery(psInputs); break; } try { psInputs.SetValue(cXML); psInputs = CallEvent(psInputs, "PostC4Correspondence"); cXML = psInputs.GetValue(); } catch(e) { //dont stop execution in case the event is not skripted propertly } if (cModus == "central" && cTemplateDefined=="true") { SubmitXML(cXML); } else { cXML=EncodeEntities(cXML); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4Correspondence"; } throw(e); } finally { psOutputs.SetValue(cXML); } }

C4 Call Correspondence
C4Correspondence
function C4Correspondence(psInputs, psOutputs) { var cType; var cXML; var cURL; var cHTML; try { cXML = ""; cType = "value"; Init(); try { psInputs = CallEvent(psInputs, "PreC4Correspondence"); } catch(e) { //dont stop execution in case the event is not skripted propertly } switch (cType) { case "value": C4CorrespondenceByValue(psInputs); cXML = psInputs.GetValue(); if (psInputs.PropertyExists("URL")) { cURL = psInputs.GetProperty("URL"); psOutputs.SetProperty("URL", cURL); } break; case "query": cXML=C4CorrespondenceByQuery(psInputs); break; } try { psInputs.SetValue(cXML); psInputs = CallEvent(psInputs, "PostC4Correspondence"); cXML = psInputs.GetValue(); } catch(e) { //dont stop execution in case the event is not skripted propertly } if (cModus == "central" && cTemplateDefined=="true") { SubmitXML(cXML); } else { cXML=EncodeEntities(cXML); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4Correspondence"; } throw(e); } finally { psOutputs.SetValue(cXML); } }

C4 Call Correspondence
C4CorrespondenceByQuery
function C4CorrespondenceByQuery(psInputs) { try { if (cSubType!="automatic") { } else { } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4CorrespondenceByQuery"; } throw(e); } finally { } }

C4 Call Correspondence
C4CorrespondenceByQuery
function C4CorrespondenceByQuery(psInputs) { try { if (cSubType!="automatic") { } else { } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4CorrespondenceByQuery"; } throw(e); } finally { } }

C4 Call Correspondence
C4CorrespondenceByValue
function C4CorrespondenceByValue(psInputs) { var psAppContext; var psUserContext; var psQuery; var psProcessing; var psEnclosures; var psStandardData; var psStartup; var cClientMode; var cCallTech; var cAdapterURLTech; var cXML; var cSOAPMessage; var cURL; try { cClientMode = DetermineSetting(psInputs, "ClientMode"); cCallTech = DetermineSetting(psInputs, "CallTech"); cAdapterURLTech = DetermineSetting(psInputs, "AdapterURLTech"); psAppContext = oApp.NewPropertySet(); psUserContext = DetermineUserContext(); psAppContext = DetermineAppContext(psInputs); psQuery = BuildQuery(psAppContext, psInputs); psEnclosures = GetEnclosures(psInputs); psStandardData = BuildStandardData(psInputs, psAppContext, psUserContext); psProcessing=BuildProcessing(psInputs); BuildProcessingGeneral(psInputs, psProcessing); psStartup = BuildStartUp(psAppContext, psUserContext, psQuery, psProcessing, psEnclosures, psStandardData, psInputs); cXML = ConvertToXML(psStartup); psInputs.SetValue(cXML); if (cCallTech.toLowerCase() == "url") { cSOAPMessage = CreateSOAPCall(cClientMode, cAdapterURLTech, psStartup); cURL = CallSOAPStartWS(cSOAPMessage); psInputs.SetProperty("URL", cURL); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4CorrespondenceByValue"; } throw(e); } finally { psAppContext = null; psUserContext = null; psQuery = null; psProcessing = null; } }

C4 Call Correspondence
C4CorrespondenceByValue
function C4CorrespondenceByValue(psInputs) { var psAppContext; var psUserContext; var psQuery; var psProcessing; var psEnclosures; var psStandardData; var psStartup; var cClientMode; var cCallTech; var cAdapterURLTech; var cXML; var cSOAPMessage; var cURL; try { cClientMode = DetermineSetting(psInputs, "ClientMode"); cCallTech = DetermineSetting(psInputs, "CallTech"); cAdapterURLTech = DetermineSetting(psInputs, "AdapterURLTech"); psAppContext = oApp.NewPropertySet(); psUserContext = DetermineUserContext(); psAppContext = DetermineAppContext(psInputs); psQuery = BuildQuery(psAppContext, psInputs); psEnclosures = GetEnclosures(psInputs); psStandardData = BuildStandardData(psInputs, psAppContext, psUserContext); psProcessing=BuildProcessing(psInputs); BuildProcessingGeneral(psInputs, psProcessing); psStartup = BuildStartUp(psAppContext, psUserContext, psQuery, psProcessing, psEnclosures, psStandardData, psInputs); cXML = ConvertToXML(psStartup); psInputs.SetValue(cXML); if (cCallTech.toLowerCase() == "url") { cSOAPMessage = CreateSOAPCall(cClientMode, cAdapterURLTech, psStartup); cURL = CallSOAPStartWS(cSOAPMessage); psInputs.SetProperty("URL", cURL); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4CorrespondenceByValue"; } throw(e); } finally { psAppContext = null; psUserContext = null; psQuery = null; psProcessing = null; } }

C4 Call Correspondence
C4ReadAttachments
function C4ReadAttachments(psInputs, psOutputs) { var cId; var psListOfAttachments; try { Init(); try { psInputs = CallEvent(psInputs, "PreC4ReadAttachments"); } catch(e) { //dont stop execution in case the event is not skripted propertly } cId = psInputs.GetProperty("Id"); psListOfAttachments = GetAttachments(psInputs, cId); if (psListOfAttachments.GetType() == "Attachments") { psOutputs.AddChild(psListOfAttachments); } try { psInputs = CallEvent(psInputs, "PostC4ReadAttachments"); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4ReadAttachments"; } throw(e); } finally { } }

C4 Call Correspondence
C4ReadAttachments
function C4ReadAttachments(psInputs, psOutputs) { var cId; var psListOfAttachments; try { Init(); try { psInputs = CallEvent(psInputs, "PreC4ReadAttachments"); } catch(e) { //dont stop execution in case the event is not skripted propertly } cId = psInputs.GetProperty("Id"); psListOfAttachments = GetAttachments(psInputs, cId); if (psListOfAttachments.GetType() == "Attachments") { psOutputs.AddChild(psListOfAttachments); } try { psInputs = CallEvent(psInputs, "PostC4ReadAttachments"); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4ReadAttachments"; } throw(e); } finally { } }

C4 Call Correspondence
C4Reopen
function C4Reopen(psInputs, psOutputs) { var cId; var cXML; var psAttachment; var psAppContext; var psUserContext; var psProcessing; var psEnclosures; try { Init(); cXML = ""; cId = psInputs.GetProperty("Id"); try { psInputs = CallEvent(psInputs, "PreC4Reopen"); } catch(e) { //dont stop execution in case the event is not skripted propertly } psAttachment = GetAttachment(psInputs, cId); psProcessing = oApp.NewPropertySet(); if (psAttachment != null && psAttachment != "") { psUserContext = DetermineUserContext(); psAppContext = DetermineAppContext(psInputs); BuildProcessingGeneral(psInputs, psProcessing); psEnclosures = GetEnclosures(psInputs); cXML = BuildReopen(psAppContext, psUserContext, psAttachment, psProcessing, psEnclosures); cXML=EncodeEntities(cXML); } try { psInputs.SetValue(cXML); psInputs = CallEvent(psInputs, "PostC4Reopen"); cXML = psInputs.GetValue(); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4Reopen"; } throw(e); } finally { psAttachment = null; psAppContext = null; psUserContext = null; psProcessing = null; psEnclosures = null; psOutputs.SetValue(cXML); } }

C4 Call Correspondence
C4Reopen
function C4Reopen(psInputs, psOutputs) { var cId; var cXML; var psAttachment; var psAppContext; var psUserContext; var psProcessing; var psEnclosures; try { Init(); cXML = ""; cId = psInputs.GetProperty("Id"); try { psInputs = CallEvent(psInputs, "PreC4Reopen"); } catch(e) { //dont stop execution in case the event is not skripted propertly } psAttachment = GetAttachment(psInputs, cId); psProcessing = oApp.NewPropertySet(); if (psAttachment != null && psAttachment != "") { psUserContext = DetermineUserContext(); psAppContext = DetermineAppContext(psInputs); BuildProcessingGeneral(psInputs, psProcessing); psEnclosures = GetEnclosures(psInputs); cXML = BuildReopen(psAppContext, psUserContext, psAttachment, psProcessing, psEnclosures); cXML=EncodeEntities(cXML); } try { psInputs.SetValue(cXML); psInputs = CallEvent(psInputs, "PostC4Reopen"); cXML = psInputs.GetValue(); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="C4Reopen"; } throw(e); } finally { psAttachment = null; psAppContext = null; psUserContext = null; psProcessing = null; psEnclosures = null; psOutputs.SetValue(cXML); } }

C4 Call Correspondence
CallEvent
function CallEvent(psInputs, cEvent) { var psOutputs; var oBSEvents; try { psOutputs = oApp.NewPropertySet(); oBSEvents = oApp.GetService("C4 Events"); switch (cEvent) { case "PreC4Correspondence": oBSEvents.InvokeMethod("PreC4Correspondence", psInputs, psOutputs); break; case "PostC4Correspondence": oBSEvents.InvokeMethod("PostC4Correspondence", psInputs, psOutputs); break; case "PreC4ReadAttachments": oBSEvents.InvokeMethod("PreC4ReadAttachments", psInputs, psOutputs); break; case "PostC4ReadAttachments": oBSEvents.InvokeMethod("PostC4ReadAttachments", psInputs, psOutputs); break; case "PreC4Reopen": oBSEvents.InvokeMethod("PreC4Reopen", psInputs, psOutputs); break; case "PostC4Reopen": oBSEvents.InvokeMethod("PostC4Reopen", psInputs, psOutputs); break; case "PreCallEAI": oBSEvents.InvokeMethod("PreCallEAI", psInputs, psOutputs); break; case "PostCallEAI": oBSEvents.InvokeMethod("PostCallEAI", psInputs, psOutputs); break; default: //do nothing break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallEvent"; } throw(e); } finally { oBSEvents = null; if (psOutputs == null || psOutputs == "") { return(psInputs); psOutputs = null; } else { return(psOutputs); } } }

C4 Call Correspondence
CallEvent
function CallEvent(psInputs, cEvent) { var psOutputs; var oBSEvents; try { psOutputs = oApp.NewPropertySet(); oBSEvents = oApp.GetService("C4 Events"); switch (cEvent) { case "PreC4Correspondence": oBSEvents.InvokeMethod("PreC4Correspondence", psInputs, psOutputs); break; case "PostC4Correspondence": oBSEvents.InvokeMethod("PostC4Correspondence", psInputs, psOutputs); break; case "PreC4ReadAttachments": oBSEvents.InvokeMethod("PreC4ReadAttachments", psInputs, psOutputs); break; case "PostC4ReadAttachments": oBSEvents.InvokeMethod("PostC4ReadAttachments", psInputs, psOutputs); break; case "PreC4Reopen": oBSEvents.InvokeMethod("PreC4Reopen", psInputs, psOutputs); break; case "PostC4Reopen": oBSEvents.InvokeMethod("PostC4Reopen", psInputs, psOutputs); break; case "PreCallEAI": oBSEvents.InvokeMethod("PreCallEAI", psInputs, psOutputs); break; case "PostCallEAI": oBSEvents.InvokeMethod("PostCallEAI", psInputs, psOutputs); break; default: //do nothing break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallEvent"; } throw(e); } finally { oBSEvents = null; if (psOutputs == null || psOutputs == "") { return(psInputs); psOutputs = null; } else { return(psOutputs); } } }

C4 Call Correspondence
CallSOAPStartWS
function CallSOAPStartWS(cSOAPMessage) { var psInputs; var psOutputs; var oBS; var cSOAPResponse; var cURLEndPoint; var cURL try { if (cDebugMode == "true") { WriteToDisk(cSOAPMessage); } cURLEndPoint = oApp.GetProfileAttr("URL-Endpoint"); if ((cURLEndPoint != null) && (cURLEndPoint != "")) { psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetValue(cSOAPMessage); psInputs.SetProperty("HTTPRequestMethod", "POST"); psInputs.SetProperty("CharSetConversion", "UTF-8"); psInputs.SetProperty("HTTPContentType", "text/xml;charset=UTF-8"); psInputs.SetProperty("HTTPRequestURLTemplate", cURLEndPoint); oBS = oApp.GetService("EAI HTTP Transport"); oBS.InvokeMethod("SendReceive", psInputs, psOutputs); cSOAPResponse = psOutputs.GetValue(); cURL = RetrieveURLfromSOAP(cSOAPResponse); if (cDebugMode == "true") { WriteToDisk(cURL); } } else { // no end point defined } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallSOAPStartWS"; } throw(e); } finally { psInputs = null; psOutputs = null; oBS = null; return(cURL); } }

C4 Call Correspondence
CallSOAPStartWS
function CallSOAPStartWS(cSOAPMessage) { var psInputs; var psOutputs; var oBS; var cSOAPResponse; var cURLEndPoint; var cURL try { if (cDebugMode == "true") { WriteToDisk(cSOAPMessage); } cURLEndPoint = oApp.GetProfileAttr("URL-Endpoint"); if ((cURLEndPoint != null) && (cURLEndPoint != "")) { psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetValue(cSOAPMessage); psInputs.SetProperty("HTTPRequestMethod", "POST"); psInputs.SetProperty("CharSetConversion", "UTF-8"); psInputs.SetProperty("HTTPContentType", "text/xml;charset=UTF-8"); psInputs.SetProperty("HTTPRequestURLTemplate", cURLEndPoint); oBS = oApp.GetService("EAI HTTP Transport"); oBS.InvokeMethod("SendReceive", psInputs, psOutputs); cSOAPResponse = psOutputs.GetValue(); cURL = RetrieveURLfromSOAP(cSOAPResponse); if (cDebugMode == "true") { WriteToDisk(cURL); } } else { // no end point defined } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallSOAPStartWS"; } throw(e); } finally { psInputs = null; psOutputs = null; oBS = null; return(cURL); } }

C4 Call Correspondence
ConvertToXML
function ConvertToXML(psInputs) { var cXML; var psOutputs; var oService; try { cXML = ""; oService = oApp.GetService("XML Converter"); psOutputs = oApp.NewPropertySet(); oService.InvokeMethod("PropSetToXML", psInputs, psOutputs); cXML = psOutputs.GetValue(); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ConvertToXML"; } throw e; } finally { psOutputs = null; oService = null; return(cXML); } }

C4 Call Correspondence
ConvertToXML
function ConvertToXML(psInputs) { var cXML; var psOutputs; var oService; try { cXML = ""; oService = oApp.GetService("XML Converter"); psOutputs = oApp.NewPropertySet(); oService.InvokeMethod("PropSetToXML", psInputs, psOutputs); cXML = psOutputs.GetValue(); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ConvertToXML"; } throw e; } finally { psOutputs = null; oService = null; return(cXML); } }

C4 Call Correspondence
CreateSOAPCall
function CreateSOAPCall(cClientMode, cAdapterURLTech, psStartup) { var psSOAP; var cSOAPMessage; try { psSOAP = CreateSOAPPropertyHierarchy(cClientMode, cAdapterURLTech, psStartup); cSOAPMessage = ConvertToXML(psSOAP); cSOAPMessage = replaceString(cSOAPMessage, "<?Siebel-Property-Set EscapeNames=\"true\"?>", ""); cSOAPMessage = replaceString(cSOAPMessage, "_cln", ":"); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CreateSOAPCall"; } throw(e); } finally { return(cSOAPMessage); } }

C4 Call Correspondence
CreateSOAPCall
function CreateSOAPCall(cClientMode, cAdapterURLTech, psStartup) { var psSOAP; var cSOAPMessage; try { psSOAP = CreateSOAPPropertyHierarchy(cClientMode, cAdapterURLTech, psStartup); cSOAPMessage = ConvertToXML(psSOAP); cSOAPMessage = replaceString(cSOAPMessage, "<?Siebel-Property-Set EscapeNames=\"true\"?>", ""); cSOAPMessage = replaceString(cSOAPMessage, "_cln", ":"); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CreateSOAPCall"; } throw(e); } finally { return(cSOAPMessage); } }

C4 Call Correspondence
CreateSOAPPropertyHierarchy
function CreateSOAPPropertyHierarchy(cClientMode, cAdapterURLTech, psStartup) { var cServiceMode; var psSOAP; var psSOAPHeader; var psSOAPBody; var psStartCorr; var psMode; var psRootStartup; var cSOAPMessage; try { psSOAP = oApp.NewPropertySet(); psSOAP.SetType("soapenv:Envelope"); psSOAP.SetProperty("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/"); psSOAP.SetProperty("xmlns:star","http://legodo.com/startService/"); psSOAPHeader = oApp.NewPropertySet(); psSOAPHeader.SetType("soapenv:Header"); psSOAP.AddChild(psSOAPHeader); psSOAPBody = oApp.NewPropertySet(); psSOAPBody.SetType("soapenv:Body"); psSOAP.AddChild(psSOAPBody); psStartCorr = oApp.NewPropertySet(); psStartCorr.SetType("star:startCorrespondence"); psSOAPBody.AddChild(psStartCorr); switch (cClientMode) { case "correspondence_net": case "correspondence_word": case "net": case "word": cServiceMode = "NET"; break; case "web_correspondence": case "web_correspondence_standard": case "web": cServiceMode = "WEB_BASIC"; break; default: cServiceMode = "NET"; break; } psMode = oApp.NewPropertySet(); psMode.SetType("mode"); psMode.SetValue(cServiceMode); psStartCorr.AddChild(psMode); psRootStartup = oApp.NewPropertySet(); psRootStartup.SetType("startup"); if ((cAdapterURLTech != "") && (cAdapterURLTech != null) && (cAdapterURLTech.toLowerCase() != "off") && (cAdapterURLTech.toLowerCase() != "no")) { psRootStartup.SetProperty("adapterId", cAdapterURLTech); } psStartCorr.AddChild(psRootStartup); psRootStartup.AddChild(psStartup); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CreateSOAPPropertyHierarchy"; } throw(e); } finally { /* psMode = null; psRootStartup= null; psStartCorr = null; psSOAPBody = null; pSOAPHeader = null;*/ return(psSOAP); } }

C4 Call Correspondence
CreateSOAPPropertyHierarchy
function CreateSOAPPropertyHierarchy(cClientMode, cAdapterURLTech, psStartup) { var cServiceMode; var psSOAP; var psSOAPHeader; var psSOAPBody; var psStartCorr; var psMode; var psRootStartup; var cSOAPMessage; try { psSOAP = oApp.NewPropertySet(); psSOAP.SetType("soapenv:Envelope"); psSOAP.SetProperty("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/"); psSOAP.SetProperty("xmlns:star","http://legodo.com/startService/"); psSOAPHeader = oApp.NewPropertySet(); psSOAPHeader.SetType("soapenv:Header"); psSOAP.AddChild(psSOAPHeader); psSOAPBody = oApp.NewPropertySet(); psSOAPBody.SetType("soapenv:Body"); psSOAP.AddChild(psSOAPBody); psStartCorr = oApp.NewPropertySet(); psStartCorr.SetType("star:startCorrespondence"); psSOAPBody.AddChild(psStartCorr); switch (cClientMode) { case "correspondence_net": case "correspondence_word": case "net": case "word": cServiceMode = "NET"; break; case "web_correspondence": case "web_correspondence_standard": case "web": cServiceMode = "WEB_BASIC"; break; default: cServiceMode = "NET"; break; } psMode = oApp.NewPropertySet(); psMode.SetType("mode"); psMode.SetValue(cServiceMode); psStartCorr.AddChild(psMode); psRootStartup = oApp.NewPropertySet(); psRootStartup.SetType("startup"); if ((cAdapterURLTech != "") && (cAdapterURLTech != null) && (cAdapterURLTech.toLowerCase() != "off") && (cAdapterURLTech.toLowerCase() != "no")) { psRootStartup.SetProperty("adapterId", cAdapterURLTech); } psStartCorr.AddChild(psRootStartup); psRootStartup.AddChild(psStartup); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CreateSOAPPropertyHierarchy"; } throw(e); } finally { /* psMode = null; psRootStartup= null; psStartCorr = null; psSOAPBody = null; pSOAPHeader = null;*/ return(psSOAP); } }

C4 Call Correspondence
DecodeEntities
function DecodeEntities(cString) { var cReturn; try { cReturn = cString; cReturn = Demask(cReturn, "&", "&"); cReturn = Demask(cReturn, "'", "'"); cReturn = Demask(cReturn, ">", ">"); cReturn = Demask(cReturn, "<", "<"); cReturn = Demask(cReturn, """, "\""); return(cReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DecodeEntities"; } throw(e); } finally { } }

C4 Call Correspondence
DecodeEntities
function DecodeEntities(cString) { var cReturn; try { cReturn = cString; cReturn = Demask(cReturn, "&", "&"); cReturn = Demask(cReturn, "'", "'"); cReturn = Demask(cReturn, ">", ">"); cReturn = Demask(cReturn, "<", "<"); cReturn = Demask(cReturn, """, "\""); return(cReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DecodeEntities"; } throw(e); } finally { } }

C4 Call Correspondence
Demask
function Demask(cText, cSpecialCharacter, cEncoding) { var iPos; var cDummy; var cDummy2; var cMethod = "Mask"; try { cDummy = ""; iPos = cText.indexOf(cSpecialCharacter) while (iPos!= -1) { cDummy = cDummy + cText.substring(0, iPos)+cEncoding; cText = cText.substring(iPos+cSpecialCharacter.length); iPos = cText.indexOf(cSpecialCharacter); } cDummy = cDummy + cText; cText = cDummy; cDummy = ""; } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Demask"; } throw(e) } finally { return(cText); } }

C4 Call Correspondence
Demask
function Demask(cText, cSpecialCharacter, cEncoding) { var iPos; var cDummy; var cDummy2; var cMethod = "Mask"; try { cDummy = ""; iPos = cText.indexOf(cSpecialCharacter) while (iPos!= -1) { cDummy = cDummy + cText.substring(0, iPos)+cEncoding; cText = cText.substring(iPos+cSpecialCharacter.length); iPos = cText.indexOf(cSpecialCharacter); } cDummy = cDummy + cText; cText = cDummy; cDummy = ""; } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Demask"; } throw(e) } finally { return(cText); } }

C4 Call Correspondence
DetermineAppContext
function DetermineAppContext(psInputs) { var oBO; var cBOName; var cBCName; var cViewName; var psAppContext; try { cViewName = ""; psAppContext = oApp.NewPropertySet(); if (psInputs.PropertyExists("BusObject") && psInputs.PropertyExists("BusComp")) { cBOName = psInputs.GetProperty("BusObject"); cBCName = psInputs.GetProperty("BusComp"); } else { try { oBO = oApp.ActiveBusObject(); cBOName = oBO.Name(); } catch(e) { throw(e); } cBCName = DeterminePrimaryBC(cBOName); } try { if (psInputs.PropertyExists("ViewName")) { cViewName = psInputs.GetProperty("ViewName"); } else { cViewName = oApp.ActiveViewName(); } } catch(e) { //Suppress Error } psAppContext.SetProperty("BO", cBOName); psAppContext.SetProperty("BC", cBCName); psAppContext.SetProperty("View", cViewName); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineAppContext"; } throw(e); } finally { return(psAppContext); } }

C4 Call Correspondence
DetermineAppContext
function DetermineAppContext(psInputs) { var oBO; var cBOName; var cBCName; var cViewName; var psAppContext; try { cViewName = ""; psAppContext = oApp.NewPropertySet(); if (psInputs.PropertyExists("BusObject") && psInputs.PropertyExists("BusComp")) { cBOName = psInputs.GetProperty("BusObject"); cBCName = psInputs.GetProperty("BusComp"); } else { try { oBO = oApp.ActiveBusObject(); cBOName = oBO.Name(); } catch(e) { throw(e); } cBCName = DeterminePrimaryBC(cBOName); } try { if (psInputs.PropertyExists("ViewName")) { cViewName = psInputs.GetProperty("ViewName"); } else { cViewName = oApp.ActiveViewName(); } } catch(e) { //Suppress Error } psAppContext.SetProperty("BO", cBOName); psAppContext.SetProperty("BC", cBCName); psAppContext.SetProperty("View", cViewName); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineAppContext"; } throw(e); } finally { return(psAppContext); } }

C4 Call Correspondence
DetermineDocServerURLEndPoint
function DetermineDocServerURLEndPoint(cServerIP, cServerPort, cDocServerURLEndpoint) { try { if (cDocServerURLEndpoint != null && cDocServerURLEndpoint !="" && cDocServerURLEndpoint != "NOT FOUND") { return(cDocServerURLEndpoint); } else { cDocServerURLEndpoint = "http://"+cServerIP+":"+cServerPort+"/c4DocumentServer/servlet/docEngine"; return(cDocServerURLEndpoint); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineDocServerURLEndPoint"; } throw(e); } finally { } }

C4 Call Correspondence
DetermineDocServerURLEndPoint
function DetermineDocServerURLEndPoint(cServerIP, cServerPort, cDocServerURLEndpoint) { try { if (cDocServerURLEndpoint != null && cDocServerURLEndpoint !="" && cDocServerURLEndpoint != "NOT FOUND") { return(cDocServerURLEndpoint); } else { cDocServerURLEndpoint = "http://"+cServerIP+":"+cServerPort+"/c4DocumentServer/servlet/docEngine"; return(cDocServerURLEndpoint); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineDocServerURLEndPoint"; } throw(e); } finally { } }

C4 Call Correspondence
DeterminePrimaryBC
function DeterminePrimaryBC(cBOName) { var oBORepBO; var oBCRepBO; var cBCName; try { oBORepBO = oApp.GetBusObject("Repository Business Object"); oBCRepBO = oBORepBO.GetBusComp("Repository Business Object"); oBCRepBO.ActivateField("Name"); oBCRepBO.ActivateField("Primary Business Component"); oBCRepBO.ClearToQuery(); oBCRepBO.SetSearchSpec("Name", "'"+cBOName+"'"); oBCRepBO.ExecuteQuery(); if (oBCRepBO.FirstRecord()) { cBCName = oBCRepBO.GetFieldValue("Primary Business Component"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DeterminePrimaryBC"; } throw(e); } finally { oBCRepBO=null; oBORepBO=null; return(cBCName); } }

C4 Call Correspondence
DeterminePrimaryBC
function DeterminePrimaryBC(cBOName) { var oBORepBO; var oBCRepBO; var cBCName; try { oBORepBO = oApp.GetBusObject("Repository Business Object"); oBCRepBO = oBORepBO.GetBusComp("Repository Business Object"); oBCRepBO.ActivateField("Name"); oBCRepBO.ActivateField("Primary Business Component"); oBCRepBO.ClearToQuery(); oBCRepBO.SetSearchSpec("Name", "'"+cBOName+"'"); oBCRepBO.ExecuteQuery(); if (oBCRepBO.FirstRecord()) { cBCName = oBCRepBO.GetFieldValue("Primary Business Component"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DeterminePrimaryBC"; } throw(e); } finally { oBCRepBO=null; oBORepBO=null; return(cBCName); } }

C4 Call Correspondence
DetermineSetting
function DetermineSetting(psInputs, cParameter) { var cValue; try { if (psInputs.PropertyExists(cParameter)) { cValue = psInputs.GetProperty(cParameter).toLowerCase(); } else { cValue = oApp.GetProfileAttr(cParameter); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineSettings"; } throw(e); } finally { return(cValue); } }

C4 Call Correspondence
DetermineSetting
function DetermineSetting(psInputs, cParameter) { var cValue; try { if (psInputs.PropertyExists(cParameter)) { cValue = psInputs.GetProperty(cParameter).toLowerCase(); } else { cValue = oApp.GetProfileAttr(cParameter); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineSettings"; } throw(e); } finally { return(cValue); } }

C4 Call Correspondence
DetermineUserContext
function DetermineUserContext() { var cPosId; var cPos; var cOrgId; var cOrg; var cDivId; var cDiv; var cLoginId; var cLoginName; var oBOPosition; var oBCPosition; var psUserContext; try { psUserContext = oApp.NewPropertySet(); cPosId = oApp.PositionId(); cLoginId = oApp.LoginId(); cLoginName = oApp.LoginName(); oBOPosition = oApp.GetBusObject("Position"); oBCPosition = oBOPosition.GetBusComp("Position"); oBCPosition.ActivateField("Id"); oBCPosition.ActivateField("Name"); oBCPosition.ActivateField("Division Id"); oBCPosition.ActivateField("Division"); oBCPosition.ActivateField("Organization Id"); oBCPosition.ActivateField("Organization"); oBCPosition.ClearToQuery(); oBCPosition.SetSearchSpec("Id", cPosId); oBCPosition.ExecuteQuery(); if (oBCPosition.FirstRecord()) { cPos = oBCPosition.GetFieldValue("Name"); cDivId = oBCPosition.GetFieldValue("Division Id"); cDivId = oBCPosition.GetFieldValue("Division Id"); cDiv = oBCPosition.GetFieldValue("Division"); cOrg = oBCPosition.GetFieldValue("Organization"); cOrgId = oBCPosition.GetFieldValue("Organization Id"); psUserContext.SetProperty("Organization",cOrg); psUserContext.SetProperty("OrganizationID",cOrgId); psUserContext.SetProperty("Division", cDiv); psUserContext.SetProperty("DivisionID", cDivId); psUserContext.SetProperty("Position", cPos); psUserContext.SetProperty("PositionID", cPosId); psUserContext.SetProperty("Login", cLoginName); psUserContext.SetProperty("LoginID", cLoginId); } else { throw(e); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineUserContext"; } throw e; } finally { oBCPosition = null; oBOPosition = null; return(psUserContext); } }

C4 Call Correspondence
DetermineUserContext
function DetermineUserContext() { var cPosId; var cPos; var cOrgId; var cOrg; var cDivId; var cDiv; var cLoginId; var cLoginName; var oBOPosition; var oBCPosition; var psUserContext; try { psUserContext = oApp.NewPropertySet(); cPosId = oApp.PositionId(); cLoginId = oApp.LoginId(); cLoginName = oApp.LoginName(); oBOPosition = oApp.GetBusObject("Position"); oBCPosition = oBOPosition.GetBusComp("Position"); oBCPosition.ActivateField("Id"); oBCPosition.ActivateField("Name"); oBCPosition.ActivateField("Division Id"); oBCPosition.ActivateField("Division"); oBCPosition.ActivateField("Organization Id"); oBCPosition.ActivateField("Organization"); oBCPosition.ClearToQuery(); oBCPosition.SetSearchSpec("Id", cPosId); oBCPosition.ExecuteQuery(); if (oBCPosition.FirstRecord()) { cPos = oBCPosition.GetFieldValue("Name"); cDivId = oBCPosition.GetFieldValue("Division Id"); cDivId = oBCPosition.GetFieldValue("Division Id"); cDiv = oBCPosition.GetFieldValue("Division"); cOrg = oBCPosition.GetFieldValue("Organization"); cOrgId = oBCPosition.GetFieldValue("Organization Id"); psUserContext.SetProperty("Organization",cOrg); psUserContext.SetProperty("OrganizationID",cOrgId); psUserContext.SetProperty("Division", cDiv); psUserContext.SetProperty("DivisionID", cDivId); psUserContext.SetProperty("Position", cPos); psUserContext.SetProperty("PositionID", cPosId); psUserContext.SetProperty("Login", cLoginName); psUserContext.SetProperty("LoginID", cLoginId); } else { throw(e); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="DetermineUserContext"; } throw e; } finally { oBCPosition = null; oBOPosition = null; return(psUserContext); } }

C4 Call Correspondence
EncodeEntities
function EncodeEntities(cXML) { var cReturn; try { cReturn = cXML; cReturn = replaceString(cReturn, "&", "&amp;") cReturn = replaceString(cReturn, "'", "&apos;") cReturn = replaceString(cReturn, ">", "&gt;") cReturn = replaceString(cReturn, "<", "&lt;") cReturn = replaceString(cReturn, """, "&quot;") return(cReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="EncodeEntities"; } throw(e); } finally { } }

C4 Call Correspondence
EncodeEntities
function EncodeEntities(cXML) { var cReturn; try { cReturn = cXML; cReturn = replaceString(cReturn, "&", "&amp;") cReturn = replaceString(cReturn, "'", "&apos;") cReturn = replaceString(cReturn, ">", "&gt;") cReturn = replaceString(cReturn, "<", "&lt;") cReturn = replaceString(cReturn, """, "&quot;") return(cReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="EncodeEntities"; } throw(e); } finally { } }

C4 Call Correspondence
ExtractAttachments
function ExtractAttachments(psIO, cAttachmentName, cType) { var psListOfAttachment; var psParent; var psAttachment; var iCount; var iMax; var cPropName; var cPropValue; var bAttachmentFound; try { bAttachmentFound = true; try { psParent = FindParentOfAttachments(psIO, cAttachmentName); iCount = 0; iMax = psParent.GetChildCount(); } catch(e) { bAttachmentFound = false; //ignore error // error occurs if there are no attachments } if (bAttachmentFound) { while (iCount < iMax) { psAttachment = psParent.GetChild(iCount); AddUsageToAttachment(psAttachment, cType); cPropName = psAttachment.GetFirstProperty(); while (cPropName != null && cPropName != "") { if (cPropName.indexOf("FileExt") != -1) { psAttachment.SetProperty("FileExt", psAttachment.GetProperty(cPropName)); } if (cPropName.indexOf("FileName") != -1) { psAttachment.SetProperty("FileName", psAttachment.GetProperty(cPropName)); } cPropName = psAttachment.GetNextProperty(); } iCount++; } psListOfAttachment = AddDocument(psParent, psIO); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ExtractAttachments"; } throw(e); } finally { psParent = null; psAttachment = null; return(psListOfAttachment); } }

C4 Call Correspondence
ExtractAttachments
function ExtractAttachments(psIO, cAttachmentName, cType) { var psListOfAttachment; var psParent; var psAttachment; var iCount; var iMax; var cPropName; var cPropValue; var bAttachmentFound; try { bAttachmentFound = true; try { psParent = FindParentOfAttachments(psIO, cAttachmentName); iCount = 0; iMax = psParent.GetChildCount(); } catch(e) { bAttachmentFound = false; //ignore error // error occurs if there are no attachments } if (bAttachmentFound) { while (iCount < iMax) { psAttachment = psParent.GetChild(iCount); AddUsageToAttachment(psAttachment, cType); cPropName = psAttachment.GetFirstProperty(); while (cPropName != null && cPropName != "") { if (cPropName.indexOf("FileExt") != -1) { psAttachment.SetProperty("FileExt", psAttachment.GetProperty(cPropName)); } if (cPropName.indexOf("FileName") != -1) { psAttachment.SetProperty("FileName", psAttachment.GetProperty(cPropName)); } cPropName = psAttachment.GetNextProperty(); } iCount++; } psListOfAttachment = AddDocument(psParent, psIO); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ExtractAttachments"; } throw(e); } finally { psParent = null; psAttachment = null; return(psListOfAttachment); } }

C4 Call Correspondence
ExtractBase64String
function ExtractBase64String(cText) { try { cText = cText.substring(cText.indexOf("<Document")); cText = cText.substring(cText.indexOf(">") + 1); cText = cText.substring(0, cText.indexOf("<")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ExtractBase64String"; } throw(e); } finally { return(cText); } }

C4 Call Correspondence
ExtractBase64String
function ExtractBase64String(cText) { try { cText = cText.substring(cText.indexOf("<Document")); cText = cText.substring(cText.indexOf(">") + 1); cText = cText.substring(0, cText.indexOf("<")); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="ExtractBase64String"; } throw(e); } finally { return(cText); } }

C4 Call Correspondence
FilterAttachments
function FilterAttachments(psListOfAttachment, psFilter) { var iCount; var iMax; var cPropName; var cPropValue; var bMatch; var psAttachment; var psFilteredList; var bAttachmentFound; try { bAttachmentFound = true; iCount = 0; try { iMax = psListOfAttachment.GetChildCount(); } catch(e) { bAttachmentFound = false; //ignore error // error occurs if there are no attachments } if (bAttachmentFound) { psFilteredList = oApp.NewPropertySet(); while (iCount < iMax) { psAttachment = psListOfAttachment.GetChild(iCount); bMatch = true; cPropName = psFilter.GetFirstProperty(); while (cPropName != "" && cPropName != null) { if (psAttachment.GetProperty(cPropName).toLowerCase() != psFilter.GetProperty(cPropName).toLowerCase()) { bMatch=false; } cPropName = psFilter.GetNextProperty(); } if (bMatch) { psFilteredList.AddChild(psAttachment); } iCount++; } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="FilterAttachments"; } throw(e); } finally { psAttachment = null; return(psFilteredList); } }

C4 Call Correspondence
FilterAttachments
function FilterAttachments(psListOfAttachment, psFilter) { var iCount; var iMax; var cPropName; var cPropValue; var bMatch; var psAttachment; var psFilteredList; var bAttachmentFound; try { bAttachmentFound = true; iCount = 0; try { iMax = psListOfAttachment.GetChildCount(); } catch(e) { bAttachmentFound = false; //ignore error // error occurs if there are no attachments } if (bAttachmentFound) { psFilteredList = oApp.NewPropertySet(); while (iCount < iMax) { psAttachment = psListOfAttachment.GetChild(iCount); bMatch = true; cPropName = psFilter.GetFirstProperty(); while (cPropName != "" && cPropName != null) { if (psAttachment.GetProperty(cPropName).toLowerCase() != psFilter.GetProperty(cPropName).toLowerCase()) { bMatch=false; } cPropName = psFilter.GetNextProperty(); } if (bMatch) { psFilteredList.AddChild(psAttachment); } iCount++; } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="FilterAttachments"; } throw(e); } finally { psAttachment = null; return(psFilteredList); } }

C4 Call Correspondence
FindParentOfAttachments
function FindParentOfAttachments(psInputs, cType) { var psParent; var iCount; var iMaxOfChild; try { iCount = 0; iMaxOfChild = psInputs.GetChildCount(); while (iCount < iMaxOfChild && psParent == null) { if (psInputs.GetChild(iCount).GetType() == cType) { psParent = psInputs; iCount = iMaxOfChild; } else { psParent = FindParentOfAttachments(psInputs.GetChild(iCount), cType); } iCount = iCount + 1; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="FindParentOfAttachments"; } throw e; } finally { return(psParent); } }

C4 Call Correspondence
FindParentOfAttachments
function FindParentOfAttachments(psInputs, cType) { var psParent; var iCount; var iMaxOfChild; try { iCount = 0; iMaxOfChild = psInputs.GetChildCount(); while (iCount < iMaxOfChild && psParent == null) { if (psInputs.GetChild(iCount).GetType() == cType) { psParent = psInputs; iCount = iMaxOfChild; } else { psParent = FindParentOfAttachments(psInputs.GetChild(iCount), cType); } iCount = iCount + 1; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="FindParentOfAttachments"; } throw e; } finally { return(psParent); } }

C4 Call Correspondence
GetAttachment
function GetAttachment(psInputs, cId) { var psListOfAttachments; var psAttachment; try { psListOfAttachments = GetAttachments(psInputs, cId); if (psListOfAttachments.GetChildCount()>0) { psAttachment = oApp.NewPropertySet(); psAttachment.SetType("reopen"); psAttachment.SetProperty("filename", psListOfAttachments.GetChild(0).GetProperty("FileName")); psAttachment.SetProperty("fileext", psListOfAttachments.GetChild(0).GetProperty("FileExt")); psAttachment.SetValue(psListOfAttachments.GetChild(0).GetValue()); if (psInputs.PropertyExists("Id")) { psAttachment.SetProperty("value", psInputs.GetProperty("Id")); } if (psInputs.PropertyExists("boid")) { psAttachment.SetProperty("boid", psInputs.GetProperty("boid")); } if (psInputs.PropertyExists("propid")) { psAttachment.SetProperty("propid", psInputs.GetProperty("propid")); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetAttachment"; } throw(e); } finally { psListOfAttachments = null; return(psAttachment); } }

C4 Call Correspondence
GetAttachment
function GetAttachment(psInputs, cId) { var psListOfAttachments; var psAttachment; try { psListOfAttachments = GetAttachments(psInputs, cId); if (psListOfAttachments.GetChildCount()>0) { psAttachment = oApp.NewPropertySet(); psAttachment.SetType("reopen"); psAttachment.SetProperty("filename", psListOfAttachments.GetChild(0).GetProperty("FileName")); psAttachment.SetProperty("fileext", psListOfAttachments.GetChild(0).GetProperty("FileExt")); psAttachment.SetValue(psListOfAttachments.GetChild(0).GetValue()); if (psInputs.PropertyExists("Id")) { psAttachment.SetProperty("value", psInputs.GetProperty("Id")); } if (psInputs.PropertyExists("boid")) { psAttachment.SetProperty("boid", psInputs.GetProperty("boid")); } if (psInputs.PropertyExists("propid")) { psAttachment.SetProperty("propid", psInputs.GetProperty("propid")); } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetAttachment"; } throw(e); } finally { psListOfAttachments = null; return(psAttachment); } }

C4 Call Correspondence
GetAttachments
function GetAttachments(psInputs, cId) { var cIntObj; var cAttachmentName; var cFileName; var cFileExt; var psListOfAttachments; var psAddedAttachment; try { cId = psInputs.GetProperty("Id"); cIntObj = psInputs.GetProperty("IntObject"); cAttachmentName = psInputs.GetProperty("IntCompAttachment"); cFileName = ""; cFileExt = ""; if (psInputs.PropertyExists("FileExt")) { cFileExt = psInputs.GetProperty("FileExt"); } else { cFileExt = ""; } if (psInputs.PropertyExists("FileName")) { cFileName = psInputs.GetProperty("FileName"); } else { cFileName = ""; } if (!psInputs.PropertyExists("Base64Stream")) { psListOfAttachments = LoadAttachments(cId, cIntObj, cAttachmentName, psInputs.GetProperty("Usage"), cFileName, cFileExt); } else { psListOfAttachments = oApp.NewPropertySet(); psAddedAttachment = oApp.NewPropertySet(); psAddedAttachment.SetType("Attachment"); psAddedAttachment.SetProperty("FileName", psInputs.GetProperty("FileName")); psAddedAttachment.SetProperty("FileExt", psInputs.GetProperty("FileExt")); AddUsageToAttachment(psAddedAttachment, psInputs.GetProperty("Usage")); psAddedAttachment.SetValue(psInputs.GetProperty("Base64Stream")); psListOfAttachments.AddChild(psAddedAttachment); } try { if (psListOfAttachments.GetChildCount()>0) { psListOfAttachments.SetType("Attachments"); } else { psListOfAttachments.SetType(""); } } catch(e) { psListOfAttachments = oApp.NewPropertySet(); psListOfAttachments.SetType(""); //ignore error // error occurs if there are no attachments } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetAttachments"; } throw(e); } finally { psAddedAttachment = null; return(psListOfAttachments); } }

C4 Call Correspondence
GetAttachments
function GetAttachments(psInputs, cId) { var cIntObj; var cAttachmentName; var cFileName; var cFileExt; var psListOfAttachments; var psAddedAttachment; try { cId = psInputs.GetProperty("Id"); cIntObj = psInputs.GetProperty("IntObject"); cAttachmentName = psInputs.GetProperty("IntCompAttachment"); cFileName = ""; cFileExt = ""; if (psInputs.PropertyExists("FileExt")) { cFileExt = psInputs.GetProperty("FileExt"); } else { cFileExt = ""; } if (psInputs.PropertyExists("FileName")) { cFileName = psInputs.GetProperty("FileName"); } else { cFileName = ""; } if (!psInputs.PropertyExists("Base64Stream")) { psListOfAttachments = LoadAttachments(cId, cIntObj, cAttachmentName, psInputs.GetProperty("Usage"), cFileName, cFileExt); } else { psListOfAttachments = oApp.NewPropertySet(); psAddedAttachment = oApp.NewPropertySet(); psAddedAttachment.SetType("Attachment"); psAddedAttachment.SetProperty("FileName", psInputs.GetProperty("FileName")); psAddedAttachment.SetProperty("FileExt", psInputs.GetProperty("FileExt")); AddUsageToAttachment(psAddedAttachment, psInputs.GetProperty("Usage")); psAddedAttachment.SetValue(psInputs.GetProperty("Base64Stream")); psListOfAttachments.AddChild(psAddedAttachment); } try { if (psListOfAttachments.GetChildCount()>0) { psListOfAttachments.SetType("Attachments"); } else { psListOfAttachments.SetType(""); } } catch(e) { psListOfAttachments = oApp.NewPropertySet(); psListOfAttachments.SetType(""); //ignore error // error occurs if there are no attachments } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetAttachments"; } throw(e); } finally { psAddedAttachment = null; return(psListOfAttachments); } }

C4 Call Correspondence
GetDocument
function GetDocument(psInputs, cContentId) { var iCount; var iMaxOfChild; var cXML; try { iCount = 0; iMaxOfChild = psInputs.GetChildCount(); while (iCount < iMaxOfChild && cXML == null) { if (psInputs.GetChild(iCount).GetProperty("ContentId") == cContentId) { cXML = ConvertToXML(psInputs.GetChild(iCount)); iCount = iMaxOfChild; } else { cXML = GetDocument(psInputs.GetChild(iCount), cContentId); } iCount = iCount + 1; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetDocument"; } throw(e); } finally { return(cXML); } }

C4 Call Correspondence
GetDocument
function GetDocument(psInputs, cContentId) { var iCount; var iMaxOfChild; var cXML; try { iCount = 0; iMaxOfChild = psInputs.GetChildCount(); while (iCount < iMaxOfChild && cXML == null) { if (psInputs.GetChild(iCount).GetProperty("ContentId") == cContentId) { cXML = ConvertToXML(psInputs.GetChild(iCount)); iCount = iMaxOfChild; } else { cXML = GetDocument(psInputs.GetChild(iCount), cContentId); } iCount = iCount + 1; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetDocument"; } throw(e); } finally { return(cXML); } }

C4 Call Correspondence
GetEnclosures
function GetEnclosures(psInputs) { var psEnclosures; var psEnclosure; var psAttachments; var psChild; var cType; var cValue; var iCount; var iMax; try { psAttachments = null; psEnclosures = null; psEnclosure = null; if (psInputs.GetChildCount()>0) { iCount = 0; iMax = psInputs.GetChildCount(); while (iCount<iMax) { psChild = psInputs.GetChild(iCount); cType = psChild.GetType(); if (cType == "Attachments") { psAttachments = psChild; } iCount++; } } if (psAttachments != null && psAttachments.GetChildCount()>0) { iCount = 0; iMax = psAttachments.GetChildCount(); psEnclosures = oApp.NewPropertySet(); psEnclosures.SetType("enclosures"); while (iCount<iMax) { psChild = psAttachments.GetChild(iCount); cType = psChild.GetType(); if (cType == "Attachment") { psEnclosure = oApp.NewPropertySet(); psEnclosure.SetType("enclosure"); psEnclosure.SetProperty("filename", psChild.GetProperty("FileName")); psEnclosure.SetProperty("fileext", psChild.GetProperty("FileExt")); psEnclosure.SetProperty("usage", psChild.GetProperty("Usage")); cValue = psChild.GetValue(); psEnclosure.SetValue(cValue); psEnclosures.AddChild(psEnclosure); } iCount++; } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetEnclosures"; } throw(e); } finally { psEnclosure = null; psAttachments = null; return(psEnclosures); } }

C4 Call Correspondence
GetEnclosures
function GetEnclosures(psInputs) { var psEnclosures; var psEnclosure; var psAttachments; var psChild; var cType; var cValue; var iCount; var iMax; try { psAttachments = null; psEnclosures = null; psEnclosure = null; if (psInputs.GetChildCount()>0) { iCount = 0; iMax = psInputs.GetChildCount(); while (iCount<iMax) { psChild = psInputs.GetChild(iCount); cType = psChild.GetType(); if (cType == "Attachments") { psAttachments = psChild; } iCount++; } } if (psAttachments != null && psAttachments.GetChildCount()>0) { iCount = 0; iMax = psAttachments.GetChildCount(); psEnclosures = oApp.NewPropertySet(); psEnclosures.SetType("enclosures"); while (iCount<iMax) { psChild = psAttachments.GetChild(iCount); cType = psChild.GetType(); if (cType == "Attachment") { psEnclosure = oApp.NewPropertySet(); psEnclosure.SetType("enclosure"); psEnclosure.SetProperty("filename", psChild.GetProperty("FileName")); psEnclosure.SetProperty("fileext", psChild.GetProperty("FileExt")); psEnclosure.SetProperty("usage", psChild.GetProperty("Usage")); cValue = psChild.GetValue(); psEnclosure.SetValue(cValue); psEnclosures.AddChild(psEnclosure); } iCount++; } } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetEnclosures"; } throw(e); } finally { psEnclosure = null; psAttachments = null; return(psEnclosures); } }

C4 Call Correspondence
GetIntegrationObject
function GetIntegrationObject(cIntObject,cIntComp, cId, cFileName, cFileExt) { var oEAIBS; var psInputs; var psOutputs; var cParentIntComp; var cPrefixField; var cSearchExpr; try { oEAIBS = TheApplication().GetService("EAI Siebel Adapter"); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); cParentIntComp = GetLeftString(cIntObject); cPrefixField = GetLeftString(cIntComp); cSearchExpr = "["+cParentIntComp+".Id] = \""+cId+"\""; if (cFileName != null && cFileName != "") { cSearchExpr = cSearchExpr + "AND ["+cIntComp+"."+cPrefixField+"FileName]=\""+cFileName+"\""; } if (cFileExt != null && cFileExt != "") { cSearchExpr = cSearchExpr + "AND (["+cIntComp+"."+cPrefixField+"FileExt]=\""+cFileExt.toLowerCase()+"\" OR ["+cIntComp+"."+cPrefixField+"FileExt]=\""+cFileExt.toUpperCase()+"\")"; } psInputs.SetProperty("OutputIntObjectName", cIntObject); psInputs.SetProperty("SearchSpec", cSearchExpr); oEAIBS.InvokeMethod("Query", psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetIntegrationObject"; } throw(e) } finally { psInputs = null; oEAIBS = null; return(psOutputs); } }

C4 Call Correspondence
GetIntegrationObject
function GetIntegrationObject(cIntObject,cIntComp, cId, cFileName, cFileExt) { var oEAIBS; var psInputs; var psOutputs; var cParentIntComp; var cPrefixField; var cSearchExpr; try { oEAIBS = TheApplication().GetService("EAI Siebel Adapter"); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); cParentIntComp = GetLeftString(cIntObject); cPrefixField = GetLeftString(cIntComp); cSearchExpr = "["+cParentIntComp+".Id] = \""+cId+"\""; if (cFileName != null && cFileName != "") { cSearchExpr = cSearchExpr + "AND ["+cIntComp+"."+cPrefixField+"FileName]=\""+cFileName+"\""; } if (cFileExt != null && cFileExt != "") { cSearchExpr = cSearchExpr + "AND (["+cIntComp+"."+cPrefixField+"FileExt]=\""+cFileExt.toLowerCase()+"\" OR ["+cIntComp+"."+cPrefixField+"FileExt]=\""+cFileExt.toUpperCase()+"\")"; } psInputs.SetProperty("OutputIntObjectName", cIntObject); psInputs.SetProperty("SearchSpec", cSearchExpr); oEAIBS.InvokeMethod("Query", psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetIntegrationObject"; } throw(e) } finally { psInputs = null; oEAIBS = null; return(psOutputs); } }

C4 Call Correspondence
GetLeftString
function GetLeftString(cString) { var cArray; var cLeft; try { cLeft = ""; cArray = cString.split(" "); if (cArray.length>0) { cLeft = cArray[0]; } else { cLeft = ""; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetLeftString"; } throw(e); } finally { return(cLeft); } }

C4 Call Correspondence
GetLeftString
function GetLeftString(cString) { var cArray; var cLeft; try { cLeft = ""; cArray = cString.split(" "); if (cArray.length>0) { cLeft = cArray[0]; } else { cLeft = ""; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetLeftString"; } throw(e); } finally { return(cLeft); } }

C4 Call Correspondence
GetReopenAttachment
function GetReopenAttachment(psInputs, cId) { var cIntObj; var cAttachmentName; var cFileName; var cFileExt; var psListOfAttachments; var psAttachment; var psFilter; try { psAttachment = null; cId = psInputs.GetProperty("Id"); cIntObj = psInputs.GetProperty("IntObject"); cAttachmentName = psInputs.GetProperty("IntCompAttachment"); cFileName = psInputs.GetProperty("FileName"); psListOfAttachments = LoadAttachments(cId, cIntObj, cAttachmentName); psFilter = oApp.NewPropertySet(); psFilter.SetType("Filter"); psFilter.SetProperty("FileName", cFileName); if (psInputs.PropertyExists("FileExt")) { cFileExt = psInputs.GetProperty("FileExt"); psFilter.SetProperty("FileExt", cFileExt); } psListOfAttachments = FilterAttachments(psListOfAttachments, psFilter); if (psListOfAttachments.GetChildCount()>0) { psAttachment = oApp.NewPropertySet(); psAttachment.SetType("reopen"); psAttachment.SetProperty("filename", psListOfAttachments.GetChild(0).GetProperty("FileName")); psAttachment.SetProperty("fileext", psListOfAttachments.GetChild(0).GetProperty("FileExt")); psAttachment.SetValue(psListOfAttachments.GetChild(0).GetValue()); if (psInputs.PropertyExists("Id")) { psAttachment.SetProperty("value", psInputs.GetProperty("Id")); } if (psInputs.PropertyExists("boid")) { psAttachment.SetProperty("boid", psInputs.GetProperty("boid")); } if (psInputs.PropertyExists("propid")) { psAttachment.SetProperty("propid", psInputs.GetProperty("propid")); } } } catch(e) { throw(e); } finally { return(psAttachment); } }

C4 Call Correspondence
GetReopenAttachment
function GetReopenAttachment(psInputs, cId) { var cIntObj; var cAttachmentName; var cFileName; var cFileExt; var psListOfAttachments; var psAttachment; var psFilter; try { psAttachment = null; cId = psInputs.GetProperty("Id"); cIntObj = psInputs.GetProperty("IntObject"); cAttachmentName = psInputs.GetProperty("IntCompAttachment"); cFileName = psInputs.GetProperty("FileName"); psListOfAttachments = LoadAttachments(cId, cIntObj, cAttachmentName); psFilter = oApp.NewPropertySet(); psFilter.SetType("Filter"); psFilter.SetProperty("FileName", cFileName); if (psInputs.PropertyExists("FileExt")) { cFileExt = psInputs.GetProperty("FileExt"); psFilter.SetProperty("FileExt", cFileExt); } psListOfAttachments = FilterAttachments(psListOfAttachments, psFilter); if (psListOfAttachments.GetChildCount()>0) { psAttachment = oApp.NewPropertySet(); psAttachment.SetType("reopen"); psAttachment.SetProperty("filename", psListOfAttachments.GetChild(0).GetProperty("FileName")); psAttachment.SetProperty("fileext", psListOfAttachments.GetChild(0).GetProperty("FileExt")); psAttachment.SetValue(psListOfAttachments.GetChild(0).GetValue()); if (psInputs.PropertyExists("Id")) { psAttachment.SetProperty("value", psInputs.GetProperty("Id")); } if (psInputs.PropertyExists("boid")) { psAttachment.SetProperty("boid", psInputs.GetProperty("boid")); } if (psInputs.PropertyExists("propid")) { psAttachment.SetProperty("propid", psInputs.GetProperty("propid")); } } } catch(e) { throw(e); } finally { return(psAttachment); } }

C4 Call Correspondence
GetSystemPreference
function GetSystemPreference(cName) { try { var oBOPref = oApp.GetBusObject("System Preferences"); var oBCPref = oBOPref.GetBusComp ("System Preferences"); var cValue = ""; oBCPref.ActivateField("Value"); oBCPref.ActivateField("Name"); oBCPref.ClearToQuery(); oBCPref.SetSearchSpec("Name", cName); oBCPref.ExecuteQuery(); if (oBCPref.FirstRecord()) { cValue = oBCPref.GetFieldValue("Value"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetSystemPreference"; } throw e; } finally { oBCPref = null; oBOPref = null; return(cValue); } }

C4 Call Correspondence
GetSystemPreference
function GetSystemPreference(cName) { try { var oBOPref = oApp.GetBusObject("System Preferences"); var oBCPref = oBOPref.GetBusComp ("System Preferences"); var cValue = ""; oBCPref.ActivateField("Value"); oBCPref.ActivateField("Name"); oBCPref.ClearToQuery(); oBCPref.SetSearchSpec("Name", cName); oBCPref.ExecuteQuery(); if (oBCPref.FirstRecord()) { cValue = oBCPref.GetFieldValue("Value"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetSystemPreference"; } throw e; } finally { oBCPref = null; oBOPref = null; return(cValue); } }

C4 Call Correspondence
GetUniqueID
function GetUniqueID() { var cString; var oDate; var cDay; var cMonth; var cYear; var cHour; var cMinutes; var cSeconds; var cMilliSeconds; var cRandom; var cTimeStamp; try { cTimeStamp = ""; cRandom = Math.round(Math.random()*1000); oDate = new Date; cDay = oDate.getDate(); if (ToInt32(cDay)<10) { cDay = "0"+ToString(cDay); } cMonth = ToInt32(oDate.getMonth())+1; if (ToInt32(cMonth)<10) { cMonth = "0"+ToString(cMonth); } cYear = oDate.getFullYear(); cHour = oDate.getHours(); if (ToInt32(cHour)<10) { cHour = "0"+ToString(cHour); } cMinutes = oDate.getMinutes(); if (ToInt32(cMinutes)<10) { cMinutes = "0"+ToString(cMinutes); } cSeconds = oDate.getSeconds(); if (ToInt32(cSeconds)<10) { cSeconds = "0"+ToString(cSeconds); } cMilliSeconds = oDate.getMilliseconds(); cTimeStamp = ToString(cRandom)+ToString(cHour)+ToString(cMinutes)+ToString(cSeconds)+ToString(cMilliSeconds)+ToString(cDay)+ToString(cMonth)+ToString(cYear); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetUniqueID"; } throw(e) } finally { oDate = null; return(cTimeStamp); } }

C4 Call Correspondence
GetUniqueID
function GetUniqueID() { var cString; var oDate; var cDay; var cMonth; var cYear; var cHour; var cMinutes; var cSeconds; var cMilliSeconds; var cRandom; var cTimeStamp; try { cTimeStamp = ""; cRandom = Math.round(Math.random()*1000); oDate = new Date; cDay = oDate.getDate(); if (ToInt32(cDay)<10) { cDay = "0"+ToString(cDay); } cMonth = ToInt32(oDate.getMonth())+1; if (ToInt32(cMonth)<10) { cMonth = "0"+ToString(cMonth); } cYear = oDate.getFullYear(); cHour = oDate.getHours(); if (ToInt32(cHour)<10) { cHour = "0"+ToString(cHour); } cMinutes = oDate.getMinutes(); if (ToInt32(cMinutes)<10) { cMinutes = "0"+ToString(cMinutes); } cSeconds = oDate.getSeconds(); if (ToInt32(cSeconds)<10) { cSeconds = "0"+ToString(cSeconds); } cMilliSeconds = oDate.getMilliseconds(); cTimeStamp = ToString(cRandom)+ToString(cHour)+ToString(cMinutes)+ToString(cSeconds)+ToString(cMilliSeconds)+ToString(cDay)+ToString(cMonth)+ToString(cYear); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="GetUniqueID"; } throw(e) } finally { oDate = null; return(cTimeStamp); } }

C4 Call Correspondence
Init
function Init() { try { oApp = TheApplication(); if (oApp.GetProfileAttr("c4ServerVersion") == null || oApp.GetProfileAttr("c4ServerVersion") == "") { c4ServerVersion = LIC2DESC("C4_PARAMETER", "Server Version"); if (c4ServerVersion != "NOT FOUND") { c4ClientVersion = LIC2DESC("C4_PARAMETER", "Client Version"); cSysId = LIC2DESC("C4_PARAMETER", "System ID"); cServerPort = LIC2DESC("C4_PARAMETER", "Server Port"); cClientPort = LIC2DESC("C4_PARAMETER", "Client Port"); cServerIP = LIC2DESC("C4_PARAMETER", "Server IP"); cClientIP = LIC2DESC("C4_PARAMETER", "Client IP"); cDefaultClientMode = LIC2DESC("C4_PARAMETER", "ClientMode"); cDefaultCallTech = LIC2DESC("C4_PARAMETER", "CallTech"); cDefaultAdapterURL = LIC2DESC("C4_PARAMETER", "AdapterURLTech"); cDefaultURLEndpoint = LIC2DESC("C4_PARAMETER", "URL-Endpoint"); cDocServerURLEndpoint = LIC2DESC("C4_PARAMETER", "DocSrv-Endpoint"); cAppSrvProtocol = LIC2DESC("C4_PARAMETER", "AppSrv-Protocol"); } else { c4ServerVersion = GetSystemPreference("C4 Server Version"); c4ClientVersion = GetSystemPreference("C4 Client Version"); cSysId = GetSystemPreference("C4 System ID"); cServerPort = GetSystemPreference("C4 Server Port"); cClientPort = GetSystemPreference("C4 Client Port"); cServerIP = GetSystemPreference("C4 Server IP"); cClientIP = GetSystemPreference("C4 Client IP"); cDefaultClientMode = GetSystemPreference("ClientMode"); cDefaultCallTech = GetSystemPreference("CallTech"); cDefaultAdapterURL = GetSystemPreference("AdapterURLTech"); cDefaultURLEndpoint = GetSystemPreference("URL-Endpoint"); cDocServerURLEndpoint = GetSystemPreference("DocSrv-Endpoint"); cAppSrvProtocol = GetSystemPreference("AppSrv-Protocol"); } oApp.SetProfileAttr("c4ServerVersion", c4ServerVersion); oApp.SetProfileAttr("c4ClientVersion", c4ClientVersion); oApp.SetProfileAttr("SysId", cSysId); oApp.SetProfileAttr("ServerPort", cServerPort); oApp.SetProfileAttr("ClientPort", cClientPort); oApp.SetProfileAttr("ServerIP", cServerIP); oApp.SetProfileAttr("ClientIP", cClientIP); oApp.SetProfileAttr("ClientMode", cDefaultClientMode.toLowerCase()); oApp.SetProfileAttr("CallTech", cDefaultCallTech.toLowerCase()); oApp.SetProfileAttr("AdapterURLTech", cDefaultAdapterURL.toLowerCase()); oApp.SetProfileAttr("URL-Endpoint", cDefaultURLEndpoint); cDocServerURLEndpoint = DetermineDocServerURLEndPoint(cServerIP, cServerPort, cDocServerURLEndpoint); oApp.SetProfileAttr("DocSrv-Endpoint", cDocServerURLEndpoint); if (cAppSrvProtocol != null && cAppSrvProtocol != "" && cAppSrvProtocol != "NOT FOUND") { oApp.SetProfileAttr("AppSrv-Protocol", cAppSrvProtocol.toLowerCase()); } else { oApp.SetProfileAttr("AppSrv-Protocol", "http"); } } else { c4ServerVersion = oApp.GetProfileAttr("c4ServerVersion"); c4ClientVersion = oApp.GetProfileAttr("c4ClientVersion"); cSysId = oApp.GetProfileAttr("SysId"); cServerPort = oApp.GetProfileAttr("ServerPort"); cClientPort = oApp.GetProfileAttr("ClientPort"); cServerIP = oApp.GetProfileAttr("ServerIP"); cClientIP = oApp.GetProfileAttr("ClientIP"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Init"; } throw(e); } finally { } }

C4 Call Correspondence
Init
function Init() { try { oApp = TheApplication(); if (oApp.GetProfileAttr("c4ServerVersion") == null || oApp.GetProfileAttr("c4ServerVersion") == "") { c4ServerVersion = LIC2DESC("C4_PARAMETER", "Server Version"); if (c4ServerVersion != "NOT FOUND") { c4ClientVersion = LIC2DESC("C4_PARAMETER", "Client Version"); cSysId = LIC2DESC("C4_PARAMETER", "System ID"); cServerPort = LIC2DESC("C4_PARAMETER", "Server Port"); cClientPort = LIC2DESC("C4_PARAMETER", "Client Port"); cServerIP = LIC2DESC("C4_PARAMETER", "Server IP"); cClientIP = LIC2DESC("C4_PARAMETER", "Client IP"); cDefaultClientMode = LIC2DESC("C4_PARAMETER", "ClientMode"); cDefaultCallTech = LIC2DESC("C4_PARAMETER", "CallTech"); cDefaultAdapterURL = LIC2DESC("C4_PARAMETER", "AdapterURLTech"); cDefaultURLEndpoint = LIC2DESC("C4_PARAMETER", "URL-Endpoint"); cDocServerURLEndpoint = LIC2DESC("C4_PARAMETER", "DocSrv-Endpoint"); cAppSrvProtocol = LIC2DESC("C4_PARAMETER", "AppSrv-Protocol"); } else { c4ServerVersion = GetSystemPreference("C4 Server Version"); c4ClientVersion = GetSystemPreference("C4 Client Version"); cSysId = GetSystemPreference("C4 System ID"); cServerPort = GetSystemPreference("C4 Server Port"); cClientPort = GetSystemPreference("C4 Client Port"); cServerIP = GetSystemPreference("C4 Server IP"); cClientIP = GetSystemPreference("C4 Client IP"); cDefaultClientMode = GetSystemPreference("ClientMode"); cDefaultCallTech = GetSystemPreference("CallTech"); cDefaultAdapterURL = GetSystemPreference("AdapterURLTech"); cDefaultURLEndpoint = GetSystemPreference("URL-Endpoint"); cDocServerURLEndpoint = GetSystemPreference("DocSrv-Endpoint"); cAppSrvProtocol = GetSystemPreference("AppSrv-Protocol"); } oApp.SetProfileAttr("c4ServerVersion", c4ServerVersion); oApp.SetProfileAttr("c4ClientVersion", c4ClientVersion); oApp.SetProfileAttr("SysId", cSysId); oApp.SetProfileAttr("ServerPort", cServerPort); oApp.SetProfileAttr("ClientPort", cClientPort); oApp.SetProfileAttr("ServerIP", cServerIP); oApp.SetProfileAttr("ClientIP", cClientIP); oApp.SetProfileAttr("ClientMode", cDefaultClientMode.toLowerCase()); oApp.SetProfileAttr("CallTech", cDefaultCallTech.toLowerCase()); oApp.SetProfileAttr("AdapterURLTech", cDefaultAdapterURL.toLowerCase()); oApp.SetProfileAttr("URL-Endpoint", cDefaultURLEndpoint); cDocServerURLEndpoint = DetermineDocServerURLEndPoint(cServerIP, cServerPort, cDocServerURLEndpoint); oApp.SetProfileAttr("DocSrv-Endpoint", cDocServerURLEndpoint); if (cAppSrvProtocol != null && cAppSrvProtocol != "" && cAppSrvProtocol != "NOT FOUND") { oApp.SetProfileAttr("AppSrv-Protocol", cAppSrvProtocol.toLowerCase()); } else { oApp.SetProfileAttr("AppSrv-Protocol", "http"); } } else { c4ServerVersion = oApp.GetProfileAttr("c4ServerVersion"); c4ClientVersion = oApp.GetProfileAttr("c4ClientVersion"); cSysId = oApp.GetProfileAttr("SysId"); cServerPort = oApp.GetProfileAttr("ServerPort"); cClientPort = oApp.GetProfileAttr("ClientPort"); cServerIP = oApp.GetProfileAttr("ServerIP"); cClientIP = oApp.GetProfileAttr("ClientIP"); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Init"; } throw(e); } finally { } }

C4 Call Correspondence
LIC2DESC
function LIC2DESC(cType, cName) { try { var cLang = oApp.InvokeMethod("LANGUAGE"); var cValue = ""; var boLOV = oApp.GetBusObject("List Of Values"); var bcLOV = boLOV.GetBusComp("List Of Values"); if (cType != null && cType.length > 0 && cName != null && cName.length > 0) { with (bcLOV) { ActivateField ("Type"); ActivateField ("Value"); ActivateField ("Name"); ActivateField ("Active"); ActivateField ("Language"); ActivateField ("Description"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec ("Type", cType); SetSearchSpec ("Name", cName); SetSearchSpec ("Active", "Y"); SetSearchSpec ("Language", cLang); ExecuteQuery(); if (FirstRecord()) { cValue = GetFieldValue("Description"); }//end if else { ClearToQuery(); SetSearchSpec ("Type", cType); SetSearchSpec ("Name", cName); // SetSearchSpec ("Active", "Y"); SetSearchSpec ("Language", cLang); ExecuteQuery(); if (FirstRecord()) { cValue = GetFieldValue("Description"); } else { cValue = "NOT FOUND"; } } }// end with (bcLOV) }//end if }// end try catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="LIC2DESC"; } throw e; } finally { bcLOV = null; boLOV = null; return(cValue); }//end finally }

C4 Call Correspondence
LIC2DESC
function LIC2DESC(cType, cName) { try { var cLang = oApp.InvokeMethod("LANGUAGE"); var cValue = ""; var boLOV = oApp.GetBusObject("List Of Values"); var bcLOV = boLOV.GetBusComp("List Of Values"); if (cType != null && cType.length > 0 && cName != null && cName.length > 0) { with (bcLOV) { ActivateField ("Type"); ActivateField ("Value"); ActivateField ("Name"); ActivateField ("Active"); ActivateField ("Language"); ActivateField ("Description"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec ("Type", cType); SetSearchSpec ("Name", cName); SetSearchSpec ("Active", "Y"); SetSearchSpec ("Language", cLang); ExecuteQuery(); if (FirstRecord()) { cValue = GetFieldValue("Description"); }//end if else { ClearToQuery(); SetSearchSpec ("Type", cType); SetSearchSpec ("Name", cName); // SetSearchSpec ("Active", "Y"); SetSearchSpec ("Language", cLang); ExecuteQuery(); if (FirstRecord()) { cValue = GetFieldValue("Description"); } else { cValue = "NOT FOUND"; } } }// end with (bcLOV) }//end if }// end try catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="LIC2DESC"; } throw e; } finally { bcLOV = null; boLOV = null; return(cValue); }//end finally }

C4 Call Correspondence
LoadAttachments
function LoadAttachments(cId, cIntObj, cAttachmentName, cType, cFileName, cFileExt) { var psIO; var psListOfAttachment; try { psIO = GetIntegrationObject(cIntObj, cAttachmentName, cId, cFileName, cFileExt); psListOfAttachment = ExtractAttachments(psIO, cAttachmentName, cType); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="LoadAttachments"; } throw(e); } finally { psIO = null; return(psListOfAttachment); } }

C4 Call Correspondence
LoadAttachments
function LoadAttachments(cId, cIntObj, cAttachmentName, cType, cFileName, cFileExt) { var psIO; var psListOfAttachment; try { psIO = GetIntegrationObject(cIntObj, cAttachmentName, cId, cFileName, cFileExt); psListOfAttachment = ExtractAttachments(psIO, cAttachmentName, cType); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="LoadAttachments"; } throw(e); } finally { psIO = null; return(psListOfAttachment); } }

C4 Call Correspondence
RetrieveURLfromSOAP
function RetrieveURLfromSOAP(cSOAPResponse) { var cURL; var iStart; var iEnd; try { cURL = ""; iStart = cSOAPResponse.indexOf("<url>"); iEnd = cSOAPResponse.indexOf("</url>"); if ((iStart != 0) && (iEnd != 0)) { cURL = cSOAPResponse.substring((iStart+5),iEnd); cURL = DecodeEntities(cURL); } else { cURL = ""; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="RetrieveURLfromSOAP"; } throw(e); } finally { return(cURL); } }

C4 Call Correspondence
RetrieveURLfromSOAP
function RetrieveURLfromSOAP(cSOAPResponse) { var cURL; var iStart; var iEnd; try { cURL = ""; iStart = cSOAPResponse.indexOf("<url>"); iEnd = cSOAPResponse.indexOf("</url>"); if ((iStart != 0) && (iEnd != 0)) { cURL = cSOAPResponse.substring((iStart+5),iEnd); cURL = DecodeEntities(cURL); } else { cURL = ""; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="RetrieveURLfromSOAP"; } throw(e); } finally { return(cURL); } }

C4 Call Correspondence
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "C4Correspondence": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4Reopen": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4ReadAttachments": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4BuildBusObj": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4BuildRelation": iReturn = CancelOperation; CanInvoke = "TRUE"; break; default: iReturn = ContinueOperation; CanInvoke = "FALSE"; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 Call Correspondence
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "C4Correspondence": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4Reopen": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4ReadAttachments": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4BuildBusObj": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4BuildRelation": iReturn = CancelOperation; CanInvoke = "TRUE"; break; default: iReturn = ContinueOperation; CanInvoke = "FALSE"; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 Call Correspondence
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; oApp = TheApplication(); switch(MethodName) { case "C4Correspondence": iReturn = CancelOperation; C4Correspondence(Inputs, Outputs); break; case "GetSystemPreference": iReturn = CancelOperation; var cName; var cValue; cName = Inputs.GetProperty("Name"); cValue = GetSystemPreference(cName); Outputs.SetValue(cValue); break; case "GetCurrentPosition": iReturn = CancelOperation; var sPosition; var cPos; cPos = Inputs.GetProperty("Name"); sPosition = TheApplication().PositionName(); Outputs.SetValue(sPosition); break; case "C4Reopen": iReturn = CancelOperation; C4Reopen(Inputs, Outputs); break; case "C4ReadAttachments": iReturn = CancelOperation; C4ReadAttachments(Inputs, Outputs); break; case "C4BuildBusObj": iReturn = CancelOperation; C4BuildBusObj(Inputs, Outputs); break; case "C4BuildRelation": iReturn = CancelOperation; C4BuildRelation(Inputs, Outputs); break; } if (cErrorCode != "" && cErrorCode != null) { Outputs.SetProperty("ErrorMessage", cErrorCode + " " + cErrorText + " method:" + cErrorMethod); } else { Outputs.SetProperty("ErrorMessage", ""); } return (iReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Service_PreInvokeMethod"; } throw(e); } finally { cErrorCode=""; cErrorText=""; cErrorMethod=""; } }

C4 Call Correspondence
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; oApp = TheApplication(); switch(MethodName) { case "C4Correspondence": iReturn = CancelOperation; C4Correspondence(Inputs, Outputs); break; case "GetSystemPreference": iReturn = CancelOperation; var cName; var cValue; cName = Inputs.GetProperty("Name"); cValue = GetSystemPreference(cName); Outputs.SetValue(cValue); break; case "GetCurrentPosition": iReturn = CancelOperation; var sPosition; var cPos; cPos = Inputs.GetProperty("Name"); sPosition = TheApplication().PositionName(); Outputs.SetValue(sPosition); break; case "C4Reopen": iReturn = CancelOperation; C4Reopen(Inputs, Outputs); break; case "C4ReadAttachments": iReturn = CancelOperation; C4ReadAttachments(Inputs, Outputs); break; case "C4BuildBusObj": iReturn = CancelOperation; C4BuildBusObj(Inputs, Outputs); break; case "C4BuildRelation": iReturn = CancelOperation; C4BuildRelation(Inputs, Outputs); break; } if (cErrorCode != "" && cErrorCode != null) { Outputs.SetProperty("ErrorMessage", cErrorCode + " " + cErrorText + " method:" + cErrorMethod); } else { Outputs.SetProperty("ErrorMessage", ""); } return (iReturn); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Service_PreInvokeMethod"; } throw(e); } finally { cErrorCode=""; cErrorText=""; cErrorMethod=""; } }

C4 Call Correspondence
SetEditorAndModus
function SetEditorAndModus(psInputs, psProcessing) { var cEditor; var psModus; var psEditor; try { psModus = oApp.NewPropertySet(); psModus.SetType("modus"); if (psInputs.PropertyExists("Modus")) { if (psInputs.GetProperty("Modus").toLowerCase()!="local") { cModus = "central"; } else { cModus = "local"; } } else { cModus = "local"; } psModus.SetValue(cModus); psProcessing.AddChild(psModus); psEditor = oApp.NewPropertySet(); psEditor.SetType("editor"); if (psInputs.PropertyExists("Editor") && cModus=="local") { if (psInputs.GetProperty("Editor").toLowerCase()!="false") { cEditor = "true"; } else { cEditor = "false"; } } else { if (cModus=="local") { cEditor = "true"; } else { cEditor = "false"; } } psEditor.SetValue(cEditor); psProcessing.AddChild(psEditor); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="SetEditorAndModus"; } throw(e); } finally { psModus = null; psEditor = null; } }

C4 Call Correspondence
SetEditorAndModus
function SetEditorAndModus(psInputs, psProcessing) { var cEditor; var psModus; var psEditor; try { psModus = oApp.NewPropertySet(); psModus.SetType("modus"); if (psInputs.PropertyExists("Modus")) { if (psInputs.GetProperty("Modus").toLowerCase()!="local") { cModus = "central"; } else { cModus = "local"; } } else { cModus = "local"; } psModus.SetValue(cModus); psProcessing.AddChild(psModus); psEditor = oApp.NewPropertySet(); psEditor.SetType("editor"); if (psInputs.PropertyExists("Editor") && cModus=="local") { if (psInputs.GetProperty("Editor").toLowerCase()!="false") { cEditor = "true"; } else { cEditor = "false"; } } else { if (cModus=="local") { cEditor = "true"; } else { cEditor = "false"; } } psEditor.SetValue(cEditor); psProcessing.AddChild(psEditor); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="SetEditorAndModus"; } throw(e); } finally { psModus = null; psEditor = null; } }

C4 Call Correspondence
SubmitXML
function SubmitXML(cXML) { var psInputs; var psOutputs; var oBS; try { if (cDebugMode == "true") { WriteToDisk(cXML); } // cXML = "comrequest=\""+cXML+"\""; psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetValue(cXML); psInputs.SetProperty("HTTPRequestMethod", "POST"); psInputs.SetProperty("CharSetConversion", "UTF-8"); // psInputs.SetProperty("HTTPRequestURLTemplate", "http://"+cServerIP+":"+cServerPort+"/c4DocumentServer/servlet/docEngine"); psInputs.SetProperty("HTTPRequestURLTemplate", oApp.GetProfileAttr("DocSrv-Endpoint")); oBS = oApp.GetService("EAI HTTP Transport"); oBS.InvokeMethod("Send", psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="SubmitXML"; } throw(e); } finally { psInputs = null; psOutputs = null; oBS = null; } }

C4 Call Correspondence
SubmitXML
function SubmitXML(cXML) { var psInputs; var psOutputs; var oBS; try { if (cDebugMode == "true") { WriteToDisk(cXML); } // cXML = "comrequest=\""+cXML+"\""; psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetValue(cXML); psInputs.SetProperty("HTTPRequestMethod", "POST"); psInputs.SetProperty("CharSetConversion", "UTF-8"); // psInputs.SetProperty("HTTPRequestURLTemplate", "http://"+cServerIP+":"+cServerPort+"/c4DocumentServer/servlet/docEngine"); psInputs.SetProperty("HTTPRequestURLTemplate", oApp.GetProfileAttr("DocSrv-Endpoint")); oBS = oApp.GetService("EAI HTTP Transport"); oBS.InvokeMethod("Send", psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="SubmitXML"; } throw(e); } finally { psInputs = null; psOutputs = null; oBS = null; } }

C4 Call Correspondence
WriteToDisk
function WriteToDisk(cXML) { var psInputs; var psOutputs; var oService; try { psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); if (cTempPath != "" && cTempPath != null) { psInputs.SetValue(cXML); psInputs.SetProperty("FileName", cTempPath+"Temp.xml"); oService = TheApplication().GetService("EAI File Transport"); oService.InvokeMethod("Send", psInputs, psOutputs); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="WriteToDisk"; } throw(e); } finally { oService = null; psInputs = null; psOutputs = null; } }

C4 Call Correspondence
WriteToDisk
function WriteToDisk(cXML) { var psInputs; var psOutputs; var oService; try { psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); if (cTempPath != "" && cTempPath != null) { psInputs.SetValue(cXML); psInputs.SetProperty("FileName", cTempPath+"Temp.xml"); oService = TheApplication().GetService("EAI File Transport"); oService.InvokeMethod("Send", psInputs, psOutputs); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="WriteToDisk"; } throw(e); } finally { oService = null; psInputs = null; psOutputs = null; } }

C4 Call Correspondence
replaceString
function replaceString(cText, cSpecialCharacter, cEncoding) { var iPos; var cDummy; var cDummy2; var cMethod = "Mask"; try { cDummy = ""; while (cText.indexOf(cSpecialCharacter)!= -1) { iPos = cText.indexOf(cSpecialCharacter); if (iPos != cText.indexOf(cEncoding)) { cDummy = cDummy + cText.substring(0, iPos)+cEncoding; cText = cText.substring(iPos+cSpecialCharacter.length); } else { cDummy = cDummy + cText.substring(0, iPos + cEncoding.length); cText = cText.substring(iPos+cEncoding.length); } } cDummy = cDummy + cText; cText = cDummy; cDummy = ""; } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="replaceString"; } throw(e) } finally { return(cText); } }

C4 Call Correspondence
replaceString
function replaceString(cText, cSpecialCharacter, cEncoding) { var iPos; var cDummy; var cDummy2; var cMethod = "Mask"; try { cDummy = ""; while (cText.indexOf(cSpecialCharacter)!= -1) { iPos = cText.indexOf(cSpecialCharacter); if (iPos != cText.indexOf(cEncoding)) { cDummy = cDummy + cText.substring(0, iPos)+cEncoding; cText = cText.substring(iPos+cSpecialCharacter.length); } else { cDummy = cDummy + cText.substring(0, iPos + cEncoding.length); cText = cText.substring(iPos+cEncoding.length); } } cDummy = cDummy + cText; cText = cDummy; cDummy = ""; } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="replaceString"; } throw(e) } finally { return(cText); } }

C4 EAI Service
(declarations)
var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 EAI Service
(declarations)
var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 EAI Service
CallEAI
function CallEAI(psInputs, psOutputs) { var cXML; var psXML; var psSiebelMessage; var psResult; var cMethodName; var oBSEAIXMLConverter; var oBSSiebelAdapter; var cReturnCode; try { try { psInputs = CallEvent(psInputs, "PreCallEAI"); } catch(e) { //dont stop execution in case the event is not skripted propertly } cReturnCode = "OK"; cXML = psInputs.GetValue(); psXML = TheApplication().NewPropertySet(); psXML.SetValue(cXML); psXML = SetEncoding(psXML); psSiebelMessage = TheApplication().NewPropertySet(); psResult = TheApplication().NewPropertySet(); oBSEAIXMLConverter = TheApplication().GetService("EAI XML Converter"); oBSEAIXMLConverter.InvokeMethod("XMLDocToIntObjHier", psXML, psSiebelMessage); if (psInputs.PropertyExists("Siebel EAI Method")) { cMethodName = psInputs.GetProperty("Siebel EAI Method"); } else { cMethodName = "Upsert"; } oBSSiebelAdapter = TheApplication().GetService("EAI Siebel Adapter"); oBSSiebelAdapter.InvokeMethod(cMethodName, psSiebelMessage, psResult); try { psInputs = CallEvent(psInputs, "PostCallEAI"); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { throw(e); cReturnCode = "NOK"; } finally { psXML = null; psSiebelMessage = null; psResult = null; oBSEAIXMLConverter = null; oBSSiebelAdapter = null; psOutputs.SetValue(cReturnCode); } }

C4 EAI Service
CallEAI
function CallEAI(psInputs, psOutputs) { var cXML; var psXML; var psSiebelMessage; var psResult; var cMethodName; var oBSEAIXMLConverter; var oBSSiebelAdapter; var cReturnCode; try { try { psInputs = CallEvent(psInputs, "PreCallEAI"); } catch(e) { //dont stop execution in case the event is not skripted propertly } cReturnCode = "OK"; cXML = psInputs.GetValue(); psXML = TheApplication().NewPropertySet(); psXML.SetValue(cXML); psXML = SetEncoding(psXML); psSiebelMessage = TheApplication().NewPropertySet(); psResult = TheApplication().NewPropertySet(); oBSEAIXMLConverter = TheApplication().GetService("EAI XML Converter"); oBSEAIXMLConverter.InvokeMethod("XMLDocToIntObjHier", psXML, psSiebelMessage); if (psInputs.PropertyExists("Siebel EAI Method")) { cMethodName = psInputs.GetProperty("Siebel EAI Method"); } else { cMethodName = "Upsert"; } oBSSiebelAdapter = TheApplication().GetService("EAI Siebel Adapter"); oBSSiebelAdapter.InvokeMethod(cMethodName, psSiebelMessage, psResult); try { psInputs = CallEvent(psInputs, "PostCallEAI"); } catch(e) { //dont stop execution in case the event is not skripted propertly } } catch(e) { throw(e); cReturnCode = "NOK"; } finally { psXML = null; psSiebelMessage = null; psResult = null; oBSEAIXMLConverter = null; oBSSiebelAdapter = null; psOutputs.SetValue(cReturnCode); } }

C4 EAI Service
CallEvent
function CallEvent(psInputs, cEvent) { var psOutputs; var oBSEvents; try { psOutputs = TheApplication().NewPropertySet(); oBSEvents = TheApplication().GetService("C4 Events"); switch (cEvent) { case "PreC4Correspondence": oBSEvents.InvokeMethod("PreC4Correspondence", psInputs, psOutputs); break; case "PostC4Correspondence": oBSEvents.InvokeMethod("PostC4Correspondence", psInputs, psOutputs); break; case "PreC4ReadAttachments": oBSEvents.InvokeMethod("PreC4ReadAttachments", psInputs, psOutputs); break; case "PostC4ReadAttachments": oBSEvents.InvokeMethod("PostC4ReadAttachments", psInputs, psOutputs); break; case "PreC4Reopen": oBSEvents.InvokeMethod("PreC4Reopen", psInputs, psOutputs); break; case "PostC4Reopen": oBSEvents.InvokeMethod("PostC4Reopen", psInputs, psOutputs); break; case "PreCallEAI": oBSEvents.InvokeMethod("PreCallEAI", psInputs, psOutputs); break; case "PostCallEAI": oBSEvents.InvokeMethod("PostCallEAI", psInputs, psOutputs); break; default: //do nothing break; } if (psOutputs == null || psOutputs == "") { return(psInputs); psOutputs = null; } else { return(psOutputs); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallEvent"; } throw(e); } finally { oBSEvents = null; } }

C4 EAI Service
CallEvent
function CallEvent(psInputs, cEvent) { var psOutputs; var oBSEvents; try { psOutputs = TheApplication().NewPropertySet(); oBSEvents = TheApplication().GetService("C4 Events"); switch (cEvent) { case "PreC4Correspondence": oBSEvents.InvokeMethod("PreC4Correspondence", psInputs, psOutputs); break; case "PostC4Correspondence": oBSEvents.InvokeMethod("PostC4Correspondence", psInputs, psOutputs); break; case "PreC4ReadAttachments": oBSEvents.InvokeMethod("PreC4ReadAttachments", psInputs, psOutputs); break; case "PostC4ReadAttachments": oBSEvents.InvokeMethod("PostC4ReadAttachments", psInputs, psOutputs); break; case "PreC4Reopen": oBSEvents.InvokeMethod("PreC4Reopen", psInputs, psOutputs); break; case "PostC4Reopen": oBSEvents.InvokeMethod("PostC4Reopen", psInputs, psOutputs); break; case "PreCallEAI": oBSEvents.InvokeMethod("PreCallEAI", psInputs, psOutputs); break; case "PostCallEAI": oBSEvents.InvokeMethod("PostCallEAI", psInputs, psOutputs); break; default: //do nothing break; } if (psOutputs == null || psOutputs == "") { return(psInputs); psOutputs = null; } else { return(psOutputs); } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CallEvent"; } throw(e); } finally { oBSEvents = null; } }

C4 EAI Service
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call EAI": CanInvoke="TRUE"; iReturn = CancelOperation; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 EAI Service
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call EAI": CanInvoke="TRUE"; iReturn = CancelOperation; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 EAI Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call EAI": iReturn = CancelOperation; CallEAI(Inputs, Outputs); break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 EAI Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call EAI": iReturn = CancelOperation; CallEAI(Inputs, Outputs); break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 EAI Service
SetEncoding
function SetEncoding(psInputs) { var oService; var psOutputs; try { psOutputs = TheApplication().NewPropertySet(); try { oService = TheApplication().GetService("Transcode Service"); if (oService != null && oService != "" && oService.Name() == "Transcode Service") { psInputs.SetProperty("ConversionMode", "StringToEncoding"); psInputs.SetProperty("TargetEncoding", "UTF-8"); oService.InvokeMethod("Convert", psInputs, psOutputs); } else { psOutputs.SetValue(psInputs.GetValue()); } } catch(e) { psOutputs.SetValue(psInputs.GetValue()); } } catch(e) { throw e; } finally { oService = null; return(psOutputs); } }

C4 EAI Service
SetEncoding
function SetEncoding(psInputs) { var oService; var psOutputs; try { psOutputs = TheApplication().NewPropertySet(); try { oService = TheApplication().GetService("Transcode Service"); if (oService != null && oService != "" && oService.Name() == "Transcode Service") { psInputs.SetProperty("ConversionMode", "StringToEncoding"); psInputs.SetProperty("TargetEncoding", "UTF-8"); oService.InvokeMethod("Convert", psInputs, psOutputs); } else { psOutputs.SetValue(psInputs.GetValue()); } } catch(e) { psOutputs.SetValue(psInputs.GetValue()); } } catch(e) { throw e; } finally { oService = null; return(psOutputs); } }

C4 Events
(declarations)
var oApp; var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 Events
(declarations)
var oApp; var cErrorCode=""; var cErrorText=""; var cErrorMethod="";

C4 Events
CopyPropertySetManually
function CopyPropertySetManually(psInputs, psOutputs) { var cPropertyName; var iCount; var iMax; try { psOutputs.SetValue(psInputs.GetValue()); cPropertyName = psInputs.GetFirstProperty(); while (cPropertyName != null && cPropertyName != "") { psOutputs.SetProperty(cPropertyName, psInputs.GetProperty(cPropertyName)); cPropertyName = psInputs.GetNextProperty(); } iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { psOutputs.AddChild(psInputs.GetChild(iCount)); iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CopyPropertySetManually"; } throw(e); } finally { } }

C4 Events
CopyPropertySetManually
function CopyPropertySetManually(psInputs, psOutputs) { var cPropertyName; var iCount; var iMax; try { psOutputs.SetValue(psInputs.GetValue()); cPropertyName = psInputs.GetFirstProperty(); while (cPropertyName != null && cPropertyName != "") { psOutputs.SetProperty(cPropertyName, psInputs.GetProperty(cPropertyName)); cPropertyName = psInputs.GetNextProperty(); } iCount = 0; iMax = psInputs.GetChildCount(); while (iCount < iMax) { psOutputs.AddChild(psInputs.GetChild(iCount)); iCount++; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="CopyPropertySetManually"; } throw(e); } finally { } }

C4 Events
PostC4Correspondence
function PostC4Correspondence(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PostC4Correspondence
function PostC4Correspondence(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PostC4ReadAttachments
function PostC4ReadAttachments(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PostC4ReadAttachments"; } throw(e); } finally { } }

C4 Events
PostC4ReadAttachments
function PostC4ReadAttachments(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PostC4ReadAttachments"; } throw(e); } finally { } }

C4 Events
PostC4Reopen
function PostC4Reopen(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PostC4Reopen
function PostC4Reopen(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PostCallEAI
function PostCallEAI(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PostCallEAI
function PostCallEAI(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreC4Correspondence
function PreC4Correspondence(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreC4Correspondence
function PreC4Correspondence(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreC4ReadAttachments
function PreC4ReadAttachments(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4ReadAttachments"; } throw(e); } finally { } }

C4 Events
PreC4ReadAttachments
function PreC4ReadAttachments(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4ReadAttachments"; } throw(e); } finally { } }

C4 Events
PreC4Reopen
function PreC4Reopen(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreC4Reopen
function PreC4Reopen(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreCallEAI
function PreCallEAI(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
PreCallEAI
function PreCallEAI(psInputs, psOutputs) { try { CopyPropertySetManually(psInputs, psOutputs); } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="PreC4Correspondence"; } throw(e); } finally { } }

C4 Events
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "PreC4Correspondence": iReturn = CancelOperation; PreC4Correspondence(Inputs, Outputs); break; case "PostC4Correspondence": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreC4ReadAttachments": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostC4ReadAttachments": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreC4Reopen": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostC4Reopen": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreCallEAI": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostCallEAI": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Service_PreInvokeMethod"; } throw(e); } finally { if (cErrorCode != "" && cErrorCode != null) { Outputs.SetProperty("ErrorMessage", cErrorCode + " " + cErrorText + " method:" + cErrorMethod); } else { Outputs.SetProperty("ErrorMessage", ""); } return (iReturn); } }

C4 Events
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "PreC4Correspondence": iReturn = CancelOperation; PreC4Correspondence(Inputs, Outputs); break; case "PostC4Correspondence": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreC4ReadAttachments": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostC4ReadAttachments": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreC4Reopen": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostC4Reopen": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PreCallEAI": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; case "PostCallEAI": iReturn = CancelOperation; PostC4Correspondence(Inputs, Outputs); break; } } catch(e) { if (cErrorCode== null || cErrorCode == "") { cErrorCode="000"; cErrorText="Unknown Error"; cErrorMethod="Service_PreInvokeMethod"; } throw(e); } finally { if (cErrorCode != "" && cErrorCode != null) { Outputs.SetProperty("ErrorMessage", cErrorCode + " " + cErrorText + " method:" + cErrorMethod); } else { Outputs.SetProperty("ErrorMessage", ""); } return (iReturn); } }

C4 Process Control SCM
C4PrintDecision
/************************************************************************************************** * Function: C4PrintDecision * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Finds out whether C4 printing should be executed * * Date : 2010-03-18 * **************************************************************************************************/ function C4PrintDecision(psOutputs) { var oApp:Application = TheApplication(); var sPrintApp:chars = ""; var sAttList:chars = ""; var sValList:chars = ""; var useC4:chars = "false"; var sAtt:chars = ""; var sAttArray = new Array(); try { if(oApp.GetProfileAttr("ApplicationName") == "Siebel Power Communications") { sPrintApp = oApp.GetProfileAttr("INIT: C4DocGenerate4CUC"); sAttList = oApp.GetProfileAttr("INIT: C4DocGenerate4CUCAtt"); sValList = oApp.GetProfileAttr("INIT: C4DocGenerate4CUCList"); } else { sPrintApp = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOS"); sAttList = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOSAtt"); sValList = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOSList"); } //do not use C4 if (sPrintApp == 0) { useC4 = "false"; //use C4 } else if (sPrintApp == 1) { useC4 = "true"; //usage of C4 is on attributes dependent } else if (sPrintApp == 2) { sAttArray = sAttList.split(";"); for (var i = 0; i < sAttArray.length; i++) { sAtt = oApp.GetProfileAttr(sAttArray[i]); if (sValList.indexOf(sAtt + ";")>-1) { useC4 = "true"; break; } } } } catch(e) { } finally { psOutputs.SetProperty("UseC4",useC4); sAttArray = null; } }

C4 Process Control SCM
C4PrintDecision
/************************************************************************************************** * Function: C4PrintDecision * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Finds out whether C4 printing should be executed * * Date : 2010-03-18 * **************************************************************************************************/ function C4PrintDecision(psOutputs) { var oApp:Application = TheApplication(); var sPrintApp:chars = ""; var sAttList:chars = ""; var sValList:chars = ""; var useC4:chars = "false"; var sAtt:chars = ""; var sAttArray = new Array(); try { if(oApp.GetProfileAttr("ApplicationName") == "Siebel Power Communications") { sPrintApp = oApp.GetProfileAttr("INIT: C4DocGenerate4CUC"); sAttList = oApp.GetProfileAttr("INIT: C4DocGenerate4CUCAtt"); sValList = oApp.GetProfileAttr("INIT: C4DocGenerate4CUCList"); } else { sPrintApp = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOS"); sAttList = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOSAtt"); sValList = oApp.GetProfileAttr("INIT: C4DocGenerate4SHOPPOSList"); } //do not use C4 if (sPrintApp == 0) { useC4 = "false"; //use C4 } else if (sPrintApp == 1) { useC4 = "true"; //usage of C4 is on attributes dependent } else if (sPrintApp == 2) { sAttArray = sAttList.split(";"); for (var i = 0; i < sAttArray.length; i++) { sAtt = oApp.GetProfileAttr(sAttArray[i]); if (sValList.indexOf(sAtt + ";")>-1) { useC4 = "true"; break; } } } } catch(e) { } finally { psOutputs.SetProperty("UseC4",useC4); sAttArray = null; } }

C4 Process Control SCM
GenerateString
/************************************************************************************************** * Function: GenerateString * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Generates a random string of 16 numerical characters * * Date : 2010-04-06 * **************************************************************************************************/ function GenerateString(psOutputs) { //Disabled - please see comment 1. //var number; //var numberStr:chars = ""; //var dateStr:chars = ""; //var firstPart:chars = ""; //var lastPart:chars = ""; //var firstPartLength = 11; //var lastPartLength = 5; var oApp:Application = TheApplication(); var date; var dateStr:chars = ""; var outString:chars = ""; var psTmpInputs:PropertySet = null; var psTmpOutputs:PropertySet = null; var oService:Service = null; var sGUIDValue:chars = ""; var character:chars = ""; var position,GUIDlength,dateIDX,j; var outStringLength = 16; try { //1. this option is not enough - it may produce equal numbers //for two consecutive calls //number = Math.random(); //numberStr = number.toString(); date = new Date().getTime(); dateStr = date.toString(); //firstPart = numberStr.substring(numberStr.length-firstPartLength); //lastPart = dateStr.substring(dateStr.length-lastPartLength); //2. some made up logic for generating random numbers psTmpInputs = oApp.NewPropertySet(); psTmpOutputs = oApp.NewPropertySet(); psTmpInputs.SetProperty("IDType", "GUID"); oService = oApp.GetService("FINS Teller Converter Extensions"); oService.InvokeMethod("GenerateID", psTmpInputs, psTmpOutputs); sGUIDValue = psTmpOutputs.GetValue(); GUIDlength = sGUIDValue.length; dateIDX=0; position=0; for (j = 0; j < outStringLength; j++) { position = (position + ToNumber(dateStr[dateIDX])) % GUIDlength; character = sGUIDValue[position]; switch (character) { case "A": case "a": case "B": case "b": case "C": case "c": case "D": case "d": case "E": case "e": case "F": case "f": case "-": outString = outString + dateStr[dateIDX]; break; default: outString = outString + character; break; } dateIDX = (dateIDX + 1) % dateStr.length; } } catch(e) { } finally { //Disabled - please see comment 1. //psOutputs.SetProperty("String", firstPart + lastPart); psOutputs.SetProperty("String", outString); psTmpInputs = null; psTmpOutputs = null; oService = null; date = null; } }

C4 Process Control SCM
GenerateString
/************************************************************************************************** * Function: GenerateString * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Generates a random string of 16 numerical characters * * Date : 2010-04-06 * **************************************************************************************************/ function GenerateString(psOutputs) { //Disabled - please see comment 1. //var number; //var numberStr:chars = ""; //var dateStr:chars = ""; //var firstPart:chars = ""; //var lastPart:chars = ""; //var firstPartLength = 11; //var lastPartLength = 5; var oApp:Application = TheApplication(); var date; var dateStr:chars = ""; var outString:chars = ""; var psTmpInputs:PropertySet = null; var psTmpOutputs:PropertySet = null; var oService:Service = null; var sGUIDValue:chars = ""; var character:chars = ""; var position,GUIDlength,dateIDX,j; var outStringLength = 16; try { //1. this option is not enough - it may produce equal numbers //for two consecutive calls //number = Math.random(); //numberStr = number.toString(); date = new Date().getTime(); dateStr = date.toString(); //firstPart = numberStr.substring(numberStr.length-firstPartLength); //lastPart = dateStr.substring(dateStr.length-lastPartLength); //2. some made up logic for generating random numbers psTmpInputs = oApp.NewPropertySet(); psTmpOutputs = oApp.NewPropertySet(); psTmpInputs.SetProperty("IDType", "GUID"); oService = oApp.GetService("FINS Teller Converter Extensions"); oService.InvokeMethod("GenerateID", psTmpInputs, psTmpOutputs); sGUIDValue = psTmpOutputs.GetValue(); GUIDlength = sGUIDValue.length; dateIDX=0; position=0; for (j = 0; j < outStringLength; j++) { position = (position + ToNumber(dateStr[dateIDX])) % GUIDlength; character = sGUIDValue[position]; switch (character) { case "A": case "a": case "B": case "b": case "C": case "c": case "D": case "d": case "E": case "e": case "F": case "f": case "-": outString = outString + dateStr[dateIDX]; break; default: outString = outString + character; break; } dateIDX = (dateIDX + 1) % dateStr.length; } } catch(e) { } finally { //Disabled - please see comment 1. //psOutputs.SetProperty("String", firstPart + lastPart); psOutputs.SetProperty("String", outString); psTmpInputs = null; psTmpOutputs = null; oService = null; date = null; } }

C4 Process Control SCM
GetAssetType
function GetAssetType(psInputs) { var cBusObject; var cBusComp; var cAssetType; var cId; var oBO; var oBC; var bIsRecord; try { cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); cId = psInputs.GetProperty("Id"); if(cId != " ") { /* TSGGUJA1 03.03.2010 Defect 7378. Field renamed. From Asset Type Calc to Asset Type Calc SCM*/ oBC.ActivateField("Asset Type Calc SCM"); oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", cId); oBC.ExecuteQuery(); bIsRecord = oBC.FirstRecord(); if (bIsRecord) { /* TSGGUJA1 03.03.2010 Defect 7378. Field renamed. From Asset Type Calc to Asset Type Calc SCM*/ cAssetType = oBC.GetFieldValue("Asset Type Calc SCM"); TheApplication().SetProfileAttr("SCM_AssetTypeCalc", cAssetType); } } } catch(e) { TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; } }

C4 Process Control SCM
GetAssetType
function GetAssetType(psInputs) { var cBusObject; var cBusComp; var cAssetType; var cId; var oBO; var oBC; var bIsRecord; try { cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); cId = psInputs.GetProperty("Id"); if(cId != " ") { /* TSGGUJA1 03.03.2010 Defect 7378. Field renamed. From Asset Type Calc to Asset Type Calc SCM*/ oBC.ActivateField("Asset Type Calc SCM"); oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", cId); oBC.ExecuteQuery(); bIsRecord = oBC.FirstRecord(); if (bIsRecord) { /* TSGGUJA1 03.03.2010 Defect 7378. Field renamed. From Asset Type Calc to Asset Type Calc SCM*/ cAssetType = oBC.GetFieldValue("Asset Type Calc SCM"); TheApplication().SetProfileAttr("SCM_AssetTypeCalc", cAssetType); } } } catch(e) { TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; } }

C4 Process Control SCM
GetFilterValues
function GetFilterValues(psInputs, psOutputs) { var cBusObject; var cBusComp; var cId; var cProfileAttr; var cFilterField; var cFieldValue; var iCounter; var iNumber; var iMax; var oBO; var oBC; var bIsRecord; try { iCounter = 0; iMax = TheApplication().GetProfileAttr("SCM_C4CountFilter"); cProfileAttr = ""; cFilterField = ""; if (TheApplication().GetProfileAttr("SCM_C4_Filter").toLowerCase() == "true") { cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); cId = psInputs.GetProperty("Id"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); oBC.ActivateField(cFilterField); iCounter++; } oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", cId); oBC.ExecuteQuery(); bIsRecord = oBC.FirstRecord(); if (bIsRecord) { iCounter = 0; while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); cFieldValue = oBC.GetFieldValue(cFilterField); TheApplication().SetProfileAttr("SCM_C4ValueFilterfield"+iNumber, cFieldValue); iCounter++; } } else { iCounter = 0; while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); iCounter++; } } } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; } }

C4 Process Control SCM
GetFilterValues
function GetFilterValues(psInputs, psOutputs) { var cBusObject; var cBusComp; var cId; var cProfileAttr; var cFilterField; var cFieldValue; var iCounter; var iNumber; var iMax; var oBO; var oBC; var bIsRecord; try { iCounter = 0; iMax = TheApplication().GetProfileAttr("SCM_C4CountFilter"); cProfileAttr = ""; cFilterField = ""; if (TheApplication().GetProfileAttr("SCM_C4_Filter").toLowerCase() == "true") { cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); cId = psInputs.GetProperty("Id"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); oBC.ActivateField(cFilterField); iCounter++; } oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", cId); oBC.ExecuteQuery(); bIsRecord = oBC.FirstRecord(); if (bIsRecord) { iCounter = 0; while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); cFieldValue = oBC.GetFieldValue(cFilterField); TheApplication().SetProfileAttr("SCM_C4ValueFilterfield"+iNumber, cFieldValue); iCounter++; } } else { iCounter = 0; while (iCounter < iMax) { iNumber = iCounter+1; cProfileAttr = "SCM_C4Filterfield"+iNumber; cFilterField = TheApplication().GetProfileAttr(cProfileAttr); iCounter++; } } } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; } }

C4 Process Control SCM
GetSRId
function GetSRId(psInputs, psOutputs) { var cBusObject; var cBusComp; var cId; var cSRNumber; var oBO; var oBC; try { cId = ""; cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); cSRNumber = psInputs.GetProperty("SRNumber"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("SR Number", cSRNumber); oBC.ExecuteQuery(); if (oBC.FirstRecord()) { cId = oBC.GetFieldValue("Id"); } else { cId = ""; } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; psOutputs.SetProperty("SRId", cId); } }

C4 Process Control SCM
GetSRId
function GetSRId(psInputs, psOutputs) { var cBusObject; var cBusComp; var cId; var cSRNumber; var oBO; var oBC; try { cId = ""; cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); cSRNumber = psInputs.GetProperty("SRNumber"); oBO = TheApplication().GetBusObject(cBusObject); oBC = oBO.GetBusComp(cBusComp); oBC.SetViewMode(AllView); oBC.ClearToQuery(); oBC.SetSearchSpec("SR Number", cSRNumber); oBC.ExecuteQuery(); if (oBC.FirstRecord()) { cId = oBC.GetFieldValue("Id"); } else { cId = ""; } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { oBC = null; oBO = null; psOutputs.SetProperty("SRId", cId); } }

C4 Process Control SCM
IndividualCNOAvailable
function IndividualCNOAvailable(psInputs, psOutputs) { var cPositionID; var cLastPositionID; var cStatus; var cReturn; var cPilotUser; var bIsTraceOn; try { bIsTraceOn = TheApplication().isTraceON; cReturn = "false"; cPilotUser = "false"; cLastPositionID = TheApplication().GetProfileAttr("SCM_C4_PositionID"); cPositionID= TheApplication().PositionId(); if (cPositionID != cLastPositionID) { TheApplication().SCM_IndividualCNOControl(); } else { //do nothing } cStatus = TheApplication().GetProfileAttr("SCM_C4_Status"); switch (cStatus) { case "ON": cReturn = "true"; break; case "OFF": cReturn = "false"; break; case "PILOT": cPilotUser = TheApplication().GetProfileAttr("SCM_C4_PilotUser"); if (cPilotUser == "true") { cReturn = "true"; } else { cReturn = "false"; } break; default: cReturn = "false"; break; } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { psOutputs.SetProperty("Status", cReturn); } }

C4 Process Control SCM
IndividualCNOAvailable
function IndividualCNOAvailable(psInputs, psOutputs) { var cPositionID; var cLastPositionID; var cStatus; var cReturn; var cPilotUser; var bIsTraceOn; try { bIsTraceOn = TheApplication().isTraceON; cReturn = "false"; cPilotUser = "false"; cLastPositionID = TheApplication().GetProfileAttr("SCM_C4_PositionID"); cPositionID= TheApplication().PositionId(); if (cPositionID != cLastPositionID) { TheApplication().SCM_IndividualCNOControl(); } else { //do nothing } cStatus = TheApplication().GetProfileAttr("SCM_C4_Status"); switch (cStatus) { case "ON": cReturn = "true"; break; case "OFF": cReturn = "false"; break; case "PILOT": cPilotUser = TheApplication().GetProfileAttr("SCM_C4_PilotUser"); if (cPilotUser == "true") { cReturn = "true"; } else { cReturn = "false"; } break; default: cReturn = "false"; break; } }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { psOutputs.SetProperty("Status", cReturn); } }

C4 Process Control SCM
ServerPrint
/************************************************************************************************** * Function: ServerPrint * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Calls C4 Printing * * Date : 2010-03-18 * **************************************************************************************************/ function ServerPrint(psInputs, psOutputs) { var oApp:Application = TheApplication(); var cBusObject:BusObject = null; var cBusComp:BusComp = null; var oService:Service = null; var psTmpInputs:PropertySet = null; var psTmpOutputs:PropertySet = null; var psC4Inputs:PropertySet = null; var psC4Outputs:PropertySet = null; var psId:PropertySet = null; var documentName:chars = ""; var documentNameINT:chars = ""; var cId:chars = ""; var sGUIDValue:chars = ""; var priority:chars = ""; try { psC4Inputs = oApp.NewPropertySet(); psC4Outputs = oApp.NewPropertySet(); psTmpInputs = oApp.NewPropertySet(); psTmpOutputs = oApp.NewPropertySet(); psId = oApp.NewPropertySet(); documentNameINT = psInputs.GetProperty("Document"); documentName = oApp.InvokeMethod("LookupValue","C4_TEMPLATE_NAME",documentNameINT); priority = oApp.InvokeMethod("LookupValue","C4_PRIORITY","Priority1"); cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); if (psInputs.PropertyExists("Id")) { cId = psInputs.GetProperty("Id"); } else if (psInputs.PropertyExists("SRNumber")) { if (psInputs.GetProperty("SRNumber") != ""){ GetSRId(psInputs, psTmpOutputs); cId = psTmpOutputs.GetProperty("SRId"); psTmpOutputs.Reset(); } } if (cId != ""){ //FileName GUID generation //TGDCEJO3 : 06.04.2010 : C4 PDF Servlet does not support //GUID data type filename (numerical characters up to a word length only) //psTmpInputs.SetProperty("IDType", "GUID"); //oService = oApp.GetService("FINS Teller Converter Extensions"); //oService.InvokeMethod("GenerateID", psTmpInputs, psTmpOutputs); //sGUIDValue = psTmpOutputs.GetValue(); GenerateString(psTmpOutputs); sGUIDValue = psTmpOutputs.GetProperty("String"); psC4Inputs.SetProperty("ViewName",sGUIDValue); psC4Inputs.SetProperty("Processing", "Y"); psC4Inputs.SetProperty("BusObject", cBusObject); psC4Inputs.SetProperty("BusComp", cBusComp); psId.SetType("Id"); psId.SetValue(cId); psC4Inputs.AddChild(psId); psC4Inputs.SetProperty("Id", cId); psC4Inputs.SetProperty("Channel", "save"); psC4Inputs.SetProperty("Modus", "central"); psC4Inputs.SetProperty("ProcessMode", "asynchronous"); psC4Inputs.SetProperty("TemplateName", documentName); psC4Inputs.SetProperty("Priority", priority); oService = oApp.GetService("C4 Call Correspondence"); oService.InvokeMethod("C4Correspondence", psC4Inputs, psC4Outputs); } } catch(e) { } finally { psOutputs.SetProperty("FileName",sGUIDValue); cBusObject = null; cBusComp = null; oService = null; psTmpInputs = null; psTmpOutputs = null; psC4Inputs = null; psC4Outputs = null; psId = null; } }

C4 Process Control SCM
ServerPrint
/************************************************************************************************** * Function: ServerPrint * * Author : Jozef Cepko (TGDCEJO3) * * Purpose : Calls C4 Printing * * Date : 2010-03-18 * **************************************************************************************************/ function ServerPrint(psInputs, psOutputs) { var oApp:Application = TheApplication(); var cBusObject:BusObject = null; var cBusComp:BusComp = null; var oService:Service = null; var psTmpInputs:PropertySet = null; var psTmpOutputs:PropertySet = null; var psC4Inputs:PropertySet = null; var psC4Outputs:PropertySet = null; var psId:PropertySet = null; var documentName:chars = ""; var documentNameINT:chars = ""; var cId:chars = ""; var sGUIDValue:chars = ""; var priority:chars = ""; try { psC4Inputs = oApp.NewPropertySet(); psC4Outputs = oApp.NewPropertySet(); psTmpInputs = oApp.NewPropertySet(); psTmpOutputs = oApp.NewPropertySet(); psId = oApp.NewPropertySet(); documentNameINT = psInputs.GetProperty("Document"); documentName = oApp.InvokeMethod("LookupValue","C4_TEMPLATE_NAME",documentNameINT); priority = oApp.InvokeMethod("LookupValue","C4_PRIORITY","Priority1"); cBusObject = psInputs.GetProperty("BusObject"); cBusComp = psInputs.GetProperty("BusComp"); if (psInputs.PropertyExists("Id")) { cId = psInputs.GetProperty("Id"); } else if (psInputs.PropertyExists("SRNumber")) { if (psInputs.GetProperty("SRNumber") != ""){ GetSRId(psInputs, psTmpOutputs); cId = psTmpOutputs.GetProperty("SRId"); psTmpOutputs.Reset(); } } if (cId != ""){ //FileName GUID generation //TGDCEJO3 : 06.04.2010 : C4 PDF Servlet does not support //GUID data type filename (numerical characters up to a word length only) //psTmpInputs.SetProperty("IDType", "GUID"); //oService = oApp.GetService("FINS Teller Converter Extensions"); //oService.InvokeMethod("GenerateID", psTmpInputs, psTmpOutputs); //sGUIDValue = psTmpOutputs.GetValue(); GenerateString(psTmpOutputs); sGUIDValue = psTmpOutputs.GetProperty("String"); psC4Inputs.SetProperty("ViewName",sGUIDValue); psC4Inputs.SetProperty("Processing", "Y"); psC4Inputs.SetProperty("BusObject", cBusObject); psC4Inputs.SetProperty("BusComp", cBusComp); psId.SetType("Id"); psId.SetValue(cId); psC4Inputs.AddChild(psId); psC4Inputs.SetProperty("Id", cId); psC4Inputs.SetProperty("Channel", "save"); psC4Inputs.SetProperty("Modus", "central"); psC4Inputs.SetProperty("ProcessMode", "asynchronous"); psC4Inputs.SetProperty("TemplateName", documentName); psC4Inputs.SetProperty("Priority", priority); oService = oApp.GetService("C4 Call Correspondence"); oService.InvokeMethod("C4Correspondence", psC4Inputs, psC4Outputs); } } catch(e) { } finally { psOutputs.SetProperty("FileName",sGUIDValue); cBusObject = null; cBusComp = null; oService = null; psTmpInputs = null; psTmpOutputs = null; psC4Inputs = null; psC4Outputs = null; psId = null; } }

C4 Process Control SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "IndividualCNOAvailable": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "SelectTemplate": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "GetFilterValues": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "GetSRId": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "ServerPrint": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4PrintDecision": iReturn = CancelOperation; CanInvoke = "TRUE"; break; } return (iReturn);//SCM 27.01.2009 TGDESIS1 Moved of finally to try }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { iReturn = null; } }

C4 Process Control SCM
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "IndividualCNOAvailable": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "SelectTemplate": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "GetFilterValues": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "GetSRId": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "ServerPrint": iReturn = CancelOperation; CanInvoke = "TRUE"; break; case "C4PrintDecision": iReturn = CancelOperation; CanInvoke = "TRUE"; break; } return (iReturn);//SCM 27.01.2009 TGDESIS1 Moved of finally to try }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); } finally { iReturn = null; } }

C4 Process Control SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch (MethodName) { case "IndividualCNOAvailable": iReturn = CancelOperation; IndividualCNOAvailable(Inputs, Outputs); break; case "GetFilterValues": iReturn = CancelOperation; GetFilterValues(Inputs, Outputs); break; case "GetSRId": iReturn = CancelOperation; GetSRId(Inputs, Outputs); break; case "ServerPrint": iReturn = CancelOperation; ServerPrint(Inputs, Outputs); break; case "C4PrintDecision": iReturn = CancelOperation; C4PrintDecision(Outputs); break; /*OneCRM R1.0 SCM 14.09.2009 TSGBEJA1: Due to CR234, new function added in order to retrieve the asset type which will be needed for the new tag called 'Organization' that needs to be filled in the XML sent to C4 BCM application.*/ case "GetAssetType": iReturn = CancelOperation; GetAssetType(Inputs); break; } return (iReturn);//SCM 27.01.2009 TGDESIS1 Moved of finally to try }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); }finally { iReturn = null; } }

C4 Process Control SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch (MethodName) { case "IndividualCNOAvailable": iReturn = CancelOperation; IndividualCNOAvailable(Inputs, Outputs); break; case "GetFilterValues": iReturn = CancelOperation; GetFilterValues(Inputs, Outputs); break; case "GetSRId": iReturn = CancelOperation; GetSRId(Inputs, Outputs); break; case "ServerPrint": iReturn = CancelOperation; ServerPrint(Inputs, Outputs); break; case "C4PrintDecision": iReturn = CancelOperation; C4PrintDecision(Outputs); break; /*OneCRM R1.0 SCM 14.09.2009 TSGBEJA1: Due to CR234, new function added in order to retrieve the asset type which will be needed for the new tag called 'Organization' that needs to be filled in the XML sent to C4 BCM application.*/ case "GetAssetType": iReturn = CancelOperation; GetAssetType(Inputs); break; } return (iReturn);//SCM 27.01.2009 TGDESIS1 Moved of finally to try }catch(e){ TheApplication().Trace(this.Name()+" Error: "+e.toString()); }finally { iReturn = null; } }

C4 Wrapper
Call
function Call(psInputs, psOutputs) { var cBSName; var cMethodName; var oBS; try { cBSName = psInputs.GetProperty("Siebel Business Service"); psInputs.RemoveProperty("Siebel Business Service"); cMethodName = psInputs.GetProperty("Siebel Method"); psInputs.RemoveProperty("Siebel Method"); oBS = TheApplication().GetService(cBSName); oBS.InvokeMethod(cMethodName, psInputs, psOutputs); } catch(e) { throw(e); } finally { oBS = null; } }

C4 Wrapper
Call
function Call(psInputs, psOutputs) { var cBSName; var cMethodName; var oBS; try { cBSName = psInputs.GetProperty("Siebel Business Service"); psInputs.RemoveProperty("Siebel Business Service"); cMethodName = psInputs.GetProperty("Siebel Method"); psInputs.RemoveProperty("Siebel Method"); oBS = TheApplication().GetService(cBSName); oBS.InvokeMethod(cMethodName, psInputs, psOutputs); } catch(e) { throw(e); } finally { oBS = null; } }

C4 Wrapper
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call": CanInvoke="TRUE"; iReturn = CancelOperation; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 Wrapper
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call": CanInvoke="TRUE"; iReturn = CancelOperation; break; } return (iReturn); } catch(e) { throw(e); } finally { } }

C4 Wrapper
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call": iReturn = CancelOperation; Call(Inputs, Outputs); break; } } catch(e) { throw(e); } finally { return (iReturn); } }

C4 Wrapper
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var iReturn; try { iReturn = ContinueOperation; switch(MethodName) { case "Call": iReturn = CancelOperation; Call(Inputs, Outputs); break; } } catch(e) { throw(e); } finally { return (iReturn); } }

CAC Dummy VBC BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { Inputs.SetProperty("Field1", ""); Inputs.SetProperty("Field2", ""); Inputs.SetProperty("Field3", ""); Inputs.SetProperty("Field4", ""); Inputs.SetProperty("Field5", ""); Inputs.SetProperty("Field6", ""); Inputs.SetProperty("Field7", ""); Inputs.SetProperty("Field8", ""); Inputs.SetProperty("Field9", ""); Inputs.SetProperty("Field10", ""); Inputs.SetProperty("Field11", ""); Inputs.SetProperty("Field12", ""); Inputs.SetProperty("Field13", ""); Inputs.SetProperty("Field14", ""); Inputs.SetProperty("Field41", ""); Inputs.SetProperty("Field16", ""); Inputs.SetProperty("Field17", ""); Inputs.SetProperty("Field18", ""); Inputs.SetProperty("Field19", ""); Inputs.SetProperty("Field20", ""); Inputs.SetProperty("Field21", ""); Inputs.SetProperty("Field22", ""); Inputs.SetProperty("Field23", ""); Inputs.SetProperty("Field24", ""); Inputs.SetProperty("Field25", ""); Inputs.SetProperty("Field26", ""); Inputs.SetProperty("Field27", ""); Inputs.SetProperty("Field28", ""); Inputs.SetProperty("Field29", ""); Inputs.SetProperty("Field30", ""); Inputs.SetProperty("Field31", ""); Inputs.SetProperty("Field32", ""); Inputs.SetProperty("Field33", ""); Inputs.SetProperty("Field34", ""); Inputs.SetProperty("Field35", ""); Inputs.SetProperty("Field36", ""); Inputs.SetProperty("Field37", ""); Inputs.SetProperty("Field38", ""); Inputs.SetProperty("Field39", ""); Inputs.SetProperty("Field40", ""); return (CancelOperation); } if (MethodName == "Query") { var oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); return (CancelOperation); } if (MethodName == "Update") { return (CancelOperation); } return (ContinueOperation); }

CAC Dummy VBC BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { Inputs.SetProperty("Field1", ""); Inputs.SetProperty("Field2", ""); Inputs.SetProperty("Field3", ""); Inputs.SetProperty("Field4", ""); Inputs.SetProperty("Field5", ""); Inputs.SetProperty("Field6", ""); Inputs.SetProperty("Field7", ""); Inputs.SetProperty("Field8", ""); Inputs.SetProperty("Field9", ""); Inputs.SetProperty("Field10", ""); Inputs.SetProperty("Field11", ""); Inputs.SetProperty("Field12", ""); Inputs.SetProperty("Field13", ""); Inputs.SetProperty("Field14", ""); Inputs.SetProperty("Field41", ""); Inputs.SetProperty("Field16", ""); Inputs.SetProperty("Field17", ""); Inputs.SetProperty("Field18", ""); Inputs.SetProperty("Field19", ""); Inputs.SetProperty("Field20", ""); Inputs.SetProperty("Field21", ""); Inputs.SetProperty("Field22", ""); Inputs.SetProperty("Field23", ""); Inputs.SetProperty("Field24", ""); Inputs.SetProperty("Field25", ""); Inputs.SetProperty("Field26", ""); Inputs.SetProperty("Field27", ""); Inputs.SetProperty("Field28", ""); Inputs.SetProperty("Field29", ""); Inputs.SetProperty("Field30", ""); Inputs.SetProperty("Field31", ""); Inputs.SetProperty("Field32", ""); Inputs.SetProperty("Field33", ""); Inputs.SetProperty("Field34", ""); Inputs.SetProperty("Field35", ""); Inputs.SetProperty("Field36", ""); Inputs.SetProperty("Field37", ""); Inputs.SetProperty("Field38", ""); Inputs.SetProperty("Field39", ""); Inputs.SetProperty("Field40", ""); return (CancelOperation); } if (MethodName == "Query") { var oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); oPs = TheApplication().NewPropertySet(); Outputs.AddChild(oPs); return (CancelOperation); } if (MethodName == "Update") { return (CancelOperation); } return (ContinueOperation); }

CAC Test VBC Service
(declarations)
var theData:PropertySet; // The Database

CAC Test VBC Service
(declarations)
var theData:PropertySet; // The Database

CAC Test VBC Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName:String, Inputs:PropertySet, Outputs:PropertySet) { if (MethodName == "Init") return myInitialise(Outputs); else if (MethodName == "Query") return myQuery(Inputs, Outputs); else if (MethodName == "PreInsert") return myPreInsert(Outputs); else if (MethodName == "Insert") return myInsert(Inputs, Outputs); else if (MethodName == "Delete") return myDelete(Inputs, Outputs); else if (MethodName == "Update") return myUpdate(Inputs, Outputs); else return (ContinueOperation); }

CAC Test VBC Service
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName:String, Inputs:PropertySet, Outputs:PropertySet) { if (MethodName == "Init") return myInitialise(Outputs); else if (MethodName == "Query") return myQuery(Inputs, Outputs); else if (MethodName == "PreInsert") return myPreInsert(Outputs); else if (MethodName == "Insert") return myInsert(Inputs, Outputs); else if (MethodName == "Delete") return myDelete(Inputs, Outputs); else if (MethodName == "Update") return myUpdate(Inputs, Outputs); else return (ContinueOperation); }

CAC Test VBC Service
makeid
function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 5; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }

CAC Test VBC Service
makeid
function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 5; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }

CAC Test VBC Service
myDelete
function myDelete(Inputs, Outputs) { var oChild:PropertySet = Inputs.GetChild(0); var oRecord:PropertySet; var sPropName:String; var bFound:bool = false; var bEqual:bool; if (oChild.GetProperty("First Name") == "Jack") { var oErrorChild:PropertySet = TheApplication().NewPropertySet(); oErrorChild.SetType("Status"); oErrorChild.SetProperty("Status", "4"); oErrorChild.SetProperty("Error Field", "First Name"); oErrorChild.SetProperty("Error Text", "Cannot delete Jack"); Outputs.AddChild(oErrorChild); } else { for (var i=0; i < theData.GetChildCount() && !bFound; i++) { bEqual = true; oRecord = theData.GetChild(i); sPropName = oChild.GetFirstProperty(); while (sPropName != "" && bEqual) { if (oChild.GetProperty(sPropName) != oRecord.GetProperty(sPropName)) bEqual = false; sPropName = oChild.GetNextProperty(); } if (bEqual) { bFound = true; theData.RemoveChild(i); } } } return (CancelOperation); }

CAC Test VBC Service
myDelete
function myDelete(Inputs, Outputs) { var oChild:PropertySet = Inputs.GetChild(0); var oRecord:PropertySet; var sPropName:String; var bFound:bool = false; var bEqual:bool; if (oChild.GetProperty("First Name") == "Jack") { var oErrorChild:PropertySet = TheApplication().NewPropertySet(); oErrorChild.SetType("Status"); oErrorChild.SetProperty("Status", "4"); oErrorChild.SetProperty("Error Field", "First Name"); oErrorChild.SetProperty("Error Text", "Cannot delete Jack"); Outputs.AddChild(oErrorChild); } else { for (var i=0; i < theData.GetChildCount() && !bFound; i++) { bEqual = true; oRecord = theData.GetChild(i); sPropName = oChild.GetFirstProperty(); while (sPropName != "" && bEqual) { if (oChild.GetProperty(sPropName) != oRecord.GetProperty(sPropName)) bEqual = false; sPropName = oChild.GetNextProperty(); } if (bEqual) { bFound = true; theData.RemoveChild(i); } } } return (CancelOperation); }

CAC Test VBC Service
myInitialise
function myInitialise(Outputs:PropertySet) { var currentRow:PropertySet; var i; for (i=1; i < 100; i++) { Outputs.SetProperty("Field" + i, ""); } // fill our 'database' with some inital data theData = TheApplication().NewPropertySet(); for (var j=0; j < 20; j++) { currentRow = TheApplication().NewPropertySet() ; for (i=1; i < 100; i++) { currentRow.SetProperty("Field"+i, makeid()); } theData.AddChild(currentRow); } currentRow = null; return (CancelOperation); }

CAC Test VBC Service
myInitialise
function myInitialise(Outputs:PropertySet) { var currentRow:PropertySet; var i; for (i=1; i < 100; i++) { Outputs.SetProperty("Field" + i, ""); } // fill our 'database' with some inital data theData = TheApplication().NewPropertySet(); for (var j=0; j < 20; j++) { currentRow = TheApplication().NewPropertySet() ; for (i=1; i < 100; i++) { currentRow.SetProperty("Field"+i, makeid()); } theData.AddChild(currentRow); } currentRow = null; return (CancelOperation); }

CAC Test VBC Service
myInsert
function myInsert(Inputs, Outputs) { //Update my array to include the inserted new Row theData.AddChild(Inputs.GetChild(0)); Outputs.AddChild(Inputs.GetChild(0)); return (CancelOperation); }

CAC Test VBC Service
myInsert
function myInsert(Inputs, Outputs) { //Update my array to include the inserted new Row theData.AddChild(Inputs.GetChild(0)); Outputs.AddChild(Inputs.GetChild(0)); return (CancelOperation); }

CAC Test VBC Service
myLike
function myLike(SearchString:String, Pattern:String) { if (Pattern.indexOf("*") >= 0) { var oSearch = Pattern.split("*"); var bMatch:bool = true; var Index:Number = 0; for (var i=0; i < oSearch.length && bMatch; i++) { if (oSearch[i].length > 0) { Index = SearchString.indexOf(oSearch[i], Index); if (Index < 0) bMatch = false; Index++; } } return bMatch; } else return (SearchString == Pattern); }

CAC Test VBC Service
myLike
function myLike(SearchString:String, Pattern:String) { if (Pattern.indexOf("*") >= 0) { var oSearch = Pattern.split("*"); var bMatch:bool = true; var Index:Number = 0; for (var i=0; i < oSearch.length && bMatch; i++) { if (oSearch[i].length > 0) { Index = SearchString.indexOf(oSearch[i], Index); if (Index < 0) bMatch = false; Index++; } } return bMatch; } else return (SearchString == Pattern); }

CAC Test VBC Service
myPreInsert
function myPreInsert(Outputs:PropertySet) { var newRow:PropertySet = TheApplication().NewPropertySet(); newRow.SetProperty("First Name",""); newRow.SetProperty("Last Name",""); newRow.SetProperty("Phone",""); newRow.SetProperty("Key",""); newRow.SetProperty("Occupation","SC"); Outputs.AddChild(newRow); newRow = null; return (CancelOperation); }

CAC Test VBC Service
myPreInsert
function myPreInsert(Outputs:PropertySet) { var newRow:PropertySet = TheApplication().NewPropertySet(); newRow.SetProperty("First Name",""); newRow.SetProperty("Last Name",""); newRow.SetProperty("Phone",""); newRow.SetProperty("Key",""); newRow.SetProperty("Occupation","SC"); Outputs.AddChild(newRow); newRow = null; return (CancelOperation); }

CAC Test VBC Service
myQuery
function myQuery(Inputs:PropertySet,Outputs:PropertySet) { var oQuerySpec:PropertySet; var oChild:PropertySet; var bAdd:bool; var sPropName:String; // The Query specifications are in a child propertyset of the inputs oQuerySpec = Inputs.GetChild(0); for (var i=0; i < theData.GetChildCount(); i++) { bAdd = true; oChild = theData.GetChild(i); sPropName = oQuerySpec.GetFirstProperty(); while (sPropName != "" && bAdd) { bAdd = myLike(oChild.GetProperty(sPropName),oQuerySpec.GetProperty(sPropName)); sPropName = oQuerySpec.GetNextProperty(); } if (bAdd) Outputs.AddChild(theData.GetChild(i)); } return (CancelOperation); }

CAC Test VBC Service
myQuery
function myQuery(Inputs:PropertySet,Outputs:PropertySet) { var oQuerySpec:PropertySet; var oChild:PropertySet; var bAdd:bool; var sPropName:String; // The Query specifications are in a child propertyset of the inputs oQuerySpec = Inputs.GetChild(0); for (var i=0; i < theData.GetChildCount(); i++) { bAdd = true; oChild = theData.GetChild(i); sPropName = oQuerySpec.GetFirstProperty(); while (sPropName != "" && bAdd) { bAdd = myLike(oChild.GetProperty(sPropName),oQuerySpec.GetProperty(sPropName)); sPropName = oQuerySpec.GetNextProperty(); } if (bAdd) Outputs.AddChild(theData.GetChild(i)); } return (CancelOperation); }

CAC Test VBC Service
myUpdate
function myUpdate(Inputs:PropertySet, Outputs:PropertySet) { var oChild:PropertySet; var oInputChild:PropertySet; var bFound:bool = false; var bEqual:bool; var oOutputChild:PropertySet = TheApplication().NewPropertySet(); for (var i=0; i < theData.GetChildCount() && !bFound; i++) { bEqual = true; var j:Number; oChild = theData.GetChild(i); for (j=0; j < Inputs.GetChildCount() && bEqual; j++) { oInputChild = Inputs.GetChild(j); if (oInputChild.GetProperty("Changed") == "false") { if (oInputChild.GetProperty("Field Value") != oChild.GetProperty(oInputChild.GetProperty("Field Name"))) bEqual = false; } } if (bEqual) { bFound = true; for (j=0; j < Inputs.GetChildCount(); j++) { oInputChild = Inputs.GetChild(j); if (oInputChild.GetProperty("Changed") == "true") { theData.GetChild(i).SetProperty(oInputChild.GetProperty("Field Name"), oInputChild.GetProperty("Field Value")); oOutputChild.SetProperty(oInputChild.GetProperty("Field Name"), oInputChild.GetProperty("Field Value")); } } } } Outputs.AddChild(oOutputChild); return (CancelOperation); }

CAC Test VBC Service
myUpdate
function myUpdate(Inputs:PropertySet, Outputs:PropertySet) { var oChild:PropertySet; var oInputChild:PropertySet; var bFound:bool = false; var bEqual:bool; var oOutputChild:PropertySet = TheApplication().NewPropertySet(); for (var i=0; i < theData.GetChildCount() && !bFound; i++) { bEqual = true; var j:Number; oChild = theData.GetChild(i); for (j=0; j < Inputs.GetChildCount() && bEqual; j++) { oInputChild = Inputs.GetChild(j); if (oInputChild.GetProperty("Changed") == "false") { if (oInputChild.GetProperty("Field Value") != oChild.GetProperty(oInputChild.GetProperty("Field Name"))) bEqual = false; } } if (bEqual) { bFound = true; for (j=0; j < Inputs.GetChildCount(); j++) { oInputChild = Inputs.GetChild(j); if (oInputChild.GetProperty("Changed") == "true") { theData.GetChild(i).SetProperty(oInputChild.GetProperty("Field Name"), oInputChild.GetProperty("Field Value")); oOutputChild.SetProperty(oInputChild.GetProperty("Field Name"), oInputChild.GetProperty("Field Value")); } } } } Outputs.AddChild(oOutputChild); return (CancelOperation); }

CAM BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var fEventId:Number = 1;

CAM BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool; var fEventId:Number = 1;

CAM BS SCM
BCHasRecord
function BCHasRecord(&oBC:BusComp){ /******************************************************* ** Name: BCHasRecord ** Created: 25.03.2009 ** Created By: Javier Amor ** Description: This method is used to know if an object, which is received as input parameter, has records. ** Is used to avoid using method FirstRecord when a BC is not created yet. ******************************************************/ try{ var cId = oBC.GetFieldValue("Id"); return(true); } catch(e){ return(false); } finally{ } }

CAM BS SCM
BCHasRecord
/******************************************************* ** Name: BCHasRecord ** Created: 25.03.2009 ** Created By: Javier Amor ** Description: This method is used to know if an object, which is received as input parameter, has records. ** Is used to avoid using method FirstRecord when a BC is not created yet. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function BCHasRecord(&oBC) { try { var cId = oBC.GetFieldValue("Id"); return(true); } catch(e) { return(false); } finally { } }

CAM BS SCM
CBUValidation
function CBUValidation(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: CBUValidation ** Created: 29.07.2008 ** Created By: Gema Torres ** Description: small CR 8338/issue 10384. Check if agent can perform Solvency Check on the customer selected -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOEmployee:BusObject; var BCEmployee:BusComp; var strLogin:chars = ""; var srtExpr:chars = ""; var strAction:chars; var strMsg:chars = ""; if(bIsTraceOn) oApp.Trace(this.Name() + ".CBUValidation START"); try{ //Get Action strAction = Inputs.GetProperty("Action"); //Get Login of the agent strLogin = oApp.GetProfileAttr("Login Name"); //Instance Employee BC BOEmployee = oApp.GetBusObject("Employee"); BCEmployee = BOEmployee.GetBusComp("Employee"); //Set Search expression, the agent must have the correct responsibility if(strAction == "SolvencyCheck"){ srtExpr = "EXISTS([Responsibility]='SCM CCI') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: No CCI Agent"; } if(strAction == "SegmentChange" || strAction == "SegmentChangePetition"){ srtExpr = "EXISTS([Responsibility]='SCM NIT Data Quality') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: No NIT DAQ Agent"; } if(strAction == "SpecialCBU"){ srtExpr = "EXISTS([Responsibility]='SCM CBU Data Quality' OR [Responsibility]='SCM NIT Data Quality') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: Special CBU Validation"; } //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); //If there is no result means that the agent is not authorized to perform the solvency check if(!BCEmployee.FirstRecord()){ Outputs.SetProperty("Error", "TRUE"); if(strAction != "SegmentChangePetition"){ oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", strMsg)); } } else{ Outputs.SetProperty("Error", "FALSE"); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CBUValidation Errror:" + e.message); throw(e); } finally{ BCEmployee = null; BOEmployee = null; }//SCS-CBU-SXL-CUC-PRQ-DAQ Agent }

CAM BS SCM
CBUValidation
/******************************************************* ** Name: CBUValidation ** Created: 29.07.2008 ** Created By: Gema Torres ** Description: small CR 8338/issue 10384. Check if agent can perform Solvency Check on the customer selected ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CBUValidation(Inputs,Outputs) { var strLogin; var BOEmployee; var BCEmployee; var srtExpr = ""; var strAction; var strMsg = ""; try { //Get Action strAction = Inputs.GetProperty("Action"); //Get Login of the agent strLogin = TheApplication().GetProfileAttr("Login Name"); //Instance Employee BC BOEmployee = TheApplication().GetBusObject("Employee"); BCEmployee = BOEmployee.GetBusComp("Employee"); //Set Search expression, the agent must have the correct responsibility if(strAction == "SolvencyCheck") { srtExpr = "EXISTS([Responsibility]='SCM CCI') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: No CCI Agent"; } if(strAction == "SegmentChange" || strAction == "SegmentChangePetition") { srtExpr = "EXISTS([Responsibility]='SCM NIT Data Quality') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: No NIT DAQ Agent"; } if(strAction == "SpecialCBU") { srtExpr = "EXISTS([Responsibility]='SCM CBU Data Quality' OR [Responsibility]='SCM NIT Data Quality') AND [Login Name] ='"+ strLogin +"'"; strMsg = "Error: Special CBU Validation"; } //perform query on BC Employee BCEmployee.SetViewMode(AllView); BCEmployee.ClearToQuery(); BCEmployee.SetSearchExpr(srtExpr); BCEmployee.ExecuteQuery("ForwardOnly"); //If there is no result means that the agent is not authorized to perform the solvency check if(!BCEmployee.FirstRecord()) { Outputs.SetProperty("Error", "TRUE"); if(strAction != "SegmentChangePetition") TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", strMsg)); } else { Outputs.SetProperty("Error", "FALSE"); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { BCEmployee = null; BOEmployee = null; } //SCS-CBU-SXL-CUC-PRQ-DAQ Agent }

CAM BS SCM
CalcMod97
/******************************************************* ** Name: CalcMod97 ** Created: 24.02.2011 ** Created By: Alejandro Strickler ** Description: This method returns the calculated modulo 97 of a given string that shoud represent an banck occount number -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CalcMod97(bankAccount) { var sDivident = ""; var sRest; for (var i = 0; i < bankAccount.length; i++ ) { sDivident = sDivident + bankAccount.substring(i, i+1); if (sDivident >= 97) { sRest = sDivident % 97; sDivident = sRest; } } return sDivident; }

CAM BS SCM
CalcMod97
function CalcMod97(bankAccount) { /******************************************************* ** Name: CalcMod97 ** Created: 24.02.2011 ** Created By: Alejandro Strickler ** Description: This method returns the calculated modulo 97 of a given string that shoud represent an banck occount number ******************************************************/ var sDivident:chars = ""; var sRest; for (var i = 0; i < bankAccount.length; i++ ) { sDivident = sDivident + bankAccount.substring(i, i+1); if (sDivident >= 97) { sRest = sDivident % 97; sDivident = sRest; } } return sDivident; }

CAM BS SCM
CalcVATExempt
function CalcVATExempt(sCMAId) { // 2013-02-26; tgdstre0; Quadrica - CustBillEnh var oBO:BusObject; var oBC:BusComp; var sReturn; var sCustInt; var sCustInternal; var sDiplo; try { sReturn="1"; // not exempt trc ("CalcVATExempt - sCMAId='" + sCMAId + "'"); oBO = oApp.GetBusObject("Account"); oBC = oBO.GetBusComp("Account"); oBC.SetViewMode(AllView); oBC.ActivateField("Internal Customer Indicator Code SCM"); oBC.ActivateField("Diplomacy Flag SCM"); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", sCMAId); oBC.ExecuteQuery(ForwardBackward); if (BCHasRecord(oBC)) { sCustInt = oBC.GetFieldValue("Internal Customer Indicator Code SCM"); sDiplo = oBC.GetFieldValue("Diplomacy Flag SCM"); sCustInternal = oApp.InvokeMethod("LookUpValue", "INTERNAL_CUST_CODE_SCM", "internal"); trc ("CalcVATExempt - sCustInt='" + sCustInt + "' / sCustInternal='" + sCustInternal + "'/ sDiplo='" + sDiplo + "'"); if (sCustInt == sCustInternal) { sReturn = "2"; // internal } else { if (sDiplo == "Y") { sReturn = "3"; // diplomacy } } } trc ("CalcVATExempt - sReturn='" + sReturn + "'"); } catch(e) { trc("CalcVATExempt - " + e.toString()); } finally { oBC = null; oBO = null; } return (sReturn); }

CAM BS SCM
CalcVATExempt
function CalcVATExempt(sCMAId:chars){ /******************************************************* ** Name: CalcVATExempt ** Created: 09.11.2016 ** Updated By: Aingeru Sabando Lasuen TAASAAI2 ** Description: Code clean-up. Strong typing ******************************************************/ // 2013-02-26; tgdstre0; Quadrica - CustBillEnh var oBO:BusObject; var oBC:BusComp; var sReturn:chars; var sCustInt:chars; var sCustInternal:chars; var sDiplo:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CalcVATExempt START"); try{ sReturn="1"; // not exempt trc ("CalcVATExempt - sCMAId='" + sCMAId + "'"); oBO = oApp.GetBusObject("Account"); oBC = oBO.GetBusComp("Account"); oBC.SetViewMode(AllView); oBC.ActivateField("Internal Customer Indicator Code SCM"); oBC.ActivateField("Diplomacy Flag SCM"); oBC.ClearToQuery(); oBC.SetSearchSpec("Id", sCMAId); oBC.ExecuteQuery(ForwardBackward); if (BCHasRecord(oBC)){ sCustInt = oBC.GetFieldValue("Internal Customer Indicator Code SCM"); sDiplo = oBC.GetFieldValue("Diplomacy Flag SCM"); sCustInternal = oApp.InvokeMethod("LookUpValue", "INTERNAL_CUST_CODE_SCM", "internal"); trc ("CalcVATExempt - sCustInt='" + sCustInt + "' / sCustInternal='" + sCustInternal + "'/ sDiplo='" + sDiplo + "'"); if (sCustInt == sCustInternal){ sReturn = "2"; // internal } else{ if (sDiplo == "Y"){ sReturn = "3"; // diplomacy } } } trc ("CalcVATExempt - sReturn='" + sReturn + "'"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CalcVATExempt ERROR:" + e.message); } finally{ oBC = null; oBO = null; } return (sReturn); }

CAM BS SCM
CancelActiveServiceRequest
function CancelActiveServiceRequest(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: CancelActiveServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR an Opened SR got from the context. This method is used when only one SR is in the context. -------------------- Modifications --------------------- ** Date: 2010.02.11 ** Changed By: Carolina Indiano ** Description: SCM TGDFESO1 2010.02.11 CR19835: It should be performed a search for every single SR ** Areas/SubArea -different from the 09 Customer Data / 09.20 New customer-, excluding the SRs with Closed or Cancelled status. -------------------- Modifications --------------------- ** Date: 2010.02.15 ** Changed By: Carolina Indiano ** Description: SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando ** Description: Strong typing and code clean up ******************************************************/ var BOActiveAccount:BusObject; var BCServiceRequest:BusComp; var BCAction:BusComp; var BCAccount:BusComp; var strSRId:chars; var strorderid:chars; var strSubType:chars; var strParentAccount:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelActiveServiceRequest START"); try{ //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = oApp.ActiveBusObject(); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); BCAction = BOActiveAccount.GetBusComp("Action"); if(oApp.ActiveViewName() == "Duplicate Customer Candidate View SCM"){ BCAccount = BOActiveAccount.GetBusComp("Account"); strSRId = BCAccount.GetFieldValue("Id"); BCServiceRequest.ActivateField("Account Id"); BCServiceRequest.ActivateField("Sub-Area"); BCServiceRequest.ActivateField("Status"); //Look for the SR whose Id was the input argument BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strSRId); BCServiceRequest.SetSearchSpec("Sub-Area","New customer"); BCServiceRequest.SetSearchSpec("Status","Open"); BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord()){ BCServiceRequest.InvokeMethod("CancelSR"); } else{ oApp.RaiseErrorText("There is Not Active SR"); } //The SR from eOrders has to be reasigned to the selected customer //Look for the SR of type 14.21 New Contract and assign it to the customer selected -> change the Account Id BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strSRId); //Areas/SubArea -different from the 09 Customer Data / 09.20 New customer-, excluding the SRs with Closed or Cancelled status. BCServiceRequest.SetSearchSpec("Sub-Area","<> 'New customer'"); BCServiceRequest.SetSearchSpec("Status", "<> 'Closed' AND [Status] <> 'Cancelled'"); BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord()){// Change Activity FK to Account do{ BCAction.ActivateField("Activity SR Id"); BCAction.ClearToQuery(); BCAction.SetSearchSpec("Activity SR Id",BCServiceRequest.GetFieldValue("Id")); BCAction.ExecuteQuery(ForwardOnly); if (BCAction.FirstRecord()){ do{ BCAction.SetFieldValue("Account Id",Inputs.GetProperty("Acc Id")); BCAction.WriteRecord(); } while(BCAction.NextRecord()) } strorderid = BCServiceRequest.GetFieldValue("Order Id"); if (strorderid!=""){ Inputs.SetProperty("OrderId", strorderid); TransferOrderAndOrderItems(Inputs,Outputs); } BCServiceRequest.SetFieldValue("Account Id", Inputs.GetProperty("Acc Id")); BCServiceRequest.WriteRecord(); } while(BCServiceRe

CAM BS SCM
CancelActiveServiceRequest
/******************************************************* ** Name: CancelActiveServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR an Opened SR got ** from the context. This method is used when only one SR is in the context. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 2010.02.11 ** Changed By: Carolina Indiano ** Description: SCM TGDFESO1 2010.02.11 CR19835: It should be performed a search for every single SR ** Areas/SubArea -different from the 09 Customer Data / 09.20 New customer-, excluding the SRs ** with Closed or Cancelled status. ** Date: 2010.02.15 ** Changed By: Carolina Indiano ** Description: SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. ******************************************************/ function CancelActiveServiceRequest(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BOOrder; var BCOrder; var BCOrderItem; var BCServiceRequest; var BCAction; var BCAccount; var strSRId; //BEGIN. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. var strorderid; //END. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. var BOInstAccount; var BCInstAccount; var strSubType; var strParentAccount; try{ //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); BCAction = BOActiveAccount.GetBusComp("Action"); if(TheApplication().ActiveViewName() == "Duplicate Customer Candidate View SCM") { BCAccount = BOActiveAccount.GetBusComp("Account"); strSRId = BCAccount.GetFieldValue("Id"); BCServiceRequest.ActivateField("Account Id"); BCServiceRequest.ActivateField("Sub-Area"); BCServiceRequest.ActivateField("Status"); //Look for the SR whose Id was the input argument BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strSRId); BCServiceRequest.SetSearchSpec("Sub-Area","New customer"); BCServiceRequest.SetSearchSpec("Status","Open"); BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord()) BCServiceRequest.InvokeMethod("CancelSR"); else TheApplication().RaiseErrorText("There is Not Active SR"); //-- BEGIN CR086 --TGDTOGE3 07.04.2009 The SR from eOrders has to be reasigned to the selected customer //Look for the SR of type //14 Modif. Order Management //14.21 New Contract //04 Activation //and assign it to the customer selected -> change the Account Id // INI TGDGAAND 25.01.10 Issue 19068 Reassign New Contract OMS BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strSRId); //BEGIN. SCM TGDFESO1 2010.02.11 CR19835: It should be performed a search for every single SR //Areas/SubArea -different from the 09 Customer Data / 09.20 New customer-, excluding the SRs //with Closed or Cancelled status. //BCServiceRequest.SetSearchSpec("Sub-Area","New contract"); BCServiceRequest.SetSearchSpec("Sub-Area","<> 'New customer'"); //BCServiceRequest.SetSearchSpec("Status","Open"); BCServiceRequest.SetSearchSpec("Status", "<> 'Closed' AND [Status] <> 'Cancelled'"); //END. SCM TGDFESO1 2010.02.11 CR19835 BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord()) { // Change Activity FK to Account do { BCAction.ActivateField("Activity SR Id"); BCAction.ClearToQuery(); BCAction.SetSearchSpec("Activity SR Id",BCServiceRequest.GetFieldValue("Id")); BCAction.ExecuteQuery(ForwardOnly); if (BCAction.FirstRecord()) { do {

CAM BS SCM
CancelServiceRequest
function CancelServiceRequest(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: CancelServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR whose Id was stored in a property. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOServiceRequest:BusObject; var BCServiceRequest:BusComp; var SRId:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelServiceRequest START"); try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR is cancelled if(BCServiceRequest.FirstRecord()){ BCServiceRequest.InvokeMethod("CancelSR"); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelServiceRequest Error:" + e.message); throw(e); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
CancelServiceRequest
/******************************************************* ** Name: CancelServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR whose Id was ** stored in a property. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CancelServiceRequest(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR is cancelled if(BCServiceRequest.FirstRecord()) BCServiceRequest.InvokeMethod("CancelSR"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
CancelServiceRequestOnly
function CancelServiceRequestOnly(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: CancelServiceRequestOnly ** Created: 05.01.2009 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR whose Id was ** stored in a property. This method is used when is needed to cancel an address change SR without cancelling the associated address. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOServiceRequest:BusObject; var BCServiceRequest:BusComp; var SRId:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelServiceRequestOnly START"); try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR is cancelled but not the address. if(BCServiceRequest.FirstRecord()){ BCServiceRequest.InvokeMethod("CancelSR"); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelServiceRequestOnly Error:" + e.message); throw(e); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
CancelServiceRequestOnly
/******************************************************* ** Name: CancelServiceRequestOnly ** Created: 05.01.2009 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to cancel the SR whose Id was ** stored in a property. This method is used when is needed to cancel an address change SR without ** cancelling the associated address. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function CancelServiceRequestOnly(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR is cancelled but not the address. if(BCServiceRequest.FirstRecord()) BCServiceRequest.InvokeMethod("CancelSR"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
ChangeAddressStatus
function ChangeAddressStatus(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: ChangeAddressStatus ** Created: 13.10.2008 ** Created By: Javier Amor ** Description: This method looks for the Address which is in the context and set its status to Scheduled. Input parameter is required to determine which kind of address needs to be changed. ------------------------------------------------------------ ** Date: 26.03.2010 ** Changed By: Alejandro Strickler ** Description: CR 0335 Functionality extended with a special case "CancelActive" for changeing status of active Addresses (Should be revised, ** other implementation of this functionality should be better -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOAccount:BusObject; var BCAddressUsage:BusComp; var strEntity:chars; var strAddressId:chars; var strParentId:chars; var strAccountId:chars; var strId:chars; //Issue 2548 var strStatus:chars = ""; var strAccountIdInstance:chars; var strSpecialCall:chars = ""; var sAllAddressView:chars = "N"; if(bIsTraceOn) oApp.Trace(this.Name() + ".ChangeAddressStatus START"); try{ //Get input parameter strId = Inputs.GetProperty("Id"); //Issue 2548 strEntity = Inputs.GetProperty("Entity"); strParentId = Inputs.GetProperty("AccountId"); strStatus = Inputs.GetProperty("Status"); strSpecialCall = Inputs.GetProperty("SpecialCall"); if(strStatus != ""){ strStatus = oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", strStatus); } else{ strStatus = oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Scheduled"); } //When the bus object is not account, account will be get.For the GUI is necessary to use the ActiveBusObject command. BOAccount = null; // to avoid bloody warning if(oApp.ActiveBusObject()){ if(oApp.ActiveBusObject().Name() == "Account"){ BOAccount = oApp.ActiveBusObject(); } else { BOAccount = oApp.GetBusObject("Account"); } } else { BOAccount = oApp.GetBusObject("Account"); } BCAddressUsage = BOAccount.GetBusComp("Account Address Usage SCM"); strAccountId = "Account Id SCM"; //To bypass the BC query & refresh logic for All Address Applets (Account, BP & Contracts) if(oApp.GetProfileAttr("ActiveViewName") == "Account Entry All Addresses View SCM"){ sAllAddressView = "Y"; } //Get BC depending on the entity. Account is selected by default switch (strEntity) { case "Billing": if(sAllAddressView != "Y"){ BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage SCM"); } else { BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); } strAccountId= "Account Id SCM"; break; case "Billing Light": BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); strAccountId = "Account Id SCM"; break; case "Contract": //For Contract Address (All or individual contracts), the Applet's BC should be used if(sAllAddressView != "Y") { BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage SCM"); strAccountId= "Account Id"; } else { BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage Light SCM"); strAccountId= "Account Id SCM"; } strAccountIdInstance= "Account Id"; break; case "Contract Light": BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage Light SCM"); strAccountIdInstance = "Account Id"; strAccountId = "Account Id SCM"; break; } //To bypass the BC query & refresh logic for All Address Applets (Account, BP & Contracts) if(sAllAddressView != "Y"){ BCAddressUsage.SetViewMode(AllView); BCAddressUsage.ClearToQuery(); BCAddressUsage.SetS

CAM BS SCM
ChangeAddressStatus
/******************************************************* ** Name: ChangeAddressStatus ** Created: 13.10.2008 ** Created By: Javier Amor ** Description: This method looks for the Address which is in the context and set its status to Scheduled. ** Input parameter is required to determine which kind of address needs to be changed. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 28.09.2009 ** Changed By: Javier Amor ** Description: Issue 13328. To make this scripting more reusable, status can be set according to an input parameter. ** When is empty it will be predefaulted to Scheduled to mantain the current funcionality and ** without any change in the current WFs and scripting. ** In Status property must be set the LIC of the desired status to set the address. Otherwise it ** will be set to Scheduled by default. ------------------------------------------------------------ ** Version: <New Version> ** Date: 26.03.2010 ** Changed By: Alejandro Strickler ** Description: CR 0335 Functionality extended with a special case "CancelActive" for changeing status of active Addresses (Should be revised, ** other implementation of this functionality should be better ******************************************************/ function ChangeAddressStatus(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOAccount; var BCAddressUsage; var strEntity; var strAddressId; var strParentId; var strAccountId; var strId; //Issue 2548 var strStatus=""; var strAccountIdInstance; var strSpecialCall = ""; //var BCInstance; try{ //Get input parameter strId = Inputs.GetProperty("Id"); //Issue 2548 strEntity = Inputs.GetProperty("Entity"); strParentId = Inputs.GetProperty("AccountId"); strStatus = Inputs.GetProperty("Status"); strSpecialCall = Inputs.GetProperty("SpecialCall"); if(strStatus != "") strStatus = oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", strStatus); else strStatus = oApp.InvokeMethod("LookupValue", "ACCT_ADD_TYPE", "Scheduled"); //SCM 2009.09.15 TGDAMJA1.Issue 13194,13420. When the bus object is not account, account will be get. //For the GUI is necessary to use the ActiveBusObject command. BOAccount = null; // to avoid bloody warning if(oApp.ActiveBusObject()) { if(oApp.ActiveBusObject().Name() == "Account") BOAccount = oApp.ActiveBusObject(); else BOAccount = oApp.GetBusObject("Account"); } else BOAccount = oApp.GetBusObject("Account"); BCAddressUsage = BOAccount.GetBusComp("Account Address Usage SCM"); /* Issue 2395 */ //strParentId= BCAddressUsage.GetFieldValue("Account Id SCM"); strAccountId="Account Id SCM"; /* Issue 2395 */ //Get BC depending on the entity. Account is selected by default switch (strEntity) { case "Billing": //BCInstance = BOAccount.GetBusComp("Billing Profile Address Usage SCM"); //SCM 2009.12.03 TGDAMJA1. Issue 17918. Changed BC from light one to the original one, because the query //below was not finding any record. //BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage SCM"); /* Issue 2395 */ ///strParentId= BCAddressUsage.GetFieldValue("Account Id SCM"); strAccountId= "Account Id SCM"; /* Issue 2395 */ break; case "Billing Light": //Added for CR 0335 BCAddressUsage = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); strAccountId= "Account Id SCM"; /* Issue 2395 */ break; case "Contract": case "Contract Light": //BCInstance = BOAccount.GetBusComp("Contract Address Usage SCM"); BCAddressUsage = BOAccount.GetBusComp("Contract Address Usage Light SCM"); /* Issue 2395 */ //strParentId= BCAddress

CAM BS SCM
CheckIBANagainstPaymentMethod
function CheckIBANagainstPaymentMethod (Inputs:PropertySet, Outputs:PropertySet){ /***************************************************************************** ** Function: CheckIBANagainstPaymentMethod ** Date: 15.06.2015 ** Author: Christoph Reitermann ** Description: used to validate the IBAN against the payment Method SO-2482 -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************************************/ var sIBAN:chars = ""; var sPaymentMethod:chars = ""; var sBankClearingDigit:chars = ""; var sValidIBAN2:chars = "Y"; var sValidIBAN3:chars = "Y"; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckIBANagainstPaymentMethod START"); try { sIBAN = Inputs.GetProperty("IBAN"); sPaymentMethod = Inputs.GetProperty("PaymentMethod"); sBankClearingDigit = sIBAN.substring(4, 9); if (sIBAN.length > 0) { if (sPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","LSV") && sBankClearingDigit == "09000") { sValidIBAN2 = "N"; if(bIsTraceOn)oApp.Trace(this.Name() + ".CheckIBANagainstPaymentMethod Msg1 - Payment Method '" + sPaymentMethod + "' doesn't match with Bank Clearing Number '" + sBankClearingDigit + "'!"); } if (sPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Debit Direct") && sBankClearingDigit != "09000") { sValidIBAN3 = "N"; if(bIsTraceOn)oApp.Trace(this.Name() + ".CheckIBANagainstPaymentMethod Msg2 - Payment Method '" + sPaymentMethod + "' doesn't match with Bank Clearing Number '" + sBankClearingDigit + "'!"); } } Outputs.SetProperty("Valid2", sValidIBAN2); Outputs.SetProperty("Valid3", sValidIBAN3); if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckIBANagainstPaymentMethod Valid2:" + sValidIBAN2+ " Valid3: " + sValidIBAN3); } catch (e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckIBANagainstPaymentMethod Error:" + e.message); throw(e); } finally { } }

CAM BS SCM
CheckIBANagainstPaymentMethod
function CheckIBANagainstPaymentMethod (Inputs, Outputs) { /***************************************************************************** ** Function: CheckIBANagainstPaymentMethod ** Date: 15.06.2015 ** Author: Christoph Reitermann ** Description: used to validate the IBAN against the payment Method SO-2482 ******************************************************************************/ var sIBAN:String = ""; var sPaymentMethod:String = ""; var sBankClearingDigit:String = ""; var sValidIBAN2:String = "Y"; var sValidIBAN3:String = "Y"; try { sIBAN = Inputs.GetProperty("IBAN"); sPaymentMethod = Inputs.GetProperty("PaymentMethod"); sBankClearingDigit = sIBAN.substring(4, 9); if (sIBAN.length > 0) { if (sPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","LSV") && sBankClearingDigit == "09000") { sValidIBAN2 = "N"; oApp.Trace("CheckIBANagainstPaymentMethod Msg1 - Payment Method '" + sPaymentMethod + "' doesn't match with Bank Clearing Number '" + sBankClearingDigit + "'!"); } if (sPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Debit Direct") && sBankClearingDigit != "09000") { sValidIBAN3 = "N"; oApp.Trace("CheckIBANagainstPaymentMethod Msg2 - Payment Method '" + sPaymentMethod + "' doesn't match with Bank Clearing Number '" + sBankClearingDigit + "'!"); } } Outputs.SetProperty("Valid2", sValidIBAN2); Outputs.SetProperty("Valid3", sValidIBAN3); } catch (e) { throw(e); } finally { } }

CAM BS SCM
CheckLOVHierachy
function CheckLOVHierachy(oBCLOV:BusComp, sType:chars, &sLevel1LICToDisplay, &sLevel2DisplayToLIC, &sLevel3DisplayToLIC, sHigh1:chars, sHigh2:chars, sHigh3:chars){ /*********************************************** ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ***********************************************/ var sSearchExpr:chars; var sSearchHigh:chars; var sLevel1LIC:chars; var bReturn:bool; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckLOVHierachy START"); try{ bReturn = false; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckLOVHierachy sLevel1LICToDisplay=" + sLevel1LICToDisplay + " / sLevel2DisplayToLIC=" + sLevel2DisplayToLIC + " / sLevel3DisplayToLIC=" + sLevel3DisplayToLIC + " / sHigh1=" + sHigh1 + " / sHigh2=" + sHigh2 + " / sHigh3=" + sHigh3); sSearchExpr = "[Type]='" + sType + "' AND [Active]='Y' AND [Language]=Language()"; sSearchHigh = ""; if (sHigh1 != ""){ sSearchHigh = " AND [High] LIKE '*" + sHigh1 + "*'"; } if (sLevel1LICToDisplay == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent] is null AND [Name]='" + sLevel1LICToDisplay + "'")){ bReturn = true; sLevel1LICToDisplay = ""; sLevel2DisplayToLIC = ""; sLevel3DisplayToLIC = ""; } else { sSearchExpr = "[Type]='" + sType + "' AND [Active]='Y' AND [Language]='ENU'"; sLevel1LIC = sLevel1LICToDisplay; sLevel1LICToDisplay = oBCLOV.GetFieldValue("Value"); if (sHigh2 != ""){ sSearchHigh = " AND [High] LIKE '*" + sHigh2 + "*'"; } else { sSearchHigh = ""; } if (sLevel2DisplayToLIC == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent]='" + sLevel1LIC + "' AND [Value]='" + sLevel2DisplayToLIC + "'")){ sLevel2DisplayToLIC = ""; sLevel3DisplayToLIC = ""; } else { sLevel2DisplayToLIC = oBCLOV.GetFieldValue("Name"); if (sHigh3 != "") { sSearchHigh = " AND [High] LIKE '*" + sHigh3 + "*'"; } else { sSearchHigh = ""; } if (sLevel3DisplayToLIC == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent]='" + sLevel2DisplayToLIC + "' AND [Value]='" + sLevel3DisplayToLIC + "'")){ sLevel3DisplayToLIC = ""; } else { sLevel3DisplayToLIC = oBCLOV.GetFieldValue("Name"); } } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckLOVHierachy Error: " + e.message); } finally{ if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckLOVHierachy - return: sLevel1LICToDisplay=" + sLevel1LICToDisplay + " / sLevel2DisplayToLIC=" + sLevel2DisplayToLIC + " / sLevel3DisplayToLIC=" + sLevel3DisplayToLIC); } return (bReturn); }

CAM BS SCM
CheckLOVHierachy
function CheckLOVHierachy(oBCLOV:BusComp, sType, &sLevel1LICToDisplay, &sLevel2DisplayToLIC, &sLevel3DisplayToLIC, sHigh1, sHigh2, sHigh3) { var sSearchExpr; var sSearchHigh; var sLevel1LIC; var bReturn; try { bReturn = false; trc ("CheckLOVHierachy - start: sLevel1LICToDisplay=" + sLevel1LICToDisplay + " / sLevel2DisplayToLIC=" + sLevel2DisplayToLIC + " / sLevel3DisplayToLIC=" + sLevel3DisplayToLIC + " / sHigh1=" + sHigh1 + " / sHigh2=" + sHigh2 + " / sHigh3=" + sHigh3); sSearchExpr = "[Type]='" + sType + "' AND [Active]='Y' AND [Language]=Language()"; sSearchHigh = ""; if (sHigh1 != "") { sSearchHigh = " AND [High] LIKE '*" + sHigh1 + "*'"; } if (sLevel1LICToDisplay == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent] is null AND [Name]='" + sLevel1LICToDisplay + "'")) { bReturn = true; sLevel1LICToDisplay = ""; sLevel2DisplayToLIC = ""; sLevel3DisplayToLIC = ""; } else { sSearchExpr = "[Type]='" + sType + "' AND [Active]='Y' AND [Language]='ENU'"; sLevel1LIC = sLevel1LICToDisplay; sLevel1LICToDisplay = oBCLOV.GetFieldValue("Value"); if (sHigh2 != "") { sSearchHigh = " AND [High] LIKE '*" + sHigh2 + "*'"; } else { sSearchHigh = ""; } if (sLevel2DisplayToLIC == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent]='" + sLevel1LIC + "' AND [Value]='" + sLevel2DisplayToLIC + "'")) { sLevel2DisplayToLIC = ""; sLevel3DisplayToLIC = ""; } else { sLevel2DisplayToLIC = oBCLOV.GetFieldValue("Name"); if (sHigh3 != "") { sSearchHigh = " AND [High] LIKE '*" + sHigh3 + "*'"; } else { sSearchHigh = ""; } if (sLevel3DisplayToLIC == "" || !QueryLOV(oBCLOV, sSearchExpr + sSearchHigh + " AND [Parent]='" + sLevel2DisplayToLIC + "' AND [Value]='" + sLevel3DisplayToLIC + "'")) { sLevel3DisplayToLIC = ""; } else { sLevel3DisplayToLIC = oBCLOV.GetFieldValue("Name"); } } } } catch(e) { trc ("CheckLOVHierachy - " + e.toString()); } trc ("CheckLOVHierachy - return: sLevel1LICToDisplay=" + sLevel1LICToDisplay + " / sLevel2DisplayToLIC=" + sLevel2DisplayToLIC + " / sLevel3DisplayToLIC=" + sLevel3DisplayToLIC); return (bReturn); }

CAM BS SCM
CheckModulo10
function CheckModulo10(Inputs, Outputs) { //==================================================================================================== // Authors: Jochen Greulich, TGDGRJO6 // Purpose: Used to check the Bank Account Number of a Bililng Profile // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-07-18 Jochen Greulich 1 created //==================================================================================================== try { var strFuncName = "BS:"+this.Name()+".CheckModulo10"; if (bIsTraceOn) oApp.Trace(strFuncName + " Enter"); var sLen = Inputs.GetProperty("Account Number").length; var aDigits = new Array(sLen); if (sLen > 0) { for (var i = 0; i < sLen; i++ ) { aDigits[i] = parseInt(Inputs.GetProperty("Account Number").substring(i,i+1), 10); } var sDigit = 0; var sSum1 = 0; for (var j = sLen-1; j >= 0; j-- ) { sDigit = 1*aDigits[j]; sSum1 += sDigit; j--; } var sSum2 = 0; sDigit = 0; for (var k = sLen-2; k >= 0; k-- ) { sDigit = 2*aDigits[k]; sSum2 += (sDigit>9) ? sDigit-9 : sDigit; k--; } var sSum = sSum1 + sSum2; if (sSum % 10 == 0) { Outputs.SetProperty("Valid", "Y"); if (bIsTraceOn) { oApp.Trace("CheckModulo10 - Valid Account Number"); } } else { Outputs.SetProperty("Valid", "N"); if (bIsTraceOn) { oApp.Trace("CheckModulo10 - Non valid Account Number"); } } } else { Outputs.SetProperty("Valid", "N"); if (bIsTraceOn) { oApp.Trace("CheckModulo10 - Non valid Account Number"); } } } catch(e) { throw(e); } finally { aDigits = null; } }

CAM BS SCM
CheckModulo10
function CheckModulo10(Inputs:PropertySet, Outputs:PropertySet){ /***************************************************************************** ** Function: CheckModulo10 ** Date: 18.07.2009 ** Author: Jochen Greulich, TGDGRJO6 ** Description: Used to check the Bank Account Number of a Bililng Profile -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************************************/ var strFuncName:chars = ""; var sLen:float = 0; var aDigits:Array; var sDigit:float = 0; var sSum:float = 0; var sSum1:float = 0; var sSum2:float = 0; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10 START"); try{ sLen = Inputs.GetProperty("Account Number").length; aDigits = new Array(sLen); if (sLen > 0) { for (var i = 0; i < sLen; i++ ) { aDigits[i] = parseInt(Inputs.GetProperty("Account Number").substring(i,i+1), 10); } sDigit = 0; sSum1 = 0; for (var j = sLen-1; j >= 0; j-- ) { sDigit = 1*aDigits[j]; sSum1 += sDigit; j--; } sSum2 = 0; sDigit = 0; for (var k = sLen-2; k >= 0; k-- ) { sDigit = 2*aDigits[k]; sSum2 += (sDigit>9) ? sDigit-9 : sDigit; k--; } sSum = sSum1 + sSum2; if (sSum % 10 == 0) { Outputs.SetProperty("Valid", "Y"); if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10 - Valid Account Number"); } else { Outputs.SetProperty("Valid", "N"); if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10 - Non valid Account Number"); } } else { Outputs.SetProperty("Valid", "N"); if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10 - Non valid Account Number"); } } catch(e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10 - Error: " + e.message); throw(e); } finally{ aDigits = null; } }

CAM BS SCM
CheckModulo10Recursive
//==================================================================================================== // Authors: Jochen Greulich, TGDGRJO6 // Purpose: Used to check the Bank Account Number of a Billing Profile // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-07-18 Jochen Greulich 1 created // 2011-03-10 Alejandro Strickler 2 Null length check added //==================================================================================================== function CheckModulo10Recursive(Inputs:PropertySet, Outputs:PropertySet) { var sBankAccount:String = ""; var sLen; var sLastDigit; var aTable; var sCharPos; var sNormLength; var sAccountLength; var sLength; var nUebertrag; var accountArr; try { // Get bank Account Number to be checked sBankAccount = Inputs.GetProperty("Bank Account Number"); if (sBankAccount.length > 0) { //TGDHAKA8 2011-09-05: defect 41078: validation of bank account format added accountArr = sBankAccount.split("-"); if(accountArr.length != 3 || accountArr[0].length != 2 || accountArr[2].length != 1) { Outputs.SetProperty("Valid", "N"); } else { sLen = sBankAccount.length; sLastDigit = sBankAccount.substring(sLen-1, sLen); aTable = new Array(0, 9, 4, 6, 8, 2, 7, 1, 3, 5); sCharPos = 0; // replace "-" while (sCharPos != -1) { sCharPos = sBankAccount.indexOf("-"); if (sCharPos != -1) { sBankAccount = sBankAccount.replace("-", "") } } // fill up with 0 sNormLength = 9; sAccountLength = 0; sLength = 0; sAccountLength = sBankAccount.length; sLength = sNormLength - sAccountLength; while (sLength > 0) { sBankAccount = sBankAccount.substring(0, 2) + "0" + sBankAccount.substring(2, sBankAccount.length); sLength--; } // calculate Uebertrag nUebertrag = 0; for (var i=0; i <= sBankAccount.length-2; i++) { nUebertrag = aTable[(ToNumber(nUebertrag) + ToNumber(sBankAccount.substring(i, i+1)))%10]; } aTable = null; if (sLen > 0) { if (((10 - nUebertrag) % 10) == sLastDigit) { Outputs.SetProperty("Valid", "Y"); } else { Outputs.SetProperty("Valid", "N"); } } else { Outputs.SetProperty("Valid", "N"); } } } else { // Bank Account is empty Outputs.SetProperty("Valid", "Y"); } } catch(e) { throw(e); } finally { accountArr = null; } }

CAM BS SCM
CheckModulo10Recursive
function CheckModulo10Recursive(Inputs:PropertySet, Outputs:PropertySet) { /***************************************************************************** ** Function: CheckModulo10Recursive ** Date: 18.07.2009 ** Author: Jochen Greulich, TGDGRJO6 ** Description: Used to check the Bank Account Number of a Bililng Profile -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************************************/ var accountArr:Array; var aTable:Array; var sBankAccount:chars = ""; var sLen:chars; var sLastDigit:chars; var sCharPos:chars; var sNormLength:chars; var sAccountLength:chars; var sLength:chars; var nUebertrag:float; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10Recursive START"); try { // Get bank Account Number to be checked sBankAccount = Inputs.GetProperty("Bank Account Number"); if (sBankAccount.length > 0) { //TGDHAKA8 2011-09-05: defect 41078: validation of bank account format added accountArr = sBankAccount.split("-"); if(accountArr.length != 3 || accountArr[0].length != 2 || accountArr[2].length != 1) { Outputs.SetProperty("Valid", "N"); } else { sLen = sBankAccount.length; sLastDigit = sBankAccount.substring(sLen-1, sLen); aTable = new Array(0, 9, 4, 6, 8, 2, 7, 1, 3, 5); sCharPos = 0; // replace "-" while (sCharPos != -1) { sCharPos = sBankAccount.indexOf("-"); if (sCharPos != -1) { sBankAccount = sBankAccount.replace("-", "") } } // fill up with 0 sNormLength = 9; sAccountLength = 0; sLength = 0; sAccountLength = sBankAccount.length; sLength = sNormLength - sAccountLength; while (sLength > 0) { sBankAccount = sBankAccount.substring(0, 2) + "0" + sBankAccount.substring(2, sBankAccount.length); sLength--; } // calculate Uebertrag nUebertrag = 0; for (var i=0; i <= sBankAccount.length-2; i++) { nUebertrag = aTable[(ToNumber(nUebertrag) + ToNumber(sBankAccount.substring(i, i+1)))%10]; } aTable = null; if (sLen > 0) { if (((10 - nUebertrag) % 10) == sLastDigit) { Outputs.SetProperty("Valid", "Y"); } else { Outputs.SetProperty("Valid", "N"); } } else { Outputs.SetProperty("Valid", "N"); } } } else { // Bank Account is empty Outputs.SetProperty("Valid", "Y"); } } catch(e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo10Recursive ERROR: " + e.message); throw(e); } finally { accountArr = null; } }

CAM BS SCM
CheckModulo97
function CheckModulo97(Inputs, Outputs) { //==================================================================================================== // Authors: Jochen Greulich, TGDGRJO6 // Purpose: Used to check the IBAN of a Bililng Profile // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-07-18 Jochen Greulich 1 created // 2010-02-17 Thorwald Schubert 2 added replacement of further characters in IBAN and // added validation for any other digits than integers // 2011-03-10 Alejandro Strickler 3 Field names adapted to Symphony // 2013-11-21 Mario Geiss 4 Added check for IBAN Country due to Defect 77770 // 2015-06-16 Christoph Reitermann 5 Added Payment Method 'Debit Direct' for SO_2482 //==================================================================================================== var strAccountNumber:String = ""; var strEpaymentNumber:String = ""; var strPaymentMethod:String = ""; var sLastDigits; var sIBAN4Calc; var sValidDigits = "N"; try { strAccountNumber = Inputs.GetProperty("AccountNumber"); strEpaymentNumber = Inputs.GetProperty("EpaymentNumber"); strPaymentMethod = Inputs.GetProperty("PaymentMethod"); var sValidAccountNumber = "N"; if (bIsTraceOn) { oApp.Trace("CheckModulo97 - strPaymentMethod: " + strPaymentMethod); oApp.Trace("CheckModulo97 - strAccountNumber: " + strAccountNumber); oApp.Trace("CheckModulo97 - strEpaymentNumber: " + strEpaymentNumber); } if (strAccountNumber.length > 0 || strEpaymentNumber.length > 0) { //SCM TGDRECHA 16.06.2015 added Payment Method 'Debit Direct' for SO_2482 if (strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","LSV") || strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Debit Direct")) { // Transform IBAN input to the correct format to be able to calculate the checksum it //var reValid = new RegExp('^[a-zA-Z0-9]*$'); var reValid = new RegExp('^[A-Z0-9]*$'); // defect 38987: spaces not allowed if (! reValid.test(strAccountNumber) ) { sValidAccountNumber = "N"; } else { var sFirstCCDigit = strAccountNumber.substring(0, 1); var sSecondCCDigit = strAccountNumber.substring(1, 2); var sLastCCDigits = strAccountNumber.substring(2, 4); sLastDigits = strAccountNumber.substring(4, strAccountNumber.length); // Re-arrange the IBAN for validation sIBAN4Calc = sLastDigits + sFirstCCDigit + sSecondCCDigit + sLastCCDigits; // Replace all characters by integers in the string and check if IBAN contains only integers sIBAN4Calc = GenerateNumericIban(sIBAN4Calc); if (sIBAN4Calc == null) { sValidAccountNumber = "N"; oApp.Trace("CheckModulo97 - GenerateNumericIban failed!!"); } else { if (CalcMod97(sIBAN4Calc) == 1) { // <START> TGDGEMAM 2013-11-21 Defect 77770 switch (strAccountNumber.substring(0,2)) { case "CH": case "LI": if (strAccountNumber.length == 21) { sValidAccountNumber = "Y"; } else { sValidAccountNumber = "N"; } break; default: sValidAccountNumber = "Y"; break; } // <END> TGDGEMAM 2013-11-21 Defect 77770 } else { oApp.Trace("CheckModulo97 - CalcMod97 failed!!"); sValidAccountNumber = "N"; } } } } else if (strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Yellow Bill") || strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Paynet")) { // Replace all characters by integers in the string and check if IBAN contains only integers sIBAN4Calc = GenerateNumericIban(strEpaymentNumber); if (sIBAN4Calc == null) { sValidAccountNumb

CAM BS SCM
CheckModulo97
function CheckModulo97(Inputs:PropertySet, Outputs:PropertySet) { /***************************************************************************** ** Function: CheckModulo97 ** Date: 18.07.2009 ** Author: Jochen Greulich, TGDGRJO6 ** Description: Used to check the IBAN of a Bililng Profile ** Changes: 2013-11-21 Mario Geiss Added check for IBAN Country due to Defect 77770 ** Changes: 2015-06-16 Christoph Reitermann Added Payment Method 'Debit Direct' for SO_2482 -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************************************/ var strAccountNumber:chars = ""; var strEpaymentNumber:chars = ""; var strPaymentMethod:chars = ""; var sLastDigits:chars; var sIBAN4Calc:chars; var sValidDigits:chars = "N"; var sValidAccountNumber:chars = "N"; var sFirstCCDigit:chars; var sSecondCCDigit:chars; var sLastCCDigits:chars; var reValid; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo97 START"); strAccountNumber = Inputs.GetProperty("AccountNumber"); strEpaymentNumber = Inputs.GetProperty("EpaymentNumber"); strPaymentMethod = Inputs.GetProperty("PaymentMethod"); if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo97 - strPaymentMethod: " + strPaymentMethod + " - strAccountNumber: " + strAccountNumber + " - strEpaymentNumber: " + strEpaymentNumber); if (strAccountNumber.length > 0 || strEpaymentNumber.length > 0) { if (strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","LSV") || strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Debit Direct")) {//Added Payment Method 'Debit Direct' for SO_2482 // Transform IBAN input to the correct format to be able to calculate the checksum it reValid = new RegExp('^[A-Z0-9]*$'); //spaces not allowed if (! reValid.test(strAccountNumber) ) { sValidAccountNumber = "N"; } else { sFirstCCDigit = strAccountNumber.substring(0, 1); sSecondCCDigit = strAccountNumber.substring(1, 2); sLastCCDigits = strAccountNumber.substring(2, 4); sLastDigits = strAccountNumber.substring(4, strAccountNumber.length); // Re-arrange the IBAN for validation sIBAN4Calc = sLastDigits + sFirstCCDigit + sSecondCCDigit + sLastCCDigits; // Replace all characters by integers in the string and check if IBAN contains only integers sIBAN4Calc = GenerateNumericIban(sIBAN4Calc); if (sIBAN4Calc == null) { sValidAccountNumber = "N"; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo97 - GenerateNumericIban failed!!"); } else { if (CalcMod97(sIBAN4Calc) == 1) { switch (strAccountNumber.substring(0,2)) { case "CH": case "LI": if (strAccountNumber.length == 21) { sValidAccountNumber = "Y"; } else { sValidAccountNumber = "N"; } break; default: sValidAccountNumber = "Y"; break; } } else { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckModulo97 - CalcMod97 failed!!"); sValidAccountNumber = "N"; } } } } else if (strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Yellow Bill") || strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Paynet")) { // Replace all characters by integers in the string and check if IBAN contains only integers sIBAN4Calc = GenerateNumericIban(strEpaymentNumber); if (sIBAN4Calc == null) { sValidAccountNumber = "N"; } else { // Check the first 4 Digits if ((sIBAN4Calc.substring(0, 4) == "4101" && strPaymentMethod == oApp.InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Paynet")) || (sIBAN4Calc.substring(0, 4) == "4110" && strPaymentMethod == oApp.InvokeMethod("

CAM BS SCM
CheckNameMiddleUppercaseQualification
function CheckNameMiddleUppercaseQualification(name:String) { /******************************************************* ** Name: CheckNameMiddleUppercaseQualification ** Created: 22.07.2010 ** Created By: Alejandro Strickler ** Description: This function checks if a given name is qualified to have an Uppercase at its middle Returns true if qualified, false otherwise Qualification decision is taken based on a list of qualifiyn begin-words -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var bResult:bool = false; var MiddleUppercaseQualifiers:Array; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckNameMiddleUppercaseQualification START"); try{ // Define and load the qualifier's array MiddleUppercaseQualifiers = new Array(); MiddleUppercaseQualifiers[0] = "Mc"; MiddleUppercaseQualifiers[1] = "Mac"; // Check the received word for middle upeercase qualifiers for (var i = 0; i < MiddleUppercaseQualifiers.length && !bResult; i++){ if (name.indexOf(MiddleUppercaseQualifiers[i]) == 0) { bResult = true; } } MiddleUppercaseQualifiers = null; } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckNameMiddleUppercaseQualification Error:" + e.message); throw(e); } finally{ MiddleUppercaseQualifiers = null; } return bResult; }

CAM BS SCM
CheckNameMiddleUppercaseQualification
/******************************************************* ** Name: CheckNameMiddleUppercaseQualification ** Created: 22.07.2010 ** Created By: Alejandro Strickler ** Description: This function checks if a given name is qualified to have an Uppercase at its middle ** Returns true if qualified, false otherwise ** Qualification decision is taken based on a list of qualifiyn begin-words -------------------- Modifications --------------------- ** ******************************************************/ function CheckNameMiddleUppercaseQualification(name:String) { var bResult = false; // Define and load the qualifier's array var MiddleUppercaseQualifiers = new Array(); MiddleUppercaseQualifiers[0] = "Mc"; MiddleUppercaseQualifiers[1] = "Mac"; // Check the received word for middle upeercase qualifiers for (var i = 0; i < MiddleUppercaseQualifiers.length && !bResult; i++){ if (name.indexOf(MiddleUppercaseQualifiers[i]) == 0) { bResult = true; } } MiddleUppercaseQualifiers = null; return bResult; }

CAM BS SCM
CleanupReservedNumbers
function CleanupReservedNumbers() { /******************************************************* ** Name: CleanupReservedNumbers ** Created: 20.7.2011 ** Created By: TGDLABR1 ** Description: delete the reserved phone numbers that are not used in a Quote and ** reservation end date is expired ******************************************************/ var boLog; var bcLog; var bcLogEvent; var bcLogRecord; var objNow; var strLogEventDescText; var strLogEntry; var boResNumb; var bcResNumb; var isRecord; var iDelete=0; var oDate; var sQuoteId; var sSRId; var sSearchSpec; var boQuote; var bcQuote; var boSR; var bcSR; var srStatus; var sId; if(bIsTraceOn) TheApplication().Trace("CleanupReservedNumbers"); try { objNow = new Date(); strLogEventDescText = "Start at " + objNow.toLocaleString() + " (Server Time)"; strLogEntry = strLogEventDescText + "; "; // Create Log BCs boLog = oApp.GetBusObject("Log SCM"); bcLog = boLog.GetBusComp("Log SCM"); bcLogEvent = boLog.GetBusComp("Log Event SCM"); bcLogRecord = boLog.GetBusComp("Log Record SCM"); // Create Log with(bcLog) { NewRecord(NewAfter); // Application Name is 30 chars max SetFieldValue("Application Name","CLEAN_RESERV_NUMBER"); SetFieldValue("Type", "Siebel Workflow"); SetFieldValue("Desc Text","Cleanup Reservation Number"); WriteRecord(); } // Create Start Log Event with(bcLogEvent) { NewRecord(NewAfter); SetFieldValue("Type", "Start"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } boResNumb = oApp.GetBusObject("Customer Reserved Numbers SCM"); bcResNumb = boResNumb.GetBusComp("Customer Reserved Numbers SCM"); // Requirement 1: Deleted expired Reservation with (bcResNumb) { ClearToQuery(); ActivateField("Reservation End Date SCM"); ActivateField("Object Id SCM"); SetViewMode(AllView); sSearchSpec = "([Reservation End Date SCM] < Today () - 2) AND [Object Id SCM] IS NULL AND [Reservation End Date SCM] IS NOT NULL"; SetSearchExpr(sSearchSpec); ExecuteQuery(ForwardBackward); while (FirstRecord()) { iDelete = iDelete+1; DeleteRecord(); } } with(bcLogEvent) { strLogEventDescText = "Search Spec was: " + sSearchSpec ; NewRecord(NewAfter); SetFieldValue("Type", "Update"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); strLogEventDescText = "Number Record Delete: " + iDelete; NewRecord(NewAfter); SetFieldValue("Type", "Update"); SetFieldValue("Desc Text",strLogEventDescText); WriteRecord(); } // Requirement 2: Deleted Reservation where SR is closed boQuote = oApp.GetBusObject("Quote Lite SCM"); bcQuote = boQuote.GetBusComp("Quote Lite SCM"); boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); with (bcResNumb) { ClearToQuery(); ActivateField("Reservation End Date SCM"); ActivateField("Object Id SCM"); ActivateField("Context SCM"); SetViewMode(AllView); sSearchSpec = "[Object Id SCM] IS NOT NULL"; SetSearchExpr(sSearchSpec); ExecuteQuery(ForwardBackward); iDelete=0; isRecord = FirstRecord(); while (isRecord) { if (GetFieldValue("Context SCM")=="Standalone") { // sSRId=GetFieldValue("Object Id SCM"); bcSR.ClearToQuery(); bcSR.ActivateField("Status"); bcSR.SetViewMode(AllView); bcSR.SetSearchSpec("Id",sSRId); bcSR.ExecuteQuery(ForwardBackward); if (bcSR.FirstRecord()) { srStatus = bcSR.GetFieldValue("Status"); if (srStatus == "Closed" || srStatus == "Cancelled") { DeleteRecord(); iDelete = iDelete+1; try { sId = GetFieldValue("Id"); isRecord=true; } catch (e) { isRecord=false; } } else { is

CAM BS SCM
CopyAddress
/****** ** Name: Copy Address ** Created: 28.02.2011 ** Created By: Karin Haack ** Description: copies one address from a specified entity to another entity ** Arguments: Source Entity: where the source address can be found: {Customer | Contract | BillingProfile} ** Source Address Id: Row_id of the source address depending on source entity ** if (Source Entity = Customer) -> Account Address Usage SCM, S_CON_ADDR ** if (Source Entity = Contract) -> Contract Address Usage SCM, CX_ASSET_ADDR ** if (Source Entity = BillingProfile) -> Billing Profile Address Usage SCM, CX_INV_CON_ADDR ** Target Entity: entity to which the address shall be attached: {Customer | Contract | BillingProfile} ** Target Entity Id: row_id of entity ** if (Target Entity = Customer) -> Account, S_ORG_EXT ** if (Target Entity = Contract) -> Asset Mgmt - Asset, S_ASSET ** if (Target Entity = BillingProfile) -> Com Invoice Profile SCM, S_INV_PROF ** Target Address Type: Relation Type Code for new address ** Target Address Status: Status of new address -------- Modifications ------------ ** Description: Removed the constraints to support copying from any Source Entity to any Target Entity. ** Arguments: User Process: TRUE for processes initiated by an applet, this will use the ActiveBusObject as source. Target Entity and Target Entity Id are not considered in this case. ****/ function CopyAddress(Inputs,Outputs) { var sourceAddressId = Inputs.GetProperty("Source Address Id"); var sourceEntity = Inputs.GetProperty("Source Entity"); var targetAddressStatus = Inputs.GetProperty("Target Address Status"); var targetAddressType = Inputs.GetProperty("Target Address Type"); var targetEntity = Inputs.GetProperty("Target Entity"); var targetEntityId = Inputs.GetProperty("Target Entity Id"); var strUserProcess = Inputs.GetProperty("User Process"); var bUserProcess = (strUserProcess != null && strUserProcess == "TRUE"); var oBOSource:BusObject; var oBCSourceAddress:BusComp; var addrTypeCode = ""; var addrTypeCodeLIC = ""; var addrLangCode = ""; var accId = ""; var strAccIdField = ""; var bCreateAddress = true; var oBOTarget:BusObject; var oBCTargetEntity = ""; var oBCTargetAddr:BusComp; var pickBc; var strCheckMessage = ""; var strBCSourceAddress = ""; var strBCTargetEntity = ""; var strBCTargetAddress = ""; try { oBOTarget = null; Outputs.SetProperty("ErrorCode",0); Outputs.SetProperty("ErrorMessage",""); // Check if Input is correct if (sourceEntity != "Customer" && sourceEntity != "Contract" && sourceEntity != "BillingProfile") strCheckMessage ="Source Entity unknown"; if (targetEntity != "Customer" && targetEntity != "Contract" && targetEntity != "BillingProfile") strCheckMessage = "Target Entity unknown"; if (sourceAddressId == "") strCheckMessage = "Source Address Id empty"; if (targetAddressStatus == "" || (targetAddressStatus != "Initial" && targetAddressStatus != "Active" && targetAddressStatus != "Scheduled")) strCheckMessage = "Target Address Status is empty or not correct"; if ( (targetEntity == "BillingProfile" && (targetAddressType != "Default" && targetAddressType != "Envelope" && targetAddressType != "Bill" && targetAddressType != "Itemized Bill")) || (targetEntity == "Customer" && (targetAddressType != "Default" && targetAddressType != "Correspondence" && targetAddressType != "Marketing")) || (targetEntity == "Contract" && (targetAddressType != "Default" && targetAddressType != "Summary" && targetAddressType != "Contract" && targetAddressType != "User" && targetAddressType != "Itemized Bill")) ) {if (!(bUserProcess && targetAddressType == "")) strCheckMessage = "Target Address Type is empty or not corresponding to target entity " + targetEntity; } if (strCheckMessage != "") { Outputs.SetProperty("ErrorCode",1); Outputs.SetProperty("ErrorMessage", strCheckMessage); } else { //the input is ok, so we may copy the address

CAM BS SCM
CopyAddress
function CopyAddress(Inputs:PropertySet,Outputs:PropertySet){ /**************************************************************************** ** Name: Copy Address ** Created: 28.02.2011 ** Created By: Karin Haack ** Description: copies one address from a specified entity to another entity ** Arguments: Source Entity: where the source address can be found: {Customer | Contract | BillingProfile} ** Source Address Id: Row_id of the source address depending on source entity ** if (Source Entity = Customer) -> Account Address Usage SCM, S_CON_ADDR ** if (Source Entity = Contract) -> Contract Address Usage SCM, CX_ASSET_ADDR ** if (Source Entity = BillingProfile) -> Billing Profile Address Usage SCM, CX_INV_CON_ADDR ** Target Entity: entity to which the address shall be attached: {Customer | Contract | BillingProfile} ** Target Entity Id: row_id of entity ** if (Target Entity = Customer) -> Account, S_ORG_EXT ** if (Target Entity = Contract) -> Asset Mgmt - Asset, S_ASSET ** if (Target Entity = BillingProfile) -> Com Invoice Profile SCM, S_INV_PROF ** Target Address Type: Relation Type Code for new address ** Target Address Status: Status of new address -------- Modifications ------------ ** Description: Removed the constraints to support copying from any Source Entity to any Target Entity. ** Arguments: User Process: TRUE for processes initiated by an applet, this will use the ActiveBusObject as source. Target Entity and Target Entity Id are not considered in this case. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up *********************************************************************************************/ var oBOSource:BusObject; var oBOTarget:BusObject; var pickBc:BusComp; var oBCTargetAddr:BusComp; var oBCSourceAddress:BusComp; var oBCTargetEntity:BusComp; var sourceAddressId:chars = ""; var sourceEntity:chars = ""; var targetAddressStatus:chars = ""; var targetAddressType:chars = ""; var targetEntity:chars = ""; var targetEntityId:chars = ""; var strUserProcess:chars = ""; var addrTypeCode:chars = ""; var addrTypeCodeLIC:chars = ""; var addrLangCode:chars = ""; var accId:chars = ""; var strAccIdField:chars = ""; var strCheckMessage:chars = ""; var strBCSourceAddress:chars = ""; var strBCTargetEntity:chars = ""; var strBCTargetAddress:chars = ""; var bCreateAddress:bool = true; var bUserProcess:bool; if(bIsTraceOn) oApp.Trace(this.Name() + ".CopyAddress START"); try { //Get inputs sourceAddressId = Inputs.GetProperty("Source Address Id"); sourceEntity = Inputs.GetProperty("Source Entity"); targetAddressStatus = Inputs.GetProperty("Target Address Status"); targetAddressType = Inputs.GetProperty("Target Address Type"); targetEntity = Inputs.GetProperty("Target Entity"); targetEntityId = Inputs.GetProperty("Target Entity Id"); strUserProcess = Inputs.GetProperty("User Process"); bUserProcess = (strUserProcess != null && strUserProcess == "TRUE"); oBOTarget = null; Outputs.SetProperty("ErrorCode",0); Outputs.SetProperty("ErrorMessage",""); // Check if Input is correct if (sourceEntity != "Customer" && sourceEntity != "Contract" && sourceEntity != "BillingProfile") strCheckMessage ="Source Entity unknown"; if (targetEntity != "Customer" && targetEntity != "Contract" && targetEntity != "BillingProfile") strCheckMessage = "Target Entity unknown"; if (sourceAddressId == "") strCheckMessage = "Source Address Id empty"; if (targetAddressStatus == "" || (targetAddressStatus != "Initial" && targetAddressStatus != "Active" && targetAddressStatus != "Scheduled")) strCheckMessage = "Target Address Status is empty or not correct"; if ( (targetEntity == "BillingProfile" && (targetAddressType != "Default" && targetAddressType != "Envelope" && targetAddressType != "Bill" && target

CAM BS SCM
CopyField
function CopyField(&oBCSource:BusComp, &oBCTarget:BusComp, sField) { oBCTarget.SetFieldValue(sField, oBCSource.GetFieldValue(sField)); }

CAM BS SCM
CopyField
function CopyField(&oBCSource:BusComp, &oBCTarget:BusComp, sField) { oBCTarget.SetFieldValue(sField, oBCSource.GetFieldValue(sField)); }

CAM BS SCM
CreateDefaultContactRole
function CreateDefaultContactRole(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* -------------------- Modifications --------------------- ** Date: 25.08.2010 ** Changed By: Karin Haack ** Description: Modified script to create contact with "Company Main" role for each new Company -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ //Create variables var BOActiveAccount:BusObject; var BCAccount:BusComp; var BCContactAffDet:BusComp; if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateDefaultContactRole START"); try{ //Get Active BO, BCs from the context in order to get parameters BOActiveAccount = oApp.ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); BCContactAffDet = BOActiveAccount.GetBusComp("Account Contact Affiliation Detail"); BCContactAffDet.NewRecord(NewAfter); BCContactAffDet.SetFieldValue("Role", oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Employee")); BCContactAffDet.WriteRecord(); if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateDefaultContactRole End"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateDefaultContactRole Error: " + e.message); throw(e); } finally{ BCAccount=null; BOActiveAccount=null; BCContactAffDet=null; } }

CAM BS SCM
CreateDefaultContactRole
/******************************************************* ** Name: CreateMainContactRole ** Created: 01.12.2008 ** Created By: Angel Garcia ** Description: This method creates a Default Role related to the Contact ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 07.04.2009 ** Changed By: Javier Amor ** Description: Modified script to avoid to perform a query on BC Account Contact Affiliation Detail ** and to make sure that Main Role is created always when the primary contact has no role -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 25.08.2010 ** Changed By: Karin Haack ** Description: Modified script to create contact with "Company Main" role for each new Company ******************************************************/ function CreateDefaultContactRole(Inputs,Outputs) { //Create variables var BOActiveAccount; var BCAccount; var sType; var sPrimaryContact; var sConRelId; var IdAccount; var BOAccountCopy = null; var BCAccountCopy = null; var BCContactAff = null; var BCContactAffDet = null; TheApplication().Trace("TGDLOAL3-->Entro en create role"); try { //Get Active BO, BCs from the context in order to get parameters BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); IdAccount = BCAccount.GetFieldValue("Id"); BCContactAffDet = BOActiveAccount.GetBusComp("Account Contact Affiliation Detail"); BCContactAffDet.NewRecord(NewAfter); BCContactAffDet.SetFieldValue("Role",TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Employee")); BCContactAffDet.WriteRecord(); TheApplication().Trace("TGDLOAL3-->Salgo"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAccount=null; sType=null; sPrimaryContact=null; sConRelId=null; IdAccount=null; BCAccountCopy=null; BOActiveAccount=null; BOAccountCopy=null; BCContactAff=null; BCContactAffDet=null; } }

CAM BS SCM
CreateLogEvent
function CreateLogEvent(oBCLogEvent:BusComp, Type:chars, DescText:chars){ /******************************************************* ** Name: CreateLogEvent ** Created: 09.10.2013 ** Created By: Vratesh Pinge ** Description: This method inserts a log event -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ try{ oBCLogEvent.NewRecord(NewAfter); oBCLogEvent.SetFieldValue("Type", Type); oBCLogEvent.SetFieldValue("Desc Text", DescText); oBCLogEvent.WriteRecord(); } finally{ oBCLogEvent = null; } }

CAM BS SCM
CreateLogEvent
/******************************************************* ** Name: CreateLogEvent ** Created: 09.10.2013 ** Created By: Vratesh Pinge ** Description: This method inserts a log event ******************************************************/ function CreateLogEvent(oBCLogEvent, Type, DescText) { try { oBCLogEvent.NewRecord(NewAfter); oBCLogEvent.SetFieldValue("Type", Type); oBCLogEvent.SetFieldValue("Desc Text", DescText); oBCLogEvent.WriteRecord(); } finally { oBCLogEvent = null; } }

CAM BS SCM
CreateMainContactRole
function CreateMainContactRole(Inputs,Outputs){ /******************************************************* -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 25.08.2010 ** Changed By: Karin Haack ** Description: This method creates a Default Role related to the Contact Modified script to create contact with "Company Main" role for each new Company -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ //Create variables var BOActiveAccount:BusObject; var BOAccountCopy:BusObject; var BCAccount:BusComp; var BCAccountCopy:BusComp; var BCContactAff:BusComp; var BCContactAffDet:BusComp; var sType:chars; var sPrimaryContact:chars; var sConRelId:chars; var sIdAccount:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateMainContactRole START"); //Get Active BO, BCs from the context in order to get parameters BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); sIdAccount = BCAccount.GetFieldValue("Id"); sType = BCAccount.GetFieldValue("Type"); //Project CDM: Reusing this function for creating the default role for the automatic HQ SA created if (Inputs.GetProperty("Account Id") != ""){ sIdAccount = Inputs.GetProperty("Account Id"); } BOAccountCopy = oApp.GetBusObject("EAI Account IO SCM"); BCAccountCopy = BOAccountCopy.GetBusComp("Account"); BCAccountCopy.SetViewMode(AllView); BCAccountCopy.ClearToQuery(); BCAccountCopy.SetSearchSpec("Id",sIdAccount); BCAccountCopy.ExecuteQuery(ForwardOnly); sPrimaryContact = BCAccountCopy.GetFieldValue("Primary Contact Id"); BCContactAff = BOAccountCopy.GetBusComp("Account Contact SCM"); BCContactAff.SetViewMode(AllView); BCContactAff.ClearToQuery(); BCContactAff.SetSearchSpec("Accnt Id",sIdAccount); BCContactAff.SetSearchSpec("Contact Id",sPrimaryContact); BCContactAff.ExecuteQuery(ForwardOnly); if (BCContactAff.FirstRecord()){ BCContactAffDet = BOAccountCopy.GetBusComp("Account Contact Affiliation Detail"); BCContactAffDet.SetViewMode(AllView); BCContactAffDet.ClearToQuery(); BCContactAffDet.ExecuteQuery(ForwardOnly); //If any record exists, that contact already has a role if (BCContactAffDet.FirstRecord()){ } else{ BCContactAffDet.NewRecord(NewAfter); //Project CDM: creation of "Company Main" contact for each created company if (sType == oApp.InvokeMethod("LookupValue","ACCOUNT_TYPE","Person")){ BCContactAffDet.SetFieldValue("Role", oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main")); } else{ BCContactAffDet.SetFieldValue("Role", oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Company Main")); } BCContactAffDet.WriteRecord(); } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateMainContactRole Error: " + e.message); throw(e); } finally{ BCAccount=null; sType=null; sPrimaryContact=null; sConRelId=null; sIdAccount=null; BCAccountCopy=null; BCContactAff=null; BCContactAffDet=null; BOActiveAccount=null; BOAccountCopy=null; } }

CAM BS SCM
CreateMainContactRole
/******************************************************* ** Name: CreateMainContactRole ** Created: 01.12.2008 ** Created By: Angel Garcia ** Description: This method creates a Default Role related to the Contact ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 07.04.2009 ** Changed By: Javier Amor ** Description: Modified script to avoid to perform a query on BC Account Contact Affiliation Detail ** and to make sure that Main Role is created always when the primary contact has no role -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 25.08.2010 ** Changed By: Karin Haack ** Description: Modified script to create contact with "Company Main" role for each new Company ******************************************************/ function CreateMainContactRole(Inputs,Outputs) { //Create variables var BOActiveAccount; var BCAccount; var sType; var sPrimaryContact; var sConRelId; var IdAccount; var BOAccountCopy = null; var BCAccountCopy = null; var BCContactAff = null; var BCContactAffDet = null; try { //Get Active BO, BCs from the context in order to get parameters BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); IdAccount = BCAccount.GetFieldValue("Id"); sType = BCAccount.GetFieldValue("Type"); //TGDBEJA6 02.09.2010 CR415/Project CDM: Reusing this function for creating the default role for the automatic HQ SA created if (Inputs.GetProperty("Account Id") != "") { IdAccount = Inputs.GetProperty("Account Id"); } // begin: TGDHAKA8 25.08.2010 Project CDM: creation of "Company Main" contact for each created company // if (sType == TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Person")) // { // end: TGDHAKA8 25.08.2010 Project CDM BOAccountCopy = TheApplication().GetBusObject("EAI Account IO SCM"); BCAccountCopy = BOAccountCopy.GetBusComp("Account"); BCAccountCopy.SetViewMode(AllView); BCAccountCopy.ClearToQuery(); BCAccountCopy.SetSearchSpec("Id",IdAccount); BCAccountCopy.ExecuteQuery(ForwardOnly); sPrimaryContact = BCAccountCopy.GetFieldValue("Primary Contact Id"); BCContactAff = BOAccountCopy.GetBusComp("Account Contact SCM"); BCContactAff.SetViewMode(AllView); BCContactAff.ClearToQuery(); BCContactAff.SetSearchSpec("Accnt Id",IdAccount); BCContactAff.SetSearchSpec("Contact Id",sPrimaryContact); BCContactAff.ExecuteQuery(ForwardOnly); if (BCContactAff.FirstRecord()) { BCContactAffDet = BOAccountCopy.GetBusComp("Account Contact Affiliation Detail"); BCContactAffDet.SetViewMode(AllView); BCContactAffDet.ClearToQuery(); BCContactAffDet.ExecuteQuery(ForwardOnly); //If any record exists, that contact already has a role if (BCContactAffDet.FirstRecord()) { } else { BCContactAffDet.NewRecord(NewAfter); // TGDHAKA8 25.08.2010 Project CDM: creation of "Company Main" contact for each created company // begin if (sType == TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Person")) { BCContactAffDet.SetFieldValue("Role",TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main")); } else { BCContactAffDet.SetFieldValue("Role",TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Company Main")); } // end: TGDHAKA8 25.08.2010 Project CDM BCContactAffDet.WriteRecord(); } } // begin: TGDHAKA8 25.08.2010 Project CDM: creation of "Company Main" contact for each created company //} // end } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAccount=null; sType=null; sPrimaryContact=null; sConRelId=null; IdAccount=null; BCAccountCopy=null; BCContactAff=null; BCContactAffDet=null; BOActiveAccount=null; BOAccountCopy=null; } }

CAM BS SCM
CreateOrCopyBillingProfile
/***************************************************************************** ** Name: CreateOrCopyBillingProfile ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: creates a new or copies a billing profile ** Parameters: Action - "New", "Copy", "Modify" ** Billing Profile Id ** Account Id *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-02-10 TZHSTAL2 created * 2011-05-06 TGDHURO9 Defect 36556 PRT: Billing Profile: use FirstRecord * after requerying the billing profile. * 2011-07-09 TGDHURO9 Credit Limit Change: set default credit limit amount * 2012-09-17 TGDHURO9 Defect 57632 FUF_Regression - siebel throwing error message when trying to copy existing billing profile for new activation. * 2012-09-24 TGDHURO9 Defect 57628 FUF_Regression - Data for the Mandatory fileds (Payment Method, Media Type and Print code) is not getting auto populated * 2013-04-23 TGDSTER2 Defect ID : 66047 PROD : CR : Initial CL Amount to be set to 0 and the CL Flag setting logic to be fixed * 2014-03-04 TGDGEMAM QuadriCA GPE V: added Brand field predault * 2015-09-03 TGDGEMAM Kreditlimite Phase Out (light) - added predefault "N" for field "Credit Limit Flag GUARDEAN SCM" *****************************************************************************/ function CreateOrCopyBillingProfile (Inputs:PropertySet, Outputs:PropertySet) { var billingProfileId; var accountId; var action; var boActiveBO; var bcBillingProfile; var bcAccount; var bcListOfValues; var newId = ""; var bpSource = ""; var statusCode = ""; var parModifNum = ""; var parentIntegrationId = ""; var integrationSeq = ""; var SYMPHONY_BILL_INTEGRATION_NAME_BASE = "ALL:BAC:"; var sHighFlag = ""; var sCMAId; var sMediaTypeTrans; // SCM 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not var bExtSysFlag; var s1_PaymentMethod; var s2_MediaType; var s3_PrintCode; var bpSourceLIC; // 2013-11-21; 2014-02-FebRel GRIP-- var sAccountType; var sDefault; var aDefault; // --GRIP try { // 2013-11-21; GRIP-- sDefault=""; // ---GRIP s1_PaymentMethod = ""; s2_MediaType = ""; s3_PrintCode = ""; bpSourceLIC = "6"; // ALL-IP action = Inputs.GetProperty("Action"); accountId = Inputs.GetProperty("Account Id"); billingProfileId = Inputs.GetProperty("Billing Profile Id"); // 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not bExtSysFlag = Inputs.GetProperty("External System Flag"); if (bExtSysFlag == null || bExtSysFlag.length == 0 || bExtSysFlag != "Y") bExtSysFlag = "N"; if (accountId == null || accountId.length == 0) { oApp.RaiseError("EXP Account Number Missing"); } boActiveBO = oApp.GetBusObject("Account"); bcAccount = boActiveBO.GetBusComp("Account"); bcAccount.ActivateField("Calculated CMA Account Id SCM"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Id", accountId); bcAccount.SetViewMode(AllView); bcAccount.ExecuteQuery(ForwardOnly); if (!bcAccount.FirstRecord()) { oApp.RaiseError("Customer not found"); } bcListOfValues = boActiveBO.GetBusComp("List Of Values"); bcListOfValues.ActivateField("Value"); bcListOfValues.ActivateField("Name"); sCMAId = bcAccount.GetFieldValue("Calculated CMA Account Id SCM"); bcBillingProfile = boActiveBO.GetBusComp("Com Invoice Profile SCM"); if (billingProfileId != null && billingProfileId.length > 0) { bcBillingProfile.ClearToQuery(); bcBillingProfile.ActivateField("Bill Source"); bcBillingProfile.ActivateField("Integration Id SCM"); bcBillingProfile.ActivateField("Modification Number SCM"); bcBillingProfile.ActivateField("Name"); bcBillingProfile.ActivateField("Print Code High Flag SCM")

CAM BS SCM
CreateOrCopyBillingProfile
function CreateOrCopyBillingProfile (Inputs:PropertySet, Outputs:PropertySet){ /***************************************************************************** ** Name: CreateOrCopyBillingProfile ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: creates a new or copies a billing profile ** Parameters: Action - "New", "Copy", "Modify", Billing Profile Id, Account Id *----------------------------------------------------------------------------- ** Changes: 2013-04-23 TGDSTER2 Defect ID : 66047 PROD : CR : Initial CL Amount to be set to 0 and the CL Flag setting logic to be fixed ** Changes: 2014-03-04 TGDGEMAM QuadriCA GPE V: added Brand field predault ** Changes: 2015-09-03 TGDGEMAM Kreditlimite Phase Out (light) - added predefault "N" for field "Credit Limit Flag GUARDEAN SCM" -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ** Changes: 2016-12-05 TAACONU1 Defect # 16848 *****************************************************************************/ var boActiveBO:BusObject; var bcBillingProfile:BusComp; var bcAccount:BusComp; var bcListOfValues:BusComp; var billingProfileId:chars; var accountId:chars; var action:chars; var newId:chars = ""; var bpSource:chars = ""; var statusCode:chars = ""; var parModifNum:chars = ""; var parentIntegrationId:chars = ""; var integrationSeq:chars = ""; var SYMPHONY_BILL_INTEGRATION_NAME_BASE:chars = "ALL:BAC:"; var sHighFlag:chars = ""; var sCMAId:chars; var sMediaTypeTrans:chars; var bExtSysFlag:chars; var s1_PaymentMethod:chars; var s2_MediaType:chars; var s3_PrintCode:chars; var bpSourceLIC:chars; var sAccountType:chars; var sDefault:chars; //var aDefault = new Array; // TAADAPE2 15.02.2017 - Due to memory leak - defect #3458 var aDefault:Array; var defaultAmount:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateOrCopyBillingProfile START"); try{ sDefault = ""; s1_PaymentMethod = ""; s2_MediaType = ""; s3_PrintCode = ""; bpSourceLIC = "6"; // ALL-IP action = Inputs.GetProperty("Action"); accountId = Inputs.GetProperty("Account Id"); billingProfileId = Inputs.GetProperty("Billing Profile Id"); bExtSysFlag = Inputs.GetProperty("External System Flag");// 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not if (bExtSysFlag == null || bExtSysFlag.length == 0 || bExtSysFlag != "Y") bExtSysFlag = "N"; if (accountId == null || accountId.length == 0){ oApp.RaiseError("EXP Account Number Missing"); } boActiveBO = oApp.GetBusObject("Account"); bcAccount = boActiveBO.GetBusComp("Account"); bcAccount.ActivateField("Calculated CMA Account Id SCM"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Id", accountId); bcAccount.SetViewMode(AllView); bcAccount.ExecuteQuery(ForwardOnly); if (!bcAccount.FirstRecord()){ oApp.RaiseError("Customer not found"); } bcListOfValues = boActiveBO.GetBusComp("List Of Values"); bcListOfValues.ActivateField("Value"); bcListOfValues.ActivateField("Name"); sCMAId = bcAccount.GetFieldValue("Calculated CMA Account Id SCM"); bcBillingProfile = boActiveBO.GetBusComp("Com Invoice Profile SCM"); if (billingProfileId != null && billingProfileId.length > 0){ bcBillingProfile.ClearToQuery(); bcBillingProfile.ActivateField("Bill Source"); bcBillingProfile.ActivateField("Integration Id SCM"); bcBillingProfile.ActivateField("Modification Number SCM"); bcBillingProfile.ActivateField("Name"); bcBillingProfile.ActivateField("Print Code High Flag SCM"); bcBillingProfile.ActivateField("Calculated Payment Method LIC SCM"); bcBillingProfile.ActivateField("Media Type LIC SCM"); bcBillingProfile.ActivateField("Print Code LIC SCM"); bcBillingProfile.ActivateField("Brand SCM"); bcBillingProfile.SetSearchSpec("Id", billingProfileId); bc

CAM BS SCM
EAILookupMap
function EAILookupMap(sMap, sDirection, sIn) { var oBS; var oPSin; var oPSout; var sReturn; try { trc("EAILookupMap - sMap=" + sMap + " / sDirection=" + sDirection + " / sIn=" + sIn); sReturn = ""; if (sIn != "") { oBS = oApp.GetService("EAI Value Map Translator"); oPSin = oApp.NewPropertySet(); oPSout = oApp.NewPropertySet(); oPSin.SetProperty("Direction", sDirection); oPSin.SetProperty("Type", sMap); oPSin.SetValue(sIn); oBS.InvokeMethod("Translate", oPSin, oPSout); sReturn = oPSout.GetValue(); } } catch(e) { trc("EAILookupMap - " + e.toString()); } finally { oPSout = null; oPSin = null; oBS = null; } trc("EAILookupMap - sReturn=" + sReturn); return (sReturn); }

CAM BS SCM
EAILookupMap
function EAILookupMap(sMap, sDirection, sIn){ /******************************************************* ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var oBS:Service; var oPSin:PropertySet; var oPSout:PropertySet; var sReturn; if(bIsTraceOn) oApp.Trace(this.Name() + ".EAILookupMap START"); try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".EAILookupMap - sMap=" + sMap + " / sDirection=" + sDirection + " / sIn=" + sIn); sReturn = ""; if (sIn != ""){ oBS = oApp.GetService("EAI Value Map Translator"); oPSin = oApp.NewPropertySet(); oPSout = oApp.NewPropertySet(); oPSin.SetProperty("Direction", sDirection); oPSin.SetProperty("Type", sMap); oPSin.SetValue(sIn); oBS.InvokeMethod("Translate", oPSin, oPSout); sReturn = oPSout.GetValue(); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".EAILookupMap - ERROR: " + e.message); } finally{ oPSout = null; oPSin = null; oBS = null; } if(bIsTraceOn) oApp.Trace(this.Name() + ".EAILookupMap - sReturn=" + sReturn); return (sReturn); }

CAM BS SCM
EmpHasSR
function EmpHasSR(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: EmpHasSR ** Description: This method must look for Service Requests associated with a Customer and Employee with ** an opened status and created by the same agent who is trying to submit the SR. Since the SR has been created ** with the Id of the BC Account Employee SCM in the (TGDSOAN5 14.09.2010 OLD: "Contact Id") (TGDSOAN5 14.09.2010 NEWOLD: "SR Employee Id") field of the SR, this field has to be changed ** to the Employee Id. After this the SR will be submitted -------------------- Modifications --------------------- ** Date: 16.08.2016 ** Changed By: TAADEDA3 ** Description: WP1056-ORCA/Otto - Storing also the Role of the Employee in the SR to be used by EAI and allow TIBCO to decide if the change (deletion) should be replicated to back end systems or not -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOActiveAccount:BusObject; var BCServiceRequest:BusComp; var BCAccEmp:BusComp; var strId:chars; var strEmpId:chars; var strRole:chars;// TAADEDA3 16.08.2016 - WP1056 if(bIsTraceOn) oApp.Trace(this.Name() + ".EmpHasSR START"); try{ //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCAccEmp = BOActiveAccount.GetBusComp("Account Employee SCM"); strId = BCAccEmp.GetFieldValue("Id"); strEmpId = BCAccEmp.GetFieldValue("Employee Id"); strRole = BCAccEmp.GetFieldValue("Role");// TAADEDA3 16.08.2016 - WP1056 //Look for the SR linked to a customer, employee and created by the same agent who invoked this method BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("SR Employee Id SCM", strId); BCServiceRequest.SetSearchSpec("Status",TheApplication().InvokeMethod("LookupValue","SR_STATUS","Open")); BCServiceRequest.SetSearchSpec("Owned By Id", TheApplication().GetProfileAttr("Id")); BCServiceRequest.ActivateField("SR Employee Role SCM"); // TAADEDA3 16.08.2016 - WP1056 BCServiceRequest.ExecuteQuery(ForwardOnly); //if the SR is found, "Contact Id" is filled with Employee Id if(BCServiceRequest.FirstRecord()){ BCServiceRequest.SetFieldValue("SR Employee Id SCM", strEmpId); // TGDSOAN5 14.09.2010 BCServiceRequest.SetFieldValue("SR Employee Role SCM", strRole);// TAADEDA3 16.08.2016 - WP1056 BCServiceRequest.WriteRecord(); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".EmpHasSR ERROR:" + e.message); oApp.RaiseErrorText(e.toString()); } finally{ strRole = null; // TAADEDA3 16.08.2016 - WP1056 strId = null; strEmpId = null; BCAccEmp = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
EmpHasSR
/******************************************************* ** Name: EmpHasSR ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method must look for Service Requests associated with a Customer and Employee with ** an opened status and created by the same agent who is trying to submit the SR. Since the SR has been created ** with the Id of the BC Account Employee SCM in the (TGDSOAN5 14.09.2010 OLD: "Contact Id") (TGDSOAN5 14.09.2010 NEWOLD: "SR Employee Id") field of the SR, this field has to be changed ** to the Employee Id. After this the SR will be submitted ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function EmpHasSR(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCServiceRequest; var BCAccEmp; var strId; var strEmpId; try{ //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCAccEmp = BOActiveAccount.GetBusComp("Account Employee SCM"); strId = BCAccEmp.GetFieldValue("Id"); strEmpId = BCAccEmp.GetFieldValue("Employee Id"); //Look for the SR linked to a customer, employee and created by the same agent who invoked this method BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); // TGDSOAN5 14.09.2010: storage field change in BC SR: Old: "Contact Id" NEW : "SR Employee Id SCM": // BCServiceRequest.SetSearchSpec("Contact Id", strId); BCServiceRequest.SetSearchSpec("SR Employee Id SCM", strId); BCServiceRequest.SetSearchSpec("Status",TheApplication().InvokeMethod("LookupValue","SR_STATUS","Open")); BCServiceRequest.SetSearchSpec("Owned By Id", TheApplication().GetProfileAttr("Id")); BCServiceRequest.ExecuteQuery(ForwardOnly); //if the SR is found, "Contact Id" is filled with Employee Id // TGDSOAN5 14.09.2010: if the SR is found, "SR Employee Id SCM" is filled with Employee Id if(BCServiceRequest.FirstRecord()) { // BCServiceRequest.SetFieldValue("Contact Id", strEmpId); BCServiceRequest.SetFieldValue("SR Employee Id SCM", strEmpId); // TGDSOAN5 14.09.2010 BCServiceRequest.WriteRecord(); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strId = null; strEmpId = null; BCAccEmp = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
Format0Phone
function Format0Phone(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: Format0Phone ** Created: 20.10.2009 ** Created By: TGDDOPA1 ** Description: This method must delelte 0 from string +410 **SmallCR Issue 14965 .Delete 0 from +4102... phone number -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var sValue:chars; var iLength:float; var sPre:chars; var sPost:chars; var sNew:chars = "1"; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".Format0Phone START"); sValue = Inputs.GetProperty("Inputs"); if(sValue.substring(0, 4) == "+410"){ iLength = sValue.length; sPre = sValue.substring(0, 3); sPost = sValue.substring(4, iLength); sNew = sPre + sPost; Outputs.SetProperty("Outputs", sNew); } else{ Outputs.SetProperty("Outputs", sNew); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".Format0Phone ERROR: " + e.message); throw(e); } finally{ sValue = null; iLength = null; sNew = null; } return Outputs; }

CAM BS SCM
Format0Phone
/******************************************************* ** Name: Format0Phone ** Created: 20.10.2009 ** Created By: TGDDOPA1 ** Description: This method must delelte 0 from string +410 **SmallCR Issue 14965 .Delete 0 from +4102... phone number -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function Format0Phone(Inputs,Outputs) { var sValue; var iLength; var sPre; var sPost; var sNew = "1"; try { sValue = Inputs.GetProperty("Inputs"); if(sValue.substring(0, 4) == "+410") { iLength= sValue.length; sPre= sValue.substring(0, 3); sPost= sValue.substring(4, iLength); sNew = sPre + sPost; Outputs.SetProperty("Outputs", sNew); } else { Outputs.SetProperty("Outputs", sNew); } return Outputs; } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { sValue = null; iLength = null; sNew = null; } }

CAM BS SCM
GenerateNumericIban
function GenerateNumericIban(sString) { //==================================================================================================== // Authors: Thorwald Schubert, TGDSCTHO // Purpose: Depending on Input parameter (check, replace) the bank account number is checked not to contain // any other digits than integrer values and returnes 0/1 or all digits being characters are substituted via // function ReturnCCNumber() and the modified bank account number is returned // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-02-17 Thorwald Schubert 2 initial version //==================================================================================================== try { var sCheckCharacter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var sCheckInteger = "1234567890"; var sDigit; // Initialize array to convert letters to numbers var arrChatToNum = new Array(); arrChatToNum["A"] = "10"; arrChatToNum["B"] = "11"; arrChatToNum["C"] = "12"; arrChatToNum["D"] = "13"; arrChatToNum["E"] = "14"; arrChatToNum["F"] = "15"; arrChatToNum["G"] = "16"; arrChatToNum["H"] = "17"; arrChatToNum["I"] = "18"; arrChatToNum["J"] = "19"; arrChatToNum["K"] = "20"; arrChatToNum["L"] = "21"; arrChatToNum["M"] = "22"; arrChatToNum["N"] = "23"; arrChatToNum["O"] = "24"; arrChatToNum["P"] = "25"; arrChatToNum["Q"] = "26"; arrChatToNum["R"] = "27"; arrChatToNum["S"] = "28"; arrChatToNum["T"] = "29"; arrChatToNum["U"] = "30"; arrChatToNum["V"] = "31"; arrChatToNum["W"] = "32"; arrChatToNum["X"] = "33"; arrChatToNum["Y"] = "34"; arrChatToNum["Z"] = "35"; //Replace letters and Check remaining characters var valid = true; for (var i = 0; i < sString.length && valid; i++) { sDigit = (sString.substring(i, i+1)).toUpperCase(); if (sCheckCharacter.indexOf(sDigit) != -1) { sString = sString.substring(0, i) + arrChatToNum[sDigit] + sString.substring(i+1, sString.length); } else if (sCheckInteger.indexOf(sDigit) == -1) { valid = false; } } if (!valid) { sString = null; } arrChatToNum = null; } catch(e) { throw(e); } return(sString); }

CAM BS SCM
GenerateNumericIban
function GenerateNumericIban(sString:chars) { /**************************************************************** ** Authors: Thorwald Schubert, TGDSCTHO ** Purpose: Depending on Input parameter (check, replace) the bank account number is checked not to contain ** any other digits than integrer values and returnes 0/1 or all digits being characters are substituted via ** function ReturnCCNumber() and the modified bank account number is returned -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ****************************************************************/ var sCheckCharacter:chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var sCheckInteger:chars = "1234567890"; var sDigit:chars; var arrChatToNum:Array; var valid:bool = true; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".GenerateNumericIban START"); // Initialize array to convert letters to numbers arrChatToNum = new Array(); arrChatToNum["A"] = "10"; arrChatToNum["B"] = "11"; arrChatToNum["C"] = "12"; arrChatToNum["D"] = "13"; arrChatToNum["E"] = "14"; arrChatToNum["F"] = "15"; arrChatToNum["G"] = "16"; arrChatToNum["H"] = "17"; arrChatToNum["I"] = "18"; arrChatToNum["J"] = "19"; arrChatToNum["K"] = "20"; arrChatToNum["L"] = "21"; arrChatToNum["M"] = "22"; arrChatToNum["N"] = "23"; arrChatToNum["O"] = "24"; arrChatToNum["P"] = "25"; arrChatToNum["Q"] = "26"; arrChatToNum["R"] = "27"; arrChatToNum["S"] = "28"; arrChatToNum["T"] = "29"; arrChatToNum["U"] = "30"; arrChatToNum["V"] = "31"; arrChatToNum["W"] = "32"; arrChatToNum["X"] = "33"; arrChatToNum["Y"] = "34"; arrChatToNum["Z"] = "35"; //Replace letters and Check remaining characters for (var i = 0; i < sString.length && valid; i++) { sDigit = (sString.substring(i, i+1)).toUpperCase(); if (sCheckCharacter.indexOf(sDigit) != -1) { sString = sString.substring(0, i) + arrChatToNum[sDigit] + sString.substring(i+1, sString.length); } else if (sCheckInteger.indexOf(sDigit) == -1) { valid = false; } } if (!valid) { sString = null; } arrChatToNum = null; } catch(e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".GenerateNumericIban ERROR:" + e.message); throw(e); } return(sString); }

CAM BS SCM
GetAssetId
function GetAssetId (Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: GetAssetId ** Created: 02.11.2009 ** Created By: Carolina Indiano ** Description: CR15538: This method gets the asset id with this search spec: Asset Status != Inactive and asset Reference Number 2 SCM = BP Name. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOAsset:BusObject; var BOAccount:BusObject; var BCAsset:BusComp; var BCBillingProfile:BusComp; var strBPName:chars; var strBPreference:chars; var strAssetId:chars; var strBPID:chars; var strstatus:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".GetAssetId START"); try{ BOAccount = oApp.ActiveBusObject(); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile SCM"); strBPName = BCBillingProfile.GetFieldValue("Integration Id SCM"); strBPreference= BCBillingProfile.GetFieldValue("Bill Preference Code SCM"); strBPID = oApp.GetProfileAttr("ModBPId"); oApp.SetProfileAttr("ModBPId", ""); BOAsset = oApp.GetBusObject("Asset Management"); BCAsset = BOAsset.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (strBPreference == oApp.InvokeMethod("LookupValue","BILL_PREF_TYPE_SCM","1")){ BCAsset.ActivateField("Status"); BCAsset.ActivateField("Reference Number 2 SCM"); BCAsset.ActivateField("Asset Id"); strstatus= oApp.InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","2"); BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSearchExpr("[Status] <> '" + strstatus + "' AND [Reference Number 2 SCM] = '" + strBPID + "' AND [Parent Asset Id] IS NULL"); BCAsset.ExecuteQuery(ForwardOnly); if(BCAsset.FirstRecord()){ Outputs.SetProperty("Asset_Id",BCAsset.GetFieldValue("Asset Id")); } else{ Outputs.SetProperty("Asset_Id"," "); } } else{ Outputs.SetProperty("Asset_Id"," "); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".GetAssetId ERROR:" + e.message); throw(e); } finally{ BCAsset = null; BCBillingProfile = null; BOAccount = null; BOAsset = null; } }

CAM BS SCM
GetAssetId
/******************************************************* ** Name: GetAssetId ** Created: 02.11.2009 ** Created By: Carolina Indiano ** Description: CR15538: This method gets the asset id with this search spec: Asset Status != Inactive and asset Reference Number 2 SCM = BP Name. ******************************************************/ function GetAssetId (Inputs, Outputs) { var BOAsset; var BOAccount; var BCAsset; var BCBillingProfile; var strBPName; var strBPreference; var strAssetId; var strBPID; var strstatus; try{ BOAccount = TheApplication().ActiveBusObject(); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile SCM"); strBPName = BCBillingProfile.GetFieldValue("Integration Id SCM"); strBPreference= BCBillingProfile.GetFieldValue("Bill Preference Code SCM"); strBPID=TheApplication().GetProfileAttr("ModBPId"); TheApplication().SetProfileAttr("ModBPId", ""); BOAsset = TheApplication().GetBusObject("Asset Management"); BCAsset = BOAsset.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); if (strBPreference == TheApplication().InvokeMethod("LookupValue","BILL_PREF_TYPE_SCM","1")) { BCAsset.ActivateField("Status"); BCAsset.ActivateField("Reference Number 2 SCM"); BCAsset.ActivateField("Asset Id"); strstatus= TheApplication().InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","2"); BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSearchExpr("[Status] <> '" + strstatus + "' AND [Reference Number 2 SCM] = '" + strBPID + "' AND [Parent Asset Id] IS NULL"); BCAsset.ExecuteQuery(ForwardOnly); if(BCAsset.FirstRecord()) { Outputs.SetProperty("Asset_Id",BCAsset.GetFieldValue("Asset Id")); } else Outputs.SetProperty("Asset_Id"," "); } else Outputs.SetProperty("Asset_Id"," "); } finally { BCAsset = null; BCBillingProfile = null; BOAccount = null; BOAsset = null; } }

CAM BS SCM
GetBankFromIban
function GetBankFromIban(Inputs, Outputs) { var busObj:BusObject; var busComp:BusComp; var iBan; var strClearing; try { busObj = oApp.GetBusObject("SIC Bankenstamm SCM"); busComp = busObj.GetBusComp("SIC Bankenstamm SCM"); iBan = Inputs.GetProperty("IBAN"); iBan = iBan.replace(/ /g,""); iBan = iBan.toUpperCase(); strClearing = iBan.substring(4,9); while(strClearing.charAt("0") == "0") strClearing = strClearing.substring(1); busComp.SetViewMode(AllView); busComp.ActivateField("Bank"); // TGDMAEM1 12.06.12 Added for SO 1046 busComp.ActivateField("Fillial Number"); busComp.ActivateField("BC Type"); // TGDMAEM1 12.06.12 End - Added for SO 1046 busComp.ClearToQuery(); busComp.SetSearchSpec("Bank Clearing Number", strClearing); // TGDMAEM1 12.06.12 Added for SO 1046 // TGDMAEM1 17.9.12 Changed search spec from 0 to 0000 to align with source excel busComp.SetSearchSpec("Fillial Number", "0000"); // TGDMAEM1 07.11.12: Raiffeisen is a special case, all has 2... so we will sort by BC Type und take this first one //busComp.SetSearchSpec("BC Type", "1"); busComp.SetSortSpec("BC Type (ASC)"); // TGDMAEM1 12.06.12 End - Added for SO 1046 busComp.ExecuteQuery(ForwardOnly); if (busComp.FirstRecord()) { Outputs.SetProperty("Bank Clearing",strClearing); Outputs.SetProperty("Bank Name",busComp.GetFieldValue("Bank")); } } catch (e) { throw(e); } finally { busComp = null; busObj = null; } }

CAM BS SCM
GetBankFromIban
function GetBankFromIban(Inputs:PropertySet, Outputs:PropertySet) { /****************************************************** -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var busObj:BusObject; var busComp:BusComp; var iBan:chars; var strClearing:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban START"); try { busObj = oApp.GetBusObject("SIC Bankenstamm SCM"); busComp = busObj.GetBusComp("SIC Bankenstamm SCM"); iBan = Inputs.GetProperty("IBAN"); iBan = iBan.replace(/ /g,""); iBan = iBan.toUpperCase(); strClearing = iBan.substring(4,9); while(strClearing.charAt("0") == "0"){ strClearing = strClearing.substring(1); } busComp.SetViewMode(AllView); busComp.ActivateField("Bank"); busComp.ActivateField("Fillial Number");// TGDMAEM1 12.06.12 Added for SO 1046 busComp.ActivateField("BC Type"); busComp.ClearToQuery(); busComp.SetSearchSpec("Bank Clearing Number", strClearing); busComp.SetSearchSpec("Fillial Number", "0000");// TGDMAEM1 17.9.12 Changed search spec from 0 to 0000 to align with source excel busComp.SetSortSpec("BC Type (ASC)");// TGDMAEM1 07.11.12: Raiffeisen is a special case, all has 2... so we will sort by BC Type und take this first one busComp.ExecuteQuery(ForwardOnly); if (busComp.FirstRecord()) { Outputs.SetProperty("Bank Clearing",strClearing); Outputs.SetProperty("Bank Name",busComp.GetFieldValue("Bank")); } } catch (e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban ERROR:" + e.message); throw(e); } finally { busComp = null; busObj = null; } }

CAM BS SCM
GetDayOfWeek
function GetDayOfWeek (Inputs:PropertySet, Outputs:PropertySet){ /***************************************************** ** Name: GetDayOfWeek ** Created: 05.09.2011 ** Created By: Erich Stoffel ** Description: Get Day of Week as number from a Date ** Arguments: IN: CheckDate ** OUT: DayOfWeek ** "Sunday": 0 / "Monday": 1 / "Tuesday": 2/"Wednesday": 3 / "Thursday": 4/"Friday": 5 / "Saturday": 60 / -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var dtCheckDate:Date; var strDate:chars; var nYearDate:float; var nMonthDate:float; var nDayDate:float; var numDayOfWeek:float; if(bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban START"); try{ strDate = Inputs.GetProperty("CheckDate"); if(bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban Date as String: " + strDate); // Convert String -> Date nYearDate = parseInt(strDate.substr(6,4), 10); if (strDate.substr(0,1) == "0") { nMonthDate = parseInt(strDate.substr(1,1), 10); } else { nMonthDate = parseInt(strDate.substr(0,2), 10); } nMonthDate = nMonthDate - 1 if (strDate.substr(3,1) == "0") { nDayDate = parseInt(strDate.substr(4,1), 10); } else { nDayDate = parseInt(strDate.substr(3,2), 10); } dtCheckDate = new Date( nYearDate, nMonthDate, nDayDate ); numDayOfWeek = dtCheckDate.getDay(); if (bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban Date as String:" + strDate + " - dtCheckDate:" + dtCheckDate + " - numDayOfWeek:" + numDayOfWeek); Outputs.SetProperty("DayOfWeek", ToString(numDayOfWeek)); if (bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban - ToString(numDayOfWeek): " + ToString(numDayOfWeek) ); } catch (e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".GetBankFromIban ERROR: " + e.message); throw(e); } finally{ dtCheckDate = null; } }

CAM BS SCM
GetDayOfWeek
/***************************************************** ** Name: GetDayOfWeek ** Created: 05.09.2011 ** Created By: Erich Stoffel ** Description: Get Day of Week as number from a Date ** Arguments: IN: CheckDate ** OUT: DayOfWeek ** "Sunday": 0 / "Monday": 1 / "Tuesday": 2 ** "Wednesday": 3 / "Thursday": 4 ** "Friday": 5 / "Saturday": 60 / ******************************************************/ function GetDayOfWeek (Inputs, Outputs) { var strDate:String; var nYearDate:Number; var nMonthDate:Number; var nDayDate:Number; var dtCheckDate:Date; var numDayOfWeek:Number; try { strDate = Inputs.GetProperty("CheckDate"); if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Date as String: " + strDate ); } // Convert String -> Date nYearDate = parseInt(strDate.substr(6,4), 10); if (strDate.substr(0,1) == "0") { nMonthDate = parseInt(strDate.substr(1,1), 10); } else { nMonthDate = parseInt(strDate.substr(0,2), 10); } nMonthDate = nMonthDate - 1 if (strDate.substr(3,1) == "0") { nDayDate = parseInt(strDate.substr(4,1), 10); } else { nDayDate = parseInt(strDate.substr(3,2), 10); } dtCheckDate = new Date( nYearDate, nMonthDate, nDayDate ); numDayOfWeek = dtCheckDate.getDay(); if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... Date as String: " + strDate ); TheApplication().Trace(this.Name() + " ... dtCheckDate: " + dtCheckDate ); TheApplication().Trace(this.Name() + " ... numDayOfWeek: " + numDayOfWeek ); } Outputs.SetProperty("DayOfWeek", ToString(numDayOfWeek)); if (bIsTraceOn) { TheApplication().Trace(this.Name() + " ... ToString(numDayOfWeek): " + ToString(numDayOfWeek) ); } } catch (e) { if (bIsTraceOn) oApp.Trace("CAM BS SCM.GetDayOfWeek Exception: " + e.message); throw(e); } finally { dtCheckDate = null; } }

CAM BS SCM
GetInsolvents
function GetInsolvents(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GetInsolvents ** Created: 23.02.2009 ** Created By: Gema Torres ** Description: This method invokes the Query method for the Virtual Business Component 'Insolvent Customer Candidate VBC SCM' and set the ProfileAttribute to TRUE in order to -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".GetInsolvents START"); try{ oApp.SetProfileAttr("SolvencyFX","TRUE"); oApp.ActiveBusObject().GetBusComp("Insolvent Customer Candidate VBC SCM").ExecuteQuery(ForwardOnly); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".GetInsolvents ERROR: " + e.message); throw(e); } finally{ } }

CAM BS SCM
GetInsolvents
/******************************************************* ** Name: GetInsolvents ** Created: 23.02.2009 ** Created By: Gema Torres ** Description: This method invokes the Query method for the Virtual Business Component 'Insolvent Customer Candidate VBC SCM' ** and set the ProfileAttribute to TRUE in order to ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetInsolvents(Inputs,Outputs) { try { TheApplication().SetProfileAttr("SolvencyFX","TRUE"); TheApplication().ActiveBusObject().GetBusComp("Insolvent Customer Candidate VBC SCM").ExecuteQuery(ForwardOnly); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { } }

CAM BS SCM
GetMasterBillingProfile
function GetMasterBillingProfile(bcMasterBillingProfile:BusComp, strMasterBPId:chars, psMasterBPActiveFields:PropertySet){ /******************************************************* ** Name: getMasterBillingProfile ** Created: 26.09.2014 ** Created By: Lucas Requiao ** Description: Method to get Master BP instance. It has as parameter the BC itself, the Master BP Id and a propertyset with the fields to be activated -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var spropname:chars = ""; if(bIsTraceOn) oApp.Trace(this.Name() + ".GetMasterBillingProfile START"); try{ spropname = psMasterBPActiveFields.GetFirstProperty(); while (spropname != "" && spropname != null ){ bcMasterBillingProfile.ActivateField(spropname); spropname = psMasterBPActiveFields.GetNextProperty(); } bcMasterBillingProfile.SetViewMode(AllView); bcMasterBillingProfile.ClearToQuery(); bcMasterBillingProfile.SetSearchSpec("Id", strMasterBPId); bcMasterBillingProfile.ExecuteQuery(ForwardOnly); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".GetMasterBillingProfile Error: " + e.message); throw(e); } finally{ } }

CAM BS SCM
GetMasterBillingProfile
/******************************************************* ** Name: getMasterBillingProfile ** Created: 26.09.2014 ** Created By: Lucas Requiao ** Description: Method to get Master BP instance. It has as parameter the BC itself, the Master BP Id and a propertyset with the fields to be activated -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetMasterBillingProfile(bcMasterBillingProfile:BusComp, strMasterBPId:chars, psMasterBPActiveFields:PropertySet) { try { var spropname:chars = psMasterBPActiveFields.GetFirstProperty(); while (spropname != "" && spropname != null ) { bcMasterBillingProfile.ActivateField(spropname); spropname = psMasterBPActiveFields.GetNextProperty(); } bcMasterBillingProfile.SetViewMode(AllView); bcMasterBillingProfile.ClearToQuery(); bcMasterBillingProfile.SetSearchSpec("Id", strMasterBPId); bcMasterBillingProfile.ExecuteQuery(ForwardOnly); } catch(e) { throw(e); } }

CAM BS SCM
GetPreferedFleetManagerForBP
function GetPreferedFleetManagerForBP(Inputs,Outputs){ /******************************************************* ** Name: GetPreferedFleetManagerForBP ** Created: 15.09.2010 ** Created By: Karin Haack ** Description: This method returns the prefered Fleet Manager of a Billing Profile -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var aBOAccount:BusObject = null; var aBCIntersection:BusComp = null; var aBCRole:BusComp=null; var bpId:chars = ""; var cmaId:chars = ""; var ifPreferedNameFound:bool=false; var isRecord:bool; if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedFleetManagerForBP START"); try{ // getting all roles of Affiliation bpId = Inputs.GetProperty("BPId"); cmaId = Inputs.GetProperty("CMAAccountId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedFleetManagerForBP BPId: " + bpId ); aBOAccount = oApp.GetBusObject("Account"); aBCIntersection = aBOAccount.GetBusComp("Contact Invoice Profile Intersection SCM"); aBCIntersection.ClearToQuery(); aBCIntersection.SetViewMode(AllView); aBCIntersection.ActivateField("Contact Id"); aBCIntersection.SetSearchExpr("[Billing Profile Id] = '" + bpId + "'"); aBCIntersection.ExecuteQuery(ForwardOnly); isRecord = aBCIntersection.FirstRecord(); aBCRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); while (isRecord && ! ifPreferedNameFound) { aBCRole.ClearToQuery(); aBCRole.SetViewMode(AllView); aBCRole.SetSearchExpr("[Contact Id] = '" + aBCIntersection.GetFieldValue("Contact Id") + "' AND [Account Id SCM]='" + cmaId + "' AND [End Date SCM] IS NULL AND [Affiliation End Date SCM] IS NULL AND [Role]='" + oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") + "'"); aBCRole.ActivateField("Contact Full Name Calc SCM"); aBCRole.ExecuteQuery(ForwardOnly); if (aBCRole.FirstRecord()) { Outputs.SetProperty("Fleet Mananger Full Name",aBCRole.GetFieldValue("Contact Full Name Calc SCM")); ifPreferedNameFound = true; } isRecord = aBCIntersection.NextRecord(); } } catch(e){ if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedFleetManagerForBP ERROR:" + e.message); oApp.RaiseErrorText(e.toString()); } finally{ isRecord = null; aBCRole = null; aBCIntersection = null; aBOAccount = null; } }

CAM BS SCM
GetPreferedFleetManagerForBP
/******************************************************* ** Name: GetPreferedFleetManagerForBP ** Created: 15.09.2010 ** Created By: Karin Haack ** Description: This method returns the prefered Fleet Manager of a Billing Profile -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetPreferedFleetManagerForBP(Inputs,Outputs) { var aBOAccount:BusObject=null; var aBCIntersection:BusComp=null; var bpId:String=""; var cmaId:String=""; var aBCRole:BusComp=null; var ifPreferedNameFound:bool=false; var isRecord; try { // getting all roles of Affiliation bpId = Inputs.GetProperty("BPId"); cmaId = Inputs.GetProperty("CMAAccountId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedFleetManagerForBP: BPId=" + bpId ); aBOAccount = oApp.GetBusObject("Account"); aBCIntersection = aBOAccount.GetBusComp("Contact Invoice Profile Intersection SCM"); aBCIntersection.ClearToQuery(); aBCIntersection.SetViewMode(AllView); aBCIntersection.ActivateField("Contact Id"); aBCIntersection.SetSearchExpr("[Billing Profile Id] = '" + bpId + "'"); aBCIntersection.ExecuteQuery(ForwardOnly); isRecord = aBCIntersection.FirstRecord(); aBCRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); while (isRecord && ! ifPreferedNameFound) { aBCRole.ClearToQuery(); aBCRole.SetViewMode(AllView); aBCRole.SetSearchExpr("[Contact Id] = '" + aBCIntersection.GetFieldValue("Contact Id") + "' AND [Account Id SCM]='" + cmaId + "' AND [End Date SCM] IS NULL AND [Affiliation End Date SCM] IS NULL AND [Role]='" + TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") + "'"); aBCRole.ActivateField("Contact Full Name Calc SCM"); aBCRole.ExecuteQuery(ForwardOnly); if (aBCRole.FirstRecord()) { Outputs.SetProperty("Fleet Mananger Full Name",aBCRole.GetFieldValue("Contact Full Name Calc SCM")); ifPreferedNameFound = true; } isRecord = aBCIntersection.NextRecord(); } } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { isRecord = null; aBCRole = null; aBCIntersection = null; aBOAccount = null; } }

CAM BS SCM
GetPreferedRole
function GetPreferedRole(Inputs,Outputs){ /******************************************************* ** Name: GetPreferedRole ** Created: 08.09.2010 ** Created By: Karin Haack ** Description: This method returns the prefered role of a Account Contact Affiliation -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up -------------------- Modifications --------------------- ** Date Changed By Description: ** 2016.12.13 TAACONU1 Defect # 1094 ******************************************************/ var aBOAccount:BusObject=null; var boLOV:BusObject=null; var bcLOV:BusComp=null; var aBCAccountContact:BusComp=null; var affiliationId:chars = ""; var preferedRole:chars = ""; var preferedRoleOrder:chars = "0"; var ifPreferedRoleActive:bool=false; var ifPreferedRoleFound:bool=false; var roleArray = new Array(); var isRecord:bool; if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedRole START"); try{ // getting all LOV values and its ordering boLOV = oApp.GetBusObject("List Of Values"); bcLOV = boLOV.GetBusComp("List Of Values SCM"); bcLOV.ClearToQuery(); bcLOV.SetViewMode(AllView); bcLOV.ActivateField("Order By"); bcLOV.ActivateField("Name"); bcLOV.SetSearchExpr("[Language]='ENU' AND [Type]='CONTACT_ROLE_SCM'"); bcLOV.ExecuteQuery(ForwardBackward); isRecord = bcLOV.FirstRecord(); while (isRecord){ roleArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Order By"); isRecord = bcLOV.NextRecord(); } // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedRole: affiliationId: " + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); isRecord = aBCAccountContact.FirstRecord(); while (isRecord && ! ifPreferedRoleFound) { if (preferedRole == ""){// set initially the first role as prefered preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ ifPreferedRoleActive = true; if (aBCAccountContact.GetFieldValue("Role")==oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager")){ ifPreferedRoleFound = true; } } else { ifPreferedRoleActive = false; } } else { if (aBCAccountContact.GetFieldValue("Role") == oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") && aBCAccountContact.GetFieldValue("End Date SCM") == ""){// if an active Main Fleet Manager role is found preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleFound = true; } else if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ if (! ifPreferedRoleActive){// current prefered role is not active but current role is -> take current one as prefered preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleActive = true; } else if (preferedRoleOrder > roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]){// both roles are active, current role owes lower order -> take current one as pre

CAM BS SCM
GetPreferedRole
/******************************************************* ** Name: GetPreferedRole ** Created: 08.09.2010 ** Created By: Karin Haack ** Description: This method returns the prefered role of a Account Contact Affiliation ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetPreferedRole(Inputs,Outputs) { var aBOAccount:BusObject=null; var aBCAccountContact:BusComp=null; var affiliationId:String=""; var preferedRole:String=""; var ifPreferedRoleActive:bool=false; var preferedRoleOrder=0; var ifPreferedRoleFound:bool=false; var roleArray = new Array(); var boLOV:BusObject=null; var bcLOV:BusComp=null; var isRecord; try { // getting all LOV values and its ordering boLOV = oApp.GetBusObject("List Of Values"); bcLOV = boLOV.GetBusComp("List Of Values SCM"); bcLOV.ClearToQuery(); bcLOV.SetViewMode(AllView); bcLOV.ActivateField("Order By"); bcLOV.ActivateField("Name"); bcLOV.SetSearchExpr("[Language]='ENU' AND [Type]='CONTACT_ROLE_SCM'"); bcLOV.ExecuteQuery(ForwardBackward); isRecord = bcLOV.FirstRecord(); while (isRecord) { roleArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Order By"); isRecord = bcLOV.NextRecord(); } // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedRole: affiliationId=" + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); isRecord = aBCAccountContact.FirstRecord(); while (isRecord && ! ifPreferedRoleFound) { if (preferedRole == "") {// set initially the first role as prefered preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ ifPreferedRoleActive = true; if (aBCAccountContact.GetFieldValue("Role")==oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager")) { ifPreferedRoleFound = true; } } else { ifPreferedRoleActive = false; } } else { if (aBCAccountContact.GetFieldValue("Role")==TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") && aBCAccountContact.GetFieldValue("End Date SCM") == "") {// if an active Main Fleet Manager role is found preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleFound = true; } else if (aBCAccountContact.GetFieldValue("End Date SCM") == "") { if (! ifPreferedRoleActive) {// current prefered role is not active but current role is -> take current one as prefered preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleActive = true; } else if (preferedRoleOrder > roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]) {// both roles are active, current role owes lower order -> take current one as prefered preferedRole = aBCAccountContact.GetFieldValue("Role"); preferedRoleOrder = roleArray[aBC

CAM BS SCM
GetPreferedRoleForContactScreen
function GetPreferedRoleForContactScreen(Inputs,Outputs){ /******************************************************* ** Name: GetPreferedRoleForContactScreen ** Created: 27.10.2010 ** Created By: Karin Haack ** Description: This method returns the prefered role of a Account Contact Affiliation ** in Contact Screen, View "Contact Detail - Accounts View SCM" -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var aBOAccount:BusObject = null; var aBCAccountContact:BusComp = null; var affiliationId:chars = ""; var preferedRole:chars = ""; var party_id:chars = ""; if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedRoleForContactScreen START"); try{ // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedRoleForContactScreen: affiliationId=" + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("Account Id SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); if (aBCAccountContact.FirstRecord()){ party_id = aBCAccountContact.GetFieldValue("Account Id SCM"); } aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Account Id SCM]='" + party_id + "' AND [Contact Id]='" + oApp.GetProfileAttr("ContactScreenView_ContactId") + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); if (aBCAccountContact.FirstRecord()){ preferedRole = aBCAccountContact.GetFieldValue("Role"); } Outputs.SetProperty("Prefered Role",preferedRole); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedRoleForContactScreen ERROR: "+ e.message); throw(e); } finally{ aBCAccountContact = null; aBOAccount = null; } }

CAM BS SCM
GetPreferedRoleForContactScreen
/******************************************************* ** Name: GetPreferedRoleForContactScreen ** Created: 27.10.2010 ** Created By: Karin Haack ** Description: This method returns the prefered role of a Account Contact Affiliation ** in Contact Screen, View "Contact Detail - Accounts View SCM" -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GetPreferedRoleForContactScreen(Inputs,Outputs) { var aBOAccount:BusObject=null; var aBCAccountContact:BusComp=null; var affiliationId:String=""; var preferedRole:String=""; var party_id = ""; try { // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedRole: affiliationId=" + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("Account Id SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); if (aBCAccountContact.FirstRecord()) { party_id = aBCAccountContact.GetFieldValue("Account Id SCM"); } aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Account Id SCM]='" + party_id + "' AND [Contact Id]='" + oApp.GetProfileAttr("ContactScreenView_ContactId") + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); if (aBCAccountContact.FirstRecord()) { preferedRole = aBCAccountContact.GetFieldValue("Role"); } Outputs.SetProperty("Prefered Role",preferedRole); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { aBCAccountContact = null; aBOAccount = null; } }

CAM BS SCM
GetPreferedRoleLow
function GetPreferedRoleLow(Inputs:PropertySet,Outputs:PropertySet){ /**************************************************************** ** Name: GetPreferedRoleLow ** Created: 05.09.2014 ** Created By: Pedro Ferreira ** Description: This method returns the prefered role low value (from LOV) of an Account Contact Affiliation -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up *****************************************************************/ var aBOAccount:BusObject=null; var boLOV:BusObject=null; var bcLOV:BusComp=null; var aBCAccountContact:BusComp=null; var roleArray:Array; var lowArray:Array; var affiliationId:chars=""; var preferedRoleLow:chars=""; var preferedRoleOrder:float =0; var ifPreferedRoleActive:bool=false; var ifPreferedRoleFound:bool=false; var isRecord:bool; if (bIsTraceOn) oApp.Trace(this.Name() + ".GetPreferedRoleLow START"); try{ roleArray = new Array(); lowArray = new Array(); // contains the Low value from the LOV for each record // getting all LOV values and its ordering boLOV = oApp.GetBusObject("List Of Values"); bcLOV = boLOV.GetBusComp("List Of Values SCM"); bcLOV.ClearToQuery(); bcLOV.SetViewMode(AllView); bcLOV.ActivateField("Order By"); bcLOV.ActivateField("Name"); bcLOV.ActivateField("Low"); bcLOV.SetSearchExpr("[Language]='ENU' AND [Type]='CONTACT_ROLE_SCM'"); bcLOV.ExecuteQuery(ForwardBackward); isRecord = bcLOV.FirstRecord(); while (isRecord){ roleArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Order By"); lowArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Low"); isRecord = bcLOV.NextRecord(); } // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedRoleLow: affiliationId=" + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); isRecord = aBCAccountContact.FirstRecord(); while (isRecord && ! ifPreferedRoleFound) { if (preferedRoleLow == ""){// set initially the first role as prefered preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ ifPreferedRoleActive = true; if (aBCAccountContact.GetFieldValue("Role")==oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager")){ ifPreferedRoleFound = true; } } else { ifPreferedRoleActive = false; } } else { if (aBCAccountContact.GetFieldValue("Role")==oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") && aBCAccountContact.GetFieldValue("End Date SCM") == ""){// if an active Main Fleet Manager role is found preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleFound = true; } else if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ if (! ifPreferedRoleActive){// current prefered role is not active but current role is -> take current one as prefered preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldVal

CAM BS SCM
GetPreferedRoleLow
/**************************************************************** ** Name: GetPreferedRoleLow ** Created: 05.09.2014 ** Created By: Pedro Ferreira ** Description: This method returns the prefered role low value ** (from LOV) of an Account Contact Affiliation ** ------------------------ Modifications -------------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> *****************************************************************/ function GetPreferedRoleLow(Inputs,Outputs) { var aBOAccount:BusObject=null; var aBCAccountContact:BusComp=null; var affiliationId:String=""; var preferedRoleLow:String=""; var ifPreferedRoleActive:bool=false; var preferedRoleOrder=0; var ifPreferedRoleFound:bool=false; var roleArray = new Array(); var lowArray = new Array(); // contains the Low value from the LOV for each record var boLOV:BusObject=null; var bcLOV:BusComp=null; var isRecord; try { // getting all LOV values and its ordering boLOV = oApp.GetBusObject("List Of Values"); bcLOV = boLOV.GetBusComp("List Of Values SCM"); bcLOV.ClearToQuery(); bcLOV.SetViewMode(AllView); bcLOV.ActivateField("Order By"); bcLOV.ActivateField("Name"); bcLOV.ActivateField("Low"); bcLOV.SetSearchExpr("[Language]='ENU' AND [Type]='CONTACT_ROLE_SCM'"); bcLOV.ExecuteQuery(ForwardBackward); isRecord = bcLOV.FirstRecord(); while (isRecord) { roleArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Order By"); lowArray[bcLOV.GetFieldValue("Name")] = bcLOV.GetFieldValue("Low"); isRecord = bcLOV.NextRecord(); } // getting all roles of Affiliation affiliationId = Inputs.GetProperty("AffiliationId"); if (bIsTraceOn) oApp.Trace(Name() + ".GetPreferedRoleLow: affiliationId=" + affiliationId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.ActivateField("Role"); aBCAccountContact.ActivateField("Relationship Type LIC SCM"); aBCAccountContact.SetSearchExpr("[Parent Row Id] = '" + affiliationId + "'"); aBCAccountContact.ExecuteQuery(ForwardBackward); isRecord = aBCAccountContact.FirstRecord(); while (isRecord && ! ifPreferedRoleFound) { if (preferedRoleLow == "") {// set initially the first role as prefered preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; if (aBCAccountContact.GetFieldValue("End Date SCM") == ""){ ifPreferedRoleActive = true; if (aBCAccountContact.GetFieldValue("Role")==oApp.InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager")) { ifPreferedRoleFound = true; } } else { ifPreferedRoleActive = false; } } else { if (aBCAccountContact.GetFieldValue("Role")==TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Main Fleet Manager") && aBCAccountContact.GetFieldValue("End Date SCM") == "") {// if an active Main Fleet Manager role is found preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; ifPreferedRoleFound = true; } else if (aBCAccountContact.GetFieldValue("End Date SCM") == "") { if (! ifPreferedRoleActive) {// current prefered role is not active but current role is -> take current one as prefered preferedRoleLow = lowArray[aBCAccountContact.GetFieldValue("Relationship Type LIC SCM")]; preferedRoleOrder = roleArray[aBCAccountContact.GetFieldValue("Relationship

CAM BS SCM
GoToOrderEntryView
/******************************************************* ** Name: GoToOrderEntryView ** Created: 14.04.2011 ** Created By: Alejandro Strickler ** Description: This method navigates to an Order Entry View, positioning itself on a given Oreder Id (BO is Order Entry (Sales)) -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GoToOrderEntryView(Inputs,Outputs) { var strOeId; var boOrderEntry; var bcOrderEntry; var strView; try { //Get from the input the Id of the SR owner customer strOeId = Inputs.GetProperty("OrderId"); //Search the SR in the BO Service Request to navigate to the view boOrderEntry = TheApplication().GetBusObject("Order Entry (Sales)"); bcOrderEntry = boOrderEntry.GetBusComp("Order Entry - Orders"); bcOrderEntry.SetViewMode(AllView); bcOrderEntry.ClearToQuery(); bcOrderEntry.SetSearchSpec("Id",strOeId); bcOrderEntry.ExecuteQuery(ForwardOnly); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Navigation to the desired view if(bcOrderEntry.FirstRecord()) { TheApplication().GotoView(strView, boOrderEntry); } else TheApplication().Trace("CAM BS SCM.GoToOrderEntryView - No records found!"); } catch (e) { TheApplication().RaiseErrorText(e.toString()); } finally { bcOrderEntry = null; boOrderEntry = null; strView = null; strOeId = null; } }

CAM BS SCM
GoToOrderEntryView
function GoToOrderEntryView(Inputs:PropertySet,Outputs:PropertySet) { /******************************************************* ** Name: GoToOrderEntryView ** Created: 14.04.2011 ** Created By: Alejandro Strickler ** Description: This method navigates to an Order Entry View, positioning itself on a given Oreder Id (BO is Order Entry (Sales)) -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var boOrderEntry:BusObject; var bcOrderEntry:BusComp; var strView:chars; var strOeId:chars; if (bIsTraceOn) oApp.Trace(this.Name() + ".GoToOrderEntryView START"); try { //Get from the input the Id of the SR owner customer strOeId = Inputs.GetProperty("OrderId"); //Search the SR in the BO Service Request to navigate to the view boOrderEntry = oApp.GetBusObject("Order Entry (Sales)"); bcOrderEntry = boOrderEntry.GetBusComp("Order Entry - Orders"); bcOrderEntry.SetViewMode(AllView); bcOrderEntry.ClearToQuery(); bcOrderEntry.SetSearchSpec("Id",strOeId); bcOrderEntry.ExecuteQuery(ForwardOnly); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Navigation to the desired view if(bcOrderEntry.FirstRecord()) { oApp.GotoView(strView, boOrderEntry); } else { if (bIsTraceOn)oApp.Trace(this.Name() + ".GoToOrderEntryView - No records found!"); } } catch (e) { if (bIsTraceOn) oApp.Trace(this.Name() + ".GoToOrderEntryView ERROR:" + e.message); throw(e); } finally { bcOrderEntry = null; boOrderEntry = null; strView = null; strOeId = null; } }

CAM BS SCM
GotoContactView
function GotoContactView(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GotoContactView ** Created: 11.03.2009 ** Created By: Javier Amor ** Description: This method must navigate from the current view to another ** selected from an input parameter. This script is generic to be used from Workflows and sctips. If account Id and Contact Id are not received as input parameters, they are get from the context. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOAccount:BusObject; var BOActAccount:BusObject; var BCAccount:BusComp; var strView:chars; var strAccountId:chars; if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoContactView START"); try{ BOActAccount = oApp.ActiveBusObject(); strView = Inputs.GetProperty("View"); //Get Account Id and Contact Id strAccountId = Inputs.GetProperty("Account Id"); if(strAccountId == "")strAccountId = BOActAccount.GetBusComp("Account").GetFieldValue("Id"); //New empty BO and BC Account BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); //Look for the customer BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",strAccountId); BCAccount.ExecuteQuery(ForwardOnly); oApp.GotoView(strView, BOAccount); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoContactView ERROR:" + e.message); throw(e); } finally{ strView = null; strAccountId = null; BCAccount = null; BOAccount = null; BOActAccount = null; } }

CAM BS SCM
GotoContactView
/******************************************************* ** Name: GotoContactView ** Created: 11.03.2009 ** Created By: Javier Amor ** Description: This method must navigate from the current view to another ** selected from an input parameter. This method will be used in Accounts Screen so at the beginning the ** current customer and contact are selected.Depending of the view other operations will be neccesary. According to Siebel Bookshelf ** (Siebel Object Interface Reference, page 137) method GotoView cannot get Active Business Object so ** queries to select the desired customer are mandatory. ** This script is generic to be used from Workflows and sctips. If account Id and Contact Id are not received ** as input parameters, they are get from the context. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GotoContactView(Inputs,Outputs) { var strView; var strAccountId; var strContactId; var BOAccount; var BCAccount; var BCContact; var BOActAccount; try { BOActAccount = TheApplication().ActiveBusObject(); //Get the name of the view from the context strView = Inputs.GetProperty("View"); //Get Account Id and Contact Id strAccountId = Inputs.GetProperty("Account Id"); if(strAccountId == "") strAccountId = BOActAccount.GetBusComp("Account").GetFieldValue("Id"); strContactId = Inputs.GetProperty("Contact Id"); if(strContactId == "") strContactId = BOActAccount.GetBusComp("Contact").GetFieldValue("Id"); //New empty BO and BC Account BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); //Look for the customer BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",strAccountId); BCAccount.ExecuteQuery(ForwardOnly); // begin TGDHAKA8 2011-04-05: not needed //Contact must be searched only when the destination view is Duplicate Contact Candidate /*if(strView == "Duplicate Contact Candidate View SCM") { BCContact = BOAccount.GetBusComp("Contact"); BCContact.SetViewMode(AllView); BCContact.ClearToQuery(); BCContact.SetSearchSpec("Id",strContactId); BCContact.ExecuteQuery(ForwardOnly); }*/ // end: TGDHAKA8 2011-04-05: not needed //If we navigate from the Duplicate Contacts View to the Account Entry View, a profile attribute //is set to position in the right contact //if(strView == "Account Entry Contact View SCM") // TheApplication().SetProfileAttr("PositionContactId", strContactId); TheApplication().GotoView(strView, BOAccount); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { strView = null; strAccountId = null; strContactId = null; BCContact = null; BCAccount = null; BOAccount = null; BOActAccount = null; } }

CAM BS SCM
GotoSRInactivateView
function GotoSRInactivateView(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOServiceRequest:BusObject; var BCServiceRequest:BusComp var strAccId:chars; var strView:chars; var SRId:chars; if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRInactivateView START"); try{ //Get from the input the Id of the SR owner customer strAccId = Inputs.GetProperty("AccId"); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Search the SR in the BO Service Request to navigate to the view BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strAccId); BCServiceRequest.SetSearchSpec("Sub-Area","Customer data maintenance"); BCServiceRequest.SetSearchSpec("Info Consult CD Not GUI SCM","Inactivate"); BCServiceRequest.SetSearchSpec("Status","<>'Closed'"); BCServiceRequest.ExecuteQuery(ForwardOnly); //Navigation to the desired view if(BCServiceRequest.FirstRecord()){ SRId = BCServiceRequest.GetFieldValue("Id"); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord())oApp.GotoView(strView, BOServiceRequest); } } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRInactivateView ERROR:" + e.message); throw(e); } finally{ BCServiceRequest = null; BOServiceRequest = null; strView = null; strAccId = null; } }

CAM BS SCM
GotoSRInactivateView
function GotoSRInactivateView(Inputs,Outputs) { //Get from the input the Id of the SR owner customer var strAccId = Inputs.GetProperty("AccId"); //Search the SR in the BO Service Request to navigate to the view var BOServiceRequest = oApp.GetBusObject("Service Request"); var BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); var strView; var SRId; try{ BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Account Id",strAccId); BCServiceRequest.SetSearchSpec("Sub-Area","Customer data maintenance"); BCServiceRequest.SetSearchSpec("Info Consult CD Not GUI SCM","Inactivate"); //BEGIN. OneCRM R1 2009.09.28 TGDFESO1: Force to open the SR in status "Open"(in case a customer is inactivated a second time and more than one SR of type Inactivation exists). BCServiceRequest.SetSearchSpec("Status","<>'Closed'"); //END. OneCRM R1 2009.09.28 TGDFESO1: Force to open the SR in status "Open"(in case a customer is inactivated a second time and more than one SR of type Inactivation exists). BCServiceRequest.ExecuteQuery(ForwardOnly); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Navigation to the desired view if(BCServiceRequest.FirstRecord()) { //SCM 2009.11.06 TGDTOGE3 issue 16101 added query for search only by SRId and not by '<>Closed' status //because in SR Toggle Account View if ExecuteQuery is done and SR is submitted with status Closed no SR is found SRId = BCServiceRequest.GetFieldValue("Id"); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); if(BCServiceRequest.FirstRecord()) oApp.GotoView(strView, BOServiceRequest); } } catch(e){ oApp.RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BOServiceRequest = null; strView = null; strAccId = null; } }

CAM BS SCM
GotoSRView
function GotoSRView(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GotoSRView ** Created: 03.11.2008 ** Created By: María T. Martínez ** Description: This method must navigate from the current view to the "SR Toogle View SCM". For that, it is needed the active Billing Profile Id, and the Sub-Area and Detail of the Service Request created. ** According to Siebel Bookshelf (Siebel Object Interface Reference, page 137) method GotoView cannot get ** Active Business Object so queries to select the desired customer are mandatory. This method is used in Barring/Debarring process and in Change Bill Comment process.Input argument Barring difference between barring process and change bill comment process. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOAccount:BusObject; var BOServiceRequest:BusObject; var BCBillingProfile:BusComp; var BCServiceRequest:BusComp; var bs:Service; var psin:PropertySet; var psout:PropertySet; var strSubarea:chars=""; var strDetail:chars=""; var strBPId:chars; var strView:chars; var strInput:chars; var strstatus:chars=""; var SRId:chars =""; if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRView START"); try{ //The parameters needed for the navigation are got BOAccount = oApp.ActiveBusObject(); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile SCM"); strBPId = BCBillingProfile.GetFieldValue("Id"); if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRView strBPId : " + strBPId); //If barring process is invoked, service request to be found has different subarea and detail to change bill comment SR strInput = Inputs.GetProperty("Context"); if(strInput.indexOf("Y")>0){ bs = oApp.GetService("Workflow Process Manager"); psin = oApp.NewPropertySet(); psout = oApp.NewPropertySet(); psin.SetProperty("ProcessName","Automatic SR Creation SCM"); psin.SetProperty("Entity","Billing Profile"); psin.SetProperty("Area","Modification Order Management"); psin.SetProperty("Sub-Area","Cash-closes mutation automatic"); psin.SetProperty("Detail","Block Billing Profile"); psin.SetProperty("Billing Profile Id",strBPId); psin.SetProperty("Object Id",BCBillingProfile.GetFieldValue("Account Id")); bs.InvokeMethod("RunProcess",psin,psout); SRId = psout.GetProperty("SR Id"); strView= "Service Request Barring Mutation View SCM"; BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); } else { strSubarea = "Customer data maintenance"; strDetail = "Billing Profile Cost ID"; strstatus = "Open"; strView= "SR Toggle View SCM"; //Search for navigate to the View with the correct active service request BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Billing Profile Id SCM",strBPId); BCServiceRequest.SetSearchSpec("Sub-Area",strSubarea); BCServiceRequest.SetSearchSpec("Info Consult CD Not GUI SCM",strDetail); BCServiceRequest.SetSearchSpec("Status",strstatus); BCServiceRequest.ExecuteQuery(ForwardOnly); SRId = BCServiceRequest.GetFieldValue("Id"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); } //Navigation to the desired view if(BCServiceRequest.FirstRecord())oApp.GotoView(strView, BOServiceRequest

CAM BS SCM
GotoSRView
/******************************************************* ** Name: GotoSRView ** Created: 03.11.2008 ** Created By: María T. Martínez ** Description: This method must navigate from the current view to the "SR Toogle View SCM". For that, ** it is needed the active Billing Profile Id, and the Sub-Area and Detail of the Service Request created. ** According to Siebel Bookshelf (Siebel Object Interface Reference, page 137) method GotoView cannot get ** Active Business Object so queries to select the desired customer are mandatory. ** This method is used in Barring/Debarring process and in Change Bill Comment process.Input argument Barring ** difference between barring process and change bill comment process. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 11.05.2009 ** Changed By: Gema Torres ** Description: CR 208 -- due to this CR, the proccess for barring/debarring will reuse the same view as contracts ** and will save the information in the x_srv_req_xm. It will be created a new record for each type of barring/debarring ** and it will be saved the current status for each one ** ** Date: 7.2.2011 ** Changed By: Lanker B. ** Description: No Full and partial barring anymore ** ******************************************************/ function GotoSRView(Inputs,Outputs) { //SCM 2009.01.16 TGDAMJA1. Every variable must be declared before try statement var strSubarea=""; var strDetail=""; var BOAccount; var BCBillingProfile; var strBPId; var BOServiceRequest; var BCServiceRequest; var strView; var strInput; var strstatus=""; var SRId =""; var bs; var psin; var psout; try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; if( bIsTraceOn) oApp.Trace("MethodName : GotoSRView"); //The parameters needed for the navigation are got BOAccount = TheApplication().ActiveBusObject(); BCBillingProfile = BOAccount.GetBusComp("Com Invoice Profile SCM"); strBPId = BCBillingProfile.GetFieldValue("Id"); if( bIsTraceOn) oApp.Trace("strBPId : " + strBPId); //If barring process is invoked, service request to be found has different subarea and detail to change bill comment SR strInput = Inputs.GetProperty("Context"); if(strInput.indexOf("Y")>0) { bs = oApp.GetService("Workflow Process Manager"); psin = oApp.NewPropertySet(); psout = oApp.NewPropertySet(); psin.SetProperty("ProcessName","Automatic SR Creation SCM"); psin.SetProperty("Entity","Billing Profile"); psin.SetProperty("Area","Modification Order Management"); psin.SetProperty("Sub-Area","Cash-closes mutation automatic"); psin.SetProperty("Detail","Block Billing Profile"); psin.SetProperty("Billing Profile Id",strBPId); psin.SetProperty("Object Id",BCBillingProfile.GetFieldValue("Account Id")); bs.InvokeMethod("RunProcess",psin,psout); SRId = psout.GetProperty("SR Id"); strView= "Service Request Barring Mutation View SCM"; BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); } else { strSubarea = "Customer data maintenance"; strDetail = "Billing Profile Cost ID"; //SCM 2009.10.06 TGDBEJA6 Issue 14263 Navigation to a wrong SR strstatus = "Open"; //Get the name of the view strView= "SR Toggle View SCM"; //Search for navigate to the View with the correct active service request BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Billing Profile Id SCM",strBPId); BCServiceRequest.SetSearchSpec("Sub-Area",strSubarea); BCServiceRequest.SetSearchSpec("Info Consult CD No

CAM BS SCM
GotoSRViewAccount
function GotoSRViewAccount(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GotoSRViewAccount ** Created: 03.11.2008 ** Created By: F. Javier Gomez ** Description: This method navigates to the a view were the BO active ** is Service Request with the input SR selected -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOServiceRequest:BusObject; var BCServiceRequest:BusComp; var strView:chars; var strSRId:chars; try{ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRViewAccount START"); //Get from the input the Id of the SR owner customer strSRId = Inputs.GetProperty("SRId"); //Search the SR in the BO Service Request to navigate to the view BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //BEGIN. SCM 2010.02.26 TGDAMJA1. Issue 20413.Added SetViewMode BCServiceRequest.SetViewMode(AllView); //END. SCM 2010.02.26 TGDAMJA1. Issue 20413.Added SetViewMode BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",strSRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Navigation to the desired view if(BCServiceRequest.FirstRecord())oApp.GotoView(strView, BOServiceRequest); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRViewAccount ERROR:" + e.message); throw(e); } finally{ BCServiceRequest = null; BOServiceRequest = null; strView = null; strSRId = null; } }

CAM BS SCM
GotoSRViewAccount
/******************************************************* ** Name: GotoSRViewAccount ** Created: 03.11.2008 ** Created By: F. Javier Gomez ** Description: This method navigates to the a view were the BO active ** is Service Request with the input SR selected -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GotoSRViewAccount(Inputs,Outputs) { var strSRId; var BOServiceRequest; var BCServiceRequest; var strView; try{ //Get from the input the Id of the SR owner customer strSRId = Inputs.GetProperty("SRId"); //Search the SR in the BO Service Request to navigate to the view BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //BEGIN. SCM 2010.02.26 TGDAMJA1. Issue 20413.Added SetViewMode BCServiceRequest.SetViewMode(AllView); //END. SCM 2010.02.26 TGDAMJA1. Issue 20413.Added SetViewMode BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",strSRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //Get from the input the name of the view strView = Inputs.GetProperty("ViewName"); //Navigation to the desired view if(BCServiceRequest.FirstRecord()) TheApplication().GotoView(strView, BOServiceRequest); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BOServiceRequest = null; strView = null; strSRId = null; } }

CAM BS SCM
GotoSRViewBillingProfile
function GotoSRViewBillingProfile(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GotoSRViewBillingProfile ** Created: 19.11.2008 ** Created By: María T. Martínez ** Description: This method is used in order to navigate to the 'SR Toggle Billing Profile View SCM' after clicking the 'Modify' button of the Billing Profile. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOServiceRequest:BusObject; var BCServiceRequest:BusComp; try{ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRViewBillingProfile START"); //Search for navigate to the View with the correct active service request BOServiceRequest = oApp.GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",Inputs.GetProperty("SRId")); BCServiceRequest.ExecuteQuery(ForwardOnly); //Navigation to the desired view if(BCServiceRequest.FirstRecord()) oApp.GotoView(Inputs.GetProperty("View"), BOServiceRequest); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoSRViewBillingProfile ERROR: " + e.message); throw(e); } finally{ BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
GotoSRViewBillingProfile
/******************************************************* ** Name: GotoSRViewBillingProfile ** Created: 19.11.2008 ** Created By: María T. Martínez ** Description: This method is used in order to navigate to the 'SR Toggle Billing Profile View SCM' after clicking ** the 'Modify' button of the Billing Profile. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function GotoSRViewBillingProfile(Inputs,Outputs){ var BOServiceRequest; var BCServiceRequest; try{ //Search for navigate to the View with the correct active service request BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //SCM 2009.10.22 TGDAMJA1. Issue 14688.SetViewMode added to avoid a filter with the owner of the SR. BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id",Inputs.GetProperty("SRId")); BCServiceRequest.ExecuteQuery(ForwardOnly); //Navigation to the desired view if(BCServiceRequest.FirstRecord()) TheApplication().GotoView(Inputs.GetProperty("View"), BOServiceRequest); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
GotoView
function GotoView(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: GotoView ** Created: 07.08.2008 ** Description: This method must navigate from the current view to another selected from an input parameter. This method will be used in Accounts Screen so at the beginning the current customer ** Updated: TAADEDA3-03.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var BOActiveAccount:BusObject; var BOAccount:BusObject; var BCAccount:BusComp; var BCSR:BusComp; var BCActiveAccount:BusComp; var BCActiveSR:BusComp; var strView:chars; var strAccId:chars; var strSRId:chars; var strConId:chars; if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoView START"); try{ //Get the name of the view from the context strView = Inputs.GetProperty("View"); //Get Active BO and Active BC Account BOActiveAccount = oApp.ActiveBusObject(); BCActiveAccount = BOActiveAccount.GetBusComp("Account"); //Get current Id. This is necessary for the active account query. strAccId = BCActiveAccount.GetFieldValue("Id"); //New BO and BC Account empty BOAccount = oApp.GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); if ((strView != "Account Entry View SCM")&&(strView != "Account Entry View SCS")&&(strView != "MCE Homescreen View SCM")){ //TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 BCActiveSR = BOActiveAccount.GetBusComp("Service Request"); BCSR = BOAccount.GetBusComp("Service Request"); strSRId = BCActiveSR.GetFieldValue("Id"); if(Inputs.GetProperty("SRId") != "")strSRId = Inputs.GetProperty("SRId"); BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.ActivateField("Id"); BCAccount.SetSearchSpec("Id",strAccId); BCAccount.ExecuteQuery(ForwardOnly); if(strSRId != ""){ BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",strSRId); BCSR.ExecuteQuery(ForwardOnly); } } //Depending of the view other operations will be performed switch(strView){ case "Duplicate Customer Candidate View SCM": //This view only needs the active account Set Global variable to avoid leaving the view without pressing "Select" or "No match" buttons oApp.SetProfileAttr("NoExit","TRUE"); break; case "Solvency Check View SCM": //This view only needs the active account Set Global variable to avoid leaving the view without pressing "Select" or "No match" buttons oApp.SetProfileAttr("NoExit2","TRUE"); break; case "Account Entry View SCS": case "Account Entry View SCM": case "MCE Homescreen View SCM": strAccId = Inputs.GetProperty("AccId");//In this view active contact must be selected BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.SetSearchSpec("Id",strAccId); BCAccount.ExecuteQuery(ForwardOnly); // When the agent clicks on "Select" in Duplicate Customer Candidate View SCM the "New customer" SR is cancelled so it does not have to be submitted oApp.SetProfileAttr("GeoValidateAddr","N"); break; default: break; } //If the customer exists, one record will be found and the application will go to the desired view if(BCAccount.FirstRecord())oApp.GotoView(strView, BOAccount); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".GotoView ERROR: " + e.message); throw(e); } finally{ strView = null; strAccId = null; strSRId = null; strConId = null; BCAccount = null; BCSR = null; BCActiveAccount = null; BCActiveSR = null; BOAccount = null; BOActiveAccount = null; } }

CAM BS SCM
GotoView
/******************************************************* ** Name: GotoView ** Created: 07.08.2008 ** Created By: Javier Amor ** Description: This method must navigate from the current view to another selected from an input ** parameter. This method will be used in Accounts Screen so at the beginning the current customer ** is selected. Depending of the view other operations will be neccesary. According to Siebel Bookshelf ** (Siebel Object Interface Reference, page 137) method GotoView cannot get Active Business Object so ** queries to select the desired customer are mandatory. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ** Updated: TAADEDA3-03.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ******************************************************/ function GotoView(Inputs,Outputs) { var strView; var BOActiveAccount; var BCActiveAccount; var BCActiveSR; var strAccId; var strSRId; var BOAccount; var BCAccount; var BCSR; var BCActiveContact; var strConId; var BCContact; try{ //Get the name of the view from the context strView = Inputs.GetProperty("View"); //Get Active BO and Active BC Account BOActiveAccount = TheApplication().ActiveBusObject(); BCActiveAccount = BOActiveAccount.GetBusComp("Account"); //Get current Id. This is necessary for the active account query. strAccId = BCActiveAccount.GetFieldValue("Id"); //New BO and BC Account empty BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account"); //TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 if ((strView != "Account Entry View SCM")&&(strView != "Account Entry View SCS")&&(strView != "MCE Homescreen View SCM")){ BCActiveSR = BOActiveAccount.GetBusComp("Service Request"); BCSR = BOAccount.GetBusComp("Service Request"); strSRId = BCActiveSR.GetFieldValue("Id"); //SCM 2009.11.25 TGDDOPA1 ISSUE 17465 New optional argument to search the Service Request if(Inputs.GetProperty("SRId") != ""){ strSRId = Inputs.GetProperty("SRId"); } //Look for Active Account in the empty BC. This query is mandatory since GotoView method cannot get //active Business Object. BCAccount.SetViewMode(AllView); BCAccount.ClearToQuery(); BCAccount.ActivateField("Id"); BCAccount.SetSearchSpec("Id",strAccId); BCAccount.ExecuteQuery(ForwardOnly); if(strSRId != "") { BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); BCSR.SetSearchSpec("Id",strSRId); BCSR.ExecuteQuery(ForwardOnly); } } //Depending of the view other operations will be performed switch(strView) { /* TGDHAKA8 2011-04-05: view not existing anymore case "Duplicate Contact Candidate View SCM": //In this view active contact must be selected BCActiveContact = BOActiveAccount.GetBusComp("Contact"); strConId = BCActiveContact.GetFieldValue("Id"); //Get BC Contact empty BCContact = BOAccount.GetBusComp("Contact"); //Look for Active Contact BCContact.SetViewMode(AllView); BCContact.ClearToQuery(); BCContact.SetSearchSpec("Id",strConId); BCContact.ExecuteQuery(ForwardOnly); TheApplication().SetProfileAttr("No Escape","TRUE"); break; */ case "Duplicate Customer Candidate View SCM": //This view only needs the active account //Set Global variable to avoid leaving the view without pressing "Select" or "No match" buttons TheApplication().SetProfileAttr("NoExit","TRUE"); break; case "Solvency Check View SCM": //This view only needs the active account //Set Global variable to avoid leaving the view without pressing "Select" or "No match" buttons TheApplication().SetProfileAttr("NoExit2","TRUE"); break; //TAADEDA3-02.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 case "

CAM BS SCM
InactivationUpdateHQ
/******************************************************* ** Name: InactivationUpdateHQ ** Created: 14.10.2009 ** Created By: Gema Torres ** Description: Issue 14305. This method is going to carry out the process of updating the HQ to be Inactivated when its CMA was inactivated, the status is changed to Inmactive and the Status Change Reason will be the same of its CMA, it can not be done by Siebel Operation due to Workflow Object Component is 'Service Request' and the link between Service Request and Account makes only possible to update the Account Id ** -------------------- Modifications --------------------- ** Date Changed by Description ** 20161104 TAACONU1 WP1278 Nullify the 'Next Reminder Date SCM' field ******************************************************/ function InactivationUpdateHQ(Inputs, Outputs) { var strHQId; var BOAcc; var BCAcc; var strChangeReason; var BCAccount; var lsGrobsegment:String; var lsSME:String; try { strHQId = Inputs.GetProperty("HQId"); strChangeReason = Inputs.GetProperty("Change Reason"); BOAcc = oApp.GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); BCAcc.ActivateField("Account Status Change Reason"); BCAcc.ActivateField("Account Status"); BCAcc.ActivateField("Next Reminder Date SCM"); BCAcc.ActivateField("Calculated Grobsegment SCM"); //TGDTOGE3 Issue 31391 -- The HQ was not founded, SetViewMOde sentence added BCAcc.SetViewMode(AllView); //ENd Issue 31391 BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id", strHQId); BCAcc.ExecuteQuery(ForwardOnly); if(BCAcc.FirstRecord()) { // Update Status and Status Change Reason in HQ BCAcc.SetFieldValue("Account Status Change Reason", strChangeReason); BCAcc.SetFieldValue("Account Status", oApp.InvokeMethod("LookupValue", "ACCOUNT_STATUS", "Inactive")); lsGrobsegment = BCAcc.GetFieldValue("Calculated Grobsegment SCM"); lsSME = TheApplication().InvokeMethod("LookupValue","CUSTOMER_SEGMENT_SCM","SME"); // check if it is a SME Segment based Account if(lsGrobsegment.toString() == lsSME.toString()) BCAcc.SetFieldValue("Next Reminder Date SCM",""); BCAcc.WriteRecord(); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAcc = null; BOAcc = null; } }

CAM BS SCM
InactivationUpdateHQ
/******************************************************* ** Name: InactivationUpdateHQ ** Created: 14.10.2009 ** Created By: Gema Torres ** Description: Issue 14305. This method is going to carry out the process of updating the HQ to be Inactivated when its CMA was inactivated, the status is changed to Inmactive and the Status Change Reason will be the same of its CMA, it can not be done by Siebel Operation due to Workflow Object Component is 'Service Request' and the link between Service Request and Account makes only possible to update the Account Id ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function InactivationUpdateHQ(Inputs, Outputs) { var strHQId; var BOAcc; var BCAcc; var strChangeReason; var BCAccount; try { strHQId = Inputs.GetProperty("HQId"); strChangeReason = Inputs.GetProperty("Change Reason"); BOAcc = oApp.GetBusObject("Account"); BCAcc = BOAcc.GetBusComp("Account"); BCAcc.ActivateField("Account Status Change Reason"); BCAcc.ActivateField("Account Status"); //TGDTOGE3 Issue 31391 -- The HQ was not founded, SetViewMOde sentence added BCAcc.SetViewMode(AllView); //ENd Issue 31391 BCAcc.ClearToQuery(); BCAcc.SetSearchSpec("Id", strHQId); BCAcc.ExecuteQuery(ForwardOnly); if(BCAcc.FirstRecord()) { // Update Status and Status Change Reason in HQ BCAcc.SetFieldValue("Account Status Change Reason", strChangeReason); BCAcc.SetFieldValue("Account Status", oApp.InvokeMethod("LookupValue", "ACCOUNT_STATUS", "Inactive")); BCAcc.WriteRecord(); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAcc = null; BOAcc = null; } }

CAM BS SCM
IsInList
/***************************************************************************** * Function: IsInList * Purpose : Checks wheter a given LIC is in the hierarchical pick list. * Params : strPartent - the parent LIC * strName - the child LIC * strHigh - value in field High *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- -------------------------------------------------- * 2012-09-24 tgdhuro9 created. * 2013-03-18 tgdmaem1 added 3 input arg: strHigh *****************************************************************************/ function IsInList(strParent:chars, strName:chars, strHigh:chars) { var bReturn:bool; var bo:BusObject; var bc:BusComp; try { trc("Is '" + strParent + "', '" + strName + "' in list?"); bReturn = false; bo = oApp.GetBusObject("Account"); bc = bo.GetBusComp("List Of Values"); bc.ClearToQuery(); bc.SetSearchSpec("Type", "PAYMENT_TYPE_SCM"); bc.SetSearchSpec("Language", "ENU"); bc.SetSearchSpec("Active", "Y"); // TGDMAEM1: replaced fix value with input from function //bc.SetSearchSpec("High", "Y"); bc.SetSearchSpec("High", " LIKE '*" + strHigh + "*'"); bc.SetSearchSpec("Parent", strParent); bc.SetSearchSpec("Name", strName); bc.ExecuteQuery(ForwardOnly); if (bc.FirstRecord()) { trc("yes, indeed"); bReturn = true; } else { trc("no"); } } catch (e) { bc = null; bo = null; } return bReturn; }

CAM BS SCM
IsInList
/***************************************************************************** * Function: IsInList * Purpose : Checks wheter a given LIC is in the hierarchical pick list. * Params : strPartent - the parent LIC * strName - the child LIC * strHigh - value in field High *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- -------------------------------------------------- * 2012-09-24 tgdhuro9 created. * 2013-03-18 tgdmaem1 added 3 input arg: strHigh *****************************************************************************/ function IsInList(strParent:chars, strName:chars, strHigh:chars) { var bReturn:bool; var bo:BusObject; var bc:BusComp; try { trc("Is '" + strParent + "', '" + strName + "' in list?"); bReturn = false; bo = oApp.GetBusObject("Account"); bc = bo.GetBusComp("List Of Values"); bc.ClearToQuery(); bc.SetSearchSpec("Type", "PAYMENT_TYPE_SCM"); bc.SetSearchSpec("Language", "ENU"); bc.SetSearchSpec("Active", "Y"); // TGDMAEM1: replaced fix value with input from function //bc.SetSearchSpec("High", "Y"); bc.SetSearchSpec("High", " LIKE '*" + strHigh + "*'"); bc.SetSearchSpec("Parent", strParent); bc.SetSearchSpec("Name", strName); bc.ExecuteQuery(ForwardOnly); if (bc.FirstRecord()) { trc("yes, indeed"); bReturn = true; } else { trc("no"); } } catch (e) { bc = null; bo = null; } return bReturn; }

CAM BS SCM
LookUpValue
/***************************************************************************************************************** ** Name: LookUpValue ** Created: 9.09.2008 ** Created By: Jose Ignacio Diaz ** Description: ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function LookUpValue(Inputs,Outputs) { var Type; var Value; var LookType; try{ /*Variables*/ Type = Inputs.GetProperty("Type"); Value = Inputs.GetProperty("Value"); ////// get the value //// LookType = TheApplication().InvokeMethod("LookupValue",Type,Value); Outputs.SetProperty("LookType",LookType); }// catch(e) { TheApplication().RaiseErrorText(e.toString); } finally { Type=null; Value=null; LookType=null; } }

CAM BS SCM
LookUpValue
/***************************************************************************************************************** ** Name: LookUpValue ** Created: 9.09.2008 ** Created By: Jose Ignacio Diaz ** Description: ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function LookUpValue(Inputs,Outputs) { var Type; var Value; var LookType; try{ /*Variables*/ Type = Inputs.GetProperty("Type"); Value = Inputs.GetProperty("Value"); ////// get the value //// LookType = TheApplication().InvokeMethod("LookupValue",Type,Value); Outputs.SetProperty("LookType",LookType); }// catch(e) { TheApplication().RaiseErrorText(e.toString); } finally { Type=null; Value=null; LookType=null; } }

CAM BS SCM
LookupMsg
/***************************************************************************************************************** ** Name: LookupMsg ** Created: 26.11.2008 ** Created By: F. Javier Gómez Ayerbe ** Description: The method gets a message from the "User Defined Errors" category. The method receives as input ** the Key of the message and returns as output the text of the message. ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function LookupMsg(Inputs,Outputs) { var msgStr; var msgKey; try { msgKey = Inputs.GetProperty("Key"); msgStr = TheApplication().LookupMessage("User Defined Errors", msgKey); Outputs.SetProperty("Message", msgStr); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { msgStr=null; msgKey=null; } }

CAM BS SCM
LookupMsg
/***************************************************************************************************************** ** Name: LookupMsg ** Created: 26.11.2008 ** Created By: F. Javier Gómez Ayerbe ** Description: The method gets a message from the "User Defined Errors" category. The method receives as input ** the Key of the message and returns as output the text of the message. ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function LookupMsg(Inputs,Outputs) { var msgStr; var msgKey; try { msgKey = Inputs.GetProperty("Key"); msgStr = TheApplication().LookupMessage("User Defined Errors", msgKey); Outputs.SetProperty("Message", msgStr); } catch(e) { TheApplication().RaiseErrorText(e.toString()); } finally { msgStr=null; msgKey=null; } }

CAM BS SCM
LookupValueENU
function LookupValueENU(oBCLOV:BusComp, sType, sParentLIC, sLIC) { var sReturn; try { sReturn=""; trc ("LookupValueENU - sParentLIC = " + sParentLIC + " / sLIC = " + sLIC); if (QueryLOV(oBCLOV, "[Type]='" + sType + "' AND [Active]='Y' AND [Language]='ENU' AND [Parent]='" + sParentLIC + "' AND [Name]='" + sLIC + "'")) { sReturn = oBCLOV.GetFieldValue("Value"); } } catch(e) { trc ("LookupValueENU - " + e.toString()); } trc ("LookupValueENU - sReturn = " + sReturn); return (sReturn); }

CAM BS SCM
LookupValueENU
function LookupValueENU(oBCLOV:BusComp, sType, sParentLIC, sLIC) { var sReturn; try { sReturn=""; trc ("LookupValueENU - sParentLIC = " + sParentLIC + " / sLIC = " + sLIC); if (QueryLOV(oBCLOV, "[Type]='" + sType + "' AND [Active]='Y' AND [Language]='ENU' AND [Parent]='" + sParentLIC + "' AND [Name]='" + sLIC + "'")) { sReturn = oBCLOV.GetFieldValue("Value"); } } catch(e) { trc ("LookupValueENU - " + e.toString()); } trc ("LookupValueENU - sReturn = " + sReturn); return (sReturn); }

CAM BS SCM
MainCheckBillingProfile
//==================================================================================================== // Copyright: Swisscom Schweiz AG // Project: Symphony // Authors: Alejandro Strickler // Purpose: This function wraps all validations on a Billing Profile that has to be executed when the related SR is being submitted. // // Revision Date Who Ver Comments // 02.06.2014 TAADEDA3 Aug14 Quadrica GPE - Added validation for SYM-30431 that guarantees that Media and Print Codes are available for the Billing Profile selected Brand. Brand can not be null also on Modify. // 24.06.2014 TGDGEMAM Aug14 QuadriCA CCE IV - Added validation on "External Billing Account Reference SCM" length >= 25 characters // 25.07.2014 TGDRELU4 Nov14 Quadrica - ensure that only one Billing Profile with no active contract the same Brand //==================================================================================================== function MainCheckBillingProfile(Inputs, Outputs) { var boActive:BusObject = null; var bcBillingProfile:BusComp = null; var boMasterBillingProfile:BusObject = null; var bcMasterBillingProfile:BusComp = null; var psMasterBPActiveFields:PropertySet = null; var strBPId:chars = ""; var strPaymentMethod:chars = ""; var strMediaType:chars = ""; var strPrintCode:chars = ""; var strBillSource:chars = ""; var strBankAccount:chars = ""; var strIban:chars = ""; var strEpaymentId:chars = ""; var strEmailTo:chars = ""; var strBillComment:chars = ""; var strExtBillReference:chars = ""; var strVATExempt:chars = ""; var strInvoiceVATType:chars = ""; var strBrand:chars = ""; var strStatus:chars = ""; var strNonGUI = "N"; var errorCode = ""; var sEmailReqFlag:chars = ""; var strPrintCodeBrand:chars = ""; // 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not var bExtSysFlag:chars = ""; var strAccountId:chars = ""; var strConExistFlg:chars = ""; var strBPNr:chars = ""; var strMasterBPId:chars = ""; var strAllowedPaymentMethods = "Post,LSV,Paynet,Yellow Bill,Debit Direct"; try { oApp.Trace("MainCheckBillingProfile -> Enter"); // Get current billing profile bc boActive = oApp.GetBusObject("EAI Billing Profile SCM"); bcBillingProfile = boActive.GetBusComp("Com Invoice Profile SCM"); strBPId = Inputs.GetProperty("BPId"); strNonGUI = Inputs.GetProperty("NonGUI"); if (bIsTraceOn) oApp.Trace("MainCheckBillingProfile -> BP Search with Id: " + strBPId); // Position on the Billing Profile to be checked bcBillingProfile.ActivateField("Account Id"); bcBillingProfile.ActivateField("Active Contract Exists Flag SCM"); bcBillingProfile.ActivateField("External Billing Account Number SCM"); bcBillingProfile.ActivateField("Master Row ID SCM"); bcBillingProfile.ActivateField("Calculated Payment Method LIC SCM"); bcBillingProfile.ActivateField("Media Type"); bcBillingProfile.ActivateField("Print Code SCM"); bcBillingProfile.ActivateField("Bill Source"); bcBillingProfile.ActivateField("Bank Account Number"); bcBillingProfile.ActivateField("IBAN Account Number SCM"); bcBillingProfile.ActivateField("ePayment Id SCM"); bcBillingProfile.ActivateField("Email Bill To"); bcBillingProfile.ActivateField("Payment Method"); bcBillingProfile.ActivateField("Bill Comment SCM"); bcBillingProfile.ActivateField("VAT Exempt Code SCM"); bcBillingProfile.ActivateField("Invoice VAT Type SCM"); bcBillingProfile.ActivateField("Email Required Flag SCM"); bcBillingProfile.ActivateField("Brand SCM"); bcBillingProfile.ActivateField("Status"); bcBillingProfile.ActivateField("Print Code Brand SCM"); bcBillingProfile.ActivateField("External Billing Account Reference SCM"); // 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not bcBillingPr

CAM BS SCM
MainCheckBillingProfile
//==================================================================================================== // Copyright: Swisscom Schweiz AG // Project: Symphony // Authors: Alejandro Strickler // Purpose: This function wraps all validations on a Billing Profile that has to be executed when the related SR is being submitted. // // Revision Date Who Ver Comments // 02.06.2014 TAADEDA3 Aug14 Quadrica GPE - Added validation for SYM-30431 that guarantees that Media and Print Codes are available for the Billing Profile selected Brand. Brand can not be null also on Modify. // 24.06.2014 TGDGEMAM Aug14 QuadriCA CCE IV - Added validation on "External Billing Account Reference SCM" length >= 25 characters // 25.07.2014 TGDRELU4 Nov14 Quadrica - ensure that only one Billing Profile with no active contract the same Brand //==================================================================================================== function MainCheckBillingProfile(Inputs, Outputs) { var boActive:BusObject = null; var bcBillingProfile:BusComp = null; var boMasterBillingProfile:BusObject = null; var bcMasterBillingProfile:BusComp = null; var psMasterBPActiveFields:PropertySet = null; var strBPId:chars = ""; var strPaymentMethod:chars = ""; var strMediaType:chars = ""; var strPrintCode:chars = ""; var strBillSource:chars = ""; var strBankAccount:chars = ""; var strIban:chars = ""; var strEpaymentId:chars = ""; var strEmailTo:chars = ""; var strBillComment:chars = ""; var strExtBillReference:chars = ""; var strVATExempt:chars = ""; var strInvoiceVATType:chars = ""; var strBrand:chars = ""; var strStatus:chars = ""; var strNonGUI = "N"; var errorCode = ""; var sEmailReqFlag:chars = ""; var strPrintCodeBrand:chars = ""; // 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not var bExtSysFlag:chars = ""; var strAccountId:chars = ""; var strConExistFlg:chars = ""; var strBPNr:chars = ""; var strMasterBPId:chars = ""; var strAllowedPaymentMethods = "Post,LSV,Paynet,Yellow Bill,Debit Direct"; try { oApp.Trace("MainCheckBillingProfile -> Enter"); // Get current billing profile bc boActive = oApp.GetBusObject("EAI Billing Profile SCM"); bcBillingProfile = boActive.GetBusComp("Com Invoice Profile SCM"); strBPId = Inputs.GetProperty("BPId"); strNonGUI = Inputs.GetProperty("NonGUI"); if (bIsTraceOn) oApp.Trace("MainCheckBillingProfile -> BP Search with Id: " + strBPId); // Position on the Billing Profile to be checked bcBillingProfile.ActivateField("Account Id"); bcBillingProfile.ActivateField("Active Contract Exists Flag SCM"); bcBillingProfile.ActivateField("External Billing Account Number SCM"); bcBillingProfile.ActivateField("Master Row ID SCM"); bcBillingProfile.ActivateField("Calculated Payment Method LIC SCM"); bcBillingProfile.ActivateField("Media Type"); bcBillingProfile.ActivateField("Print Code SCM"); bcBillingProfile.ActivateField("Bill Source"); bcBillingProfile.ActivateField("Bank Account Number"); bcBillingProfile.ActivateField("IBAN Account Number SCM"); bcBillingProfile.ActivateField("ePayment Id SCM"); bcBillingProfile.ActivateField("Email Bill To"); bcBillingProfile.ActivateField("Payment Method"); bcBillingProfile.ActivateField("Bill Comment SCM"); bcBillingProfile.ActivateField("VAT Exempt Code SCM"); bcBillingProfile.ActivateField("Invoice VAT Type SCM"); bcBillingProfile.ActivateField("Email Required Flag SCM"); bcBillingProfile.ActivateField("Brand SCM"); bcBillingProfile.ActivateField("Status"); bcBillingProfile.ActivateField("Print Code Brand SCM"); bcBillingProfile.ActivateField("External Billing Account Reference SCM"); // 2014-01-14 TGDGEMAM: Defect # 94821 - to differentiate whether BP was created from Symphony or not bcBillingPr

CAM BS SCM
NameCheck
/***************************************************************************** * Function: NameCheck * Purpose : Validates and converts the last and first name of a person * customer according to the rules defined by CR 170. * * This algorithm was implemented 3 times: * 1. BC Account Method PreWriteRecord * 2. BC Account Lite SCM Method PreWriteRecord * 3. BC Contact Method PreWriteRecord * * For defect 36397 it was necessary to implement the same algorithm * in BC Service Request. As this is no proper software design at all * the functionality of these three places is consolidated here. * * Params : Inputs * Property "Account Type": * Designates the account type either Person or Customer * Property "Last Name": * The last name to check and convert * Property "First Name": * The first name to check and convert * Return : Outputs * Property "Last Name Converted": * Conversion to a proper and valid last name * Property "First Name Converted": * Conversion to a proper and valid first name *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-05-04 tgdhuro9 created *****************************************************************************/ function NameCheck(Inputs, Outputs) { var psFirstName:PropertySet = TheApplication().NewPropertySet(); var psLastName:PropertySet = TheApplication().NewPropertySet(); var psValidateFirstName:PropertySet = TheApplication().NewPropertySet(); var psValidateLastName:PropertySet = TheApplication().NewPropertySet(); var strAccountType:String; var strLastName:String; var strFirstName:String; var pvalue:String; var pvalue2:String; var sResWord:String; var sResWord2:String; try { strAccountType = Inputs.GetProperty("Account Type"); strLastName = Inputs.GetProperty("Last Name"); strFirstName = Inputs.GetProperty("First Name"); Outputs.SetProperty("Last Name Converted", ""); Outputs.SetProperty("First Name Converted", ""); if (bIsTraceOn) { oApp.Trace("NameCheck - strAccountType = " + strAccountType); oApp.Trace("NameCheck - strLastName = " + strLastName); oApp.Trace("NameCheck - strFirstName = " + strFirstName); } if (strAccountType != TheApplication().InvokeMethod("LookupValue", "ACCOUNT_TYPE", "Person")) { if((strLastName.indexOf("¿") >= 0) || (strLastName.indexOf("´") >= 0) || (strFirstName.indexOf("¿") >= 0) || (strFirstName.indexOf("´") >= 0)) { TheApplication().RaiseError("Special character CMA"); } return; } if (strLastName.length == 0 && strFirstName.length == 0) { return; } psFirstName.SetProperty("Inputs", strFirstName); psLastName.SetProperty("Inputs", strLastName); ValidateString(psFirstName, psValidateFirstName); ValidateString(psLastName, psValidateLastName); pvalue = psValidateFirstName.GetProperty("Outputs"); pvalue2 = psValidateLastName.GetProperty("Outputs"); //CR170 -- A name must contain at least one word, and a word must consist of at least two characters // one exception is "E", which is valid last name if (pvalue2 == "Error: E") { pvalue2 = "OK"; } if (pvalue == "Error: E") { pvalue = "Error: A word must contain at least two characters"; } sResWord = psValidateFirstName.GetProperty("RestrictedWord"); sResWord2 = psValidateLastName.GetProperty("RestrictedWord"); //CR170 -- Different types of error messages denpending on the type of error given if (pvalue != "OK" && pvalue2 != "OK") { if ((sResWord == "") && (sResWord2 == "")) { TheApplication().RaiseErrorText("Error First Name:" +TheApplication().LookupMessage("User Defined Errors", pvalue)+ " Error Last Name:" +TheApplicat

CAM BS SCM
NameCheck
/***************************************************************************** * Function: NameCheck * Purpose : Validates and converts the last and first name of a person * customer according to the rules defined by CR 170. * * This algorithm was implemented 3 times: * 1. BC Account Method PreWriteRecord * 2. BC Account Lite SCM Method PreWriteRecord * 3. BC Contact Method PreWriteRecord * * For defect 36397 it was necessary to implement the same algorithm * in BC Service Request. As this is no proper software design at all * the functionality of these three places is consolidated here. * * Params : Inputs * Property "Account Type": * Designates the account type either Person or Customer * Property "Last Name": * The last name to check and convert * Property "First Name": * The first name to check and convert * Return : Outputs * Property "Last Name Converted": * Conversion to a proper and valid last name * Property "First Name Converted": * Conversion to a proper and valid first name *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-05-04 tgdhuro9 created *****************************************************************************/ function NameCheck(Inputs, Outputs) { var psFirstName:PropertySet = TheApplication().NewPropertySet(); var psLastName:PropertySet = TheApplication().NewPropertySet(); var psValidateFirstName:PropertySet = TheApplication().NewPropertySet(); var psValidateLastName:PropertySet = TheApplication().NewPropertySet(); var strAccountType:String; var strLastName:String; var strFirstName:String; var pvalue:String; var pvalue2:String; var sResWord:String; var sResWord2:String; try { strAccountType = Inputs.GetProperty("Account Type"); strLastName = Inputs.GetProperty("Last Name"); strFirstName = Inputs.GetProperty("First Name"); Outputs.SetProperty("Last Name Converted", ""); Outputs.SetProperty("First Name Converted", ""); if (bIsTraceOn) { oApp.Trace("NameCheck - strAccountType = " + strAccountType); oApp.Trace("NameCheck - strLastName = " + strLastName); oApp.Trace("NameCheck - strFirstName = " + strFirstName); } if (strAccountType != TheApplication().InvokeMethod("LookupValue", "ACCOUNT_TYPE", "Person")) { if((strLastName.indexOf("¿") >= 0) || (strLastName.indexOf("´") >= 0) || (strFirstName.indexOf("¿") >= 0) || (strFirstName.indexOf("´") >= 0)) { TheApplication().RaiseError("Special character CMA"); } return; } if (strLastName.length == 0 && strFirstName.length == 0) { return; } psFirstName.SetProperty("Inputs", strFirstName); psLastName.SetProperty("Inputs", strLastName); ValidateString(psFirstName, psValidateFirstName); ValidateString(psLastName, psValidateLastName); pvalue = psValidateFirstName.GetProperty("Outputs"); pvalue2 = psValidateLastName.GetProperty("Outputs"); //CR170 -- A name must contain at least one word, and a word must consist of at least two characters // one exception is "E", which is valid last name if (pvalue2 == "Error: E") { pvalue2 = "OK"; } if (pvalue == "Error: E") { pvalue = "Error: A word must contain at least two characters"; } sResWord = psValidateFirstName.GetProperty("RestrictedWord"); sResWord2 = psValidateLastName.GetProperty("RestrictedWord"); //CR170 -- Different types of error messages denpending on the type of error given if (pvalue != "OK" && pvalue2 != "OK") { if ((sResWord == "") && (sResWord2 == "")) { TheApplication().RaiseErrorText("Error First Name:" +TheApplication().LookupMessage("User Defined Errors", pvalue)+ " Error Last Name:" +TheApplicat

CAM BS SCM
NoMatchCheckCompany
/******************************************************* ** Name: NoMatchCheckPerson ** Created: 27.07.2010 ** Created By: TGDLOAL3 ** Description: This method checks if the person to create exists already in the application. ** Added due to CR#413 ** ******************************************************/ function NoMatchCheckCompany(Inputs,Outputs) { var SCN; var boActive; var bcAccount; var strCompanyName; var bcDupAccount; try{ SCN = oApp.ActiveBusObject().GetBusComp("Account").GetFieldValue("Account Nr."); boActive= oApp.ActiveBusObject(); bcAccount=boActive.GetBusComp("Account"); bcAccount.SetViewMode(AllView); bcAccount.ActivateField("CMA Company Name SCM"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Account Nr.", SCN); bcAccount.ExecuteQuery(ForwardOnly); if (bcAccount.FirstRecord()){ strCompanyName = bcAccount.GetFieldValue("CMA Company Name SCM"); } bcDupAccount=oApp.GetBusObject("Account").GetBusComp("Account"); bcDupAccount.SetViewMode(AllView); bcDupAccount.ActivateField("Account Nr."); bcDupAccount.ClearToQuery(); bcDupAccount.SetSearchSpec("CMA Company Name SCM", strCompanyName); bcDupAccount.SetSearchSpec("Type", "Company"); bcDupAccount.SetSearchSpec("Account Status", "'Customer' OR [Account Status] = 'Prospect'"); // TGDHAKA8 2011-09-16: search spec extended due to defect 39068 bcDupAccount.SetSearchSpec("CMA Company Name End Date SCM","IS NULL"); bcDupAccount.ExecuteQuery(ForwardOnly); if(bcDupAccount.FirstRecord()){ oApp.SetProfileAttr("DisableNoMatch","YES"); oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "X_DUP_RECORD_SCM", bcDupAccount.GetFieldValue("Account Nr."))); } }catch(e){ oApp.RaiseErrorText(e.toString()); } finally { SCN=null; boActive=null; bcAccount=null; strCompanyName=null; bcDupAccount=null; } }

CAM BS SCM
NoMatchCheckCompany
/******************************************************* ** Name: NoMatchCheckPerson ** Created: 27.07.2010 ** Created By: TGDLOAL3 ** Description: This method checks if the person to create exists already in the application. ** Added due to CR#413 ** ******************************************************/ function NoMatchCheckCompany(Inputs,Outputs) { var SCN; var boActive; var bcAccount; var strCompanyName; var bcDupAccount; try{ SCN = oApp.ActiveBusObject().GetBusComp("Account").GetFieldValue("Account Nr."); boActive= oApp.ActiveBusObject(); bcAccount=boActive.GetBusComp("Account"); bcAccount.SetViewMode(AllView); bcAccount.ActivateField("CMA Company Name SCM"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Account Nr.", SCN); bcAccount.ExecuteQuery(ForwardOnly); if (bcAccount.FirstRecord()){ strCompanyName = bcAccount.GetFieldValue("CMA Company Name SCM"); } bcDupAccount=oApp.GetBusObject("Account").GetBusComp("Account"); bcDupAccount.SetViewMode(AllView); bcDupAccount.ActivateField("Account Nr."); bcDupAccount.ClearToQuery(); bcDupAccount.SetSearchSpec("CMA Company Name SCM", strCompanyName); bcDupAccount.SetSearchSpec("Type", "Company"); bcDupAccount.SetSearchSpec("Account Status", "'Customer' OR [Account Status] = 'Prospect'"); // TGDHAKA8 2011-09-16: search spec extended due to defect 39068 bcDupAccount.SetSearchSpec("CMA Company Name End Date SCM","IS NULL"); bcDupAccount.ExecuteQuery(ForwardOnly); if(bcDupAccount.FirstRecord()){ oApp.SetProfileAttr("DisableNoMatch","YES"); oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "X_DUP_RECORD_SCM", bcDupAccount.GetFieldValue("Account Nr."))); } }catch(e){ oApp.RaiseErrorText(e.toString()); } finally { SCN=null; boActive=null; bcAccount=null; strCompanyName=null; bcDupAccount=null; } }

CAM BS SCM
NoMatchCheckPerson
/******************************************************* ** Name: NoMatchCheckPerson ** Created: 27.07.2010 ** Created By: TGDLOAL3 ** Description: This method checks if the person to create exists already in the application. ** Added due to CR#413 ** Modified By: TGDHURO9 ** Description: 33795 PROD: Customer cannot created when the address(street) contents the special sign " ' ". ** Modified By: TGDGEMAM 2013-11-21 ** Description: Extended to set Duplicate Match Level due to SO 1869 ******************************************************/ function NoMatchCheckPerson(Inputs,Outputs) { var boActive; var bcAccount; var strFirstName; var strLastName; var strBirthDate; var strSegment; var strZipCode; var strCity; var strStreet; var strHouseNumber; var bcDupAccount; var s; var isRecord:bool; try { boActive = oApp.ActiveBusObject(); bcAccount = boActive.GetBusComp("Account"); bcAccount.SetViewMode(AllView); bcAccount.ActivateField("Account Contact First Name"); bcAccount.ActivateField("Account Contact Last Name"); bcAccount.ActivateField("Account Contact Birth Date"); bcAccount.ActivateField("Grobsegment SCM"); bcAccount.ActivateField("Primary Account Postal Code SCM"); bcAccount.ActivateField("Primary Account City SCM"); bcAccount.ActivateField("Primary Account Street Address SCM"); bcAccount.ActivateField("Strassennummer"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Account Nr.", bcAccount.GetFieldValue("Account Nr.")); bcAccount.ExecuteQuery(ForwardOnly); if (bcAccount.FirstRecord()){ strFirstName = bcAccount.GetFieldValue("Account Contact First Name"); strLastName = bcAccount.GetFieldValue("Account Contact Last Name"); strBirthDate = bcAccount.GetFieldValue("Account Contact Birth Date"); strSegment = bcAccount.GetFieldValue("Grobsegment SCM"); strZipCode = bcAccount.GetFieldValue("Primary Account Postal Code SCM"); strCity = bcAccount.GetFieldValue("Primary Account City SCM"); strStreet = bcAccount.GetFieldValue("Primary Account Street Address SCM"); strHouseNumber = bcAccount.GetFieldValue("Strassennummer"); bcDupAccount=oApp.GetBusObject("Account").GetBusComp("Account"); bcDupAccount.SetViewMode(AllView); bcDupAccount.ClearToQuery(); s = ""; s += "[Account Contact First Name]=\"" + repl(strFirstName) + "\" AND "; s += "[Account Contact Last Name]=\"" + repl(strLastName) + "\" AND "; s += "([Account Status]='Customer' OR [Account Status] = 'Prospect')"; if (strBirthDate != "01/01/1900" && strBirthDate != "11/11/1911") { s += " AND "; s += "[Account Contact Birth Date]=\"" + strBirthDate + "\""; } if (bIsTraceOn) { oApp.Trace(this.Name() + ": NoMatchCheckPerson: search expr is " + s); } bcDupAccount.SetSearchExpr(s); bcDupAccount.ExecuteQuery(ForwardOnly); isRecord = bcDupAccount.FirstRecord(); // Match Level 0 : Initialization oApp.SetProfileAttr("DuplicateMatchLevel", "0"); while(isRecord){ // Match Level 1 : Name + Birthdate if (oApp.GetProfileAttr("DuplicateMatchLevel") < 1) { oApp.SetProfileAttr("DuplicateMatchLevel", "1"); } // Check if we can find better matches if (bcDupAccount.GetFieldValue("Grobsegment SCM") == strSegment) { // Match Level 2 : Name + Birthdate + Segment (SR created later on) if (oApp.GetProfileAttr("DuplicateMatchLevel") < 2) { oApp.SetProfileAttr("DuplicateMatchLevel", "2"); } if (bcDupAccount.GetFieldValue("Primary Account Postal Code SCM") == strZipCode && bcDupAccount.GetFieldValue("Primary Account City SCM") == strCity && bcDupAccount.GetFieldValue("Primary Account Street Address SCM") == strStreet && bcDupAccount.GetFieldValue("Strassennummer") == strHouseNumber) { // Match Level 3 : Name + Birthdate + Segment + Address if (oApp.GetProfileAttr("DuplicateMatchLevel") < 3) { oApp.Set

CAM BS SCM
NoMatchCheckPerson
/******************************************************* ** Name: NoMatchCheckPerson ** Created: 27.07.2010 ** Created By: TGDLOAL3 ** Description: This method checks if the person to create exists already in the application. ** Added due to CR#413 ** Modified By: TGDHURO9 ** Description: 33795 PROD: Customer cannot created when the address(street) contents the special sign " ' ". ** Modified By: TGDGEMAM 2013-11-21 ** Description: Extended to set Duplicate Match Level due to SO 1869 ******************************************************/ function NoMatchCheckPerson(Inputs,Outputs) { var boActive; var bcAccount; var strFirstName; var strLastName; var strBirthDate; var strSegment; var strZipCode; var strCity; var strStreet; var strHouseNumber; var bcDupAccount; var s; var isRecord:bool; try { boActive = oApp.ActiveBusObject(); bcAccount = boActive.GetBusComp("Account"); bcAccount.SetViewMode(AllView); bcAccount.ActivateField("Account Contact First Name"); bcAccount.ActivateField("Account Contact Last Name"); bcAccount.ActivateField("Account Contact Birth Date"); bcAccount.ActivateField("Grobsegment SCM"); bcAccount.ActivateField("Primary Account Postal Code SCM"); bcAccount.ActivateField("Primary Account City SCM"); bcAccount.ActivateField("Primary Account Street Address SCM"); bcAccount.ActivateField("Strassennummer"); bcAccount.ClearToQuery(); bcAccount.SetSearchSpec("Account Nr.", bcAccount.GetFieldValue("Account Nr.")); bcAccount.ExecuteQuery(ForwardOnly); if (bcAccount.FirstRecord()){ strFirstName = bcAccount.GetFieldValue("Account Contact First Name"); strLastName = bcAccount.GetFieldValue("Account Contact Last Name"); strBirthDate = bcAccount.GetFieldValue("Account Contact Birth Date"); strSegment = bcAccount.GetFieldValue("Grobsegment SCM"); strZipCode = bcAccount.GetFieldValue("Primary Account Postal Code SCM"); strCity = bcAccount.GetFieldValue("Primary Account City SCM"); strStreet = bcAccount.GetFieldValue("Primary Account Street Address SCM"); strHouseNumber = bcAccount.GetFieldValue("Strassennummer"); bcDupAccount=oApp.GetBusObject("Account").GetBusComp("Account"); bcDupAccount.SetViewMode(AllView); bcDupAccount.ClearToQuery(); s = ""; s += "[Account Contact First Name]=\"" + repl(strFirstName) + "\" AND "; s += "[Account Contact Last Name]=\"" + repl(strLastName) + "\" AND "; s += "([Account Status]='Customer' OR [Account Status] = 'Prospect')"; if (strBirthDate != "01/01/1900" && strBirthDate != "11/11/1911") { s += " AND "; s += "[Account Contact Birth Date]=\"" + strBirthDate + "\""; } if (bIsTraceOn) { oApp.Trace(this.Name() + ": NoMatchCheckPerson: search expr is " + s); } bcDupAccount.SetSearchExpr(s); bcDupAccount.ExecuteQuery(ForwardOnly); isRecord = bcDupAccount.FirstRecord(); // Match Level 0 : Initialization oApp.SetProfileAttr("DuplicateMatchLevel", "0"); while(isRecord){ // Match Level 1 : Name + Birthdate if (oApp.GetProfileAttr("DuplicateMatchLevel") < 1) { oApp.SetProfileAttr("DuplicateMatchLevel", "1"); } // Check if we can find better matches if (bcDupAccount.GetFieldValue("Grobsegment SCM") == strSegment) { // Match Level 2 : Name + Birthdate + Segment (SR created later on) if (oApp.GetProfileAttr("DuplicateMatchLevel") < 2) { oApp.SetProfileAttr("DuplicateMatchLevel", "2"); } if (bcDupAccount.GetFieldValue("Primary Account Postal Code SCM") == strZipCode && bcDupAccount.GetFieldValue("Primary Account City SCM") == strCity && bcDupAccount.GetFieldValue("Primary Account Street Address SCM") == strStreet && bcDupAccount.GetFieldValue("Strassennummer") == strHouseNumber) { // Match Level 3 : Name + Birthdate + Segment + Address if (oApp.GetProfileAttr("DuplicateMatchLevel") < 3) { oApp.Set

CAM BS SCM
NormalizeNameCase
/******************************************************* ** Name: NormalizeNameCase ** Created: 22.07.2010 ** Created By: Alejandro Strickler ** Description: This function normalizes a name to have the first character uppercase and the rest lowercase ** Created as a modularization of method ValidateString -------------------- Modifications --------------------- ** ******************************************************/ function NormalizeNameCase(name:String) { var lowerStringName; var firstchar; firstchar = name.charAt(0); lowerStringName = name.toLowerCase(); return (firstchar+lowerStringName.substring(1, lowerStringName.length)); }

CAM BS SCM
NormalizeNameCase
/******************************************************* ** Name: NormalizeNameCase ** Created: 22.07.2010 ** Created By: Alejandro Strickler ** Description: This function normalizes a name to have the first character uppercase and the rest lowercase ** Created as a modularization of method ValidateString -------------------- Modifications --------------------- ** ******************************************************/ function NormalizeNameCase(name:String) { var lowerStringName; var firstchar; firstchar = name.charAt(0); lowerStringName = name.toLowerCase(); return (firstchar+lowerStringName.substring(1, lowerStringName.length)); }

CAM BS SCM
PrintTrace
function PrintTrace(sType:chars, sComment:chars, pP:PropertySet) { var oApp:Application = TheApplication(); try { var bIsTraceOn = oApp.isTraceON; if(bIsTraceOn) { switch (sType) { case "TitleBP": oApp.Trace('-*- sComment acf CustRef Type Unique VoIP Int TV Cloud Mobile'); break; case "TitleAsset": oApp.Trace('-*- sComment acf CustRef Type Unique VoIP Int TV Cloud Mobile'); break; case "BP": oApp.Trace( 'BP Repl Trace ' + sComment + ' BP: ' + pP.GetProperty("Name") + ' Id: ' + pP.GetProperty("Id") + ' Active K Exists:' + pP.GetProperty("ACE") + ' CustRef:' + pP.GetProperty("CRef") + ' CustRefType:' + pP.GetProperty("CRefType") + ' Uniq?:' + pP.GetProperty("UCRef") + ' VITCM:' + pP.GetProperty("BCV") + ' ' + pP.GetProperty("BCI") + ' ' + pP.GetProperty("BCT") + ' ' + pP.GetProperty("BCC") + ' ' + pP.GetProperty("BCM") ); break; case "Asset": oApp.Trace( 'BP Repl Trace AssetId:' + pP.GetProperty("Id") + ' ' + pP.GetProperty("PPN") + ' W+:' + pP.GetProperty("WLine") + ' W-:' + pP.GetProperty("WLess") + ' Date:' + pP.GetProperty("StD") + ' acf:' + pP.GetProperty("BCV") + pP.GetProperty("BCI") + pP.GetProperty("BCT") + pP.GetProperty("BCC") + pP.GetProperty("BCM") ); break; default: // oApp.Trace('BHU --> Dans loop Asset:' + assetId + ' assetPartNum:' + assetPartNum + ' ---- nothing to do ----'); break; } } } catch(e) { oApp.RaiseErrorText(e.toString()); } finally { oApp = null; pP = null; } }

CAM BS SCM
PrintTrace
function PrintTrace(sType:chars, sComment:chars, pP:PropertySet) { var oApp:Application = TheApplication(); try { var bIsTraceOn = oApp.isTraceON; if(bIsTraceOn) { switch (sType) { case "TitleBP": oApp.Trace('-*- sComment acf CustRef Type Unique VoIP Int TV Cloud Mobile'); break; case "TitleAsset": oApp.Trace('-*- sComment acf CustRef Type Unique VoIP Int TV Cloud Mobile'); break; case "BP": oApp.Trace( 'BP Repl Trace ' + sComment + ' BP: ' + pP.GetProperty("Name") + ' Id: ' + pP.GetProperty("Id") + ' Active K Exists:' + pP.GetProperty("ACE") + ' CustRef:' + pP.GetProperty("CRef") + ' CustRefType:' + pP.GetProperty("CRefType") + ' Uniq?:' + pP.GetProperty("UCRef") + ' VITCM:' + pP.GetProperty("BCV") + ' ' + pP.GetProperty("BCI") + ' ' + pP.GetProperty("BCT") + ' ' + pP.GetProperty("BCC") + ' ' + pP.GetProperty("BCM") ); break; case "Asset": oApp.Trace( 'BP Repl Trace AssetId:' + pP.GetProperty("Id") + ' ' + pP.GetProperty("PPN") + ' W+:' + pP.GetProperty("WLine") + ' W-:' + pP.GetProperty("WLess") + ' Date:' + pP.GetProperty("StD") + ' acf:' + pP.GetProperty("BCV") + pP.GetProperty("BCI") + pP.GetProperty("BCT") + pP.GetProperty("BCC") + pP.GetProperty("BCM") ); break; default: // oApp.Trace('BHU --> Dans loop Asset:' + assetId + ' assetPartNum:' + assetPartNum + ' ---- nothing to do ----'); break; } } } catch(e) { oApp.RaiseErrorText(e.toString()); } finally { oApp = null; pP = null; } }

CAM BS SCM
QueryLOV
function QueryLOV(oBCLOV:BusComp, sSearchExpr) { var bReturn; try { bReturn = false; trc ("QueryLOV - sSearchExpr = " + sSearchExpr); oBCLOV.ClearToQuery(); oBCLOV.SetSearchExpr(sSearchExpr); oBCLOV.ExecuteQuery(ForwardOnly); if (BCHasRecord(oBCLOV)) { bReturn = true; } } catch(e) { trc ("QueryLOV - " + e.toString()); } trc ("QueryLOV - bReturn = " + bReturn); return (bReturn); }

CAM BS SCM
QueryLOV
function QueryLOV(oBCLOV:BusComp, sSearchExpr) { var bReturn; try { bReturn = false; trc ("QueryLOV - sSearchExpr = " + sSearchExpr); oBCLOV.ClearToQuery(); oBCLOV.SetSearchExpr(sSearchExpr); oBCLOV.ExecuteQuery(ForwardOnly); if (BCHasRecord(oBCLOV)) { bReturn = true; } } catch(e) { trc ("QueryLOV - " + e.toString()); } trc ("QueryLOV - bReturn = " + bReturn); return (bReturn); }

CAM BS SCM
RefreshBP
/******************************************************* ** Name: RefreshBP ** Created: 02.07.2009 ** Created By: Gema Torres ** Description: This method refresh the BP BC to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC BP. This method has been created due to issue 10341. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RefreshBP(Inputs,Outputs) { //Create variables var ActiveBO; var BCBP; try{ ActiveBO = TheApplication().ActiveBusObject(); BCBP = ActiveBO.GetBusComp("Com Invoice Profile SCM"); BCBP.SetViewMode(AllView); BCBP.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCBP.ExecuteQuery(ForwardBackward); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCBP = null; ActiveBO = null; } }

CAM BS SCM
RefreshBP
/******************************************************* ** Name: RefreshBP ** Created: 02.07.2009 ** Created By: Gema Torres ** Description: This method refresh the BP BC to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC BP. This method has been created due to issue 10341. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RefreshBP(Inputs,Outputs) { //Create variables var ActiveBO; var BCBP; try{ ActiveBO = TheApplication().ActiveBusObject(); BCBP = ActiveBO.GetBusComp("Com Invoice Profile SCM"); BCBP.SetViewMode(AllView); BCBP.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCBP.ExecuteQuery(ForwardBackward); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCBP = null; ActiveBO = null; } }

CAM BS SCM
RefreshContracts
/******************************************************* ** Name: RefreshContracts ** Created: 02.07.2009 ** Created By: Gema Torres ** Description: This method refresh the Asset BC to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC Asset. This method has been created due to issue 10341. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RefreshContracts(Inputs,Outputs) { //Create variables var ActiveBO; var BCAsset; try{ ActiveBO = TheApplication().ActiveBusObject(); BCAsset = ActiveBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCAsset.ExecuteQuery(ForwardBackward); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAsset = null; ActiveBO = null; } }

CAM BS SCM
RefreshContracts
/******************************************************* ** Name: RefreshContracts ** Created: 02.07.2009 ** Created By: Gema Torres ** Description: This method refresh the Asset BC to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC Asset. This method has been created due to issue 10341. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RefreshContracts(Inputs,Outputs) { //Create variables var ActiveBO; var BCAsset; try{ ActiveBO = TheApplication().ActiveBusObject(); BCAsset = ActiveBO.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCAsset.ExecuteQuery(ForwardBackward); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAsset = null; ActiveBO = null; } }

CAM BS SCM
RefreshSR
/******************************************************* ** Name: RefreshSR ** Created: 15.06.2009 ** Created By: Javier Amor ** Description: This method refresh the SR to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC Service Request. This method has been created due to issue 9547. -------------------- Modifications --------------------- ** Date: 13.09.2011 ** Changed By: TGDSEAI1 ** Description: When the submission is called via automatic process this script invoked in RTE fails as there is no active bo ******************************************************/ function RefreshSR(Inputs, Outputs) { //Create variables var ActiveBO; var BCSR; try{ //TGDSEAI1 13.09.2011 Check first if there is an BO if(TheApplication().ActiveBusObject()){ ActiveBO = TheApplication().ActiveBusObject(); BCSR = ActiveBO.GetBusComp("Service Request"); //SCM 2009.12.01 TGDAMJA1.Issue 17835. Used shared global to show the SRs in the right order in the Account Entry View TheApplication().SetSharedGlobal("SortOnSREntryList","SRAccEntryView"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCSR.ExecuteQuery(ForwardBackward); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCSR = null; ActiveBO = null; } }

CAM BS SCM
RefreshSR
/******************************************************* ** Name: RefreshSR ** Created: 15.06.2009 ** Created By: Javier Amor ** Description: This method refresh the SR to be displayed in the Customer Entry View. ** This method has been created to be used in BO Account but it can be used for any object which contains ** BC Service Request. This method has been created due to issue 9547. -------------------- Modifications --------------------- ** Date: 13.09.2011 ** Changed By: TGDSEAI1 ** Description: When the submission is called via automatic process this script invoked in RTE fails as there is no active bo ******************************************************/ function RefreshSR(Inputs, Outputs) { //Create variables var ActiveBO; var BCSR; try{ //TGDSEAI1 13.09.2011 Check first if there is an BO if(TheApplication().ActiveBusObject()){ ActiveBO = TheApplication().ActiveBusObject(); BCSR = ActiveBO.GetBusComp("Service Request"); //SCM 2009.12.01 TGDAMJA1.Issue 17835. Used shared global to show the SRs in the right order in the Account Entry View TheApplication().SetSharedGlobal("SortOnSREntryList","SRAccEntryView"); BCSR.SetViewMode(AllView); BCSR.ClearToQuery(); //It is necessary to use query mode ForwardBackward instead of ForwardOnly because using //ForwardOnly an error about working size is displayed when overview tab is clicked. BCSR.ExecuteQuery(ForwardBackward); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCSR = null; ActiveBO = null; } }

CAM BS SCM
ReplicateMarkedBPs
/******************************************************* ** Name: ReplicateMarkedBPs ** Created: 04.02.2011 ** Created By: Karin Haack ** Description: This method search Symphony mastered Billing Profiles and ** checks for active contracts. If "Active Contract flag" of BP ** changes, a replication is triggered. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ReplicateMarkedBPs(Inputs, Outputs) { var BOPlain; var BCBillingProfile; var BCAsset; var BCSync; var isrecord; var oApp = TheApplication(); var existAsset; var replicate:bool = false; var anyReplication:bool = false; var activeContracts; var eventId:Number = 1; var delAmount; var delUnits; // Logs var oBOLog; var oBCLog; var oBCLogEvent; var oDate; var sDescText; var psInput:PropertySet; var psOutput:PropertySet; var psIn2:PropertySet; var bsService; var bsService2; var sTimestamp = ""; var dateCalc; var monthCalc; try { // Create Log entry oBOLog = oApp.GetBusObject("Log SCM"); oBCLog = oBOLog.GetBusComp("Log SCM"); oBCLogEvent = oBOLog.GetBusComp("Log Event SCM"); oDate = new Date(); sDescText = "Start at " + oDate.toLocaleString() + " (Server Time)"; oDate = null; oBCLog.NewRecord(NewAfter); // Application Name is 30 chars max oBCLog.SetFieldValue("Application Name","Replicate Marked BPs"); oBCLog.SetFieldValue("Type", "Siebel Workflow"); oBCLog.SetFieldValue("Desc Text","Calculates Active contract flag for marked Symphony mastered Billing profiles and if flag changes, replication is triggered"); oBCLog.WriteRecord(); // Create Start Log Event oBCLogEvent.NewRecord(NewAfter); oBCLogEvent.SetFieldValue("Type", "Start"); oBCLogEvent.SetFieldValue("Desc Text", sDescText); oBCLogEvent.WriteRecord(); //Instance of BO BOPlain = oApp.GetBusObject("EAI Plain Entity Model (Action) SCM"); BCBillingProfile = BOPlain.GetBusComp("Com Invoice Profile SCM"); BCSync = BOPlain.GetBusComp("Sync Operations SCM"); //Query for all marked BPs BCBillingProfile.SetViewMode(AllView); BCBillingProfile.ActivateField("Active Contract Exists Flag SCM"); BCBillingProfile.ActivateField("Check Active Contract Exists Flag SCM"); BCBillingProfile.ActivateField("Name"); BCBillingProfile.ActivateField("Account Nr"); BCBillingProfile.ClearToQuery(); BCBillingProfile.SetSearchSpec("Bill Source", oApp.InvokeMethod("LookupValue","BILL_SRC_CD_SCM","6")); //defect 39082: adding BP Status = Active to Search Spec BCBillingProfile.SetSearchSpec("Status", oApp.InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","1")); BCBillingProfile.SetSearchSpec("Check Active Contract Exists Flag SCM", "Y"); BCBillingProfile.ExecuteQuery(ForwardOnly); isrecord=BCBillingProfile.FirstRecord(); BCAsset = BOPlain.GetBusComp("Asset Mgmt - Asset");//TGDSEAI1 04.04.2011 Declaration moved out of the loop // loop over all marked BPs while(isrecord) { try { activeContracts = BCBillingProfile.GetFieldValue("Active Contract Exists Flag SCM"); //BCAsset = BOPlain.GetBusComp("Asset Mgmt - Asset");//TGDSEAI1 04.04.2011 Declaration moved out of the loop // Search for Assets BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSearchExpr("[Billing Profile Id]='" + BCBillingProfile.GetFieldValue("Id") + "' AND [Status]<>'" + oApp.InvokeMethod("LookupValue","IMPL_PHASE", "Inactive") + "' AND [Parent Asset Id] IS NULL"); BCAsset.ExecuteQuery(ForwardOnly); existAsset = BCAsset.FirstRecord(); if (existAsset && (activeContracts == "N" || activeContracts.length < 1 )){ // Replicate replicate = true; // change flag "Active Contract Exists Flag SCM" to 'Y' BCBillingProfile.

CAM BS SCM
ReplicateMarkedBPs
/******************************************************* ** Name: ReplicateMarkedBPs ** Created: 04.02.2011 ** Created By: Karin Haack ** Description: This method search Symphony mastered Billing Profiles and ** checks for active contracts. If "Active Contract flag" of BP ** changes, a replication is triggered. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ReplicateMarkedBPs(Inputs, Outputs) { var BOPlain; var BCBillingProfile; var BCAsset; var BCSync; var isrecord; var oApp = TheApplication(); var existAsset; var replicate:bool = false; var anyReplication:bool = false; var activeContracts; var eventId:Number = 1; var delAmount; var delUnits; // Logs var oBOLog; var oBCLog; var oBCLogEvent; var oDate; var sDescText; var psInput:PropertySet; var psOutput:PropertySet; var psIn2:PropertySet; var bsService; var bsService2; var sTimestamp = ""; var dateCalc; var monthCalc; try { // Create Log entry oBOLog = oApp.GetBusObject("Log SCM"); oBCLog = oBOLog.GetBusComp("Log SCM"); oBCLogEvent = oBOLog.GetBusComp("Log Event SCM"); oDate = new Date(); sDescText = "Start at " + oDate.toLocaleString() + " (Server Time)"; oDate = null; oBCLog.NewRecord(NewAfter); // Application Name is 30 chars max oBCLog.SetFieldValue("Application Name","Replicate Marked BPs"); oBCLog.SetFieldValue("Type", "Siebel Workflow"); oBCLog.SetFieldValue("Desc Text","Calculates Active contract flag for marked Symphony mastered Billing profiles and if flag changes, replication is triggered"); oBCLog.WriteRecord(); // Create Start Log Event oBCLogEvent.NewRecord(NewAfter); oBCLogEvent.SetFieldValue("Type", "Start"); oBCLogEvent.SetFieldValue("Desc Text", sDescText); oBCLogEvent.WriteRecord(); //Instance of BO BOPlain = oApp.GetBusObject("EAI Plain Entity Model (Action) SCM"); BCBillingProfile = BOPlain.GetBusComp("Com Invoice Profile SCM"); BCSync = BOPlain.GetBusComp("Sync Operations SCM"); //Query for all marked BPs BCBillingProfile.SetViewMode(AllView); BCBillingProfile.ActivateField("Active Contract Exists Flag SCM"); BCBillingProfile.ActivateField("Check Active Contract Exists Flag SCM"); BCBillingProfile.ActivateField("Name"); BCBillingProfile.ActivateField("Account Nr"); BCBillingProfile.ClearToQuery(); BCBillingProfile.SetSearchSpec("Bill Source", oApp.InvokeMethod("LookupValue","BILL_SRC_CD_SCM","6")); //defect 39082: adding BP Status = Active to Search Spec BCBillingProfile.SetSearchSpec("Status", oApp.InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","1")); BCBillingProfile.SetSearchSpec("Check Active Contract Exists Flag SCM", "Y"); BCBillingProfile.ExecuteQuery(ForwardOnly); isrecord=BCBillingProfile.FirstRecord(); BCAsset = BOPlain.GetBusComp("Asset Mgmt - Asset");//TGDSEAI1 04.04.2011 Declaration moved out of the loop // loop over all marked BPs while(isrecord) { try { activeContracts = BCBillingProfile.GetFieldValue("Active Contract Exists Flag SCM"); //BCAsset = BOPlain.GetBusComp("Asset Mgmt - Asset");//TGDSEAI1 04.04.2011 Declaration moved out of the loop // Search for Assets BCAsset.SetViewMode(AllView); BCAsset.ClearToQuery(); BCAsset.SetSearchExpr("[Billing Profile Id]='" + BCBillingProfile.GetFieldValue("Id") + "' AND [Status]<>'" + oApp.InvokeMethod("LookupValue","IMPL_PHASE", "Inactive") + "' AND [Parent Asset Id] IS NULL"); BCAsset.ExecuteQuery(ForwardOnly); existAsset = BCAsset.FirstRecord(); if (existAsset && (activeContracts == "N" || activeContracts.length < 1 )){ // Replicate replicate = true; // change flag "Active Contract Exists Flag SCM" to 'Y' BCBillingProfile.

CAM BS SCM
ReplicateMarkedBPs2
/******************************************************* ** Name : ReplicateMarkedBPs2 ** Created : 03.09.2013 ** Created By : Benoit Hug ** Description: This method search Symphony mastered Billing Profiles. ** Each BP will be re-calculated against his Assets ** If some changes occurs the BP will be updated ** and replicated to RMCA (via tibco) ** The function has been copied and suffixed in a v2 version ** the original Version kept as is. ** ***********************************************************************************************/ function ReplicateMarkedBPs2(Inputs, Outputs) { var oApp:Application = TheApplication(); var oPlain:BusObject; var oBP:BusComp; var oAsset:BusComp; var oAccount:BusComp; var oSync:BusComp; var sRowId:String; var bIsMoreBP:bool; var bIsTraceOn:bool; var bAnyReplication:bool = false; var delAmount; var delUnits; // Logs var oBOLog:BusObject; var oBCLog:BusComp; var oBCLogEvent:BusComp; var oDate:Date; var sDescText:chars; var psInput:PropertySet; var psOutput:PropertySet; var psIn2:PropertySet; var bsService; //Defect 111446: New parameters var iRetry:float; var iRetryACV:float; var sRetryACV:String; var bRetry:bool; try { // Create Log entry oBOLog = oApp.GetBusObject("Log SCM"); oBCLog = oBOLog.GetBusComp("Log SCM"); oBCLogEvent = oBOLog.GetBusComp("Log Event SCM"); oDate = new Date(); sDescText = "Start at " + oDate.toLocaleString() + " (Server Time)"; oDate = null; oBCLog.NewRecord(NewAfter); oBCLog.SetFieldValue("Application Name","Replicate Marked BPs (v2)"); // Application Name is 30 chars max oBCLog.SetFieldValue("Type", "Siebel Workflow"); oBCLog.SetFieldValue("Desc Text","Recalculates marked Symphony mastered Billing Profiles against Assets. If some changes, replication is triggered"); oBCLog.WriteRecord(); // Create Start Log Event CreateLogEvent(oBCLogEvent,"Start",sDescText); bIsTraceOn = oApp.isTraceON; sRetryACV = oApp.utils.SCM_RetrieveACV("ReplicateMarkedBPRetry"); if(isNaN(sRetryACV)) oApp.RaiseErrorText("ACV ReplicateMarkedBPRetry could not be changed to number"); iRetryACV = ToNumber(sRetryACV); iRetry = 0; bRetry = true; sRowId = Inputs.GetProperty("BPId"); if(bIsTraceOn) oApp.Trace("BHU --> BP Replication Start"); //Instance of BO oPlain = oApp.GetBusObject("EAI Plain Entity Model (Action) SCM"); oBP = oPlain.GetBusComp("Com Invoice Profile SCM"); oSync = oPlain.GetBusComp("Sync Operations SCM"); oAsset = oPlain.GetBusComp("Asset Mgmt - Asset"); oAccount = oPlain.GetBusComp("Account"); while(iRetry<=iRetryACV && bRetry) { bRetry = false; //Query for all marked BPs oBP.SetViewMode(AllView); oBP.ActivateField("Id"); oBP.ActivateField("Account Id"); oBP.ActivateField("Account Nr"); oBP.ActivateField("Name"); oBP.ActivateField("Check Active Contract Exists Flag SCM"); oBP.ActivateField("Active Contract Exists Flag SCM"); oBP.ActivateField("Customer Reference SCM"); oBP.ActivateField("Customer Reference Type Code SCM"); oBP.ActivateField("Unique Customer Reference Flag SCM"); oBP.ActivateField("Bundle Configuration Cloud Flag SCM"); oBP.ActivateField("Bundle Configuration Internet Flag SCM"); oBP.ActivateField("Bundle Configuration Mobile Flag SCM"); oBP.ActivateField("Bundle Configuration TV Flag SCM"); oBP.ActivateField("Bundle Configuration VoIP Flag SCM"); //TGDPIVR1:09.10.2013: Defect 74234: Activating credit limit fields oBP.ActivateField("Credit Limit CCI Agent Flag SCM"); oBP.ActivateField("Credit Limit Flag GUARDEAN SCM"); oBP.ActivateField("Credit Limit Last Response GUARDEAN SCM"); oBP.ActivateField("Credit Limit Last Verification SCM"); oBP.ActivateField("Credit Limit Flag SCM"); oBP.ClearToQuery(); if(sRowId

CAM BS SCM
ReplicateMarkedBPs2
/******************************************************* ** Name : ReplicateMarkedBPs2 ** Created : 03.09.2013 ** Created By : Benoit Hug ** Description: This method search Symphony mastered Billing Profiles. ** Each BP will be re-calculated against his Assets ** If some changes occurs the BP will be updated ** and replicated to RMCA (via tibco) ** The function has been copied and suffixed in a v2 version ** the original Version kept as is. ** ***********************************************************************************************/ function ReplicateMarkedBPs2(Inputs, Outputs) { var oApp:Application = TheApplication(); var oPlain:BusObject; var oBP:BusComp; var oAsset:BusComp; var oAccount:BusComp; var oSync:BusComp; var sRowId:String; var bIsMoreBP:bool; var bIsTraceOn:bool; var bAnyReplication:bool = false; var delAmount; var delUnits; // Logs var oBOLog:BusObject; var oBCLog:BusComp; var oBCLogEvent:BusComp; var oDate:Date; var sDescText:chars; var psInput:PropertySet; var psOutput:PropertySet; var psIn2:PropertySet; var bsService; //Defect 111446: New parameters var iRetry:float; var iRetryACV:float; var sRetryACV:String; var bRetry:bool; try { // Create Log entry oBOLog = oApp.GetBusObject("Log SCM"); oBCLog = oBOLog.GetBusComp("Log SCM"); oBCLogEvent = oBOLog.GetBusComp("Log Event SCM"); oDate = new Date(); sDescText = "Start at " + oDate.toLocaleString() + " (Server Time)"; oDate = null; oBCLog.NewRecord(NewAfter); oBCLog.SetFieldValue("Application Name","Replicate Marked BPs (v2)"); // Application Name is 30 chars max oBCLog.SetFieldValue("Type", "Siebel Workflow"); oBCLog.SetFieldValue("Desc Text","Recalculates marked Symphony mastered Billing Profiles against Assets. If some changes, replication is triggered"); oBCLog.WriteRecord(); // Create Start Log Event CreateLogEvent(oBCLogEvent,"Start",sDescText); bIsTraceOn = oApp.isTraceON; sRetryACV = oApp.utils.SCM_RetrieveACV("ReplicateMarkedBPRetry"); if(isNaN(sRetryACV)) oApp.RaiseErrorText("ACV ReplicateMarkedBPRetry could not be changed to number"); iRetryACV = ToNumber(sRetryACV); iRetry = 0; bRetry = true; sRowId = Inputs.GetProperty("BPId"); if(bIsTraceOn) oApp.Trace("BHU --> BP Replication Start"); //Instance of BO oPlain = oApp.GetBusObject("EAI Plain Entity Model (Action) SCM"); oBP = oPlain.GetBusComp("Com Invoice Profile SCM"); oSync = oPlain.GetBusComp("Sync Operations SCM"); oAsset = oPlain.GetBusComp("Asset Mgmt - Asset"); oAccount = oPlain.GetBusComp("Account"); while(iRetry<=iRetryACV && bRetry) { bRetry = false; //Query for all marked BPs oBP.SetViewMode(AllView); oBP.ActivateField("Id"); oBP.ActivateField("Account Id"); oBP.ActivateField("Account Nr"); oBP.ActivateField("Name"); oBP.ActivateField("Check Active Contract Exists Flag SCM"); oBP.ActivateField("Active Contract Exists Flag SCM"); oBP.ActivateField("Customer Reference SCM"); oBP.ActivateField("Customer Reference Type Code SCM"); oBP.ActivateField("Unique Customer Reference Flag SCM"); oBP.ActivateField("Bundle Configuration Cloud Flag SCM"); oBP.ActivateField("Bundle Configuration Internet Flag SCM"); oBP.ActivateField("Bundle Configuration Mobile Flag SCM"); oBP.ActivateField("Bundle Configuration TV Flag SCM"); oBP.ActivateField("Bundle Configuration VoIP Flag SCM"); //TGDPIVR1:09.10.2013: Defect 74234: Activating credit limit fields oBP.ActivateField("Credit Limit CCI Agent Flag SCM"); oBP.ActivateField("Credit Limit Flag GUARDEAN SCM"); oBP.ActivateField("Credit Limit Last Response GUARDEAN SCM"); oBP.ActivateField("Credit Limit Last Verification SCM"); oBP.ActivateField("Credit Limit Flag SCM"); oBP.ClearToQuery(); if(sRowId

CAM BS SCM
ReplicateOneBP
/******************************************************* ** Name : ReplicateOneBP ** Created : 17.06.2015 ** Created By : Vratesh Pinge ** Description: This function will process one billing profile ** Each BP will be re-calculated against his Assets ** If some changes occurs the BP will be updated ** and replicated to RMCA (via tibco) ** The function has been copied and suffixed in a v2 version ** the original Version kept as is. ***********************************************************************************************/ function ReplicateOneBP(oApp:Application,bIsTraceOn:bool, oBP:BusComp,oSync:BusComp,oAsset:BusComp,oAccount:BusComp,oBCLogEvent:BusComp) { var psBP:PropertySet; var psBPNew:PropertySet; var psAsset:PropertySet; var bIsMoreAsset:bool; var bAnyReplication:bool = false; var oDate:Date; var sDescText:chars; var sTimestamp:chars = ""; var fDateCalc:float; var fMonthCalc:float; try { psBP = null; psBP = oApp.NewPropertySet(); psBP.SetProperty("Id" , oBP.GetFieldValue("Id")); psBP.SetProperty("AccNr", oBP.GetFieldValue("Account Nr")); psBP.SetProperty("Name" , oBP.GetFieldValue("Name")); psBP.SetProperty("ACE" , oBP.GetFieldValue("Active Contract Exists Flag SCM")); psBP.SetProperty("CRef" , oBP.GetFieldValue("Customer Reference SCM")); psBP.SetProperty("CRefType", oBP.GetFieldValue("Customer Reference Type Code SCM")); psBP.SetProperty("UCRef", oBP.GetFieldValue("Unique Customer Reference Flag SCM")); psBP.SetProperty("BCC" , oBP.GetFieldValue("Bundle Configuration Cloud Flag SCM")); psBP.SetProperty("BCI" , oBP.GetFieldValue("Bundle Configuration Internet Flag SCM")); psBP.SetProperty("BCM" , oBP.GetFieldValue("Bundle Configuration Mobile Flag SCM")); psBP.SetProperty("BCT" , oBP.GetFieldValue("Bundle Configuration TV Flag SCM")); psBP.SetProperty("BCV" , oBP.GetFieldValue("Bundle Configuration VoIP Flag SCM")); //TGDPIVR1:09.10.2013: Defect 74234 psBP.SetProperty("CLFLAG" , oBP.GetFieldValue("Credit Limit Flag SCM")); PrintTrace("BP", " - Start - ", psBP); psBPNew = oApp.NewPropertySet(); psBPNew.SetProperty("Id", psBP.GetProperty("Id")); psBPNew.SetProperty("AccNr", psBP.GetProperty("AccNr")); psBPNew.SetProperty("Name", psBP.GetProperty("Name")); psBPNew.SetProperty("ACE", "N"); psBPNew.SetProperty("StD", "01/01/2050"); psBPNew.SetProperty("CLFLAG", psBP.GetProperty("CLFLAG")); oAsset.SetViewMode(AllView); oAsset.ActivateField("Id"); oAsset.ActivateField("Product Part Number"); oAsset.ActivateField("Bundle Configuration Cloud SCM"); oAsset.ActivateField("Bundle Configuration Internet SCM"); oAsset.ActivateField("Bundle Configuration Mobile SCM"); oAsset.ActivateField("Bundle Configuration TV SCM"); oAsset.ActivateField("Bundle Configuration VoIP SCM"); oAsset.ActivateField("Start Date"); oAsset.ActivateField("MSISDN SCM"); oAsset.ActivateField("Root MSISDN SCM"); oAsset.ClearToQuery(); oAsset.SetSearchExpr("[Billing Profile Id]='" + oBP.GetFieldValue("Id") + "' AND [Status]='" + oApp.InvokeMethod("LookupValue","IMPL_PHASE", "Active")+ "'"); oAsset.SetSortSpec("Product Part Number (ASC), Start Date (ASC)"); oAsset.ExecuteQuery(ForwardOnly); bIsMoreAsset = oAsset.FirstRecord(); while(bIsMoreAsset) { psAsset = null; psAsset = oApp.NewPropertySet(); psAsset.SetProperty("Id" , oAsset.GetFieldValue("Id")); psAsset.SetProperty("PPN", oAsset.GetFieldValue("Product Part Number")); psAsset.SetProperty("BCC", oAsset.GetFieldValue("Bundle Configuration Cloud SCM")); psAsset.SetProperty("BCI", oAsset.GetFieldValue("Bundle Configuration Internet SCM")); psAsset.SetProperty("BCM", oAsset.GetFieldValue("Bundle Configuration Mobile SCM")); psAsset.SetProperty("BCT", oAsset.GetFieldValue("Bundle Configuration TV SCM")); psAs

CAM BS SCM
ReplicateOneBP
/******************************************************* ** Name : ReplicateOneBP ** Created : 17.06.2015 ** Created By : Vratesh Pinge ** Description: This function will process one billing profile ** Each BP will be re-calculated against his Assets ** If some changes occurs the BP will be updated ** and replicated to RMCA (via tibco) ** The function has been copied and suffixed in a v2 version ** the original Version kept as is. ***********************************************************************************************/ function ReplicateOneBP(oApp:Application,bIsTraceOn:bool, oBP:BusComp,oSync:BusComp,oAsset:BusComp,oAccount:BusComp,oBCLogEvent:BusComp) { var psBP:PropertySet; var psBPNew:PropertySet; var psAsset:PropertySet; var bIsMoreAsset:bool; var bAnyReplication:bool = false; var oDate:Date; var sDescText:chars; var sTimestamp:chars = ""; var fDateCalc:float; var fMonthCalc:float; try { psBP = null; psBP = oApp.NewPropertySet(); psBP.SetProperty("Id" , oBP.GetFieldValue("Id")); psBP.SetProperty("AccNr", oBP.GetFieldValue("Account Nr")); psBP.SetProperty("Name" , oBP.GetFieldValue("Name")); psBP.SetProperty("ACE" , oBP.GetFieldValue("Active Contract Exists Flag SCM")); psBP.SetProperty("CRef" , oBP.GetFieldValue("Customer Reference SCM")); psBP.SetProperty("CRefType", oBP.GetFieldValue("Customer Reference Type Code SCM")); psBP.SetProperty("UCRef", oBP.GetFieldValue("Unique Customer Reference Flag SCM")); psBP.SetProperty("BCC" , oBP.GetFieldValue("Bundle Configuration Cloud Flag SCM")); psBP.SetProperty("BCI" , oBP.GetFieldValue("Bundle Configuration Internet Flag SCM")); psBP.SetProperty("BCM" , oBP.GetFieldValue("Bundle Configuration Mobile Flag SCM")); psBP.SetProperty("BCT" , oBP.GetFieldValue("Bundle Configuration TV Flag SCM")); psBP.SetProperty("BCV" , oBP.GetFieldValue("Bundle Configuration VoIP Flag SCM")); //TGDPIVR1:09.10.2013: Defect 74234 psBP.SetProperty("CLFLAG" , oBP.GetFieldValue("Credit Limit Flag SCM")); PrintTrace("BP", " - Start - ", psBP); psBPNew = oApp.NewPropertySet(); psBPNew.SetProperty("Id", psBP.GetProperty("Id")); psBPNew.SetProperty("AccNr", psBP.GetProperty("AccNr")); psBPNew.SetProperty("Name", psBP.GetProperty("Name")); psBPNew.SetProperty("ACE", "N"); psBPNew.SetProperty("StD", "01/01/2050"); psBPNew.SetProperty("CLFLAG", psBP.GetProperty("CLFLAG")); oAsset.SetViewMode(AllView); oAsset.ActivateField("Id"); oAsset.ActivateField("Product Part Number"); oAsset.ActivateField("Bundle Configuration Cloud SCM"); oAsset.ActivateField("Bundle Configuration Internet SCM"); oAsset.ActivateField("Bundle Configuration Mobile SCM"); oAsset.ActivateField("Bundle Configuration TV SCM"); oAsset.ActivateField("Bundle Configuration VoIP SCM"); oAsset.ActivateField("Start Date"); oAsset.ActivateField("MSISDN SCM"); oAsset.ActivateField("Root MSISDN SCM"); oAsset.ClearToQuery(); oAsset.SetSearchExpr("[Billing Profile Id]='" + oBP.GetFieldValue("Id") + "' AND [Status]='" + oApp.InvokeMethod("LookupValue","IMPL_PHASE", "Active")+ "'"); oAsset.SetSortSpec("Product Part Number (ASC), Start Date (ASC)"); oAsset.ExecuteQuery(ForwardOnly); bIsMoreAsset = oAsset.FirstRecord(); while(bIsMoreAsset) { psAsset = null; psAsset = oApp.NewPropertySet(); psAsset.SetProperty("Id" , oAsset.GetFieldValue("Id")); psAsset.SetProperty("PPN", oAsset.GetFieldValue("Product Part Number")); psAsset.SetProperty("BCC", oAsset.GetFieldValue("Bundle Configuration Cloud SCM")); psAsset.SetProperty("BCI", oAsset.GetFieldValue("Bundle Configuration Internet SCM")); psAsset.SetProperty("BCM", oAsset.GetFieldValue("Bundle Configuration Mobile SCM")); psAsset.SetProperty("BCT", oAsset.GetFieldValue("Bundle Configuration TV SCM")); psAs

CAM BS SCM
RequestBillingProfile
/******************************************************* ** Name: RequestBillingProfile ** Created: 21.11.2008 ** Created By: Gema Torres ** Description: This method is invoked from the 'Ok' button of the Solvency Check Result for taking over ** a contract. When this button is clicked, a temporaly billing profile is created. This copy will have the ** 'Status' set to 'Inactive' and the 'Integration Id SCM'='Row Id of the new BP'. Then the application will ** navigate to the account entry view -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RequestBillingProfile(Inputs,Outputs) { //Definition of variables var BOActiveAccount; var BCActiveBP; //var BPStatus=TheApplication().InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","2"); var NewId; //Get the Id of the customer and the main address var BOAccount = TheApplication().ActiveBusObject(); var BCAccount = BOAccount.GetBusComp("Account"); var CustomerId = BCAccount.GetFieldValue("Id"); var AddressId = BCAccount.GetFieldValue("Primary Usage Address Id SCM"); var strClose=""; var sMSISDN; var Input; var Output; var svc; var strCustCode; var strErrorCode; var sParam1; var sParam2; var sMsg; try{ if(AddressId == "") { //TheApplication().ActiveApplet().InvokeMethod("CloseApplet"); TheApplication().SetProfileAttr("strClose", "TRUE"); TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: No Address Calcel Solvency Check")); } //Invokes the EAI BS svc = TheApplication().GetService("EAI Create Billing Account SCM"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); //input parameter the customer id //Customer Id Input.SetProperty("InputAccount", CustomerId); //Credit limit voice Input.SetProperty("Credit Limit Voice", TheApplication().GetProfileAttr("CreditLimitVoice")); //Credit Limit 1 Input.SetProperty("Credit Limit Threshold 1 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 1 SCM")); //default value 68 //Credit Limit 2 Input.SetProperty("Credit Limit Threshold 2 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 2 SCM")); //default value 69 //Credit Limit 3 Input.SetProperty("Credit Limit Threshold 3 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 3 SCM")); //default value 70 //Payment Method = "payslip" (EAI->paymentSlip, Samba -> Post) Input.SetProperty("Payment Method", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM", "Payment Method")); //default value Post //Input.SetProperty("Payment Method", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM",TheApplication().InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Post"))); svc.InvokeMethod("CreateBillingAccount", Input, Output); //get Error Code strErrorCode = Output.GetChild(0).GetChild(0).GetProperty("Error Code"); //Added Error Handling -- CR 212 if(strErrorCode == "") { //the output is the cust code of the new BP strCustCode = Output.GetChild(0).GetChild(0).GetProperty("externalAccountNumber"); TheApplication().SetProfileAttr("NoPopup","TRUE"); } else { TheApplication().SetProfileAttr("NoPopup","TRUE"); sParam1 = Output.GetChild(0).GetChild(0).GetProperty("Param1"); sParam2 = Output.GetChild(0).GetChild(0).GetProperty("Param2"); sMsg = TheApplication().LookupMessage("User Defined Errors",strErrorCode,sParam1,sParam2); TheApplication().RaiseErrorText(sMsg); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strErrorCode=null; svc = null; Output = null; Input = null; sMSISD

CAM BS SCM
RequestBillingProfile
/******************************************************* ** Name: RequestBillingProfile ** Created: 21.11.2008 ** Created By: Gema Torres ** Description: This method is invoked from the 'Ok' button of the Solvency Check Result for taking over ** a contract. When this button is clicked, a temporaly billing profile is created. This copy will have the ** 'Status' set to 'Inactive' and the 'Integration Id SCM'='Row Id of the new BP'. Then the application will ** navigate to the account entry view -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function RequestBillingProfile(Inputs,Outputs) { //Definition of variables var BOActiveAccount; var BCActiveBP; //var BPStatus=TheApplication().InvokeMethod("LookupValue","BILLING_PROFILE_STATUS_SCM","2"); var NewId; //Get the Id of the customer and the main address var BOAccount = TheApplication().ActiveBusObject(); var BCAccount = BOAccount.GetBusComp("Account"); var CustomerId = BCAccount.GetFieldValue("Id"); var AddressId = BCAccount.GetFieldValue("Primary Usage Address Id SCM"); var strClose=""; var sMSISDN; var Input; var Output; var svc; var strCustCode; var strErrorCode; var sParam1; var sParam2; var sMsg; try{ if(AddressId == "") { //TheApplication().ActiveApplet().InvokeMethod("CloseApplet"); TheApplication().SetProfileAttr("strClose", "TRUE"); TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: No Address Calcel Solvency Check")); } //Invokes the EAI BS svc = TheApplication().GetService("EAI Create Billing Account SCM"); Input = TheApplication().NewPropertySet(); Output = TheApplication().NewPropertySet(); //input parameter the customer id //Customer Id Input.SetProperty("InputAccount", CustomerId); //Credit limit voice Input.SetProperty("Credit Limit Voice", TheApplication().GetProfileAttr("CreditLimitVoice")); //Credit Limit 1 Input.SetProperty("Credit Limit Threshold 1 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 1 SCM")); //default value 68 //Credit Limit 2 Input.SetProperty("Credit Limit Threshold 2 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 2 SCM")); //default value 69 //Credit Limit 3 Input.SetProperty("Credit Limit Threshold 3 SCM", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM","Credit Limit Threshold 3 SCM")); //default value 70 //Payment Method = "payslip" (EAI->paymentSlip, Samba -> Post) Input.SetProperty("Payment Method", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM", "Payment Method")); //default value Post //Input.SetProperty("Payment Method", TheApplication().InvokeMethod("LookupValue","BP_DEFAULT_VALUES_SCM",TheApplication().InvokeMethod("LookupValue","PAYMENT_TYPE_SCM","Post"))); svc.InvokeMethod("CreateBillingAccount", Input, Output); //get Error Code strErrorCode = Output.GetChild(0).GetChild(0).GetProperty("Error Code"); //Added Error Handling -- CR 212 if(strErrorCode == "") { //the output is the cust code of the new BP strCustCode = Output.GetChild(0).GetChild(0).GetProperty("externalAccountNumber"); TheApplication().SetProfileAttr("NoPopup","TRUE"); } else { TheApplication().SetProfileAttr("NoPopup","TRUE"); sParam1 = Output.GetChild(0).GetChild(0).GetProperty("Param1"); sParam2 = Output.GetChild(0).GetChild(0).GetProperty("Param2"); sMsg = TheApplication().LookupMessage("User Defined Errors",strErrorCode,sParam1,sParam2); TheApplication().RaiseErrorText(sMsg); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strErrorCode=null; svc = null; Output = null; Input = null; sMSISD

CAM BS SCM
SearchAddressSR
/******************************************************* ** Name: SearchAddressSR ** Created: 13.10.2008 ** Created By: Javier Amor ** Description: This method must search a SR linked to an address and with a status specified by an input argument ** Input argument entity is necessary because foreign key is different depending of the kind of address. ** SRStatus is required but SRStatusExpr is not. If SRStatusExpr is defined, SRStatus will be ignored. ** SRStatus can only be used with one status but with SRStatusExp an expression ("Open OR Scheduled") can be used in the ** query for the field Status of the Service Request. ** Output argument are not required because this method can be used to make a SR will be in the context. ** CNO Flag as output argument will be used to determine if a SR has been used in a Default CNO process ** Order Id as output argument will be used to determine if a SR has been used in a Manual CNO process. If ** the SR has not been used in a Manual CNO process, Order Id will be empty. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 26-03-2010 ** Changed By: Alejandro Strickler ** Description: Functionality extended for Address Light BCs (CR 0335) ******************************************************/ function SearchAddressSR(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCServiceRequest; var strEntity; var strAddressId; var strSRStatus; var strStatusExpr; var strFK=""; try{ //Get input parameters strEntity = Inputs.GetProperty("Entity"); strAddressId = Inputs.GetProperty("AddressId"); strSRStatus = TheApplication().InvokeMethod("LookupValue","SR_STATUS", Inputs.GetProperty("SRStatus")); strStatusExpr = Inputs.GetProperty("SRStatusExpr"); //Get Active BO, BCs from the context BOActiveAccount = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //Depending of the entity the foreign key is different.Account is taken by default if(strEntity == "Billing" || strEntity == "Billing Light") strFK = "Billing Address Id SCM"; else if(strEntity == "Contract" || strEntity == "Contract Light") strFK = "Asset Address Id SCM"; else strFK = "Account Address Id SCM"; BCServiceRequest.SetViewMode(AllView); //Query by foreign key with the id used as input argument BCServiceRequest.ClearToQuery(); //If input argument SRStatusExprs exists, SRStatus is not used in the query. Otherwise SRStatus will be used in the query if(strStatusExpr != "") BCServiceRequest.SetSearchExpr(strStatusExpr); else BCServiceRequest.SetSearchSpec("Status",strSRStatus); BCServiceRequest.SetSearchSpec(strFK,strAddressId); BCServiceRequest.SetSearchSpec("Sub-Area","Address change"); BCServiceRequest.ExecuteQuery(ForwardOnly); //If a SR with the desired status and foreign key exists output argument will be set to true if(BCServiceRequest.FirstRecord()) { Outputs.SetProperty("SRExists","Y"); Outputs.SetProperty("SRId",BCServiceRequest.GetFieldValue("Id")); Outputs.SetProperty("CNO Flag", BCServiceRequest.GetFieldValue("CNO Used SCM")); Outputs.SetProperty("Order Id", BCServiceRequest.GetFieldValue("Order Id")); } else { Outputs.SetProperty("SRExists","N"); Outputs.SetProperty("SRId",""); Outputs.SetProperty("CNO Flag",""); Outputs.SetProperty("Order Id", ""); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strEntity = null; strAddressId = null; strSRStatus = null; strFK = null; strStatusExpr = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
SearchAddressSR
/******************************************************* ** Name: SearchAddressSR ** Created: 13.10.2008 ** Created By: Javier Amor ** Description: This method must search a SR linked to an address and with a status specified by an input argument ** Input argument entity is necessary because foreign key is different depending of the kind of address. ** SRStatus is required but SRStatusExpr is not. If SRStatusExpr is defined, SRStatus will be ignored. ** SRStatus can only be used with one status but with SRStatusExp an expression ("Open OR Scheduled") can be used in the ** query for the field Status of the Service Request. ** Output argument are not required because this method can be used to make a SR will be in the context. ** CNO Flag as output argument will be used to determine if a SR has been used in a Default CNO process ** Order Id as output argument will be used to determine if a SR has been used in a Manual CNO process. If ** the SR has not been used in a Manual CNO process, Order Id will be empty. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 26-03-2010 ** Changed By: Alejandro Strickler ** Description: Functionality extended for Address Light BCs (CR 0335) ******************************************************/ function SearchAddressSR(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCServiceRequest; var strEntity; var strAddressId; var strSRStatus; var strStatusExpr; var strFK=""; try{ //Get input parameters strEntity = Inputs.GetProperty("Entity"); strAddressId = Inputs.GetProperty("AddressId"); strSRStatus = TheApplication().InvokeMethod("LookupValue","SR_STATUS", Inputs.GetProperty("SRStatus")); strStatusExpr = Inputs.GetProperty("SRStatusExpr"); //Get Active BO, BCs from the context BOActiveAccount = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //Depending of the entity the foreign key is different.Account is taken by default if(strEntity == "Billing" || strEntity == "Billing Light") strFK = "Billing Address Id SCM"; else if(strEntity == "Contract" || strEntity == "Contract Light") strFK = "Asset Address Id SCM"; else strFK = "Account Address Id SCM"; BCServiceRequest.SetViewMode(AllView); //Query by foreign key with the id used as input argument BCServiceRequest.ClearToQuery(); //If input argument SRStatusExprs exists, SRStatus is not used in the query. Otherwise SRStatus will be used in the query if(strStatusExpr != "") BCServiceRequest.SetSearchExpr(strStatusExpr); else BCServiceRequest.SetSearchSpec("Status",strSRStatus); BCServiceRequest.SetSearchSpec(strFK,strAddressId); BCServiceRequest.SetSearchSpec("Sub-Area","Address change"); BCServiceRequest.ExecuteQuery(ForwardOnly); //If a SR with the desired status and foreign key exists output argument will be set to true if(BCServiceRequest.FirstRecord()) { Outputs.SetProperty("SRExists","Y"); Outputs.SetProperty("SRId",BCServiceRequest.GetFieldValue("Id")); Outputs.SetProperty("CNO Flag", BCServiceRequest.GetFieldValue("CNO Used SCM")); Outputs.SetProperty("Order Id", BCServiceRequest.GetFieldValue("Order Id")); } else { Outputs.SetProperty("SRExists","N"); Outputs.SetProperty("SRId",""); Outputs.SetProperty("CNO Flag",""); Outputs.SetProperty("Order Id", ""); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ strEntity = null; strAddressId = null; strSRStatus = null; strFK = null; strStatusExpr = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /***************************************************************************** ** Name: Preinvoke ** Description: This BS has all script necessary for CAM purposes. *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2008-10-15 TGDZAIN1 created * 2011-05-04 TGDHURO9 Defect 36397 BS_CAM_006 NameCheck consolidated here * 2011-05-06 TGDHURO9 Defect 36556 PRT: Billing Profile (function * CreateOrCopyBillingProfile) * 2011-07-20 TGDLABR1 Added CleanupReservedNumbers * 2011-08-10 TGDSEAI1 Added ValidatePhoneNumberSearch and error tracing *****************************************************************************/ try{ oApp = TheApplication(); // enable tracing bIsTraceOn = oApp.isTraceON; // enable tracing if (bIsTraceOn) oApp.Trace(this.Name() + " START --> "+ MethodName); switch (MethodName){ case "NameCheck": NameCheck(Inputs,Outputs); break; case "GotoView": GotoView(Inputs,Outputs); break; case "GotoSRView": GotoSRView(Inputs,Outputs); break; case "SetPrimaryContactFlag": SetPrimaryContactFlag(Inputs,Outputs); break; case "GotoSRViewBillingProfile": GotoSRViewBillingProfile(Inputs,Outputs); break; case "GotoSRViewAccount": GotoSRViewAccount(Inputs,Outputs); break; case "GotoSRInactivateView": GotoSRInactivateView(Inputs,Outputs); break; case "LookUpValue": LookUpValue(Inputs,Outputs); break; case "SimpleGotoViewBOAccount": SimpleGotoViewBOAccount(Inputs,Outputs); break; case "CancelServiceRequest": CancelServiceRequest(Inputs,Outputs); break; case "SubmitServiceRequest": SubmitServiceRequest(Inputs,Outputs); break; case "CancelActiveServiceRequest": CancelActiveServiceRequest(Inputs,Outputs); break; case "SubmitActiveServiceRequest": SubmitActiveServiceRequest(Inputs,Outputs); break; case "SubmitSRWorkflow": SubmitSRWorkflow(Inputs,Outputs); break; case "UndoServiceRequest": UndoServiceRequest(Inputs,Outputs); break; case "EmpHasSR": EmpHasSR(Inputs,Outputs); break; case "ValidateString": ValidateString(Inputs,Outputs); break; case "SearchAddressSR": SearchAddressSR(Inputs,Outputs); break; case "ChangeAddressStatus": ChangeAddressStatus(Inputs,Outputs); break; case "RequestBillingProfile": RequestBillingProfile(Inputs,Outputs); break; case "LookupMsg": LookupMsg(Inputs,Outputs); break; case "CreateMainContactRole": CreateMainContactRole(Inputs,Outputs); break; case "CreateDefaultContactRole": CreateDefaultContactRole(Inputs,Outputs); break; case "CancelServiceRequestOnly": CancelServiceRequestOnly(Inputs,Outputs); break; case "GetInsolvents": GetInsolvents(Inputs,Outputs); break; case "GotoContactView": GotoContactView(Inputs,Outputs); break; case "FormatCommInfoValidation": fFormatCommInfoValidation(Inputs,Outputs); break; case "RefreshSR": RefreshSR(Inputs,Outputs); break; case "RefreshContracts": RefreshContracts(Inputs,Outputs); break; case "RefreshBP": RefreshBP(Inputs,Outputs); break; case "SetSRLanguage": SetSRLanguage(Inputs,Outputs); break; case "CBUValidation": CBUValidation(Inputs,Outputs); break; case "InactivationUpdateHQ": InactivationUpdateHQ(Inputs,Outputs); break; case "Format0Phone": Format0Phone(Inputs,Outputs); break; case "GetAssetId": GetAssetId(Inputs,Outputs);

CAM BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ /***************************************************************************** ** Name: Preinvoke ** Description: This BS has all script necessary for CAM purposes. *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2008-10-15 TGDZAIN1 created * 2011-05-04 TGDHURO9 Defect 36397 BS_CAM_006 NameCheck consolidated here * 2011-05-06 TGDHURO9 Defect 36556 PRT: Billing Profile (function * CreateOrCopyBillingProfile) * 2011-07-20 TGDLABR1 Added CleanupReservedNumbers * 2011-08-10 TGDSEAI1 Added ValidatePhoneNumberSearch and error tracing *****************************************************************************/ try{ oApp = TheApplication(); // enable tracing bIsTraceOn = oApp.isTraceON; // enable tracing if (bIsTraceOn) oApp.Trace(this.Name() + " START --> "+ MethodName); switch (MethodName){ case "NameCheck": NameCheck(Inputs,Outputs); break; case "GotoView": GotoView(Inputs,Outputs); break; case "GotoSRView": GotoSRView(Inputs,Outputs); break; case "SetPrimaryContactFlag": SetPrimaryContactFlag(Inputs,Outputs); break; case "GotoSRViewBillingProfile": GotoSRViewBillingProfile(Inputs,Outputs); break; case "GotoSRViewAccount": GotoSRViewAccount(Inputs,Outputs); break; case "GotoSRInactivateView": GotoSRInactivateView(Inputs,Outputs); break; case "LookUpValue": LookUpValue(Inputs,Outputs); break; case "SimpleGotoViewBOAccount": SimpleGotoViewBOAccount(Inputs,Outputs); break; case "CancelServiceRequest": CancelServiceRequest(Inputs,Outputs); break; case "SubmitServiceRequest": SubmitServiceRequest(Inputs,Outputs); break; case "CancelActiveServiceRequest": CancelActiveServiceRequest(Inputs,Outputs); break; case "SubmitActiveServiceRequest": SubmitActiveServiceRequest(Inputs,Outputs); break; case "SubmitSRWorkflow": SubmitSRWorkflow(Inputs,Outputs); break; case "UndoServiceRequest": UndoServiceRequest(Inputs,Outputs); break; case "EmpHasSR": EmpHasSR(Inputs,Outputs); break; case "ValidateString": ValidateString(Inputs,Outputs); break; case "SearchAddressSR": SearchAddressSR(Inputs,Outputs); break; case "ChangeAddressStatus": ChangeAddressStatus(Inputs,Outputs); break; case "RequestBillingProfile": RequestBillingProfile(Inputs,Outputs); break; case "LookupMsg": LookupMsg(Inputs,Outputs); break; case "CreateMainContactRole": CreateMainContactRole(Inputs,Outputs); break; case "CreateDefaultContactRole": CreateDefaultContactRole(Inputs,Outputs); break; case "CancelServiceRequestOnly": CancelServiceRequestOnly(Inputs,Outputs); break; case "GetInsolvents": GetInsolvents(Inputs,Outputs); break; case "GotoContactView": GotoContactView(Inputs,Outputs); break; case "FormatCommInfoValidation": fFormatCommInfoValidation(Inputs,Outputs); break; case "RefreshSR": RefreshSR(Inputs,Outputs); break; case "RefreshContracts": RefreshContracts(Inputs,Outputs); break; case "RefreshBP": RefreshBP(Inputs,Outputs); break; //SCM 2009.07.24 TGDTOGE3 Issue #10959 case "SetSRLanguage": SetSRLanguage(Inputs,Outputs); break; //SCM 2009.07.24 TGDTOGE3 Issue #10959 and smallCR 8338 case "CBUValidation": CBUValidation(Inputs,Outputs); break; //SCM 2009.10.14 TGDTOGE3 Issue #14305 case "InactivationUpdateHQ":

CAM BS SCM
SetBankFromIban
/******************************************************* ** Name: SetBankFromIban ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the bank of the billing aprofile, getting it as saved in a valid iban number -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetBankFromIban(Inputs, Outputs) { var busObj:BusObject = TheApplication().ActiveBusObject(); var billBusComp:BusComp = busObj.GetBusComp("Com Invoice Profile SCM"); var oBCPick; var iBan; var fixedIban; try { iBan = billBusComp.GetFieldValue("IBAN Account Number SCM"); iBan = iBan.replace(/ /g,""); //pre calculation check iBan = iBan.toUpperCase(); fixedIban = iBan; // convert bank clearing from IBAN var strClearing = iBan.substring(4,9); // remove leading 0's from clearing while(strClearing.indexOf("0") == 0) strClearing = strClearing.substring(1); // lookup bank clearing oBCPick = billBusComp.GetPicklistBusComp("Bank Clearing SCM"); with (oBCPick){ ActivateField("Bank Clearing Number"); // TGDMAEM1 12.06.12 Added for SO 1046 ActivateField("Fillial Number"); ActivateField("BC Type"); // TGDMAEM1 12.06.12 End - Added for SO 1046 ClearToQuery(); SetSearchSpec("Bank Clearing Number", strClearing); // TGDMAEM1 12.06.12 Added for SO 1046 // TGDMAEM1 17.9.12 Changed search spec from 0 to 0000 to align with source excel SetSearchSpec("Fillial Number", "0000"); // TGDMAEM1 07.11.12: Raiffeisen is a special case, all has 2... so we will sort by BC Type und take this first one //SetSearchSpec("BC Type", "1"); SetSortSpec("BC Type (ASC)"); // TGDMAEM1 12.06.12 End - Added for SO 1046 if (bIsTraceOn) oApp.Trace("SetBankFromIban, lookup bank clearing: " + strClearing); ExecuteQuery(ForwardOnly); if(FirstRecord()) Pick(); else TheApplication().RaiseError("PayMut: No bank found SCM"); } oBCPick = null; // TGDGEMAM 2016-02-17: Defect # 5039 // billBusComp.WriteRecord(); } catch (e) { throw(e); } finally { oBCPick = null; billBusComp = null; busObj = null; } }

CAM BS SCM
SetBankFromIban
/******************************************************* ** Name: SetBankFromIban ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the bank of the billing aprofile, getting it as saved in a valid iban number -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetBankFromIban(Inputs, Outputs) { var busObj:BusObject = TheApplication().ActiveBusObject(); var billBusComp:BusComp = busObj.GetBusComp("Com Invoice Profile SCM"); var oBCPick; var iBan; var fixedIban; try { iBan = billBusComp.GetFieldValue("IBAN Account Number SCM"); iBan = iBan.replace(/ /g,""); //pre calculation check iBan = iBan.toUpperCase(); fixedIban = iBan; // convert bank clearing from IBAN var strClearing = iBan.substring(4,9); // remove leading 0's from clearing while(strClearing.indexOf("0") == 0) strClearing = strClearing.substring(1); // lookup bank clearing oBCPick = billBusComp.GetPicklistBusComp("Bank Clearing SCM"); with (oBCPick){ ActivateField("Bank Clearing Number"); // TGDMAEM1 12.06.12 Added for SO 1046 ActivateField("Fillial Number"); ActivateField("BC Type"); // TGDMAEM1 12.06.12 End - Added for SO 1046 ClearToQuery(); SetSearchSpec("Bank Clearing Number", strClearing); // TGDMAEM1 12.06.12 Added for SO 1046 // TGDMAEM1 17.9.12 Changed search spec from 0 to 0000 to align with source excel SetSearchSpec("Fillial Number", "0000"); // TGDMAEM1 07.11.12: Raiffeisen is a special case, all has 2... so we will sort by BC Type und take this first one //SetSearchSpec("BC Type", "1"); SetSortSpec("BC Type (ASC)"); // TGDMAEM1 12.06.12 End - Added for SO 1046 if (bIsTraceOn) oApp.Trace("SetBankFromIban, lookup bank clearing: " + strClearing); ExecuteQuery(ForwardOnly); if(FirstRecord()) Pick(); else TheApplication().RaiseError("PayMut: No bank found SCM"); } oBCPick = null; // TGDGEMAM 2016-02-17: Defect # 5039 // billBusComp.WriteRecord(); } catch (e) { throw(e); } finally { oBCPick = null; billBusComp = null; busObj = null; } }

CAM BS SCM
SetPrimaryContactFlag
/******************************************************* ** Name: SetPrimaryContactFlag ** Created: 18.11.2008 ** Created By: María T. Martínez ** Description: This method sets to true a flag in order to know if the contact is primary of any person customer. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetPrimaryContactFlag(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCContact; var PrimaryContactFlag; try { //Get Active BO and BCs BOActiveAccount = TheApplication().ActiveBusObject(); BCContact=BOActiveAccount.GetBusComp("Contact"); // Variables creation. PrimaryContactFlag= "Y"; BCContact.SetFieldValue("Calculated Primary Contact Flag SCM",PrimaryContactFlag); BCContact.WriteRecord(); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ PrimaryContactFlag = null; BCContact =null; BOActiveAccount = null; } }

CAM BS SCM
SetPrimaryContactFlag
/******************************************************* ** Name: SetPrimaryContactFlag ** Created: 18.11.2008 ** Created By: María T. Martínez ** Description: This method sets to true a flag in order to know if the contact is primary of any person customer. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SetPrimaryContactFlag(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCContact; var PrimaryContactFlag; try { //Get Active BO and BCs BOActiveAccount = TheApplication().ActiveBusObject(); BCContact=BOActiveAccount.GetBusComp("Contact"); // Variables creation. PrimaryContactFlag= "Y"; BCContact.SetFieldValue("Calculated Primary Contact Flag SCM",PrimaryContactFlag); BCContact.WriteRecord(); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ PrimaryContactFlag = null; BCContact =null; BOActiveAccount = null; } }

CAM BS SCM
SetSRLanguage
/******************************************************* ** Name: SetSRLanguage ** Created: 24.07.2009 ** Created By: Gema Torres ** Description: Issue #10959: This method sets the Language of SR New Customer with Correspondence Language of customer ** is invoked when first write record of Account ** TGDBEJA6 18.10.2010 Reuse this method to set the contact data for SR New Customer. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function SetSRLanguage(Inputs,Outputs) { var BOActiveAccount; var BCServiceRequest; var BCAcc; var sLanguage = ""; try{ //Filter code by view name due to EAI issue if(TheApplication().GetProfileAttr("ActiveViewName") == "Customer Creation View SCM" || TheApplication().GetProfileAttr("ActiveViewName") == "Customer Company Creation View SCM") { //Get Active BO, BCs from the context in order to get the SR created recently and the customer Correspondence Language BOActiveAccount = TheApplication().ActiveBusObject(); BCAcc = BOActiveAccount.GetBusComp("Account"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); if(BCAcc.GetFieldValue("Prepayment Flag SCM") == "N") { //Get customer Correspondence Language if(BCAcc.GetFieldValue("Type") == TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Company")) { sLanguage = BCAcc.GetFieldValue("Correspondence Language SCM"); } else { sLanguage = BCAcc.GetFieldValue("Account Contact Correspondence Language SCM"); //TGDBEJA6 18.10.2010 Project CDM, Set the contact Id for New Customer SR BCServiceRequest.SetFieldValue("Contact Id", BCAcc.GetFieldValue("Primary Contact Id")); BCServiceRequest.SetFieldValue("OneTime Contact Title SCM", BCAcc.GetFieldValue("Account Contact M/M")); BCServiceRequest.SetFieldValue("OneTime Contact First Name SCM", BCAcc.GetFieldValue("Account Contact First Name")); BCServiceRequest.SetFieldValue("OneTime Contact Last Name SCM", BCAcc.GetFieldValue("Account Contact Last Name")); BCServiceRequest.SetFieldValue("OneTime Contact Email SCM", BCAcc.GetFieldValue("Account Contact Email Address SCM")); BCServiceRequest.SetFieldValue("OneTime Contact Cell Phone SCM", BCAcc.GetFieldValue("Account Contact Cell Phone Number SCM")); } //TheApplication().RaiseErrorText("language: " +sLanguage); //Set SR Language BCServiceRequest.SetFieldValue("SR Language Name SCM", sLanguage); BCServiceRequest.WriteRecord(); } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BCAcc = null; BOActiveAccount = null; } }

CAM BS SCM
SetSRLanguage
/******************************************************* ** Name: SetSRLanguage ** Created: 24.07.2009 ** Created By: Gema Torres ** Description: Issue #10959: This method sets the Language of SR New Customer with Correspondence Language of customer ** is invoked when first write record of Account ** TGDBEJA6 18.10.2010 Reuse this method to set the contact data for SR New Customer. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function SetSRLanguage(Inputs,Outputs) { var BOActiveAccount; var BCServiceRequest; var BCAcc; var sLanguage = ""; try{ //Filter code by view name due to EAI issue if(TheApplication().GetProfileAttr("ActiveViewName") == "Customer Creation View SCM" || TheApplication().GetProfileAttr("ActiveViewName") == "Customer Company Creation View SCM") { //Get Active BO, BCs from the context in order to get the SR created recently and the customer Correspondence Language BOActiveAccount = TheApplication().ActiveBusObject(); BCAcc = BOActiveAccount.GetBusComp("Account"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); if(BCAcc.GetFieldValue("Prepayment Flag SCM") == "N") { //Get customer Correspondence Language if(BCAcc.GetFieldValue("Type") == TheApplication().InvokeMethod("LookupValue","ACCOUNT_TYPE","Company")) { sLanguage = BCAcc.GetFieldValue("Correspondence Language SCM"); } else { sLanguage = BCAcc.GetFieldValue("Account Contact Correspondence Language SCM"); //TGDBEJA6 18.10.2010 Project CDM, Set the contact Id for New Customer SR BCServiceRequest.SetFieldValue("Contact Id", BCAcc.GetFieldValue("Primary Contact Id")); BCServiceRequest.SetFieldValue("OneTime Contact Title SCM", BCAcc.GetFieldValue("Account Contact M/M")); BCServiceRequest.SetFieldValue("OneTime Contact First Name SCM", BCAcc.GetFieldValue("Account Contact First Name")); BCServiceRequest.SetFieldValue("OneTime Contact Last Name SCM", BCAcc.GetFieldValue("Account Contact Last Name")); BCServiceRequest.SetFieldValue("OneTime Contact Email SCM", BCAcc.GetFieldValue("Account Contact Email Address SCM")); BCServiceRequest.SetFieldValue("OneTime Contact Cell Phone SCM", BCAcc.GetFieldValue("Account Contact Cell Phone Number SCM")); } //TheApplication().RaiseErrorText("language: " +sLanguage); //Set SR Language BCServiceRequest.SetFieldValue("SR Language Name SCM", sLanguage); BCServiceRequest.WriteRecord(); } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCServiceRequest = null; BCAcc = null; BOActiveAccount = null; } }

CAM BS SCM
SimpleGotoViewBOAccount
/***************************************************************************************************************** ** Name: SimpleGotoViewBOAccount ** Created: ** Created By: ** Description: Method to navigate to the specified view. This method is invoked when a customer is submitted ** in the workflow Customer Validation SCM. ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function SimpleGotoViewBOAccount(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActive; var BCAccount; var strAccId; var BOAccount; var BCAccountView; var strView; try { /*Variables*/ BOActive = TheApplication().ActiveBusObject(); BCAccount = BOActive.GetBusComp("Account"); strAccId = BCAccount.GetFieldValue("Id"); BOAccount = TheApplication().GetBusObject("Account"); BCAccountView = BOAccount.GetBusComp("Account"); strView = Inputs.GetProperty("ViewName"); /*search Account*/ BCAccountView.ActivateField("Duplicate Check Flag SCM"); BCAccountView.SetViewMode(AllView); BCAccountView.ClearToQuery(); BCAccountView.SetSearchSpec("Id",strAccId); BCAccountView.ExecuteQuery(ForwardOnly); if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel Power Communications") { if(BCAccountView.GetFieldValue("Geo Id SCM")== "N") { //Set Profile attribute to inform the agent that the SR can not be submitted, //and has to be asigned to a teambox TheApplication().SetProfileAttr("GeoValidateAddr","Y"); } else { TheApplication().SetProfileAttr("GeoValidateAddr","N"); } } else //When application is shop, SR is automatically assigned to the right teambox, and error message must not be displayed TheApplication().SetProfileAttr("GeoValidateAddr","N"); /*Navigate to the view*/ TheApplication().GotoView(strView, BOAccount); }//end try catch(e) { TheApplication().RaiseErrorText(e.toString()); }//end catch finally { BCAccount=null; BOActive=null; strAccId=null; BCAccountView=null; BOAccount=null; strView = null; }//end finally }//end function

CAM BS SCM
SimpleGotoViewBOAccount
/***************************************************************************************************************** ** Name: SimpleGotoViewBOAccount ** Created: ** Created By: ** Description: Method to navigate to the specified view. This method is invoked when a customer is submitted ** in the workflow Customer Validation SCM. ** -------------------- Modifications --------------------- ** Version: <> ** Date: <> ** Changed By: <> ** Description: <> **********************************************************************************************************************/ function SimpleGotoViewBOAccount(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActive; var BCAccount; var strAccId; var BOAccount; var BCAccountView; var strView; try { /*Variables*/ BOActive = TheApplication().ActiveBusObject(); BCAccount = BOActive.GetBusComp("Account"); strAccId = BCAccount.GetFieldValue("Id"); BOAccount = TheApplication().GetBusObject("Account"); BCAccountView = BOAccount.GetBusComp("Account"); strView = Inputs.GetProperty("ViewName"); /*search Account*/ BCAccountView.ActivateField("Duplicate Check Flag SCM"); BCAccountView.SetViewMode(AllView); BCAccountView.ClearToQuery(); BCAccountView.SetSearchSpec("Id",strAccId); BCAccountView.ExecuteQuery(ForwardOnly); if(TheApplication().GetProfileAttr("ApplicationName")== "Siebel Power Communications") { if(BCAccountView.GetFieldValue("Geo Id SCM")== "N") { //Set Profile attribute to inform the agent that the SR can not be submitted, //and has to be asigned to a teambox TheApplication().SetProfileAttr("GeoValidateAddr","Y"); } else { TheApplication().SetProfileAttr("GeoValidateAddr","N"); } } else //When application is shop, SR is automatically assigned to the right teambox, and error message must not be displayed TheApplication().SetProfileAttr("GeoValidateAddr","N"); /*Navigate to the view*/ TheApplication().GotoView(strView, BOAccount); }//end try catch(e) { TheApplication().RaiseErrorText(e.toString()); }//end catch finally { BCAccount=null; BOActive=null; strAccId=null; BCAccountView=null; BOAccount=null; strView = null; }//end finally }//end function

CAM BS SCM
SubmitActiveServiceRequest
function SubmitActiveServiceRequest(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: SubmitActiveServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method is used to submit an Opened SR got ** from the context. This method is used when only one SR is in the context. ******************************************************/ //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount:BusObject; var BCAccount:BusComp; var BCServiceRequest:BusComp; try{ //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = oApp.ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //The SR must be submitted if(BCHasRecord(BCServiceRequest))BCServiceRequest.InvokeMethod("SubmitSR"); } catch(e){ oApp.RaiseErrorText(e.toString()); } finally{ BCAccount = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
SubmitActiveServiceRequest
/******************************************************* ** Name: SubmitActiveServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method is used to submit an Opened SR got ** from the context. This method is used when only one SR is in the context. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitActiveServiceRequest(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOActiveAccount; var BCAccount; var BCServiceRequest; try { //Get Active BO, BCs from the context in order to get the SR created recently BOActiveAccount = TheApplication().ActiveBusObject(); BCAccount = BOActiveAccount.GetBusComp("Account"); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); //The SR must be submitted if(BCHasRecord(BCServiceRequest)) BCServiceRequest.InvokeMethod("SubmitSR"); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ BCAccount = null; BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
SubmitSRWorkflow
/******************************************************* ** Name: SubmitSRWorkflow ** Created: 19.12.2008 ** Created By: Alberto Lopez Arellano ** Description: This method invokes a Service Request BC method to submit the SR whose Id was ** stored in a property. This method is different thatn standard method to be invoke from ** a WF policy ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitSRWorkflow(Inputs,Outputs) { //Create variables var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); if (BCServiceRequest.FirstRecord()) { //The SR must be submitted BCServiceRequest.InvokeMethod("SubmitSRWorkflow"); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
SubmitSRWorkflow
/******************************************************* ** Name: SubmitSRWorkflow ** Created: 19.12.2008 ** Created By: Alberto Lopez Arellano ** Description: This method invokes a Service Request BC method to submit the SR whose Id was ** stored in a property. This method is different thatn standard method to be invoke from ** a WF policy ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitSRWorkflow(Inputs,Outputs) { //Create variables var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); if (BCServiceRequest.FirstRecord()) { //The SR must be submitted BCServiceRequest.InvokeMethod("SubmitSRWorkflow"); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
SubmitServiceRequest
/******************************************************* ** Name: SubmitServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to submit the SR whose Id was ** stored in a property. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitServiceRequest(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR must be submitted if(BCServiceRequest.FirstRecord()) { BCServiceRequest.InvokeMethod("SubmitSR"); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
SubmitServiceRequest
/******************************************************* ** Name: SubmitServiceRequest ** Created: 27.08.2008 ** Created By: Javier Amor ** Description: This method invokes a Service Request BC method to submit the SR whose Id was ** stored in a property. ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function SubmitServiceRequest(Inputs,Outputs) { //SCM 2009.01.12 TGDAMJA1. Every variable must be declared before try statement var BOServiceRequest; var BCServiceRequest; var SRId; try{ //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); //Get Active BO and BCs BOServiceRequest = TheApplication().GetBusObject("Service Request"); BCServiceRequest = BOServiceRequest.GetBusComp("Service Request"); //Look for the SR whose Id was the input argument BCServiceRequest.SetViewMode(AllView); BCServiceRequest.ClearToQuery(); BCServiceRequest.SetSearchSpec("Id", SRId); BCServiceRequest.ExecuteQuery(ForwardOnly); //The SR must be submitted if(BCServiceRequest.FirstRecord()) { BCServiceRequest.InvokeMethod("SubmitSR"); } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ SRId = null; BCServiceRequest = null; BOServiceRequest = null; } }

CAM BS SCM
TransferOrderAndOrderItems
/******************************************************* ** Name: TransferOrderAndOrderItems ** Created: 15.02.2010 ** Created By: Carolina Indiano ** Description: This method is called from the CancelActiveServiceRequest method to transfer the orders and OLIs ** from the source to the target customer in a duplicate check process. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function TransferOrderAndOrderItems(Inputs,Outputs) { //BEGIN. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. var BOOrder; var BCOrder; var BCOrderItem; var BOInstAccount; var BCInstAccount; var strSubType; var strParentAccount; var strorderid; strorderid = Inputs.GetProperty("OrderId"); BOOrder = TheApplication().GetBusObject("Order Entry (Sales)"); BCOrder = BOOrder.GetBusComp("Order Entry - Orders"); BCOrder.SetViewMode(AllView); BCOrder.ActivateField("Service Account Id"); BCOrder.ActivateField("Billing Account Id"); BCOrder.ActivateField("Ship To Account Id"); BCOrder.ActivateField("Account Id"); BCOrder.ClearToQuery(); BCOrder.SetSearchSpec("Id",strorderid); BCOrder.ExecuteQuery(ForwardOnly); if (BCOrder.FirstRecord()) { BOInstAccount = TheApplication().GetBusObject("Account"); BCInstAccount = BOInstAccount.GetBusComp("Account"); BCInstAccount.SetViewMode(AllView); BCInstAccount.ActivateField("Calculate Sub Type SCM"); BCInstAccount.ClearToQuery(); BCInstAccount.SetSearchSpec("Id",Inputs.GetProperty("Acc Id")); BCInstAccount.ExecuteQuery(ForwardOnly); if (BCInstAccount.FirstRecord()) { strSubType = BCInstAccount.GetFieldValue("Calculate Sub Type SCM"); strParentAccount = BCInstAccount.GetFieldValue("Parent Account Id"); } var strServAcct = BCOrder.GetFieldValue("Service Account Id"); var strBillAcct = BCOrder.GetFieldValue("Billing Account Id"); var strShipAcct = BCOrder.GetFieldValue("Ship To Account Id"); var strOwneAcct = BCOrder.GetFieldValue("Account Id"); BCOrder.SetFieldValue("Service Account Id",Inputs.GetProperty("Acc Id")); BCOrder.SetFieldValue("Billing Account Id",Inputs.GetProperty("Acc Id")); BCOrder.SetFieldValue("Ship To Account Id",Inputs.GetProperty("Acc Id")); if (strSubType == "Y") BCOrder.SetFieldValue("Account Id",strParentAccount); else BCOrder.SetFieldValue("Account Id",Inputs.GetProperty("Acc Id")); BCOrder.WriteRecord(); } BCOrderItem = BOOrder.GetBusComp("Order Entry - Line Items (Simple)"); BCOrderItem.SetViewMode(AllView); BCOrderItem.ActivateField("Order Header Id"); BCOrderItem.ActivateField("Service Account Id"); BCOrderItem.ActivateField("Billing Account Id"); BCOrderItem.ActivateField("Ship To Account Id"); BCOrderItem.ClearToQuery(); BCOrderItem.SetSearchSpec("Order Header Id",strorderid); BCOrderItem.ExecuteQuery(ForwardOnly); if (BCOrderItem.FirstRecord()) { do { var strServAcctOL = BCOrderItem.GetFieldValue("Service Account Id"); var strBillAcctOL = BCOrderItem.GetFieldValue("Billing Account Id"); var strShipAcctOL = BCOrderItem.GetFieldValue("Ship To Account Id"); BCOrderItem.SetFieldValue("Service Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.SetFieldValue("Billing Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.SetFieldValue("Ship To Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.WriteRecord(); } while(BCOrderItem.NextRecord()) } BCOrder=null; BCOrderItem=null; BCInstAccount=null; BOOrder=null; BOInstAccount=null; return(ContinueOperation); //END. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. }

CAM BS SCM
TransferOrderAndOrderItems
/******************************************************* ** Name: TransferOrderAndOrderItems ** Created: 15.02.2010 ** Created By: Carolina Indiano ** Description: This method is called from the CancelActiveServiceRequest method to transfer the orders and OLIs ** from the source to the target customer in a duplicate check process. -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function TransferOrderAndOrderItems(Inputs,Outputs) { //BEGIN. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. var BOOrder; var BCOrder; var BCOrderItem; var BOInstAccount; var BCInstAccount; var strSubType; var strParentAccount; var strorderid; strorderid = Inputs.GetProperty("OrderId"); BOOrder = TheApplication().GetBusObject("Order Entry (Sales)"); BCOrder = BOOrder.GetBusComp("Order Entry - Orders"); BCOrder.SetViewMode(AllView); BCOrder.ActivateField("Service Account Id"); BCOrder.ActivateField("Billing Account Id"); BCOrder.ActivateField("Ship To Account Id"); BCOrder.ActivateField("Account Id"); BCOrder.ClearToQuery(); BCOrder.SetSearchSpec("Id",strorderid); BCOrder.ExecuteQuery(ForwardOnly); if (BCOrder.FirstRecord()) { BOInstAccount = TheApplication().GetBusObject("Account"); BCInstAccount = BOInstAccount.GetBusComp("Account"); BCInstAccount.SetViewMode(AllView); BCInstAccount.ActivateField("Calculate Sub Type SCM"); BCInstAccount.ClearToQuery(); BCInstAccount.SetSearchSpec("Id",Inputs.GetProperty("Acc Id")); BCInstAccount.ExecuteQuery(ForwardOnly); if (BCInstAccount.FirstRecord()) { strSubType = BCInstAccount.GetFieldValue("Calculate Sub Type SCM"); strParentAccount = BCInstAccount.GetFieldValue("Parent Account Id"); } var strServAcct = BCOrder.GetFieldValue("Service Account Id"); var strBillAcct = BCOrder.GetFieldValue("Billing Account Id"); var strShipAcct = BCOrder.GetFieldValue("Ship To Account Id"); var strOwneAcct = BCOrder.GetFieldValue("Account Id"); BCOrder.SetFieldValue("Service Account Id",Inputs.GetProperty("Acc Id")); BCOrder.SetFieldValue("Billing Account Id",Inputs.GetProperty("Acc Id")); BCOrder.SetFieldValue("Ship To Account Id",Inputs.GetProperty("Acc Id")); if (strSubType == "Y") BCOrder.SetFieldValue("Account Id",strParentAccount); else BCOrder.SetFieldValue("Account Id",Inputs.GetProperty("Acc Id")); BCOrder.WriteRecord(); } BCOrderItem = BOOrder.GetBusComp("Order Entry - Line Items (Simple)"); BCOrderItem.SetViewMode(AllView); BCOrderItem.ActivateField("Order Header Id"); BCOrderItem.ActivateField("Service Account Id"); BCOrderItem.ActivateField("Billing Account Id"); BCOrderItem.ActivateField("Ship To Account Id"); BCOrderItem.ClearToQuery(); BCOrderItem.SetSearchSpec("Order Header Id",strorderid); BCOrderItem.ExecuteQuery(ForwardOnly); if (BCOrderItem.FirstRecord()) { do { var strServAcctOL = BCOrderItem.GetFieldValue("Service Account Id"); var strBillAcctOL = BCOrderItem.GetFieldValue("Billing Account Id"); var strShipAcctOL = BCOrderItem.GetFieldValue("Ship To Account Id"); BCOrderItem.SetFieldValue("Service Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.SetFieldValue("Billing Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.SetFieldValue("Ship To Account Id",Inputs.GetProperty("Acc Id")); BCOrderItem.WriteRecord(); } while(BCOrderItem.NextRecord()) } BCOrder=null; BCOrderItem=null; BCInstAccount=null; BOOrder=null; BOInstAccount=null; return(ContinueOperation); //END. SCM TGDFESO1 2010.02.15 CR19835: Orders and OLIs should be transferred too. }

CAM BS SCM
TransformationAssetIntegrationId
/******************************************************* ** Name: TransformationAssetIntegrationId ** Created: 08.12.2009 ** Created By: Gema Torres ** Description: method to get transformation of Asset Integration Id for Wireline TDM Contracts ** used in RTX link, invoked from calculated field 'Calculated TDM Integration Id SCM' on BC 'Asset Mgmt - Asset (Order Mgmt)' -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function TransformationAssetIntegrationId(Inputs,Outputs) { var strIntegrationId; var strOutput; var strArray; var strOffset; var strOffsetTDM = 2000000000000000; try { strIntegrationId = Inputs.GetProperty("IntegrationId"); strOffset = Inputs.GetProperty("Offset"); //Asset Integration Is has the following format ALL:IP:<Number>:<Mini> strArray = strIntegrationId.split(":"); if(strOffset == "2000000000000000") //Extended key generation for Wireline TDM contracts strOutput = strOffsetTDM + (1000*ToInteger(strArray[2])) + ToInteger(strArray[3]); else strOutput = ToNumber(strOffset) + ToInteger(strArray[2]); /* else if(strOffset == "3000000000000000") strOutput = ToNumber(strOffset) + ToInteger(strArray[2]); else if(strOffset == "1000000000000000") strOutput = 1000000000000000 + ToInteger(strArray[2]); else strOutput = ToInteger(strArray[2]);*/ //Transformation of Asset Integration Id to use in RTX link as Source field Outputs.SetProperty("IntegrationIdConverted",strOutput); } catch(e) { if (oApp.bIsTraceOn) oApp.Trace(this.Name() + "-> Raise Error Text"); } finally { strIntegrationId=null; strOutput=null; strArray=null; strOffset=null; } }

CAM BS SCM
TransformationAssetIntegrationId
/******************************************************* ** Name: TransformationAssetIntegrationId ** Created: 08.12.2009 ** Created By: Gema Torres ** Description: method to get transformation of Asset Integration Id for Wireline TDM Contracts ** used in RTX link, invoked from calculated field 'Calculated TDM Integration Id SCM' on BC 'Asset Mgmt - Asset (Order Mgmt)' -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function TransformationAssetIntegrationId(Inputs,Outputs) { var strIntegrationId; var strOutput; var strArray; var strOffset; var strOffsetTDM = 2000000000000000; try { strIntegrationId = Inputs.GetProperty("IntegrationId"); strOffset = Inputs.GetProperty("Offset"); //Asset Integration Is has the following format ALL:IP:<Number>:<Mini> strArray = strIntegrationId.split(":"); if(strOffset == "2000000000000000") //Extended key generation for Wireline TDM contracts strOutput = strOffsetTDM + (1000*ToInteger(strArray[2])) + ToInteger(strArray[3]); else strOutput = ToNumber(strOffset) + ToInteger(strArray[2]); /* else if(strOffset == "3000000000000000") strOutput = ToNumber(strOffset) + ToInteger(strArray[2]); else if(strOffset == "1000000000000000") strOutput = 1000000000000000 + ToInteger(strArray[2]); else strOutput = ToInteger(strArray[2]);*/ //Transformation of Asset Integration Id to use in RTX link as Source field Outputs.SetProperty("IntegrationIdConverted",strOutput); } catch(e) { if (oApp.bIsTraceOn) oApp.Trace(this.Name() + "-> Raise Error Text"); } finally { strIntegrationId=null; strOutput=null; strArray=null; strOffset=null; } }

CAM BS SCM
UndoServiceRequest
function UndoServiceRequest(Inputs,Outputs) { /************************************************************************************************************* ** Name: UndoServiceRequest ** Created: 01.09.2008 ** Created By: Javier Amor ** Description: This method undo the recently created SR which is active in the context. This method will be ** invoked only when an error happens while creating the SR, otherwise the SR must be cancelled or closed. -------------------- Modifications --------------------- ** Date: 16.09.2011 ** Changed By: TGDSEAI1: Aingeru Sabando Lasuen ** Description: Added a check to ensure that we have an active BO when some WF using this script are called with no GUI the process crashes ************************************************************************************************************ ************************************************************************************************************/ //Variable declarations var BOActiveAccount:BusObject; var BCServiceRequest:BusComp; try{ //Get Active BO, BCs from the context in order to get the SR created recently if(TheApplication().ActiveBusObject()) { BOActiveAccount = TheApplication().ActiveBusObject(); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); if(BCServiceRequest.Name() == "Service Request"){ //Undo the SR BCServiceRequest.UndoRecord(); } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ //Variable destruction BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
UndoServiceRequest
function UndoServiceRequest(Inputs,Outputs) { /************************************************************************************************************* ** Name: UndoServiceRequest ** Created: 01.09.2008 ** Created By: Javier Amor ** Description: This method undo the recently created SR which is active in the context. This method will be ** invoked only when an error happens while creating the SR, otherwise the SR must be cancelled or closed. -------------------- Modifications --------------------- ** Date: 16.09.2011 ** Changed By: TGDSEAI1: Aingeru Sabando Lasuen ** Description: Added a check to ensure that we have an active BO when some WF using this script are called with no GUI the process crashes ************************************************************************************************************ ************************************************************************************************************/ //Variable declarations var BOActiveAccount:BusObject; var BCServiceRequest:BusComp; try{ //Get Active BO, BCs from the context in order to get the SR created recently if(TheApplication().ActiveBusObject()) { BOActiveAccount = TheApplication().ActiveBusObject(); BCServiceRequest = BOActiveAccount.GetBusComp("Service Request"); if(BCServiceRequest.Name() == "Service Request"){ //Undo the SR BCServiceRequest.UndoRecord(); } } } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ //Variable destruction BCServiceRequest = null; BOActiveAccount = null; } }

CAM BS SCM
UpdateAddressIdinSR
/******************************************************* ** Name: UpdateAddressIdinSR ** Created: 11.08.2010 ** Created By: Gema Torres ** Description: CR 415 -- This method updates the Accounjt Address Id SCM field in the SR ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function UpdateAddressIdinSR(Inputs,Outputs) { var SRId; var strAddressId; var BCServiceReq; try { BCServiceReq = oApp.GetBusObject("Account").GetBusComp("Service Request"); //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); strAddressId = Inputs.GetProperty("strAddressId"); BCServiceReq.ActivateField("Account Address Id SCM"); BCServiceReq.ClearToQuery(); BCServiceReq.SetSearchSpec("Id",SRId); BCServiceReq.ExecuteQuery(ForwardOnly); if(BCServiceReq.FirstRecord()) { BCServiceReq.SetFieldValue ("Account Address Id SCM", strAddressId); BCServiceReq.WriteRecord(); } }catch (e){ oApp.RaiseErrorText(e.toString()); } finally { SRId = null; strAddressId = null; BCServiceReq = null; } }

CAM BS SCM
UpdateAddressIdinSR
/******************************************************* ** Name: UpdateAddressIdinSR ** Created: 11.08.2010 ** Created By: Gema Torres ** Description: CR 415 -- This method updates the Accounjt Address Id SCM field in the SR ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ function UpdateAddressIdinSR(Inputs,Outputs) { var SRId; var strAddressId; var BCServiceReq; try { BCServiceReq = oApp.GetBusObject("Account").GetBusComp("Service Request"); //Get the Input property SRId SRId = Inputs.GetProperty("SRId"); strAddressId = Inputs.GetProperty("strAddressId"); BCServiceReq.ActivateField("Account Address Id SCM"); BCServiceReq.ClearToQuery(); BCServiceReq.SetSearchSpec("Id",SRId); BCServiceReq.ExecuteQuery(ForwardOnly); if(BCServiceReq.FirstRecord()) { BCServiceReq.SetFieldValue ("Account Address Id SCM", strAddressId); BCServiceReq.WriteRecord(); } }catch (e){ oApp.RaiseErrorText(e.toString()); } finally { SRId = null; strAddressId = null; BCServiceReq = null; } }

CAM BS SCM
UpdateBP
/******************************************************* ** Name: UpdateBP ** Created: 09.10.2013 ** Created By: Vratesh Pinge ** Description: This method updates a billing profile ******************************************************/ function UpdateBP(oBP,oAccount,oSync,psBPNew,sTimestamp,fEventId) { var psInput:PropertySet; var psOutput:PropertySet; var bsService; var sFlaggedBPId:String; var sCurrentFlag:String; if(bIsTraceOn) oApp.Trace("Replication Begin --> UpdateBP: "+psBPNew.GetProperty("Name")); try { // Insert record in Sync Operation BC oSync.NewRecord(NewAfter); oSync.SetFieldValue("Status", "NEW"); oSync.SetFieldValue("Target System", "RMCA"); oSync.SetFieldValue("Account Integration Id", psBPNew.GetProperty("AccNr")); oSync.SetFieldValue("Request Type","updateContract"); oSync.SetFieldValue("Billing Profile Integration Id", psBPNew.GetProperty("Name")); // tgdhube3 28.01.2014 Defect 79507 after defect correction "updated log" created has been changed to system field // oSync.SetFieldValue("Created",sTimestamp); oSync.SetFieldValue("Event Id",fEventId); oSync.WriteRecord(); oBP.SetFieldValue("Active Contract Exists Flag SCM", psBPNew.GetProperty("ACE")); oBP.SetFieldValue("Customer Reference SCM", psBPNew.GetProperty("CRef")); oBP.SetFieldValue("Customer Reference Type Code SCM", psBPNew.GetProperty("CRefType")); oBP.SetFieldValue("Unique Customer Reference Flag SCM", psBPNew.GetProperty("UCRef")); oBP.SetFieldValue("Bundle Configuration Cloud Flag SCM", psBPNew.GetProperty("BCC")); oBP.SetFieldValue("Bundle Configuration Internet Flag SCM", psBPNew.GetProperty("BCI")); oBP.SetFieldValue("Bundle Configuration Mobile Flag SCM", psBPNew.GetProperty("BCM")); oBP.SetFieldValue("Bundle Configuration TV Flag SCM", psBPNew.GetProperty("BCT")); oBP.SetFieldValue("Bundle Configuration VoIP Flag SCM", psBPNew.GetProperty("BCV")); oBP.SetFieldValue("Credit Limit Flag SCM", psBPNew.GetProperty("CLFLAG")); oBP.SetFieldValue("Check Active Contract Exists Flag SCM", "N"); oBP.WriteRecord(); if(bIsTraceOn) oApp.Trace("Replication End --> UpdateBP: "+psBPNew.GetProperty("Name")); if(psBPNew.GetProperty("UpdateBlockPurchase") == "Y" && oBP.GetFieldValue("Account Id") !="" && oBP.GetFieldValue("Account Id") != null) { psInput = oApp.NewPropertySet(); psOutput= oApp.NewPropertySet(); bsService= oApp.GetService("General Utilities SCM"); psInput.SetProperty("BusComp","EAI Billing Profile SCM"); psInput.SetProperty("BusObject","EAI Billing Profile SCM"); psInput.SetProperty("SearchSpec","[Account Id] = '"+oBP.GetFieldValue("Account Id")+"' AND [Bill Source] = 'ALL IP' AND [Status] = 'Active' AND [Credit Limit Flag SCM] = 'Y'"); bsService.InvokeMethod("QueryRecord", psInput, psOutput); sFlaggedBPId = psOutput.GetProperty("RecordId"); oAccount.SetViewMode(AllView); oAccount.ActivateField("Id"); oAccount.ActivateField("Block Purchase Flag SCM"); oAccount.SetSearchSpec("Id", oBP.GetFieldValue("Account Id")); oAccount.ExecuteQuery(ForwardOnly); if(oAccount.FirstRecord()) { sCurrentFlag = oAccount.GetFieldValue("Block Purchase Flag SCM"); if((sFlaggedBPId == "" || sFlaggedBPId == null) && sCurrentFlag == "Y") { if(bIsTraceOn) oApp.Trace("Update Block Purchase Flag to N --> UpdateBP: "+psBPNew.GetProperty("Name")); oAccount.SetFieldValue("Block Purchase Flag SCM","N"); oAccount.WriteRecord(); } else if(sFlaggedBPId != "" && sFlaggedBPId != null && (sCurrentFlag == "N" || sCurrentFlag == "" || sCurrentFlag == null)) { if(bIsTraceOn) oApp.Trace("Update Block Purchase Flag to Y --> UpdateBP: "+psBPNew.GetProperty("Name")); oAccount.SetFieldValue("Block Purchase Flag SCM","Y"); oAccount.WriteRecord(); } } } } catch (e) { if(bIsTraceOn) oApp.Trace("Replication Error --> UpdateBP: Error: "+e.toString()); oApp.RaiseErrorText(e.toString()); } f

CAM BS SCM
UpdateBP
/******************************************************* ** Name: UpdateBP ** Created: 09.10.2013 ** Created By: Vratesh Pinge ** Description: This method updates a billing profile ******************************************************/ function UpdateBP(oBP,oAccount,oSync,psBPNew,sTimestamp,fEventId) { var psInput:PropertySet; var psOutput:PropertySet; var bsService; var sFlaggedBPId:String; var sCurrentFlag:String; if(bIsTraceOn) oApp.Trace("Replication Begin --> UpdateBP: "+psBPNew.GetProperty("Name")); try { // Insert record in Sync Operation BC oSync.NewRecord(NewAfter); oSync.SetFieldValue("Status", "NEW"); oSync.SetFieldValue("Target System", "RMCA"); oSync.SetFieldValue("Account Integration Id", psBPNew.GetProperty("AccNr")); oSync.SetFieldValue("Request Type","updateContract"); oSync.SetFieldValue("Billing Profile Integration Id", psBPNew.GetProperty("Name")); // tgdhube3 28.01.2014 Defect 79507 after defect correction "updated log" created has been changed to system field // oSync.SetFieldValue("Created",sTimestamp); oSync.SetFieldValue("Event Id",fEventId); oSync.WriteRecord(); oBP.SetFieldValue("Active Contract Exists Flag SCM", psBPNew.GetProperty("ACE")); oBP.SetFieldValue("Customer Reference SCM", psBPNew.GetProperty("CRef")); oBP.SetFieldValue("Customer Reference Type Code SCM", psBPNew.GetProperty("CRefType")); oBP.SetFieldValue("Unique Customer Reference Flag SCM", psBPNew.GetProperty("UCRef")); oBP.SetFieldValue("Bundle Configuration Cloud Flag SCM", psBPNew.GetProperty("BCC")); oBP.SetFieldValue("Bundle Configuration Internet Flag SCM", psBPNew.GetProperty("BCI")); oBP.SetFieldValue("Bundle Configuration Mobile Flag SCM", psBPNew.GetProperty("BCM")); oBP.SetFieldValue("Bundle Configuration TV Flag SCM", psBPNew.GetProperty("BCT")); oBP.SetFieldValue("Bundle Configuration VoIP Flag SCM", psBPNew.GetProperty("BCV")); oBP.SetFieldValue("Credit Limit Flag SCM", psBPNew.GetProperty("CLFLAG")); oBP.SetFieldValue("Check Active Contract Exists Flag SCM", "N"); oBP.WriteRecord(); if(bIsTraceOn) oApp.Trace("Replication End --> UpdateBP: "+psBPNew.GetProperty("Name")); if(psBPNew.GetProperty("UpdateBlockPurchase") == "Y" && oBP.GetFieldValue("Account Id") !="" && oBP.GetFieldValue("Account Id") != null) { psInput = oApp.NewPropertySet(); psOutput= oApp.NewPropertySet(); bsService= oApp.GetService("General Utilities SCM"); psInput.SetProperty("BusComp","EAI Billing Profile SCM"); psInput.SetProperty("BusObject","EAI Billing Profile SCM"); psInput.SetProperty("SearchSpec","[Account Id] = '"+oBP.GetFieldValue("Account Id")+"' AND [Bill Source] = 'ALL IP' AND [Status] = 'Active' AND [Credit Limit Flag SCM] = 'Y'"); bsService.InvokeMethod("QueryRecord", psInput, psOutput); sFlaggedBPId = psOutput.GetProperty("RecordId"); oAccount.SetViewMode(AllView); oAccount.ActivateField("Id"); oAccount.ActivateField("Block Purchase Flag SCM"); oAccount.SetSearchSpec("Id", oBP.GetFieldValue("Account Id")); oAccount.ExecuteQuery(ForwardOnly); if(oAccount.FirstRecord()) { sCurrentFlag = oAccount.GetFieldValue("Block Purchase Flag SCM"); if((sFlaggedBPId == "" || sFlaggedBPId == null) && sCurrentFlag == "Y") { if(bIsTraceOn) oApp.Trace("Update Block Purchase Flag to N --> UpdateBP: "+psBPNew.GetProperty("Name")); oAccount.SetFieldValue("Block Purchase Flag SCM","N"); oAccount.WriteRecord(); } else if(sFlaggedBPId != "" && sFlaggedBPId != null && (sCurrentFlag == "N" || sCurrentFlag == "" || sCurrentFlag == null)) { if(bIsTraceOn) oApp.Trace("Update Block Purchase Flag to Y --> UpdateBP: "+psBPNew.GetProperty("Name")); oAccount.SetFieldValue("Block Purchase Flag SCM","Y"); oAccount.WriteRecord(); } } } } catch (e) { if(bIsTraceOn) oApp.Trace("Replication Error --> UpdateBP: Error: "+e.toString()); oApp.RaiseErrorText(e.toString()); } f

CAM BS SCM
ValidateIBan
/******************************************************* ** Name: ValidateIBan ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the bank of the billing aprofile, getting it as saved in a valid iban number ** Aus den AIP Toolkit BS vom Jochen Greulich kopiert -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ValidateIBan(iBan:String) { var result = 'Y'; var ibanArr; var changedIBan:String; var remainder = 0; var current; var upperIndex = 9; var lowerIndex = 0; var finished = false; try { if(iBan.length != 21) { result = 'N'; oApp.RaiseError("PayMut: Exact 21 digits SCM"); } ibanArr = iBan.split(""); // input handling for(var i = 0; i < ibanArr.length; i++){ if(!Clib.isalnum(ibanArr[i])) { result = 'N'; oApp.RaiseError("PayMut: No special chars SCM"); } } if(!(iBan.substring(0,2) == "CH" || iBan.substring(0,2) == "LI")) { result = 'N'; oApp.RaiseError("PayMut: Only CH or LI SCM"); } if(isNaN(ibanArr[2]) || isNaN(ibanArr[3])) { result = 'N'; oApp.RaiseError("PayMut: Only numbers allowed"); } //convert characters to numbers and remove space iBan = iBan.replace(/( )/g, ""); //move country code & check sum to end changedIBan = iBan.substring(4,iBan.length) + iBan.substring(0,4); //calculate checksum with intermediate steps while(!finished){ if(upperIndex > changedIBan.length){ upperIndex = changedIBan.length; finished = true; } current = remainder + changedIBan.substring(lowerIndex, upperIndex); remainder = ToNumber(current) % 97; lowerIndex = upperIndex; upperIndex = upperIndex + 7; } if (bIsTraceOn) oApp.Trace("SetBankFromIban, 1 == remainder: " + 1 + " " +remainder); //check checksum if(1 != remainder){ // EMA : added RaiseError to inform the agent that the entry is not valid result = 'N'; oApp.RaiseError("PayMut: No bank found SCM"); } } catch (e) { throw(e); } finally { ibanArr = null; } return (result); }

CAM BS SCM
ValidateIBan
/******************************************************* ** Name: ValidateIBan ** Created: 10.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the bank of the billing aprofile, getting it as saved in a valid iban number ** Aus den AIP Toolkit BS vom Jochen Greulich kopiert -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function ValidateIBan(iBan:String) { var result = 'Y'; var ibanArr; var changedIBan:String; var remainder = 0; var current; var upperIndex = 9; var lowerIndex = 0; var finished = false; try { if(iBan.length != 21) { result = 'N'; oApp.RaiseError("PayMut: Exact 21 digits SCM"); } ibanArr = iBan.split(""); // input handling for(var i = 0; i < ibanArr.length; i++){ if(!Clib.isalnum(ibanArr[i])) { result = 'N'; oApp.RaiseError("PayMut: No special chars SCM"); } } if(!(iBan.substring(0,2) == "CH" || iBan.substring(0,2) == "LI")) { result = 'N'; oApp.RaiseError("PayMut: Only CH or LI SCM"); } if(isNaN(ibanArr[2]) || isNaN(ibanArr[3])) { result = 'N'; oApp.RaiseError("PayMut: Only numbers allowed"); } //convert characters to numbers and remove space iBan = iBan.replace(/( )/g, ""); //move country code & check sum to end changedIBan = iBan.substring(4,iBan.length) + iBan.substring(0,4); //calculate checksum with intermediate steps while(!finished){ if(upperIndex > changedIBan.length){ upperIndex = changedIBan.length; finished = true; } current = remainder + changedIBan.substring(lowerIndex, upperIndex); remainder = ToNumber(current) % 97; lowerIndex = upperIndex; upperIndex = upperIndex + 7; } if (bIsTraceOn) oApp.Trace("SetBankFromIban, 1 == remainder: " + 1 + " " +remainder); //check checksum if(1 != remainder){ // EMA : added RaiseError to inform the agent that the entry is not valid result = 'N'; oApp.RaiseError("PayMut: No bank found SCM"); } } catch (e) { throw(e); } finally { ibanArr = null; } return (result); }

CAM BS SCM
ValidateString
/******************************************************* ** Name: ValidateString ** Created: 30.09.2008 ** Created By: P. Dominguez ** Description: This method checks if a string passed contains any invalid character ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 04.05.2009 ** Changed By: Gema Torres ** Description: CR170 -- New validations on First Name and Last Name ****************************************************** ** Version: <New Version> ** Date: 22.07.2010 ** Changed By: Alejandro Strickler ** Description: CR460 -- Validation for first and last Name changed ******************************************************/ function ValidateString(Inputs,Outputs) { //Create variables //Code modified - Issues: 2488,2637 - 27/11/2008 //var numNumbers="0123456789+-~·:;,_<>$¿{}[]^´\"*ç%&/\¡!#@¬()=¿?`^"; // var numNumbers="0123456789+·:;,_<>$¿{}[]´*%&/\\¡!#@¬()=¿`\""; //End Code modified - Issues: 2488,2637 - 27/11/2008 var stringName= Inputs.GetProperty("Inputs"); var i; var k; var j; var tmpName; //CR170 Outputs.SetProperty("RestrictedWord", ""); var Delimiters = " -'"; var nIndex1 = 0; var nIndex2 = 0; var iNroArray = 0; var strArray = new Array(); var strArray1= new Array(); var strArray2 = new Array(); var strArray3 = new Array(); var strArray22 = new Array(); var strArray33 = new Array(); var index = 0; var lowerStringName; var firstchar; var ValidName = new Array(); var sName = ""; var sACVRestricted : chars; var RestrictedWordArray : Array; /* var RestrictedWordArray = new Array(); RestrictedWordArray[0] = "A l`att"; RestrictedWordArray[1] = "A l'att."; RestrictedWordArray[2] = "All'att"; RestrictedWordArray[3] = "All¿att."; RestrictedWordArray[4] = "À l'att."; RestrictedWordArray[5] = "À l'att"; RestrictedWordArray[6] = "praxis"; RestrictedWordArray[7] = "Polizei"; RestrictedWordArray[8] = "Police"; RestrictedWordArray[9] = "Polizia"; RestrictedWordArray[10] = "Zivilschutz"; RestrictedWordArray[11] = "Protection civile"; RestrictedWordArray[12] = "Protezione civile"; RestrictedWordArray[13] = "Gemeinschaft"; RestrictedWordArray[14] = "Communauté"; RestrictedWordArray[15] = "Comunità"; RestrictedWordArray[16] = "Büro"; RestrictedWordArray[17] = "Ufficio"; RestrictedWordArray[18] = "case postale"; RestrictedWordArray[19] = "case pos"; RestrictedWordArray[20] = "casella postale"; RestrictedWordArray[21] = "casella post."; RestrictedWordArray[22] = "casella post"; RestrictedWordArray[23] = "cas. post."; RestrictedWordArray[24] = "cas. post"; RestrictedWordArray[25] = "cas post"; RestrictedWordArray[26] = "P.O. Box"; RestrictedWordArray[27] = "P.O.B."; RestrictedWordArray[28] = "Poste restante"; RestrictedWordArray[29] = "fermo posta"; */ try { sACVRestricted = oApp.SCM_RetrieveACV("RESTRICTED_STRINGS"); if (bIsTraceOn) oApp.Trace("ACV 'RESTRICTED_STRINGS' = " + sACVRestricted); RestrictedWordArray = sACVRestricted.split("|"); iNroArray = getArrayLength(RestrictedWordArray); if (bIsTraceOn) oApp.Trace("ACV length = " + iNroArray); //Looking for restricted words in Array for (k = 0; k < iNroArray ; k++) { if (Clib.strstri(stringName, RestrictedWordArray[k]) != null) //case-insensitive search { Outputs.SetProperty("Outputs", "Error: No sigle Restricted word"); Outputs.SetProperty("RestrictedWord", RestrictedWordArray[k]); return Outputs; } } if(k == iNroArray -1) Outputs.SetProperty("Outputs", "OK"); var srReg = /[\sa-zA-ZÄÖÜäöüàâêôéèñçëïÇÉòûùÿáíìîóúÑÔãÃÂÎõÕÓÒÚÛÙ¿'-.]{1,}/; var srReg2 = /[\*\(\)\+]/; for(i=0; i<stringName.length; i++) { if((stringName.charAt(i).search(srReg) == -1) || (stringName.charAt(i).search(srReg2) != -1)) TheApplication().RaiseError("Special character"); } if(stringName.indexOf(",") != -1)

CAM BS SCM
ValidateString
/******************************************************* ** Name: ValidateString ** Created: 30.09.2008 ** Created By: P. Dominguez ** Description: This method checks if a string passed contains any invalid character ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: 04.05.2009 ** Changed By: Gema Torres ** Description: CR170 -- New validations on First Name and Last Name ****************************************************** ** Version: <New Version> ** Date: 22.07.2010 ** Changed By: Alejandro Strickler ** Description: CR460 -- Validation for first and last Name changed ******************************************************/ function ValidateString(Inputs,Outputs) { //Create variables //Code modified - Issues: 2488,2637 - 27/11/2008 //var numNumbers="0123456789+-~·:;,_<>$¿{}[]^´\"*ç%&/\¡!#@¬()=¿?`^"; // var numNumbers="0123456789+·:;,_<>$¿{}[]´*%&/\\¡!#@¬()=¿`\""; //End Code modified - Issues: 2488,2637 - 27/11/2008 var stringName= Inputs.GetProperty("Inputs"); var i; var k; var j; var tmpName; //CR170 Outputs.SetProperty("RestrictedWord", ""); var Delimiters = " -'"; var nIndex1 = 0; var nIndex2 = 0; var iNroArray = 0; var strArray = new Array(); var strArray1= new Array(); var strArray2 = new Array(); var strArray3 = new Array(); var strArray22 = new Array(); var strArray33 = new Array(); var index = 0; var lowerStringName; var firstchar; var ValidName = new Array(); var sName = ""; var sACVRestricted : chars; var RestrictedWordArray : Array; /* var RestrictedWordArray = new Array(); RestrictedWordArray[0] = "A l`att"; RestrictedWordArray[1] = "A l'att."; RestrictedWordArray[2] = "All'att"; RestrictedWordArray[3] = "All¿att."; RestrictedWordArray[4] = "À l'att."; RestrictedWordArray[5] = "À l'att"; RestrictedWordArray[6] = "praxis"; RestrictedWordArray[7] = "Polizei"; RestrictedWordArray[8] = "Police"; RestrictedWordArray[9] = "Polizia"; RestrictedWordArray[10] = "Zivilschutz"; RestrictedWordArray[11] = "Protection civile"; RestrictedWordArray[12] = "Protezione civile"; RestrictedWordArray[13] = "Gemeinschaft"; RestrictedWordArray[14] = "Communauté"; RestrictedWordArray[15] = "Comunità"; RestrictedWordArray[16] = "Büro"; RestrictedWordArray[17] = "Ufficio"; RestrictedWordArray[18] = "case postale"; RestrictedWordArray[19] = "case pos"; RestrictedWordArray[20] = "casella postale"; RestrictedWordArray[21] = "casella post."; RestrictedWordArray[22] = "casella post"; RestrictedWordArray[23] = "cas. post."; RestrictedWordArray[24] = "cas. post"; RestrictedWordArray[25] = "cas post"; RestrictedWordArray[26] = "P.O. Box"; RestrictedWordArray[27] = "P.O.B."; RestrictedWordArray[28] = "Poste restante"; RestrictedWordArray[29] = "fermo posta"; */ try { sACVRestricted = oApp.SCM_RetrieveACV("RESTRICTED_STRINGS"); if (bIsTraceOn) oApp.Trace("ACV 'RESTRICTED_STRINGS' = " + sACVRestricted); RestrictedWordArray = sACVRestricted.split("|"); iNroArray = getArrayLength(RestrictedWordArray); if (bIsTraceOn) oApp.Trace("ACV length = " + iNroArray); //Looking for restricted words in Array for (k = 0; k < iNroArray ; k++) { if (Clib.strstri(stringName, RestrictedWordArray[k]) != null) //case-insensitive search { Outputs.SetProperty("Outputs", "Error: No sigle Restricted word"); Outputs.SetProperty("RestrictedWord", RestrictedWordArray[k]); return Outputs; } } if(k == iNroArray -1) Outputs.SetProperty("Outputs", "OK"); var srReg = /[\sa-zA-ZÄÖÜäöüàâêôéèñçëïÇÉòûùÿáíìîóúÑÔãÃÂÎõÕÓÒÚÛÙ¿'-.]{1,}/; var srReg2 = /[\*\(\)\+]/; for(i=0; i<stringName.length; i++) { if((stringName.charAt(i).search(srReg) == -1) || (stringName.charAt(i).search(srReg2) != -1)) TheApplication().RaiseError("Special character"); } if(stringName.indexOf(",") != -1)

CAM BS SCM
deleteAccountContacts
function deleteAccountContacts(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: deleteAccountContacts ** Created: 17.09.2010 ** Created By: Karin Haack ** Description: This method deletes all inactive contact-account relations and its roles of the account -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var aBOAccount:BusObject=null; var bBOAccount:BusObject=null; var aBCAccount:BusComp=null; var aBCAccountContact:BusComp=null; var aBCContactRole:BusComp=null; var strAccountId:String=""; var oBCContact:BusComp=null; var oBCContactAff:BusComp=null; if(bIsTraceOn) oApp.Trace(this.Name() + ".deleteAccountContacts START"); try{ strAccountId = Inputs.GetProperty("Account Id"); if (bIsTraceOn) oApp.Trace(Name() + ".deleteAccountContacts: strAccountId=" + strAccountId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccount = aBOAccount.GetBusComp("Account"); // for checking if deleted contact is part in any other account -> if not, set to Inactive bBOAccount = oApp.GetBusObject("Account"); oBCContact = bBOAccount.GetBusComp("Contact"); oBCContactAff = bBOAccount.GetBusComp("Account Contact SCM"); aBCAccount.ClearToQuery(); aBCAccount.SetViewMode(AllView); aBCAccount.SetSearchExpr("[Id] = '"+strAccountId+"'"); aBCAccount.ExecuteQuery(ForwardOnly); if( aBCAccount.FirstRecord()) { aBCAccountContact = aBOAccount.GetBusComp("Account Contact SCM"); //Delete inactive Contact Affilitations aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("Contact Id"); aBCAccountContact.SetSearchExpr("[End Date SCM] IS NOT NULL"); aBCAccountContact.ExecuteQuery(ForwardBackward); while (aBCAccountContact.FirstRecord()) { aBCContactRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCContactRole.ClearToQuery(); aBCContactRole.SetViewMode(AllView); aBCContactRole.SetSearchExpr("[Account Id SCM]='" + strAccountId + "' AND [Contact Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "'"); aBCContactRole.ExecuteQuery(ForwardBackward); while (aBCContactRole.FirstRecord()) { aBCContactRole.DeleteRecord(); } // checking for other accounts oBCContactAff.ClearToQuery(); oBCContactAff.SetViewMode(AllView); oBCContactAff.SetSearchExpr("[Contact Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "' AND [End Date SCM] IS NULL AND [Accnt Id]<>'" + strAccountId + "'"); oBCContactAff.ExecuteQuery(ForwardBackward); if( ! oBCContactAff.FirstRecord()) { // setting contact status to inactive oBCContact.ClearToQuery(); oBCContact.SetViewMode(AllView); oBCContact.ActivateField("Status"); oBCContact.SetSearchExpr("[Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "'"); oBCContact.ExecuteQuery(ForwardOnly); if(oBCContact.FirstRecord()) { oBCContact.SetFieldValue("Status", oApp.InvokeMethod("LookupValue","CONTACT_STATUS","Inactive")); oBCContact.WriteRecord(); } } aBCAccountContact.DeleteRecord(); } } } catch(e){ if (bIsTraceOn)oApp.Trace("An exception occurred in " + this.Name() + " ERROR: " + e.errText + "STACK: " + e.toString()); oApp.RaiseErrorText("An exception occurred in " + this.Name() + " ERROR: " + e.errText + "STACK: " + e.toString()); } finally{ aBCAccount = null; aBCAccountContact = null; aBCContactRole = null; oBCContact = null; oBCContactAff = null; aBOAccount = null; bBOAccount = null; } }

CAM BS SCM
deleteAccountContacts
/******************************************************* ** Name: deleteAccountContacts ** Created: 17.09.2010 ** Created By: Karin Haack ** Description: This method deletes all inactive contact-account relations and its roles of the account ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function deleteAccountContacts(Inputs,Outputs) { var aBOAccount:BusObject=null; var bBOAccount:BusObject=null; var aBCAccount:BusComp=null; var aBCAccountContact:BusComp=null; var aBCContactRole:BusComp=null; var strAccountId:String=""; var oBCContact:BusComp=null; var oBCContactAff:BusComp=null; try { strAccountId = Inputs.GetProperty("Account Id"); if (bIsTraceOn) oApp.Trace(Name() + ".deleteAccountContacts: strAccountId=" + strAccountId ); aBOAccount = oApp.GetBusObject("Account"); aBCAccount = aBOAccount.GetBusComp("Account"); // for checking if deleted contact is part in any other account -> if not, set to Inactive bBOAccount = oApp.GetBusObject("Account"); oBCContact = bBOAccount.GetBusComp("Contact"); oBCContactAff = bBOAccount.GetBusComp("Account Contact SCM"); aBCAccount.ClearToQuery(); aBCAccount.SetViewMode(AllView); aBCAccount.SetSearchExpr("[Id] = '"+strAccountId+"'"); aBCAccount.ExecuteQuery(ForwardOnly); if( aBCAccount.FirstRecord()) { aBCAccountContact = aBOAccount.GetBusComp("Account Contact SCM"); //Delete inactive Contact Affilitations aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("Contact Id"); aBCAccountContact.SetSearchExpr("[End Date SCM] IS NOT NULL"); aBCAccountContact.ExecuteQuery(ForwardBackward); while (aBCAccountContact.FirstRecord()) { aBCContactRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCContactRole.ClearToQuery(); aBCContactRole.SetViewMode(AllView); aBCContactRole.SetSearchExpr("[Account Id SCM]='" + strAccountId + "' AND [Contact Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "'"); aBCContactRole.ExecuteQuery(ForwardBackward); while (aBCContactRole.FirstRecord()) { aBCContactRole.DeleteRecord(); } // checking for other accounts oBCContactAff.ClearToQuery(); oBCContactAff.SetViewMode(AllView); oBCContactAff.SetSearchExpr("[Contact Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "' AND [End Date SCM] IS NULL AND [Accnt Id]<>'" + strAccountId + "'"); oBCContactAff.ExecuteQuery(ForwardBackward); if( ! oBCContactAff.FirstRecord()) { // setting contact status to inactive oBCContact.ClearToQuery(); oBCContact.SetViewMode(AllView); oBCContact.ActivateField("Status"); oBCContact.SetSearchExpr("[Id]='" + aBCAccountContact.GetFieldValue("Contact Id") + "'"); oBCContact.ExecuteQuery(ForwardOnly); if(oBCContact.FirstRecord()) { oBCContact.SetFieldValue("Status", oApp.InvokeMethod("LookupValue","CONTACT_STATUS","Inactive")); oBCContact.WriteRecord(); } } aBCAccountContact.DeleteRecord(); } } } catch(e) { oApp.Trace("An exception occurred in " + this.Name() + " ERROR: " + e.errText + "STACK: " + e.toString()); oApp.RaiseErrorText("An exception occurred in " + this.Name() + " ERROR: " + e.errText + "STACK: " + e.toString()); } finally { aBCAccount = null; aBCAccountContact = null; aBCContactRole = null; oBCContact = null; oBCContactAff = null; aBOAccount = null; bBOAccount = null; } }

CAM BS SCM
deleteContact
function deleteContact(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: deleteContact ** Created: 12.08.2010 ** Created By: Karin Haack ** Description: This method ends the relation contact-account -------------------- Modifications --------------------- ** Date Changed By Description ** 20161115 TAACONU1 WP1278 - Checks Account Segment. If it is SME or Role is met, sets Next Reminder date ******************************************************/ var aBOAccount:BusObject; var oBCContact:BusComp; var aBCAccountContact:BusComp; var aBCContactRole:BusComp; var loBCAccount:BusComp; var oDate:Date; var sTimestamp:chars = ""; var dateCalc:float; var monthCalc:float; var strContactId:chars; var strAccountId:chars; var affiliationId:chars; var lsLOVSecOfficer:String; var lsLOVSMESegment:String; var lsCurRole:String; var lsRoleFlag:String; var lsCalcGrobsegment:String; var lsNextReminderDateCalc4:String; var isRecord:bool = false; if(bIsTraceOn) oApp.Trace(this.Name() + ".deleteContact START"); try{ // Get required LOVs lsLOVSecOfficer = TheApplication().InvokeMethod("LookupValue","CONTACT_ROLE_SCM","Security Officer"); lsLOVSMESegment = TheApplication().InvokeMethod("LookupValue","CUSTOMER_SEGMENT_SCM","SME"); Outputs.SetProperty("Status","Active"); strContactId = Inputs.GetProperty("Contact Id"); strAccountId = Inputs.GetProperty("Account Id"); // setting end date of contact affiliation oDate = new Date; dateCalc = oDate.getDate(); dateCalc = dateCalc < 10 ? "0"+dateCalc : dateCalc; monthCalc = oDate.getMonth(); monthCalc= monthCalc < 9 ? "0"+(monthCalc+1) : (monthCalc+1); sTimestamp =""+monthCalc+"/"+dateCalc+"/"+oDate.getFullYear(); if (bIsTraceOn) oApp.Trace(Name() + ".deleteContact: strContactId=" + strContactId + ",strAccountId=" + strAccountId); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact SCM"); oBCContact = aBOAccount.GetBusComp("Contact"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.SetSearchExpr("[Accnt Id]='" + strAccountId + "' AND [Contact Id]='" + strContactId + "'"); aBCAccountContact.ExecuteQuery(ForwardOnly); if (aBCAccountContact.FirstRecord()) { aBCAccountContact.SetFieldValue("End Date SCM",sTimestamp); aBCAccountContact.WriteRecord(); } affiliationId = aBCAccountContact.GetFieldValue("Id"); // setting end date on all roles aBCContactRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCContactRole.ClearToQuery(); aBCContactRole.SetViewMode(AllView); aBCContactRole.ActivateField("End Date SCM"); aBCContactRole.SetSearchExpr("[Parent Row Id]='" + affiliationId + "' AND [End Date SCM] IS NULL"); aBCContactRole.ExecuteQuery(ForwardOnly); isRecord = aBCContactRole.FirstRecord(); while (isRecord) { lsCurRole = aBCContactRole.GetFieldValue("Role"); if(lsCurRole.toString() == lsLOVSecOfficer.toString()) lsRoleFlag = "Y"; aBCContactRole.SetFieldValue("End Date SCM",sTimestamp); aBCContactRole.WriteRecord(); isRecord = aBCContactRole.NextRecord(); } //Check if contact is part of any other account aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.SetSearchExpr("[Contact Id]='" + strContactId + "' AND [Id]<>'" + affiliationId + "' AND [End Date SCM] IS NULL"); aBCAccountContact.ExecuteQuery(ForwardOnly); if( ! aBCAccountContact.FirstRecord()) { oBCContact.ClearToQuery(); oBCContact.SetViewMode(AllView); oBCContact.ActivateField("Status"); oBCContact.ActivateField("Account Id"); oBCContact.SetSearchSpec("Id",strContactId); oBCContact.ExecuteQuery(ForwardOnly); if (oBCContact.FirstRecord()) { // contact exist in no other accounts -> setting status to Inactive oBCC

CAM BS SCM
deleteContact
/******************************************************* ** Name: deleteContact ** Created: 12.08.2010 ** Created By: Karin Haack ** Description: This method ends the relation contact-account ** -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function deleteContact(Inputs,Outputs) { var oDate:Date; var sTimestamp:String = ""; var dateCalc:float; var monthCalc:float; var aBOAccount:BusObject; var oBCContact:BusComp; var aBCAccountContact:BusComp; var aBCContactRole:BusComp; var strContactId:String; var strAccountId:String; try { Outputs.SetProperty("Status","Active"); strContactId = Inputs.GetProperty("Contact Id"); strAccountId = Inputs.GetProperty("Account Id"); // setting end date of contact affiliation oDate = new Date; dateCalc = oDate.getDate(); dateCalc = dateCalc < 10 ? "0"+dateCalc : dateCalc; monthCalc = oDate.getMonth(); monthCalc= monthCalc < 9 ? "0"+(monthCalc+1) : (monthCalc+1); sTimestamp =""+monthCalc+"/"+dateCalc+"/"+oDate.getFullYear(); if (bIsTraceOn) oApp.Trace(Name() + ".deleteContact: strContactId=" + strContactId + ",strAccountId=" + strAccountId); aBOAccount = oApp.GetBusObject("Account"); aBCAccountContact = aBOAccount.GetBusComp("Account Contact SCM"); oBCContact = aBOAccount.GetBusComp("Contact"); aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.ActivateField("End Date SCM"); aBCAccountContact.SetSearchExpr("[Accnt Id]='" + strAccountId + "' AND [Contact Id]='" + strContactId + "'"); aBCAccountContact.ExecuteQuery(ForwardOnly); if (aBCAccountContact.FirstRecord()) { aBCAccountContact.SetFieldValue("End Date SCM",sTimestamp); aBCAccountContact.WriteRecord(); } var affiliationId = aBCAccountContact.GetFieldValue("Id"); // setting end date on all roles aBCContactRole = aBOAccount.GetBusComp("Account Contact Affiliation Detail"); aBCContactRole.ClearToQuery(); aBCContactRole.SetViewMode(AllView); aBCContactRole.ActivateField("End Date SCM"); aBCContactRole.SetSearchExpr("[Parent Row Id]='" + affiliationId + "' AND [End Date SCM] IS NULL"); aBCContactRole.ExecuteQuery(ForwardOnly); var isRecord; isRecord = aBCContactRole.FirstRecord(); while (isRecord) { aBCContactRole.SetFieldValue("End Date SCM",sTimestamp); aBCContactRole.WriteRecord(); isRecord = aBCContactRole.NextRecord(); } //Check if contact is part of any other account aBCAccountContact.ClearToQuery(); aBCAccountContact.SetViewMode(AllView); aBCAccountContact.SetSearchExpr("[Contact Id]='" + strContactId + "' AND [Id]<>'" + affiliationId + "' AND [End Date SCM] IS NULL"); aBCAccountContact.ExecuteQuery(ForwardOnly); if( ! aBCAccountContact.FirstRecord()) { oBCContact.ClearToQuery(); oBCContact.SetViewMode(AllView); oBCContact.ActivateField("Status"); oBCContact.ActivateField("Account Id"); oBCContact.SetSearchSpec("Id",strContactId); oBCContact.ExecuteQuery(ForwardOnly); if (oBCContact.FirstRecord()) { // contact exist in no other accounts -> setting status to Inactive oBCContact.SetFieldValue("Status", oApp.InvokeMethod("LookupValue","CONTACT_STATUS","Inactive")); oBCContact.WriteRecord(); } Outputs.SetProperty("Status","Inactive"); } return(true); } catch(e) { return(false); } finally { oDate = null; aBCAccountContact = null; aBCContactRole = null; oBCContact = null; aBOAccount = null; } }

CAM BS SCM
fAuthenticateCustomer
function fAuthenticateCustomer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fAuthenticateCustomer ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fAuthenticateCustomer --> START"); var objBO:BusObject; var objBC:BusComp; var bsVP:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var sSCN:chars = ""; var sAccountId:chars = ""; var sLanguage:chars = ""; try{ sSCN = Inputs.GetProperty("SCN"); if(sSCN == null || sSCN == ""){ oApp.RaiseErrorText(this.Name() + ".fAuthenticateCustomer No SCN Provided"); } else{ objBO = oApp.GetBusObject("Account Search Screen BO EM SCM"); objBC = objBO.GetBusComp("Account Light EM SCM"); objBC.SetViewMode(AllView); objBC.ActivateField("Correspondence Language Code SCM"); objBC.ClearToQuery(); objBC.SetSearchSpec("Account Nr.", sSCN) objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()){ sAccountId = objBC.GetFieldValue("Id"); sLanguage = objBC.GetFieldValue("Correspondence Language Code SCM"); //Call voiceprint bsVP = oApp.GetService("Voiceprint Authentication Utilitiy SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("AccountId", sAccountId); psInputs.SetProperty("LanguageCode", sLanguage); bsVP.InvokeMethod("RunAuthenticationSmartScript", psInputs, psOutputs); } else{ oApp.RaiseErrorText(this.Name() + ".fAuthenticateCustomer No SCN Found"); } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fAuthenticateCustomer --> Error: " + e.message); throw(e); } finally{ objBC = null; objBO = null; bsVP = null; psInputs = null; psOutputs = null; sSCN = null; sAccountId = null; sLanguage = null; } }

CAM BS SCM
fAuthenticateCustomer
function fAuthenticateCustomer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fAuthenticateCustomer ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fAuthenticateCustomer --> START"); var objBO:BusObject; var objBC:BusComp; var bsVP:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var sSCN:chars = ""; var sAccountId:chars = ""; var sLanguage:chars = ""; try{ sSCN = Inputs.GetProperty("SCN"); if(sSCN == null || sSCN == ""){ oApp.RaiseErrorText(this.Name() + ".fAuthenticateCustomer No SCN Provided"); } else{ objBO = oApp.GetBusObject("Account Search Screen BO EM SCM"); objBC = objBO.GetBusComp("Account Light EM SCM"); objBC.SetViewMode(AllView); objBC.ActivateField("Correspondence Language Code SCM"); objBC.ClearToQuery(); objBC.SetSearchSpec("Account Nr.", sSCN) objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()){ sAccountId = objBC.GetFieldValue("Id"); sLanguage = objBC.GetFieldValue("Correspondence Language Code SCM"); //Call voiceprint bsVP = oApp.GetService("Voiceprint Authentication Utilitiy SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("AccountId", sAccountId); psInputs.SetProperty("LanguageCode", sLanguage); bsVP.InvokeMethod("RunAuthenticationSmartScript", psInputs, psOutputs); } else{ oApp.RaiseErrorText(this.Name() + ".fAuthenticateCustomer No SCN Found"); } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fAuthenticateCustomer --> Error: " + e.message); throw(e); } finally{ objBC = null; objBO = null; bsVP = null; psInputs = null; psOutputs = null; sSCN = null; sAccountId = null; sLanguage = null; } }

CAM BS SCM
fFormatCommInfoValidation
function fFormatCommInfoValidation(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: fFormatCommInfoValidation ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone number and the Email Address, clean up of existing old function ******************************************************/ var strValue:chars = ""; var strType:chars = ""; var strOutputs:chars = "FALSE"; try{ strValue = Inputs.GetProperty("Inputs"); strType = Inputs.GetProperty("Type"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fFormatCommInfoValidation --> srValue"+ strValue + " srType " + strType ); switch(strType){ case "Phone": strOutputs = fValidatePhoneFormat(strValue); break; case "PhoneMobile": strOutputs = fValidatePhoneMobileFormat(strValue); break; case "Email": strOutputs = fValidateEmailFormat(strValue); break; case "StrictEmail": strOutputs = fValidateStrictEmailFormat(strValue); break; case "PhoneFXNoStrict": strOutputs = fValidateFXPhoneNoStrictFormat(strValue); break; case "PhoneMCNoStrict": strOutputs = fValidateMCPhoneNoStrictFormat(strValue); break; case "PhoneSimple": strOutputs = fValidateNoStrictGeneralPhone(strValue); break; default: strOutputs = "FALSE"; break; } if(bIsTraceOn) oApp.Trace(this.Name() + ".fFormatCommInfoValidation --> srValue"+ strValue + " Valid: " + strOutputs ); Outputs.SetProperty("Outputs", strOutputs); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fFormatCommInfoValidation --> Error: " + e.message); throw(e); } finally{ strValue = null; strType = null; } }

CAM BS SCM
fFormatCommInfoValidation
function fFormatCommInfoValidation(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: fFormatCommInfoValidation ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone number and the Email Address, clean up of existing old function ******************************************************/ var strValue:chars = ""; var strType:chars = ""; var strOutputs:chars = "FALSE"; try{ strValue = Inputs.GetProperty("Inputs"); strType = Inputs.GetProperty("Type"); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fFormatCommInfoValidation --> srValue"+ strValue + " srType " + strType ); switch(strType){ case "Phone": strOutputs = fValidatePhoneFormat(strValue); break; case "PhoneMobile": strOutputs = fValidatePhoneMobileFormat(strValue); break; case "Email": strOutputs = fValidateEmailFormat(strValue); break; case "StrictEmail": strOutputs = fValidateStrictEmailFormat(strValue); break; case "PhoneFXNoStrict": strOutputs = fValidateFXPhoneNoStrictFormat(strValue); break; case "PhoneMCNoStrict": strOutputs = fValidateMCPhoneNoStrictFormat(strValue); break; case "PhoneSimple": strOutputs = fValidateNoStrictGeneralPhone(strValue); break; default: strOutputs = "FALSE"; break; } if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fFormatCommInfoValidation --> srValue"+ strValue + " Valid: " + strOutputs ); Outputs.SetProperty("Outputs", strOutputs); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fFormatCommInfoValidation --> Error: " + e.message); throw(e); } finally{ strValue = null; strType = null; } }

CAM BS SCM
fGetAttributeInfo
function fGetAttributeInfo(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** Name: fGetAttributeInfo ** Created: 29.11.2013 ** Created By: TGDSEAI1 Aingeru Sabando Lasuen SO 1890 ** Description: Get the Info for an XA attributt to be created *************************************************************************************************************/ //Declaration var objBO:BusObject; var objBC:BusComp; var objBS:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var psAttr:PropertySet; var psRoot:PropertySet; var psDomain:PropertySet; var strName:chars = ""; // output var strValue:chars = ""; // output var strTypeCode:chars = ""; // output var strXAId:chars = ""; // output var strFound:chars = "N"; // output, Y or N var strProductId:chars = ""; var strAttrName:chars = ""; var strAttrValue:chars = ""; var strError:chars = ""; var strAttr:chars = ""; var iAttrMax:float = 0; var iDomainMax:float = 0; var iDomain:float = 0; if (bIsTraceOn) oApp.Trace(this.Name() + ".fGetAttributeInfo START"); try{ //Initialiaze strProductId = Inputs.GetProperty("Product Id"); strAttrName = Inputs.GetProperty("Attribute Name"); strAttrValue = Inputs.GetProperty("Attribute Value"); objBS = oApp.GetService("Cfg Object Broker"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("RootId", strProductId); psInputs.SetProperty("Full", "N"); if (bIsTraceOn) oApp.Trace(this.Name() + ".fGetAttributeInfo strProductId = " +strProductId + " - strAttrName = " +strAttrName + " - strAttrValue = " +strAttrValue); try{ objBS.InvokeMethod("GetProdStruct", psInputs, psOutputs); if (bIsTraceOn) oApp.Trace(this.Name() + ".fGetAttributeInfo psOutputs"); if (bIsTraceOn) fWritePs(psOutputs); } catch(e){ if (bIsTraceOn)oApp.Trace(this.Name() + ".fGetAttributeInfo catch(e) = " +e.toString()); } finally{ objBS = null; psInputs = null; } strError = psOutputs.GetProperty("Error Message"); if (strError.length == 0){ if (psOutputs.GetChildCount() == 1){ psRoot = psOutputs.GetChild(0) iAttrMax = psRoot.GetChildCount(); for (var iAttr = 0; iAttr < iAttrMax; iAttr++){ psAttr = psRoot.GetChild(iAttr); if (psAttr.GetType() == "Attribute"){ if (psAttr.GetProperty("Name") == strAttrName){ strTypeCode = psAttr.GetProperty("LocalType"); iDomainMax = psAttr.GetChildCount(); if(iDomainMax > 0){//TGDSEAI1 31.08.2011 Olympia R3 Check if value is valid only when it is a enumerated value when it has a child domain for (iDomain = 0; iDomain < iDomainMax; iDomain++){ psDomain = psAttr.GetChild(iDomain); if (psDomain.GetProperty("InternalValue") == strAttrValue){ strValue = psDomain.GetProperty("LocalValue"); objBO = oApp.GetBusObject("VOD ImpExp BO"); objBC = objBO.GetBusComp("VOD ImpExp BC"); objBC.ClearToQuery(); objBC.SetSearchSpec("VOD Name", strAttrName); objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()){ strXAId = objBC.GetFieldValue("VOD Object Num"); strFound = "Y"; } break; }//End If }//End for } else {//TGDSEAI1 31.08.2011 Olympia R3 No domain freetext attr strValue = strAttrValue; objBO = oApp.GetBusObject("VOD ImpExp BO"); objBC = objBO.GetBusComp("VOD ImpExp BC"); objBC.ClearToQuery(); objBC.SetSearchSpec("VOD Name", strAttrName); objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()){ strXAId = objBC.GetFieldValue("VOD Object Num"); strFound = "Y"; } }//End else break; } } } } } else { if (bIsTraceOn) oApp.Trace(this.Name() + ".fGetAttributeInf

CAM BS SCM
fGetAttributeInfo
function fGetAttributeInfo(Inputs, Outputs) { /************************************************************************************************************** ** Name: fGetAttributeInfo ** Created: 29.11.2013 ** Created By: TGDSEAI1 SO 1890 ** Description: Get the Info for an XA attributt to be created *************************************************************************************************************/ //Declaration var objBO:BusObject; var objBC:BusComp; var objBS:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var psAttr:PropertySet; var psRoot:PropertySet; var psDomain:PropertySet; var strName = ""; // output var strValue = ""; // output var strTypeCode = ""; // output var strXAId = ""; // output var strFound = "N"; // output, Y or N var strProductId = ""; var strAttrName = ""; var strAttrValue = ""; var strError = ""; var strAttr = ""; var iAttrMax = 0; var iDomainMax = 0; var iDomain = 0; try { //Initialiaze strProductId = Inputs.GetProperty("Product Id"); strAttrName = Inputs.GetProperty("Attribute Name"); strAttrValue = Inputs.GetProperty("Attribute Value"); objBS = TheApplication().GetService("Cfg Object Broker"); psInputs = TheApplication().NewPropertySet(); psOutputs = TheApplication().NewPropertySet(); psInputs.SetProperty("RootId", strProductId); psInputs.SetProperty("Full", "N"); if (bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetAttributeInfo strProductId = " +strProductId); if (bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetAttributeInfo strAttrName = " +strAttrName); if (bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetAttributeInfo strAttrValue = " +strAttrValue); try { objBS.InvokeMethod("GetProdStruct", psInputs, psOutputs); if (bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetAttributeInfo psOutputs"); if (bIsTraceOn) fWritePs(psOutputs); } catch(e) { if (bIsTraceOn)TheApplication().Trace(this.Name() + ".fGetAttributeInfo catch(e) = " +e.toString()); } finally { objBS = null; psInputs = null; } strError = psOutputs.GetProperty("Error Message"); if (strError.length == 0) { if (psOutputs.GetChildCount() == 1) { psRoot = psOutputs.GetChild(0) iAttrMax = psRoot.GetChildCount(); for (var iAttr = 0; iAttr < iAttrMax; iAttr++) { psAttr = psRoot.GetChild(iAttr); if (psAttr.GetType() == "Attribute") { if (psAttr.GetProperty("Name") == strAttrName) { strTypeCode = psAttr.GetProperty("LocalType"); iDomainMax = psAttr.GetChildCount(); //TGDSEAI1 31.08.2011 Olympia R3 //Check if value is valid only when it is a enumerated value when it has a child domain if(iDomainMax > 0){ for (iDomain = 0; iDomain < iDomainMax; iDomain++) { psDomain = psAttr.GetChild(iDomain); if (psDomain.GetProperty("InternalValue") == strAttrValue) { strValue = psDomain.GetProperty("LocalValue"); objBO = TheApplication().GetBusObject("VOD ImpExp BO"); objBC = objBO.GetBusComp("VOD ImpExp BC"); objBC.ClearToQuery(); objBC.SetSearchSpec("VOD Name", strAttrName); objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()) { strXAId = objBC.GetFieldValue("VOD Object Num"); strFound = "Y"; } break; }//End If }//End for }//End If else{ //TGDSEAI1 31.08.2011 Olympia R3 //No domain freetext attr strValue = strAttrValue; objBO = TheApplication().GetBusObject("VOD ImpExp BO"); objBC = objBO.GetBusComp("VOD ImpExp BC"); objBC.ClearToQuery(); objBC.SetSearchSpec("VOD Name", strAttrName); objBC.ExecuteQuery(ForwardOnly); if(objBC.FirstRecord()) { strXAId = objBC.GetFieldValue("VOD Object Num");

CAM BS SCM
fGetBankIdFromIBAN
function fGetBankIdFromIBAN(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** Name: fGetBankIdFromIBAN ** Created: 20.03.2014 ** Created By: TGDSEAI1 Aingeru Sabando Lasuen Defect retrieving the bank number ** Description: From an input IBAN get the Id of the Bank in the SIC table *************************************************************************************************************/ var objBusObj:BusObject; var objBusComp:BusComp; var strIBAN:chars = ""; var strBankId:chars = ""; var strClearing:chars = ""; try { strIBAN = Inputs.GetProperty("IBAN"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetBankIdFromIBAN START: " + strIBAN); strIBAN = strIBAN.replace(/ /g,""); strIBAN = strIBAN.toUpperCase(); strClearing = strIBAN.substring(4,9); while(strClearing.charAt("0") == "0"){ strClearing = strClearing.substring(1); } if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetBankIdFromIBAN ClearingNumber: " + strClearing); objBusObj = oApp.GetBusObject("SIC Bankenstamm SCM"); objBusComp = objBusObj.GetBusComp("SIC Bankenstamm SCM"); objBusComp.SetViewMode(AllView); objBusComp.ClearToQuery(); objBusComp.SetSearchSpec("Bank Clearing Number", strClearing); objBusComp.SetSearchSpec("Fillial Number", "0000"); objBusComp.SetSortSpec("BC Type (ASC)"); objBusComp.ExecuteQuery(ForwardOnly); if (objBusComp.FirstRecord()) { if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetBankIdFromIBAN BankFound: " + objBusComp.GetFieldValue("Id")); strBankId = objBusComp.GetFieldValue("Id"); } if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetBankIdFromIBAN BankId-> " + strBankId +"<-"); Outputs.SetProperty("BankId", strBankId); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetBankIdFromIBAN Error: " + e.message); throw(e); } finally{ objBusComp = null; objBusObj = null; strIBAN = null; } }

CAM BS SCM
fGetBankIdFromIBAN
function fGetBankIdFromIBAN(Inputs:PropertySet, Outputs:PropertySet) { /************************************************************************************************************** ** Name: fGetBankIdFromIBAN ** Created: 20.03.2014 ** Created By: TGDSEAI1 Defect retrieving the bank number ** Description: From an input IBAN get the Id of the Bank in the SIC table *************************************************************************************************************/ var objBusObj:BusObject; var objBusComp:BusComp; var strIBAN = ""; var strBankId = ""; var strClearing = ""; try { strIBAN = Inputs.GetProperty("IBAN"); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetBankIdFromIBAN START: " + strIBAN); strIBAN = strIBAN.replace(/ /g,""); strIBAN = strIBAN.toUpperCase(); strClearing = strIBAN.substring(4,9); while(strClearing.charAt("0") == "0") strClearing = strClearing.substring(1); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetBankIdFromIBAN ClearingNumber: " + strClearing); objBusObj = TheApplication().GetBusObject("SIC Bankenstamm SCM"); objBusComp = objBusObj.GetBusComp("SIC Bankenstamm SCM"); objBusComp.SetViewMode(AllView); objBusComp.ClearToQuery(); objBusComp.SetSearchSpec("Bank Clearing Number", strClearing); objBusComp.SetSearchSpec("Fillial Number", "0000"); objBusComp.SetSortSpec("BC Type (ASC)"); objBusComp.ExecuteQuery(ForwardOnly); if (objBusComp.FirstRecord()) { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetBankIdFromIBAN BankFound: " + objBusComp.GetFieldValue("Id")); strBankId = objBusComp.GetFieldValue("Id"); } if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetBankIdFromIBAN BankId-> " + strBankId +"<-"); Outputs.SetProperty("BankId", strBankId); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fGetBankIdFromIBAN Error: " + e.message); throw(e); } finally{ objBusComp = null; objBusObj = null; strIBAN = null; } }

CAM BS SCM
fGetDVMMessage
function fGetDVMMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fGetDVMMessage ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> START"); var bsGR:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var sCode:chars = ""; try{ sCode = Inputs.GetProperty("CODE"); if(sCode == null || sCode == ""){ oApp.RaiseErrorText(this.Name() + ".fGetDVMMessage No CODE Provided"); } else{ bsGR = oApp.GetService("Generic Retention SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("Code", sCode); bsGR.InvokeMethod("Get Error Message", psInputs, psOutputs); Outputs.SetProperty("Message", psOutputs.GetProperty("Result")); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> Message: " + psOutputs.GetProperty("Result")); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> Error: " + e.message); throw(e); } finally{ bsGR = null; psInputs = null; psOutputs = null; sCode = null; } }

CAM BS SCM
fGetDVMMessage
function fGetDVMMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fGetDVMMessage ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> START"); var bsGR:Service; var psInputs:PropertySet; var psOutputs:PropertySet; var sCode:chars = ""; try{ sCode = Inputs.GetProperty("CODE"); if(sCode == null || sCode == ""){ oApp.RaiseErrorText(this.Name() + ".fGetDVMMessage No CODE Provided"); } else{ bsGR = oApp.GetService("Generic Retention SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psInputs.SetProperty("Code", sCode); bsGR.InvokeMethod("Get Error Message", psInputs, psOutputs); Outputs.SetProperty("Message", psOutputs.GetProperty("Result")); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> Message: " + psOutputs.GetProperty("Result")); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetDVMMessage --> Error: " + e.message); throw(e); } finally{ bsGR = null; psInputs = null; psOutputs = null; sCode = null; } }

CAM BS SCM
fGetMobileComponentIntegrationId
function fGetMobileComponentIntegrationId(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** Name: fGetMobileComponentIntegrationId ** Created: 19.03.2015 ** Created By: TAASAAI2 ** Description: Return the mobile integration id (componet or subscription) based on input integration id ** Inputs: IntegrationId ** Outputs: MobileIntegrationid *************************************************************************************************************/ //variable declarations var objBO:BusObject; var objBCAsset:BusComp; var strIntegrationId:chars = ""; var strMobileIntegrationid:chars = ""; var strSearchExpr:chars = ""; try{ strIntegrationId = Inputs.GetProperty("IntegrationId"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId START IntegrationId: " + strIntegrationId); if(strIntegrationId != null && strIntegrationId != ""){ // TGDGEMAM 2016-06-29 (Oct16) WP 1152 => Multi Device 1.0: added NG_Mobile product strSearchExpr = "[Status] = 'Active' AND ([Product Name]='N_Mobile' OR [Product Name]='NG_Mobile' OR [Service Type]='Subscription') AND ([Reference Number 2 SCM]='" + strIntegrationId + "' OR [Integration Id] = '" + strIntegrationId + "')" if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId strSearchExpr: " + strSearchExpr); objBO = oApp.GetBusObject("FE Service Request Simple BO SCM"); objBCAsset = objBO.GetBusComp("Asset Query SCM"); objBCAsset.SetViewMode(AllView); objBCAsset.ActivateField("Integration Id"); objBCAsset.ClearToQuery(); objBCAsset.SetSearchExpr(strSearchExpr); objBCAsset.ExecuteQuery(); if(objBCAsset.FirstRecord()){ strMobileIntegrationid = objBCAsset.GetFieldValue("Integration Id"); } } Outputs.SetProperty("MobileIntegrationId", strMobileIntegrationid); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId Error: " + e.message); throw(e); } finally{ objBCAsset = null; objBO = null; } }

CAM BS SCM
fGetMobileComponentIntegrationId
function fGetMobileComponentIntegrationId(Inputs:PropertySet, Outputs:PropertySet) { /************************************************************************************************************** ** Name: fGetMobileComponentIntegrationId ** Created: 19.03.2015 ** Created By: TAASAAI2 ** Description: Return the mobile integration id (componet or subscription) based on input integration id ** Inputs: IntegrationId ** Outputs: MobileIntegrationid *************************************************************************************************************/ //variable declarations var objBO:BusObject; var objBCAsset:BusComp; var strIntegrationId = ""; var strMobileIntegrationid = ""; var strSearchExpr = ""; try{ strIntegrationId = Inputs.GetProperty("IntegrationId"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId IntegrationId: " + strIntegrationId); if(strIntegrationId != null && strIntegrationId != ""){ strSearchExpr = "[Status] = 'Active' AND ([Product Name]='N_Mobile' OR [Service Type]='Subscription') AND ([Reference Number 2 SCM]='" + strIntegrationId + "' OR [Integration Id] = '" + strIntegrationId + "')" if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId strSearchExpr: " + strSearchExpr); objBO = oApp.GetBusObject("FE Service Request Simple BO SCM"); objBCAsset = objBO.GetBusComp("Asset Query SCM"); objBCAsset.SetViewMode(AllView); objBCAsset.ActivateField("Integration Id"); objBCAsset.ClearToQuery(); objBCAsset.SetSearchExpr(strSearchExpr); objBCAsset.ExecuteQuery(); if(objBCAsset.FirstRecord()){ strMobileIntegrationid = objBCAsset.GetFieldValue("Integration Id"); } } Outputs.SetProperty("MobileIntegrationId", strMobileIntegrationid); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMobileComponentIntegrationId Error: " + e.message); throw(e); } finally{ objBCAsset = null; objBO = null; } }

CAM BS SCM
fGetMultipleDVMMessage
function fGetMultipleDVMMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fGetMultipleDVMMessage ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> START"); var bsGR:Service; var psAux:PropertySet; var psInputs:PropertySet; var psOutputs:PropertySet; var psOutAux:PropertySet; var psOutAuxParent:PropertySet; var sCode:chars = ""; var sMessage:chars = ""; var nChild:float = 0; try{ fWritePs(Inputs); nChild = Inputs.GetChildCount(); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Childs: " + nChild); if(nChild > 0){ bsGR = oApp.GetService("Generic Retention SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psOutAux = oApp.NewPropertySet(); psOutAuxParent = oApp.NewPropertySet(); psOutAuxParent.SetType("Messages"); for(var index = 0;index < nChild; index++){ psAux = Inputs.GetChild(index); sCode = psAux.GetProperty("Code"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Code: " + sCode); if(sCode != "" && sCode != null){ psInputs.SetProperty("Code", sCode); bsGR.InvokeMethod("Get Error Message", psInputs, psOutputs); sMessage = psOutputs.GetProperty("Result"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Message: " + sMessage); psOutAux.SetProperty("Code", sCode); psOutAux.SetProperty("Message", sMessage); psOutAuxParent.AddChild(psOutAux.Copy()); } } Outputs.AddChild(psOutAuxParent); } else{ oApp.RaiseErrorText(this.Name() + ".fGetMultipleDVMMessage No Inputs Provided"); } fWritePs(Outputs); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Error: " + e.message); throw(e); } finally{ bsGR = null; psInputs = null; psOutputs = null; psOutAux = null; psAux = null; psOutAuxParent = null; sCode = null; nChild = null; sMessage = null; } }

CAM BS SCM
fGetMultipleDVMMessage
function fGetMultipleDVMMessage(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fGetMultipleDVMMessage ** Created: 11.01.2016 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: WP855 Voiceprint ******************************************************/ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> START"); var bsGR:Service; var psAux:PropertySet; var psInputs:PropertySet; var psOutputs:PropertySet; var psOutAux:PropertySet; var psOutAuxParent:PropertySet; var sCode:chars = ""; var sMessage:chars = ""; var nChild:float = 0; try{ fWritePs(Inputs); nChild = Inputs.GetChildCount(); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Childs: " + nChild); if(nChild > 0){ bsGR = oApp.GetService("Generic Retention SCM"); psInputs = oApp.NewPropertySet(); psOutputs = oApp.NewPropertySet(); psOutAux = oApp.NewPropertySet(); psOutAuxParent = oApp.NewPropertySet(); psOutAuxParent.SetType("Messages"); for(var index = 0;index < nChild; index++){ psAux = Inputs.GetChild(index); sCode = psAux.GetProperty("Code"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Code: " + sCode); if(sCode != "" && sCode != null){ psInputs.SetProperty("Code", sCode); bsGR.InvokeMethod("Get Error Message", psInputs, psOutputs); sMessage = psOutputs.GetProperty("Result"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Message: " + sMessage); psOutAux.SetProperty("Code", sCode); psOutAux.SetProperty("Message", sMessage); psOutAuxParent.AddChild(psOutAux.Copy()); } } Outputs.AddChild(psOutAuxParent); } else{ oApp.RaiseErrorText(this.Name() + ".fGetMultipleDVMMessage No Inputs Provided"); } fWritePs(Outputs); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fGetMultipleDVMMessage --> Error: " + e.message); throw(e); } finally{ bsGR = null; psInputs = null; psOutputs = null; psOutAux = null; psAux = null; psOutAuxParent = null; sCode = null; nChild = null; sMessage = null; } }

CAM BS SCM
fIsStringInSet
function fIsStringInSet(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** Name: fIsStringInSet ** Created: 07.02.2012 ** Created By: TGDSEAI1 Aingeru Sabando Lasuen ** Description: Apply general attachment validation for OTTO attachments. ** Attachment validation: Check whether or not the file extension is of a type which is not ** entitled to be uploaded into third-party file systems. ** Outputs: strExclusionFlag. *************************************************************************************************************/ var strStringToCheck:chars = ""; var strStringSet:String; var strStringSeparator:String; var strModStringSet:String; // modified StringSet var strModStringToCheck:chars = ""; // modified StringToCheck var strStringProcessing:chars = null; var strExclusionFlag:chars = "N"; if(bIsTraceOn) oApp.Trace(this.Name() + ".fIsStringInSet START"); try{ // Get PS strStringToCheck = Inputs.GetProperty("StringToCheck"); strStringSet = Inputs.GetProperty("StringSet"); strStringSeparator = Inputs.GetProperty("StringSeparator"); // String preparation: Enrich the values with the StringSeparator comma (,) // in order to distinguish "html" from "htmlx" -> e.g.: ,html, is not included in ,htmlx, strModStringSet = strStringSeparator + strStringSet + strStringSeparator; strModStringToCheck = strStringSeparator + strStringToCheck + strStringSeparator; // Ensure correct string comparison via having set all the values to upper case strModStringSet = strModStringSet.toUpperCase(); strModStringToCheck = strModStringToCheck.toUpperCase(); // String processing: IndexOf returns -1 if nothing found strStringProcessing = strModStringSet.indexOf(strModStringToCheck); // Check whether String is found in excluded file extension // If substring is not found, then the function returns a value of -1. if(strStringProcessing != -1){ // String found -> attachment is of non-valid file extension strExclusionFlag = "Y"; } Outputs.SetProperty("FlagExcluded",strExclusionFlag); } // end try catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fIsStringInSet ERROR:" + e.message); throw(e); } // end catch finally{ strStringToCheck = null strStringSet = null strStringSeparator = null strModStringSet = null; strModStringToCheck = null; strStringProcessing = null; strExclusionFlag = null; } // end finally } // end function

CAM BS SCM
fIsStringInSet
function fIsStringInSet(Inputs, Outputs) { /************************************************************************************************************** ** Name: fIsStringInSet ** Created: 07.02.2012 ** Created By: TGDSEAI1 TGDSTKA9 CR594 ** Description: Apply general attachment validation for OTTO attachments. ** Attachment validation: Check whether or not the file extension is of a type which is not ** entitled to be uploaded into third-party file systems. ** Outputs: strExclusionFlag. *************************************************************************************************************/ var strStringToCheck; var strStringSet:String; var strStringSeparator:String; var strModStringSet:String; // modified StringSet var strModStringToCheck; // modified StringToCheck var strStringProcessing = null; var strExclusionFlag = "N"; try { // Get PS strStringToCheck = Inputs.GetProperty("StringToCheck"); strStringSet = Inputs.GetProperty("StringSet"); strStringSeparator = Inputs.GetProperty("StringSeparator"); // String preparation: Enrich the values with the StringSeparator comma (,) // in order to distinguish "html" from "htmlx" -> e.g.: ,html, is not included in ,htmlx, strModStringSet = strStringSeparator + strStringSet + strStringSeparator; strModStringToCheck = strStringSeparator + strStringToCheck + strStringSeparator; // Ensure correct string comparison via having set all the values to upper case strModStringSet = strModStringSet.toUpperCase(); strModStringToCheck = strModStringToCheck.toUpperCase(); // String processing: IndexOf returns -1 if nothing found strStringProcessing = strModStringSet.indexOf(strModStringToCheck); // Check whether String is found in excluded file extension // If substring is not found, then the function returns a value of -1. if(strStringProcessing != -1) { // String found -> attachment is of non-valid file extension strExclusionFlag = "Y"; } Outputs.SetProperty("FlagExcluded",strExclusionFlag); } // end try catch(e) { trc("Error in fIsStringInSet: " + e.message); throw(e); } // end catch finally { strStringToCheck = null strStringSet = null strStringSeparator = null strModStringSet = null; strModStringToCheck = null; strStringProcessing = null; strExclusionFlag = null; } // end finally } // end function

CAM BS SCM
fSetProfileAttributeWithId
function fSetProfileAttributeWithId(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fSetProfileAttributeWithId ** Created: 23.06.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: Set a profile attribute with the Id of the record in the Active BC ******************************************************/ var objActiveBO:BusObject; var objBC:BusComp; var arrInputArray:Array; var intIndex:float = 0; var strContext:chars = ""; var strBCName:chars = ""; var strBOName:chars = ""; var strProfAttrName:chars = ""; if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId START"); try{ strContext = Inputs.GetProperty("Context"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId strContext: " + strContext); //Get from context RTE OR DMV call if(strContext != "" && strContext != null){ arrInputArray = strContext.split(","); if(arrInputArray.length == 4){ if (arrInputArray[0] == "BCName") { strBCName = arrInputArray[1]; } if(arrInputArray[2] == "ProfAttributeName"){ strProfAttrName = arrInputArray[2]; } } else{ oApp.RaiseErrorText(this.Name() + ".fSetProfileAttributeWithId Wrong number of parameters"); } } else{ //get from inputs strBCName = Inputs.GetProperty("BCName"); strProfAttrName = Inputs.GetProperty("ProfAttributeName"); } //Check if they are filled if(strBCName == "" ||strBCName == null || strProfAttrName == "" || strProfAttrName == null){ oApp.RaiseErrorText(this.Name() + ".fSetProfileAttributeWithId Required Input Parameter Missed"); } if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BCName " + strBCName); if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BCName " + strProfAttrName); //Get Active BO objActiveBO = oApp.ActiveBusObject(); try{ strBOName = objActiveBO.Name(); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId No Active BO"); strBOName = ""; } //Check if we are in a active BO if(strBOName!= null && strBOName != ""){ try{ objBC = objActiveBO.GetBusComp(strBCName); } catch(e){ //Do nothing if BC is not in BO if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BC not in Active BO"); } if(BCHasRecord(objBC)){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId " + strProfAttrName + ": " + objBC.GetFieldValue("Id")); oApp.SetProfileAttr(strProfAttrName, objBC.GetFieldValue("Id")); } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId Error: " + e.message); throw(e); } finally{ objBC = null; objActiveBO = null; arrInputArray = null; intIndex = null; strContext = null; strBCName = null; strBOName = null; strProfAttrName = null; } }

CAM BS SCM
fSetProfileAttributeWithId
function fSetProfileAttributeWithId(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fSetProfileAttributeWithId ** Created: 23.06.2015 ** Created By: TAASAAI2 Aingeru Sabando Lasuen ** Description: Set a profile attribute with the Id of the record in the Active BC ******************************************************/ var objActiveBO:BusObject; var objBC:BusComp; var arrInputArray:Array; var intIndex = 0; var strContext = ""; var strBCName = ""; var strBOName = ""; var strProfAttrName = ""; if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId Start"); try{ strContext = Inputs.GetProperty("Context"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId strContext: " + strContext); //Get from context RTE OR DMV call if(strContext != "" && strContext != null){ arrInputArray = strContext.split(","); if(arrInputArray.length == 4){ if (arrInputArray[0] == "BCName") { strBCName = arrInputArray[1]; } if(arrInputArray[2] == "ProfAttributeName"){ strProfAttrName = arrInputArray[2]; } } else{ oApp.RaiseErrorText(this.Name() + ".fSetProfileAttributeWithId Wrong number of parameters"); } } else{ //get from inputs strBCName = Inputs.GetProperty("BCName"); strProfAttrName = Inputs.GetProperty("ProfAttributeName"); } //Check if they are filled if(strBCName == "" ||strBCName == null || strProfAttrName == "" || strProfAttrName == null){ oApp.RaiseErrorText(this.Name() + ".fSetProfileAttributeWithId Required Input Parameter Missed"); } if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BCName " + strBCName); if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BCName " + strProfAttrName); //Get Active BO objActiveBO = oApp.ActiveBusObject(); try{ strBOName = objActiveBO.Name(); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId No Active BO"); strBOName = ""; } //Check if we are in a active BO if(strBOName!= null && strBOName != ""){ try{ objBC = objActiveBO.GetBusComp(strBCName); } catch(e){ //Do nothing if BC is not in BO if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId BC not in Active BO"); } if(BCHasRecord(objBC)){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId " + strProfAttrName + ": " + objBC.GetFieldValue("Id")); oApp.SetProfileAttr(strProfAttrName, objBC.GetFieldValue("Id")); } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetProfileAttributeWithId Error: " + e.message); throw(e); } finally{ objBC = null; objActiveBO = null; arrInputArray = null; intIndex = null; strContext = null; strBCName = null; strBOName = null; strProfAttrName = null; } }

CAM BS SCM
fSetSRServicePointAssetId
function fSetSRServicePointAssetId(Inputs,Outputs){ /******************************************************* ** Name: fSetSRServicePointAssetId ** Created: 03.04.2014 ** Created By: Christoph Reitermann ** Description: This method sets Service Point Asset Id on SR. Added due to #91778 -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var oBO:BusObject; var oBC:BusComp; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetSRServicePointAssetId START"); oBO = oApp.GetBusObject("Service Request"); oBC = oBO.GetBusComp("Service Request"); oBC.ClearToQuery(); oBC.SetViewMode(3); oBC.ActivateField("Service Point Asset Id"); oBC.SetSearchSpec("Id", Inputs.GetProperty("SRID")); oBC.ExecuteQuery(); oBC.FirstRecord(); oBC.SetFieldValue("Service Point Asset Id", Inputs.GetProperty("SRAssetId")); oBC.WriteRecord(); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSetSRServicePointAssetId Error: " + e.mmessage); throw(e); } finally{ oBC = null; oBO = null; } }

CAM BS SCM
fSetSRServicePointAssetId
function fSetSRServicePointAssetId(Inputs,Outputs){ /******************************************************* ** Name: fSetSRServicePointAssetId ** Created: 03.04.2014 ** Created By: Christoph Reitermann ** Description: This method sets Service Point Asset Id on SR. ** Added due to #91778 ******************************************************/ try{ var oBO:BusObject = TheApplication().GetBusObject("Service Request"); var oBC:BusComp = oBO.GetBusComp("Service Request"); oBC.ClearToQuery(); oBC.SetViewMode(3); oBC.ActivateField("Service Point Asset Id"); oBC.SetSearchSpec("Id", Inputs.GetProperty("SRID")); oBC.ExecuteQuery(); oBC.FirstRecord(); oBC.SetFieldValue("Service Point Asset Id", Inputs.GetProperty("SRAssetId")); oBC.WriteRecord(); } catch(e){ TheApplication().RaiseErrorText(e.toString()); } finally{ oBC = null; oBO = null; } }

CAM BS SCM
fSplitAndTest
function fSplitAndTest(Inputs,Outputs){ /******************************************************* ** Name: fSplitAndTest ** Created: 11.09.2015 ** Created By: Donato Colacicco ** Description: This method split a given string in an array of strings and test each element against a given Regular Expression. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ************************************************************************************************************/ var oStringArray : Array; var oStringRule : RegExp; var sPattern:chars; var sStringToTest:chars; var sDelminiter:chars; var sVal:chars = ""; var i:float = 0; var Result:float = 1; try{ sPattern = Inputs.GetProperty("Pattern"); sStringToTest = Inputs.GetProperty("TestString"); sDelminiter = Inputs.GetProperty("Delimiter"); if(bIsTraceOn) oApp.Trace(this.Name() + ".fSplitAndTest START Pattern: " + sPattern+ " - TestString: " + sStringToTest+ " - Delimiter" + sDelminiter); oStringRule = new RegExp(sPattern); if(sDelminiter == null || sDelminiter == "" || sDelminiter == "undefined") sDelminiter = " "; oStringArray = sStringToTest.split(sDelminiter); while(i<oStringArray.length && Result == 1){ sVal = oStringArray[i]; if(oStringRule.test(sVal))Result = 0; i++; } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fSplitAndTest ERROR: " + e.message); throw(e); } finally{ oStringArray = null; oStringRule = null; Outputs.SetProperty("TestResult",Result); } }

CAM BS SCM
fSplitAndTest
function fSplitAndTest(Inputs,Outputs) { /******************************************************* ** Name: fSplitAndTest ** Created: 11.09.2015 ** Created By: Donato Colacicco ** Description: This method split a given string in an array of strings and test each element against a given Regular Expression. ************************************************************************************************************/ var sPattern = Inputs.GetProperty("Pattern"); var sStringToTest = Inputs.GetProperty("TestString"); var sDelminiter = Inputs.GetProperty("Delimiter"); var oStringArray : Array ; var oStringRule : RegExp = new RegExp(sPattern); var i=0; var Result = 1; var sVal = ""; try { if(sDelminiter == null || sDelminiter == "" || sDelminiter == "undefined") sDelminiter = " "; oStringArray = sStringToTest.split(sDelminiter); while(i<oStringArray.length && Result == 1) { sVal = oStringArray[i]; if(oStringRule.test(sVal)) Result = 0; i++; } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Error: " + e.message); throw(e); } finally { oStringArray = null; oStringRule = null; Outputs.SetProperty("TestResult",Result); } }

CAM BS SCM
fValidateBPbyBrand
function fValidateBPbyBrand(strAccountId:String, strBrand:String, strBPNr:String){ /******************************************************* ** Name: fValidateBPbyBrand ** Created: 28.82.2014 ** Created By: Lucas Requiao ** Description: Avoid Billing Profile SR submission when for the context customer exist an All IP Billing Profile with no active contracts and the same Brand. ** Input: strAccountId -> BP belongs to strBrand -> BP Brand ** Output: false -> Stop submission. -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var boActive:BusObject = null; var bcBillingProfile:BusComp = null; var breturn:Boolean = true; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateBPbyBrand START") // Get current billing profile bc boActive = oApp.GetBusObject("EAI Billing Profile SCM"); bcBillingProfile = boActive.GetBusComp("Com Invoice Profile SCM"); bcBillingProfile.SetViewMode(AllView); bcBillingProfile.ClearToQuery(); bcBillingProfile.SetSearchSpec("Account Id", strAccountId); bcBillingProfile.SetSearchSpec("Status", "1"); bcBillingProfile.SetSearchSpec("Bill Source", "6"); bcBillingProfile.SetSearchSpec("Brand SCM", strBrand); bcBillingProfile.SetSearchSpec("External Billing Account Number SCM", "<> " + strBPNr); bcBillingProfile.SetSearchSpec("Active Contract Exists Flag SCM", "N"); bcBillingProfile.ExecuteQuery(ForwardOnly); if (bcBillingProfile.FirstRecord()){ breturn = false; } } catch (e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateBPbyBrand ERROR:" + e.message); breturn = false; throw(e); } finally { bcBillingProfile = null; boActive = null; } return (breturn); }

CAM BS SCM
fValidateBPbyBrand
function fValidateBPbyBrand(strAccountId:String, strBrand:String, strBPNr:String) { /******************************************************* ** Name: fValidateBPbyBrand ** Created: 28.82.2014 ** Created By: Lucas Requiao ** Description: Avoid Billing Profile SR submission when for the context customer exist an All IP Billing Profile ** with no active contracts and the same Brand. ** Input: strAccountId -> BP belongs to ** strBrand -> BP Brand ** Output: false -> Stop submission. ******************************************************/ var boActive:BusObject = null; var bcBillingProfile:BusComp = null; var breturn:Boolean = true; try { // Get current billing profile bc boActive = oApp.GetBusObject("EAI Billing Profile SCM"); bcBillingProfile = boActive.GetBusComp("Com Invoice Profile SCM"); bcBillingProfile.SetViewMode(AllView); bcBillingProfile.ClearToQuery(); bcBillingProfile.SetSearchSpec("Account Id", strAccountId); bcBillingProfile.SetSearchSpec("Status", "1"); bcBillingProfile.SetSearchSpec("Bill Source", "6"); bcBillingProfile.SetSearchSpec("Brand SCM", strBrand); bcBillingProfile.SetSearchSpec("External Billing Account Number SCM", "<> " + strBPNr); bcBillingProfile.SetSearchSpec("Active Contract Exists Flag SCM", "N"); bcBillingProfile.ExecuteQuery(ForwardOnly); if (bcBillingProfile.FirstRecord()){ breturn = false; } } catch (e) { breturn = false; throw(e); } finally { bcBillingProfile = null; boActive = null; } return (breturn); }

CAM BS SCM
fValidateEmailFormat
function fValidateEmailFormat(strValue:chars){ /******************************************************* ** Name: fValidateEmailFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a email, not a strict check, clean up existing function ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; try{ if(strValue != ""){ if((Clib.strrchr(strValue, "@") == null) || (Clib.strrchr(strValue, ".") == null)){ strOutputs = "TRUE"; } else{ strOutputs = "FALSE"; } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateEmailFormat --> Error: " + e.message); throw(e); } finally{ //Variable destruction } return(strOutputs); }

CAM BS SCM
fValidateEmailFormat
function fValidateEmailFormat(strValue) { /******************************************************* ** Name: fValidateEmailFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a email, not a strict check, clean up existing function ******************************************************/ //Variable declarations var strOutputs = "FALSE"; try{ if(strValue != "") { if((Clib.strrchr(strValue, "@") == null) || (Clib.strrchr(strValue, ".") == null)) { strOutputs = "TRUE"; } else { strOutputs = "FALSE"; } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateEmailFormat --> Error: " + e.message); throw(e); } finally{ //Variable destruction } return(strOutputs); }

CAM BS SCM
fValidateFXPhoneNoStrictFormat
function fValidateFXPhoneNoStrictFormat(strValue) { /******************************************************* ** Name: fValidateFXPhoneNoStrictFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: Number Portability, if the number is fix check that the number must ** -Start with +41 or +423 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid ******************************************************/ //Variable declarations var strOutputs = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart = 0; try { if(strValue != "" && strValue != null) { //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ strOutputs = "FALSE"; if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with characters not valid"); } else { //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41" || strValue.substring(0,4) == "+423") { //Leading 0s are not allowed if(strValue.substring(0,4) == "+410" || strValue.substring(0,5) == "+4230") { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with leading 0"); strOutputs = "FALSE"; } else { //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if(strValue.substring(0,4) == "+423"){ iStart = 4; } if((strValue.substring(0,4) == "+423") && (strValue.length - iStart != 7)) { //Total lengh without prefix must be 7 if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)) { //Total lengh without prefix must be 9 if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if(strValue.substring(0,3) == "+41") { //Check phone number is not contaning a mobile swiss prefix if (strValue.substring(iStart,iStart+2) == "79" || strValue.substring(iStart,iStart+2) == "78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75") { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong mobile prefix"); strOutputs = "FALSE"; } else{ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Swiss"); strOutputs = "TRUE"; } } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Swiss"); strOutputs = "TRUE"; } } } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Liet"); strOutputs = "FALSE"; } } } else{ strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) TheApplicati

CAM BS SCM
fValidateFXPhoneNoStrictFormat
function fValidateFXPhoneNoStrictFormat(strValue:chars){ /******************************************************* ** Name: fValidateFXPhoneNoStrictFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: Number Portability, if the number is fix check that the number must ** -Start with +41 or +423 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != "" && strValue != null){ //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ strOutputs = "FALSE"; if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with characters not valid"); } else { //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41" || strValue.substring(0,4) == "+423"){ //Leading 0s are not allowed if(strValue.substring(0,4) == "+410" || strValue.substring(0,5) == "+4230"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with leading 0"); strOutputs = "FALSE"; } else { //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if(strValue.substring(0,4) == "+423"){ iStart = 4; } if((strValue.substring(0,4) == "+423") && (strValue.length - iStart != 7)){ //Total lengh without prefix must be 7 if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)){ //Total lengh without prefix must be 9 if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if(strValue.substring(0,3) == "+41"){ //Check phone number is not contaning a mobile swiss prefix if (strValue.substring(iStart,iStart+2) == "79" || strValue.substring(iStart,iStart+2) == "78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Number with wrong mobile prefix"); strOutputs = "FALSE"; } else{ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Swiss"); strOutputs = "TRUE"; } } else { if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Swiss"); strOutputs = "TRUE"; } } } else { if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Valid Liet"); strOutputs = "FALSE"; } } } else { strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateFXPhoneNoStrictFormat --> Error: " + e.message)

CAM BS SCM
fValidateMCPhoneNoStrictFormat
function fValidateMCPhoneNoStrictFormat(strValue:chars){ /******************************************************* ** Name: fValidateMCPhoneNoStrictFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: Number Portability, if the number is fix check that the number must ** -Start with +41 or +423 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Swiss mobile phone numbers must begin with 77 76 78 79 ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != "" && strValue != null){ //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with characters not valid"); strOutputs = "FALSE"; } //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41" || strValue.substring(0,4) == "+423"){ //Leading 0s are not allowed if(strValue.substring(0,4) == "+410" || strValue.substring(0,5) == "+4230"){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with leading 0"); strOutputs = "FALSE"; } else{ //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if(strValue.substring(0,4) == "+423"){ iStart = 4; } if((strValue.substring(0,4) == "+423") && (strValue.length - iStart != 7)){ //Total lengh without prefix must be 7 if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)){ //Total lengh without prefix must be 9 if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if(strValue.substring(0,3) == "+41"){ //Check swiss phone number is not contaning a mobile swiss prefix if (strValue.substring(iStart,iStart+2) == "79" || strValue.substring(iStart,iStart+2) == "78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75"){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Swiss with correct mobile prefix"); strOutputs = "TRUE"; } else{ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Not valid swiss mobile"); strOutputs = "FALSE"; } } else{ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Valid Lietchestein"); strOutputs = "TRUE"; } } } } else{ strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Error: " + e.message); throw(e); } finally{ } return(strOutputs); }

CAM BS SCM
fValidateMCPhoneNoStrictFormat
function fValidateMCPhoneNoStrictFormat(strValue:chars){ /******************************************************* ** Name: fValidateMCPhoneNoStrictFormat ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: Number Portability, if the number is fix check that the number must ** -Start with +41 or +423 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Swiss mobile phone numbers must begin with 77 76 78 79 ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != "" && strValue != null){ //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with characters not valid"); strOutputs = "FALSE"; } //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41" || strValue.substring(0,4) == "+423"){ //Leading 0s are not allowed if(strValue.substring(0,4) == "+410" || strValue.substring(0,5) == "+4230"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with leading 0"); strOutputs = "FALSE"; } else{ //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if(strValue.substring(0,4) == "+423"){ iStart = 4; } if((strValue.substring(0,4) == "+423") && (strValue.length - iStart != 7)){ //Total lengh without prefix must be 7 if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; } else if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)){ //Total lengh without prefix must be 9 if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> LenghtTotal: " + strValue.length); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> iStart: " + iStart); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Number with wrong length"); strOutputs = "FALSE"; }else if(strValue.substring(0,3) == "+41"){ //Check swiss phone number is not contaning a mobile swiss prefix if (strValue.substring(iStart,iStart+2) == "79" || strValue.substring(iStart,iStart+2) == "78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Swiss with correct mobile prefix"); strOutputs = "TRUE"; }else{ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Not valid swiss mobile"); strOutputs = "FALSE"; } }else{ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Valid Lietchestein"); strOutputs = "TRUE"; } } } } else{ strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateMCPhoneNoStrictFormat --> Error: " + e.message); throw(e); } finally{ } return(strOutputs); }

CAM BS SCM
fValidateNoStrictGeneralPhone
function fValidateNoStrictGeneralPhone(strValue:chars){ /******************************************************* ** Name: fValidateNoStrictGeneralPhone ** Created: 09.09.2013 ** Created By: TGDSEAI1 Aingeru Sabando ** Description: Light validation on length and prefix ** -Start with +41 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != "" && strValue != null){ //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ strOutputs = "FALSE"; if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with characters not valid"); } else { //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41"){ //Leading 0s are not allowed if(strValue.substring(0,4) == "+410"){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with leading 0"); strOutputs = "FALSE"; } else { //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)){//Total lengh without prefix must be 9 if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> LenghtTotal: " + strValue.length); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> iStart: " + iStart); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with wrong length"); strOutputs = "FALSE"; } else { if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Valid Swiss"); strOutputs = "TRUE"; } } } else { if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Valid Liet"); strOutputs = "FALSE"; } } } else { strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Error: " + e.message); throw(e); } finally{ } return(strOutputs); }

CAM BS SCM
fValidateNoStrictGeneralPhone
function fValidateNoStrictGeneralPhone(strValue) { /******************************************************* ** Name: fValidateNoStrictGeneralPhone ** Created: 09.09.2013 ** Created By: TGSEAI1 Aingeru Sabando ** Description: Light validation on length and prefix ** -Start with +41 ** -Only numbers allowed no other characters apart of leading + ** -No leading 0s allowed ** -Length of the number 12 characters -> 9 after the prefix ** Input: strValue to be evaluated ** Output: strOutputs ** "TRUE" number valid ** "FALSE" number not valid ******************************************************/ //Variable declarations var strOutputs = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart = 0; try { if(strValue != "" && strValue != null) { //Character apart of leading + not allowed if(strValue.search(srReg) != -1 || strValue == "+"){ strOutputs = "FALSE"; if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with characters not valid"); } else { //Prefix must be +41 or +423 if(strValue.substring(0,3) == "+41") { //Leading 0s are not allowed if(strValue.substring(0,4) == "+410") { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with leading 0"); strOutputs = "FALSE"; } else { //Get start point of phone number without prefix if(strValue.substring(0,3) == "+41"){ iStart = 3; } if((strValue.substring(0,3) == "+41") && (strValue.length - iStart != 9)) { //Total lengh without prefix must be 9 if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> LenghtTotal: " + strValue.length); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> iStart: " + iStart); if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Number with wrong length"); strOutputs = "FALSE"; } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Valid Swiss"); strOutputs = "TRUE"; } } } else { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Valid Liet"); strOutputs = "FALSE"; } } } else{ strOutputs = "FALSE"; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateNoStrictGeneralPhone --> Error: " + e.message); throw(e); } finally{ } return(strOutputs); }

CAM BS SCM
fValidatePhoneFormat
function fValidatePhoneFormat(strValue) { /******************************************************* ** Name: fValidatePhone ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone Number ******************************************************/ //Variable declarations var strOutputs = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart = 0; try{ if(strValue != "") { if(strValue.search(srReg) != -1 || strValue == "+") { //TheApplication().RaiseErrorText("Phone number must contain numbers"); strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone is not correct", "Phone Number")); } else { if (strValue.substring(0,3)=="+41" ||strValue.substring(0,1)=="0") { // Swiss Number iStart=1; //when number start with 0 if (strValue.substring(0,3)=="+41") { iStart=3; } if (strValue.substring(0,4)=="+410") { iStart=4; } if (strValue.substring(iStart,iStart+2)=="79" || strValue.substring(iStart,iStart+2)=="78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75") { strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone Number must be fix")); } else { if(strValue.length - iStart != 9) { // SCM 2014-01-27 TGDGEMAM: added check for "+4986" due to defect # 76051 if (strValue.substring(iStart,iStart+2)=="86" && strValue.length - iStart == 12) { strOutputs = "FALSE"; } else { strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone number must contain 12 characters")); } } else { strOutputs = "FALSE"; } } } else { strOutputs = "FALSE"; } } } } catch(e) { if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidatePhone --> Error: " + e.message); throw(e); } finally { srReg = null; } return(strOutputs); }

CAM BS SCM
fValidatePhoneFormat
function fValidatePhoneFormat(strValue:chars){ /******************************************************* ** Name: fValidatePhone ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone Number ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != ""){ if(strValue.search(srReg) != -1 || strValue == "+"){ //oApp.RaiseErrorText("Phone number must contain numbers"); strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone is not correct", "Phone Number")); } else { if (strValue.substring(0,3)=="+41" ||strValue.substring(0,1)=="0") { // Swiss Number iStart=1; //when number start with 0 if (strValue.substring(0,3)=="+41"){ iStart=3; } if (strValue.substring(0,4)=="+410"){ iStart=4; } if (strValue.substring(iStart,iStart+2)=="79" || strValue.substring(iStart,iStart+2)=="78" || strValue.substring(iStart,iStart+2)=="77" || strValue.substring(iStart,iStart+2)=="76" || strValue.substring(iStart,iStart+2)=="75"){ strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone Number must be fix")); } else { if(strValue.length - iStart != 9) { // SCM 2014-01-27 TGDGEMAM: added check for "+4986" due to defect # 76051 if (strValue.substring(iStart,iStart+2)=="86" && strValue.length - iStart == 12) { strOutputs = "FALSE"; } else { strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone number must contain 12 characters")); } } else { strOutputs = "FALSE"; } } } else { strOutputs = "FALSE"; } } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidatePhone --> Error: " + e.message); throw(e); } finally{ srReg = null; } return(strOutputs); }

CAM BS SCM
fValidatePhoneMobileFormat
function fValidatePhoneMobileFormat(strValue) { /******************************************************* ** Name: fValidatePhoneMobile ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone number and the Email Address, clean up of existing old function ******************************************************/ //Variable declarations var strOutputs = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart = 0; try{ if(strValue != "") { if(strValue.search(srReg) != -1 || strValue == "+") { //TheApplication().RaiseErrorText("Phone number must contain numbers"); strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone is not correct", "Phone Number")); } else { if (strValue.substring(0,3)=="+41" ||strValue.substring(0,1)=="0") { // Swiss Number iStart = 1; //when number start with 0 if (strValue.substring(0,3)=="+41") { iStart=3; } if (strValue.substring(0,4)=="+410") { iStart=4; } if (bIsTraceOn) oApp.Trace(this.Name() + " fValidatePhoneMobile --> iStart"+ iStart); if (strValue.substring(iStart,iStart+2)!="79" && strValue.substring(iStart,iStart+2)!="78" && strValue.substring(iStart,iStart+2)!="77" && strValue.substring(iStart,iStart+2)!="76" && strValue.substring(iStart,iStart+2)!="75") { strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone Number must be mobile")); } else { if(strValue.length - iStart != 9) { strOutputs = "TRUE"; TheApplication().RaiseErrorText(TheApplication().LookupMessage("User Defined Errors", "Error: Phone number must contain 12 characters")); } else { strOutputs = "FALSE"; } } } else { strOutputs = "FALSE"; } } } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidatePhoneMobileFormat --> Error: " + e.message); throw(e); } finally{ srReg = null; } return(strOutputs); }

CAM BS SCM
fValidatePhoneMobileFormat
function fValidatePhoneMobileFormat(strValue:chars){ /******************************************************* ** Name: fValidatePhoneMobile ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a Phone number and the Email Address, clean up of existing old function ******************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var srReg = /[\sa-zA-Z^*]{1,}/; var iStart:float = 0; try{ if(strValue != ""){ if(strValue.search(srReg) != -1 || strValue == "+"){ strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone is not correct", "Phone Number")); } else{ if (strValue.substring(0,3)=="+41" ||strValue.substring(0,1)=="0") { // Swiss Number iStart = 1; //when number start with 0 if (strValue.substring(0,3)=="+41"){ iStart=3; } if (strValue.substring(0,4)=="+410"){ iStart=4; } if (bIsTraceOn) oApp.Trace(this.Name() + " fValidatePhoneMobile --> iStart"+ iStart); if (strValue.substring(iStart,iStart+2)!="79" && strValue.substring(iStart,iStart+2)!="78" && strValue.substring(iStart,iStart+2)!="77" && strValue.substring(iStart,iStart+2)!="76" && strValue.substring(iStart,iStart+2)!="75"){ strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone Number must be mobile")); } else { if(strValue.length - iStart != 9) { strOutputs = "TRUE"; oApp.RaiseErrorText(oApp.LookupMessage("User Defined Errors", "Error: Phone number must contain 12 characters")); } else { strOutputs = "FALSE"; } } } else{ strOutputs = "FALSE"; } } } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidatePhoneMobileFormat --> Error: " + e.message); throw(e); } finally{ srReg = null; } return(strOutputs); }

CAM BS SCM
fValidateRegularExpression
function fValidateRegularExpression(Inputs,Outputs) { /******************************************************* ** Name: fValidateRegularExpression ** Created: 04.08.2011 ** Created By: TGDSEAI1 ** Description: This method checks if a string matches with a regular expresion patter -------------------- Modifications --------------------- ** Version: <New Version> ** Date: ** Changed By: ** Description: ******************************************************/ // Declaration of variables var stringToCheck = Inputs.GetProperty("StringToCheck"); var strPattern = Inputs.GetProperty("RegularExpression"); var objReg:RegExp; var stringResult = ""; if(this.bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateRegularExpresion: stringToCheck: " + stringToCheck + " Pattern-> " + strPattern); try { objReg = new RegExp(); objReg.compile(strPattern); if (objReg.test(stringToCheck)) { stringResult = "OK"; // tracing if(this.bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateRegularExpresion: Outputs: " +stringResult); } // end if else { stringResult = "NOK"; // tracing if(this.bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateRegularExpresion: Outputs: " +stringResult); } // end else Outputs.SetProperty("Valid", stringResult); } // end try catch(e) { if(this.bIsTraceOn) TheApplication().Trace(this.Name() + " fValidateRegularExpresion: Error: " + e.message); throw(e); } // end catch finally { stringToCheck = null; strPattern = null; objReg = null; stringResult = null; } // end finally }

CAM BS SCM
fValidateRegularExpression
function fValidateRegularExpression(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: fValidateRegularExpression ** Created: 04.08.2011 ** Created By: TGDSEAI1 Aingeru Sabando Lasuen ** Description: This method checks if a string matches with a regular expresion patter ******************************************************/ // Declaration of variables var stringToCheck:chars; var strPattern:chars; var objReg:RegExp; var stringResult:chars = ""; if(this.bIsTraceOn) oApp.Trace(this.Name() + " fValidateRegularExpresion: stringToCheck: " + stringToCheck + " Pattern-> " + strPattern); try{ stringToCheck = Inputs.GetProperty("StringToCheck"); strPattern = Inputs.GetProperty("RegularExpression"); objReg = new RegExp(); objReg.compile(strPattern); if (objReg.test(stringToCheck)){ stringResult = "OK"; if(this.bIsTraceOn) oApp.Trace(this.Name() + " fValidateRegularExpresion: Outputs: " +stringResult); } else { stringResult = "NOK"; if(this.bIsTraceOn) oApp.Trace(this.Name() + " fValidateRegularExpresion: Outputs: " +stringResult); } Outputs.SetProperty("Valid", stringResult); } catch(e){ if(this.bIsTraceOn) oApp.Trace(this.Name() + " fValidateRegularExpresion: Error: " + e.message); throw(e); } finally{ stringToCheck = null; strPattern = null; objReg = null; stringResult = null; } }

CAM BS SCM
fValidateStrictEmailFormat
function fValidateStrictEmailFormat(strValue) { /******************************************************* ** Name: fValidateStrictEmail ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a email, not a strict check, clean up existing function RFC822 check added String rules: - exactly one "@" - no spaces - minimum one "." somewhere after the "@" but separated by minimum one character - any "." before the "@" must be separated by minimum one character - no two "." can follow each other directly - string starts and ends with a character/number - valid characters: [A-Z], [a-z], [0-9], [_-+@.] - valid characters in local part allowed: ! # $ % & ' * / = ? ^ ` { | } ~ " \ ************************************************************************************************************/ //Variable declarations var strOutputs = "FALSE"; var sValidEmail = '^[a-zA-Z0-9!#\$%&\'\*/=\?\^\{\}\|~`"][a-zA-Z0-9!#\$%&\'\*/=\?\^\{\}\|~`"_+\.\-]*@[a-zA-Z0-9\._+\-]+[\.][a-zA-Z]{2,5}$'; var reValidEmail = new RegExp(sValidEmail); var sValidEmail2 = '([\.][\.]|[\.]@|@[\.])'; // no ".." nor ".@" nor "@." allowed var reValidEmail2 = new RegExp(sValidEmail2); try{ if(strValue != ""){ // bakslash is not recognized in reg Expr, so it needs special treatment here: // if \ exists, then it must be before @ and delete \ in order to validate the rest of the email string if (strValue.indexOf("\\") > -1) { if (strValue.lastIndexOf("\\") < strValue.indexOf("@") ) { strValue = strValue.replace(/[\\]/g,"x"); // replace \ with x (valid char) if (! reValidEmail2.test(strValue) && reValidEmail.test(strValue) ) { strOutputs = "TRUE"; } else { strOutputs = "FALSE"; } } else { strOutputs = "FALSE"; } } else { if (! reValidEmail2.test(strValue) && reValidEmail.test(strValue) ) { strOutputs = "TRUE"; } else { strOutputs = "FALSE"; } } } else { strOutputs = "TRUE"; } } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fValidateStrictEmail --> Error: " + e.message); throw(e); } finally{ //Variable destruction sValidEmail = null; reValidEmail = null; sValidEmail2 = null; reValidEmail2 = null; } return(strOutputs); }

CAM BS SCM
fValidateStrictEmailFormat
function fValidateStrictEmailFormat(strValue:chars){ /******************************************************* ** Name: fValidateStrictEmail ** Created: 26.02.2013 ** Created By: Aingeru Sabando ** Description: This method checks the format of a email, not a strict check, clean up existing function RFC822 check added String rules: - exactly one "@" - no spaces - minimum one "." somewhere after the "@" but separated by minimum one character - any "." before the "@" must be separated by minimum one character - no two "." can follow each other directly - string starts and ends with a character/number - valid characters: [A-Z], [a-z], [0-9], [_-+@.] - valid characters in local part allowed: ! # $ % & ' * / = ? ^ ` { | } ~ " \ ************************************************************************************************************/ //Variable declarations var strOutputs:chars = "FALSE"; var sValidEmail = '^[a-zA-Z0-9!#\$%&\'\*/=\?\^\{\}\|~`"][a-zA-Z0-9!#\$%&\'\*/=\?\^\{\}\|~`"_+\.\-]*@[a-zA-Z0-9\._+\-]+[\.][a-zA-Z]{2,5}$'; var reValidEmail = new RegExp(sValidEmail); var sValidEmail2 = '([\.][\.]|[\.]@|@[\.])'; // no ".." nor ".@" nor "@." allowed var reValidEmail2 = new RegExp(sValidEmail2); if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateStrictEmail START " + strValue); try{ if(strValue != ""){ // bakslash is not recognized in reg Expr, so it needs special treatment here: // if \ exists, then it must be before @ and delete \ in order to validate the rest of the email string if (strValue.indexOf("\\") > -1) { if (strValue.lastIndexOf("\\") < strValue.indexOf("@") ){ strValue = strValue.replace(/[\\]/g,"x"); // replace \ with x (valid char) if (! reValidEmail2.test(strValue) && reValidEmail.test(strValue) ) { strOutputs = "TRUE"; } else { strOutputs = "FALSE"; } } else { strOutputs = "FALSE"; } } else { if (! reValidEmail2.test(strValue) && reValidEmail.test(strValue) ) { strOutputs = "TRUE"; } else { strOutputs = "FALSE"; } } } else { strOutputs = "TRUE"; } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fValidateStrictEmail --> Error: " + e.message); throw(e); } finally{ //Variable destruction sValidEmail = null; reValidEmail = null; sValidEmail2 = null; reValidEmail2 = null; } return(strOutputs); }

CAM BS SCM
fWritePs
function fWritePs(Inputs:PropertySet){ /************************************************************************************************************** ** Name: fWritePs ** Created: 29.11.2013 ** Created By: TGDSEAI1 Aingeru Sabando Lasuen SO 1890 ** Description: Get the Info for an XA attributt to be created *************************************************************************************************************/ var objBS:Service = oApp.GetService("XML Converter"); var psOutputs:PropertySet = oApp.NewPropertySet(); var strXML:chars = ""; try{ Inputs.SetType("SiebelMessage"); objBS.InvokeMethod("PropSetToXML", Inputs, psOutputs) strXML = psOutputs.GetValue(); if(bIsTraceOn)oApp.Trace(this.Name() + "->WritePs->"); if(bIsTraceOn)oApp.Trace(strXML); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".fWritePs Error: " + e.message); throw(e); } finally{ psOutputs = null; objBS = null; } }

CAM BS SCM
fWritePs
function fWritePs(Inputs:PropertySet) { /************************************************************************************************************** ** Name: fGetAttributeInfo ** Created: 29.11.2013 ** Created By: TGDSEAI1 SO 1890 ** Description: Get the Info for an XA attributt to be created *************************************************************************************************************/ var objBS = TheApplication().GetService("XML Converter"); var psOutputs = TheApplication().NewPropertySet(); var strXML = ""; try{ Inputs.SetType("SiebelMessage"); objBS.InvokeMethod("PropSetToXML", Inputs, psOutputs) strXML = psOutputs.GetValue(); if(bIsTraceOn) TheApplication().Trace(this.Name() + "->WritePs->"); if(bIsTraceOn)TheApplication().Trace(strXML); } catch(e){ if(bIsTraceOn) TheApplication().Trace(this.Name() + ".fWritePs Error: " + e.message); throw(e); } finally{ psOutputs = null; objBS = null; } }

CAM BS SCM
getEmailFromPrimaryContact
/******************************************************* ** Name: setPickValue ** Created: 11.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the value of a picklist-related field by picking it from the corresponding list -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function getEmailFromPrimaryContact(boActiveBO:BusObject, bcAccount:BusComp) { var bcContact:BusComp; var primaryContactId; var email = ""; try { primaryContactId = bcAccount.GetFieldValue("Primary Contact Id"); bcContact = boActiveBO.GetBusComp("Contact"); bcContact.SetViewMode(AllView); bcContact.ActivateField("Email Address"); bcContact.ClearToQuery(); bcContact.SetSearchSpec("Id", primaryContactId); bcContact.ExecuteQuery(ForwardOnly); if (bcContact.FirstRecord()) { email = bcContact.GetFieldValue("Email Address"); } } catch (e) { email = ""; throw(e); } finally { bcContact = null; } return (email); }

CAM BS SCM
getEmailFromPrimaryContact
function getEmailFromPrimaryContact(boActiveBO:BusObject, bcAccount:BusComp) { /******************************************************* -------------------- Modifications --------------------- ** Date: 2016.11.09 ** Changed By: Aingeru Sabando Lasuen ** Description: Strong typing and code clean up ******************************************************/ var bcContact:BusComp; var primaryContactId:chars; var email:chars = ""; if(bIsTraceOn) oApp.Trace(this.Name() + ".getEmailFromPrimaryContact START"); try { primaryContactId = bcAccount.GetFieldValue("Primary Contact Id"); bcContact = boActiveBO.GetBusComp("Contact"); bcContact.SetViewMode(AllView); bcContact.ActivateField("Email Address"); bcContact.ClearToQuery(); bcContact.SetSearchSpec("Id", primaryContactId); bcContact.ExecuteQuery(ForwardOnly); if (bcContact.FirstRecord()) { email = bcContact.GetFieldValue("Email Address"); } } catch (e) { if(bIsTraceOn) oApp.Trace(this.Name() + ".getEmailFromPrimaryContact ERROR:" + e.message); email = ""; throw(e); } finally { bcContact = null; } return (email); }

CAM BS SCM
repl
/***************************************************************************** * Function: repl * Purpose : Replaces in the given string " with "" * Params : strInput - the string to do the replacement(s) * Returns : the given string with the corresponding replacements done. *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-03-17 tgdhuro9 created *****************************************************************************/ function repl(strInput) { var s = strInput; s = s.replace("\"", "\"\""); return s; }

CAM BS SCM
repl
/***************************************************************************** * Function: repl * Purpose : Replaces in the given string " with "" * Params : strInput - the string to do the replacement(s) * Returns : the given string with the corresponding replacements done. *----------------------------------------------------------------------------* * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2011-03-17 tgdhuro9 created *****************************************************************************/ function repl(strInput) { var s = strInput; s = s.replace("\"", "\"\""); return s; }

CAM BS SCM
setPickValue
/******************************************************* ** Name: setPickValue ** Created: 11.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the value of a picklist-related field by picking it from the corresponding list -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function setPickValue(oBC:BusComp, fieldName:String, activationField:String, value:String) { var oBCPick:BusComp; try { // Set status based on the related pick list oBCPick = oBC.GetPicklistBusComp(fieldName); with (oBCPick){ ActivateField(activationField); ClearToQuery(); SetSearchSpec(activationField, value); ExecuteQuery(ForwardOnly); if(FirstRecord()) { Pick(); oApp.Trace("CAM BS SCM.setPickValue for fieldname: " + fieldName); } else { oApp.Trace("CAM BS SCM.setPickValue for fieldname: " + fieldName + ", NO pick value here!!!"); } } } catch (e) { throw(e); } finally { oBCPick = null; } }

CAM BS SCM
setPickValue
/******************************************************* ** Name: setPickValue ** Created: 11.02.2011 ** Created By: Alejandro Strickler (TZHSTAL2) ** Description: This BS method sets the value of a picklist-related field by picking it from the corresponding list -------------------- Modifications --------------------- ** Version: <New Version> ** Date: <Date of modification> ** Changed By: <Name of changer> ** Description: <Description of modification> ******************************************************/ function setPickValue(oBC:BusComp, fieldName:String, activationField:String, value:String) { var oBCPick:BusComp; try { // Set status based on the related pick list oBCPick = oBC.GetPicklistBusComp(fieldName); with (oBCPick){ ActivateField(activationField); ClearToQuery(); SetSearchSpec(activationField, value); ExecuteQuery(ForwardOnly); if(FirstRecord()) { Pick(); oApp.Trace("CAM BS SCM.setPickValue for fieldname: " + fieldName); } else { oApp.Trace("CAM BS SCM.setPickValue for fieldname: " + fieldName + ", NO pick value here!!!"); } } } catch (e) { throw(e); } finally { oBCPick = null; } }

CAM BS SCM
trc
/***************************************************************************** * Function: trc * Purpose : Writes the given string to the log file * Params : s - the string to trace *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2012-07-10 tgdhuro9 created *****************************************************************************/ function trc(s) { if (TheApplication().isTraceON) { TheApplication().Trace(this.Name() + ": " + s); } }

CAM BS SCM
trc
/***************************************************************************** * Function: trc * Purpose : Writes the given string to the log file * Params : s - the string to trace *----------------------------------------------------------------------------- * History : * Date Name Description * ---------- -------- ---------------------------------------------------- * 2012-07-10 tgdhuro9 created *****************************************************************************/ function trc(s) { if (TheApplication().isTraceON) { TheApplication().Trace(this.Name() + ": " + s); } }

CAM SR Reprocessing SCM
(declarations)
var oApp:Application; var bIsTraceOn;

CAM SR Reprocessing SCM
(declarations)
var oApp:Application; var bIsTraceOn;

CAM SR Reprocessing SCM
Service_PreInvokeMethod
/******************************************************* ** Name: Preinvoke ** Created: 29.03.2010 ** Created By: Alejandro Strickler ** Description: This method handles the triaging of external calls of internal methods -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function Service_PreInvokeMethod (MethodName) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch (MethodName) { case "reprocessFailedAddressChangeSRs": reprocessFailedAddressChangeSRs(); break; } oApp = null; return (CancelOperation); }

CAM SR Reprocessing SCM
Service_PreInvokeMethod
/******************************************************* ** Name: Preinvoke ** Created: 29.03.2010 ** Created By: Alejandro Strickler ** Description: This method handles the triaging of external calls of internal methods -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function Service_PreInvokeMethod (MethodName) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; switch (MethodName) { case "reprocessFailedAddressChangeSRs": reprocessFailedAddressChangeSRs(); break; } oApp = null; return (CancelOperation); }

CAM SR Reprocessing SCM
cancelSrAndActivities
/******************************************************* ** Name: cancelSrAndActivities ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method cancels a given service request and its related activities. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function cancelSrAndActivities(oActBC:BusComp, oSRBC:BusComp, newStartDate:String) { var sDesc:String; try { // Search related pending activities oActBC.ClearToQuery(); oActBC.SetViewMode(AllView); oActBC.ActivateField("Status"); oActBC.SetSearchExpr("[Status] <> 'Closed' AND [Status] <> 'Cancelled'"); oActBC.ExecuteQuery(ForwardOnly); var bRecordExists = oActBC.FirstRecord(); while(bRecordExists) { oActBC.SetFieldValue("Status", "Cancelled"); oActBC.SetFieldValue("Comment","Cancelled by " + this.Name()); oActBC.WriteRecord(); bRecordExists = oActBC.NextRecord(); } // Set status of service request to "Cancelled" oSRBC.SetFieldValue("Status", "Cancelled"); // Get description of the service request sDesc = oSRBC.GetFieldValue("Description"); // Set comment into description if (sDesc.length > 0) { oSRBC.SetFieldValue("Description", sDesc + "; " + newStartDate + " SR cancelled by " + this.Name()); } else { oSRBC.SetFieldValue("Description", newStartDate + " SR cancelled by " + this.Name()); } oSRBC.WriteRecord(); } catch (e) { if (bIsTraceOn) oApp.Trace("Error - BS "+this.Name()+": " + e.ToString()); } finally { sDesc = null; } }

CAM SR Reprocessing SCM
cancelSrAndActivities
/******************************************************* ** Name: cancelSrAndActivities ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method cancels a given service request and its related activities. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function cancelSrAndActivities(oActBC:BusComp, oSRBC:BusComp, newStartDate:String) { var sDesc:String; try { // Search related pending activities oActBC.ClearToQuery(); oActBC.SetViewMode(AllView); oActBC.ActivateField("Status"); oActBC.SetSearchExpr("[Status] <> 'Closed' AND [Status] <> 'Cancelled'"); oActBC.ExecuteQuery(ForwardOnly); var bRecordExists = oActBC.FirstRecord(); while(bRecordExists) { oActBC.SetFieldValue("Status", "Cancelled"); oActBC.SetFieldValue("Comment","Cancelled by " + this.Name()); oActBC.WriteRecord(); bRecordExists = oActBC.NextRecord(); } // Set status of service request to "Cancelled" oSRBC.SetFieldValue("Status", "Cancelled"); // Get description of the service request sDesc = oSRBC.GetFieldValue("Description"); // Set comment into description if (sDesc.length > 0) { oSRBC.SetFieldValue("Description", sDesc + "; " + newStartDate + " SR cancelled by " + this.Name()); } else { oSRBC.SetFieldValue("Description", newStartDate + " SR cancelled by " + this.Name()); } oSRBC.WriteRecord(); } catch (e) { if (bIsTraceOn) oApp.Trace("Error - BS "+this.Name()+": " + e.ToString()); } finally { sDesc = null; } }

CAM SR Reprocessing SCM
checkedActivities
/******************************************************* ** Name: checkedActivities ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method checks if the activities related to a failed service request meets all needed conditions for further processing ** Posible return codes: 0 = No error ** 1 = No activities found ** 2 = More than one replicate activites found ** 3 = Found activites not in status 'Failed' -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function checkedActivities(oActBC:BusComp) { var iRetCode = 0; // query for failed GO activity oActBC.ClearToQuery(); oActBC.SetViewMode(AllView); oActBC.ActivateField("Status"); oActBC.ActivateField("Comment"); oActBC.ActivateField("Display"); oActBC.ActivateField("Activity Id"); //20.10.2010 TGDLOAL3: Added due to defect 24586. We need to check short comment to check //if the preprocessing was successfully executed or not oActBC.ActivateField("Short Comment"); oActBC.SetSearchExpr("[Type]='Replicate' AND [Status] <> 'Cancelled'"); oActBC.ExecuteQuery(ForwardOnly); if(!oActBC.FirstRecord()) { iRetCode = 1; } else if(oActBC.NextRecord()) { iRetCode = 2; } else if(oActBC.GetFieldValue("Status") != "Failed") { iRetCode = 3; } return iRetCode; }

CAM SR Reprocessing SCM
checkedActivities
/******************************************************* ** Name: checkedActivities ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method checks if the activities related to a failed service request meets all needed conditions for further processing ** Posible return codes: 0 = No error ** 1 = No activities found ** 2 = More than one replicate activites found ** 3 = Found activites not in status 'Failed' -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function checkedActivities(oActBC:BusComp) { var iRetCode = 0; // query for failed GO activity oActBC.ClearToQuery(); oActBC.SetViewMode(AllView); oActBC.ActivateField("Status"); oActBC.ActivateField("Comment"); oActBC.ActivateField("Display"); oActBC.ActivateField("Activity Id"); //20.10.2010 TGDLOAL3: Added due to defect 24586. We need to check short comment to check //if the preprocessing was successfully executed or not oActBC.ActivateField("Short Comment"); oActBC.SetSearchExpr("[Type]='Replicate' AND [Status] <> 'Cancelled'"); oActBC.ExecuteQuery(ForwardOnly); if(!oActBC.FirstRecord()) { iRetCode = 1; } else if(oActBC.NextRecord()) { iRetCode = 2; } else if(oActBC.GetFieldValue("Status") != "Failed") { iRetCode = 3; } return iRetCode; }

CAM SR Reprocessing SCM
excludeSrFromResubmit
/******************************************************* ** Name: excludeSrFromResubmit ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method evaluates the service request related address and decides if it should be cancelled. If so, the service request and related activities are cancelled. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function excludeSrFromResubmit(oSRBC:BusComp, sAddressType:String, oSRBC_NEW:BusComp, oAddressBc:BusComp, oActBC:BusComp, sAddressId:String, todayDate:String, newStartDate:String) { // Get Service request id for logging purposes var sSrId:String = oSRBC.GetFieldValue("Id"); // Get description of the service request var sDesc:String = oSRBC.GetFieldValue("Description"); // Prepare query for address oAddressBc.ClearToQuery(); oAddressBc.SetViewMode(AllView); oAddressBc.ActivateField("Address Status SCM"); oAddressBc.ActivateField("Start Date SCM"); oAddressBc.ActivateField("Address Relation Type SCM"); oAddressBc.ActivateField("End Date SCM"); oAddressBc.SetSearchExpr("[Id]='" + sAddressId + "'"); oAddressBc.ExecuteQuery(ForwardOnly); if(!oAddressBc.FirstRecord()) { if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - No corresponding address found, excluded from reprocessing."); oSRBC.SetFieldValue("Description", (sDesc.length > 0 ? sDesc + "; " : "") + newStartDate + " Checked by " + this.Name() + " - No corresponding address found, excluded from reprocessing."); oSRBC.WriteRecord(); } else { // Get status of the related address for further processing var sAddressStatus:String = oAddressBc.GetFieldValue("Address Status SCM"); // Prepare search criteria section that depends on the address type var sAddressTypeDependentSearchCriteria:String = ""; if (sAddressType == "Account") { sAddressTypeDependentSearchCriteria = "[Account Address Id SCM] = '" + sAddressId + "'"; } else if (sAddressType == "Billing") { sAddressTypeDependentSearchCriteria = "[Billing Address Id SCM] = '" + sAddressId + "'"; } else if (sAddressType == "Contract") { sAddressTypeDependentSearchCriteria = "[Asset Address Id SCM] = '" + sAddressId + "'"; } //oApp.Trace("excludeSrFromResubmit - sAddressTypeDependentSearchCriteria: " + sAddressTypeDependentSearchCriteria); // Decide if service request should be cancelled if (sAddressStatus == 'Deleted' || sAddressStatus == 'Inactive') { // Adress is inactive or deleted - Cancel all open Activities cancelSrAndActivities(oActBC, oSRBC, newStartDate); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - cancelled. Corresponding address was already deleted or inactive."); } else if (oAddressBc.GetFieldValue("Address Status SCM") == 'Active') { // address is already active, look for another SR oSRBC_NEW.ClearToQuery(); oSRBC_NEW.SetViewMode(AllView); oSRBC_NEW.ActivateField("SR Number"); oSRBC_NEW.SetSearchExpr("[Account Id]='" + oSRBC.GetFieldValue("Account Id") + "' AND [Status] = 'Closed' AND [Area] = 'Customer Data' AND [Sub-Area] = 'Address change' AND " + sAddressTypeDependentSearchCriteria); oSRBC_NEW.ExecuteQuery(ForwardOnly); if(oSRBC_NEW.FirstRecord()) {// another SR exists, cancel all open Activities cancelSrAndActivities(oActBC, oSRBC, newStartDate); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - cancelled. Corresponding address was active and related SR already exists."); } } // Check if younger service request exists oSRBC_NEW.ClearToQuery(); oSRBC_NEW.SetViewMode(AllView); oSRBC_NEW.ActivateField("SR Number"); oSRBC_NEW.SetSearchExpr("[Account Id]='" + oSRBC.GetFieldValue("Ac

CAM SR Reprocessing SCM
excludeSrFromResubmit
/******************************************************* ** Name: excludeSrFromResubmit ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method evaluates the service request related address and decides if it should be cancelled. If so, the service request and related activities are cancelled. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function excludeSrFromResubmit(oSRBC:BusComp, sAddressType:String, oSRBC_NEW:BusComp, oAddressBc:BusComp, oActBC:BusComp, sAddressId:String, todayDate:String, newStartDate:String) { // Get Service request id for logging purposes var sSrId:String = oSRBC.GetFieldValue("Id"); // Get description of the service request var sDesc:String = oSRBC.GetFieldValue("Description"); // Prepare query for address oAddressBc.ClearToQuery(); oAddressBc.SetViewMode(AllView); oAddressBc.ActivateField("Address Status SCM"); oAddressBc.ActivateField("Start Date SCM"); oAddressBc.ActivateField("Address Relation Type SCM"); oAddressBc.ActivateField("End Date SCM"); oAddressBc.SetSearchExpr("[Id]='" + sAddressId + "'"); oAddressBc.ExecuteQuery(ForwardOnly); if(!oAddressBc.FirstRecord()) { if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - No corresponding address found, excluded from reprocessing."); oSRBC.SetFieldValue("Description", (sDesc.length > 0 ? sDesc + "; " : "") + newStartDate + " Checked by " + this.Name() + " - No corresponding address found, excluded from reprocessing."); oSRBC.WriteRecord(); } else { // Get status of the related address for further processing var sAddressStatus:String = oAddressBc.GetFieldValue("Address Status SCM"); // Prepare search criteria section that depends on the address type var sAddressTypeDependentSearchCriteria:String = ""; if (sAddressType == "Account") { sAddressTypeDependentSearchCriteria = "[Account Address Id SCM] = '" + sAddressId + "'"; } else if (sAddressType == "Billing") { sAddressTypeDependentSearchCriteria = "[Billing Address Id SCM] = '" + sAddressId + "'"; } else if (sAddressType == "Contract") { sAddressTypeDependentSearchCriteria = "[Asset Address Id SCM] = '" + sAddressId + "'"; } //oApp.Trace("excludeSrFromResubmit - sAddressTypeDependentSearchCriteria: " + sAddressTypeDependentSearchCriteria); // Decide if service request should be cancelled if (sAddressStatus == 'Deleted' || sAddressStatus == 'Inactive') { // Adress is inactive or deleted - Cancel all open Activities cancelSrAndActivities(oActBC, oSRBC, newStartDate); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - cancelled. Corresponding address was already deleted or inactive."); } else if (oAddressBc.GetFieldValue("Address Status SCM") == 'Active') { // address is already active, look for another SR oSRBC_NEW.ClearToQuery(); oSRBC_NEW.SetViewMode(AllView); oSRBC_NEW.ActivateField("SR Number"); oSRBC_NEW.SetSearchExpr("[Account Id]='" + oSRBC.GetFieldValue("Account Id") + "' AND [Status] = 'Closed' AND [Area] = 'Customer Data' AND [Sub-Area] = 'Address change' AND " + sAddressTypeDependentSearchCriteria); oSRBC_NEW.ExecuteQuery(ForwardOnly); if(oSRBC_NEW.FirstRecord()) {// another SR exists, cancel all open Activities cancelSrAndActivities(oActBC, oSRBC, newStartDate); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": Service request with Id: [" + sSrId + "] - cancelled. Corresponding address was active and related SR already exists."); } } // Check if younger service request exists oSRBC_NEW.ClearToQuery(); oSRBC_NEW.SetViewMode(AllView); oSRBC_NEW.ActivateField("SR Number"); oSRBC_NEW.SetSearchExpr("[Account Id]='" + oSRBC.GetFieldValue("Ac

CAM SR Reprocessing SCM
isAlreadyReprocessed
/******************************************************* ** Name: isAlreadyReprocessed ** Created: 29.03.2010 ** Created By: Alejandro Strickler ** Description: This method returns a boolean value: True if the SR was already marked as "Processed" by the current business service, False otherwise. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function isAlreadyReprocessed(oSRBC:BusComp) { var bResult = false; var desc:String = oSRBC.GetFieldValue("Description"); if (desc.indexOf(this.Name()) > -1) { bResult = true; } return bResult; }

CAM SR Reprocessing SCM
isAlreadyReprocessed
/******************************************************* ** Name: isAlreadyReprocessed ** Created: 29.03.2010 ** Created By: Alejandro Strickler ** Description: This method returns a boolean value: True if the SR was already marked as "Processed" by the current business service, False otherwise. -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function isAlreadyReprocessed(oSRBC:BusComp) { var bResult = false; var desc:String = oSRBC.GetFieldValue("Description"); if (desc.indexOf(this.Name()) > -1) { bResult = true; } return bResult; }

CAM SR Reprocessing SCM
reprocessFailedAddressChangeSRs
/******************************************************* ** Name: reprocessFailedSRs ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method searches all SRs on status "Failed" and decides if they should be reprocessed or cancelled -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function reprocessFailedAddressChangeSRs() { // Instantiate all needed objects var oSRBO:BusObject = oApp.GetBusObject("Service Request"); var oSRBC:BusComp = oSRBO.GetBusComp("Service Request"); var oSRBO_NEW:BusObject = oApp.GetBusObject("Service Request"); var oSRBC_NEW:BusComp = oSRBO_NEW.GetBusComp("Service Request"); var oActBC:BusComp = oSRBO.GetBusComp("Action"); var oADDRBO:BusObject = oApp.GetBusObject("EAI All Address Entities SCM"); var oAccAddrBC:BusComp = oADDRBO.GetBusComp("EAI Account Address Usage SCM"); var oBPAddrBC:BusComp = oADDRBO.GetBusComp("EAI Billing Profile Address Usage SCM"); var oConAddrBC:BusComp = oADDRBO.GetBusComp("EAI Contract Address Usage SCM"); var oWFBS:Service = oApp.GetService("Workflow Process Manager"); var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var newId; // Create address business component reference variable var oAddressBc:BusComp = null; var oToday:Date; // Declare variables to prevent fetching too much records var MAX_RECORDS = 10000; var lRecordCount = 0; try { // Initialize date variables oToday = new Date(); var todayDate:String = Clib.rsprintf("%04d%02d%02d", oToday.getFullYear(), oToday.getMonth()+1, oToday.getDate()); var newStartDate:String = Clib.rsprintf("%02d/%02d/%04d", oToday.getMonth()+1, oToday.getDate(), oToday.getFullYear()); // Create indicator for the address type related to the current service request var sAddressType:String = null; if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Reprocessing started at " + new Date()); // Get all currently failed service requests of type oSRBC.ClearToQuery(); oSRBC.SetViewMode(AllView); oSRBC.ActivateField("Area"); oSRBC.ActivateField("Sub-Area"); oSRBC.ActivateField("Account Address Id SCM"); oSRBC.ActivateField("Billing Address Id SCM"); oSRBC.ActivateField("Asset Address Id SCM"); oSRBC.ActivateField("Status"); oSRBC.ActivateField("Created"); oSRBC.ActivateField("Account Id"); oSRBC.ActivateField("Description"); oSRBC.SetSearchExpr("[Status] = 'Failed' AND [Area] = 'Customer Data' AND [Sub-Area] = 'Address change'"); oSRBC.ExecuteQuery(ForwardOnly); if(!oSRBC.FirstRecord()) { // no SR found if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - No address change Service request in status failed found. Reprocessing stopped."); } else { // For each service requests, process: var bRecordExists = oSRBC.FirstRecord(); while (bRecordExists && lRecordCount < MAX_RECORDS) { lRecordCount++; // Get Service request id for logging purposes var sSrId:String = oSRBC.GetFieldValue("Id"); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Now processing SR with id : " + sSrId); // If SR already reprocessed, ignore if (isAlreadyReprocessed(oSRBC)) { if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Service request with Id: [" + sSrId + "] already reprocessed."); } else { // Get service request description var sDesc:String = oSRBC.GetFieldValue("Description"); switch (checkedActivities(oActBC)) { case 1: // No replicate activities found if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": +reprocessFailedAddressChangeSRs - Service request with Id: [" + sSrId + "] - No correspond

CAM SR Reprocessing SCM
reprocessFailedAddressChangeSRs
/******************************************************* ** Name: reprocessFailedSRs ** Created: 29.03.2010 ** Created By: Alejandro Strickler (Based on code written by karin Haack) ** Description: This method searches all SRs on status "Failed" and decides if they should be reprocessed or cancelled -------------------- Modifications --------------------- ** Date: 06.05.2010 ** Changed By: Alejandro Strickler ** Description: Code fix ******************************************************/ function reprocessFailedAddressChangeSRs() { // Instantiate all needed objects var oSRBO:BusObject = oApp.GetBusObject("Service Request"); var oSRBC:BusComp = oSRBO.GetBusComp("Service Request"); var oSRBO_NEW:BusObject = oApp.GetBusObject("Service Request"); var oSRBC_NEW:BusComp = oSRBO_NEW.GetBusComp("Service Request"); var oActBC:BusComp = oSRBO.GetBusComp("Action"); var oADDRBO:BusObject = oApp.GetBusObject("EAI All Address Entities SCM"); var oAccAddrBC:BusComp = oADDRBO.GetBusComp("EAI Account Address Usage SCM"); var oBPAddrBC:BusComp = oADDRBO.GetBusComp("EAI Billing Profile Address Usage SCM"); var oConAddrBC:BusComp = oADDRBO.GetBusComp("EAI Contract Address Usage SCM"); var oWFBS:Service = oApp.GetService("Workflow Process Manager"); var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var newId; // Create address business component reference variable var oAddressBc:BusComp = null; var oToday:Date; // Declare variables to prevent fetching too much records var MAX_RECORDS = 10000; var lRecordCount = 0; try { // Initialize date variables oToday = new Date(); var todayDate:String = Clib.rsprintf("%04d%02d%02d", oToday.getFullYear(), oToday.getMonth()+1, oToday.getDate()); var newStartDate:String = Clib.rsprintf("%02d/%02d/%04d", oToday.getMonth()+1, oToday.getDate(), oToday.getFullYear()); // Create indicator for the address type related to the current service request var sAddressType:String = null; if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Reprocessing started at " + new Date()); // Get all currently failed service requests of type oSRBC.ClearToQuery(); oSRBC.SetViewMode(AllView); oSRBC.ActivateField("Area"); oSRBC.ActivateField("Sub-Area"); oSRBC.ActivateField("Account Address Id SCM"); oSRBC.ActivateField("Billing Address Id SCM"); oSRBC.ActivateField("Asset Address Id SCM"); oSRBC.ActivateField("Status"); oSRBC.ActivateField("Created"); oSRBC.ActivateField("Account Id"); oSRBC.ActivateField("Description"); oSRBC.SetSearchExpr("[Status] = 'Failed' AND [Area] = 'Customer Data' AND [Sub-Area] = 'Address change'"); oSRBC.ExecuteQuery(ForwardOnly); if(!oSRBC.FirstRecord()) { // no SR found if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - No address change Service request in status failed found. Reprocessing stopped."); } else { // For each service requests, process: var bRecordExists = oSRBC.FirstRecord(); while (bRecordExists && lRecordCount < MAX_RECORDS) { lRecordCount++; // Get Service request id for logging purposes var sSrId:String = oSRBC.GetFieldValue("Id"); if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Now processing SR with id : " + sSrId); // If SR already reprocessed, ignore if (isAlreadyReprocessed(oSRBC)) { if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": reprocessFailedAddressChangeSRs - Service request with Id: [" + sSrId + "] already reprocessed."); } else { // Get service request description var sDesc:String = oSRBC.GetFieldValue("Description"); switch (checkedActivities(oActBC)) { case 1: // No replicate activities found if (bIsTraceOn) oApp.Trace("Info - BS "+this.Name()+": +reprocessFailedAddressChangeSRs - Service request with Id: [" + sSrId + "] - No correspond

CG SAP Pricing Condition Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CG SAP Pricing Condition Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CG SAP Pricing Condition Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CG SAP Pricing Condition Maps - old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps - old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps - old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CG SAP Pricing Condition Maps - old
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps - old
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps - old
CreatePromotions_SiebelToIDOC
function CreatePromotions_SiebelToIDOC (inputMsg, outputMsg) { // Set up EAI Input Message objects var iObj_Promotions; // Siebel Promotion instance var iComp_Promotions; // Promotion var iComp_AccountPromotion; var iComp_AccountPromotionProducts; // Set up EAI Output Message objects var oObj_COND_A01; // IDOC instance var oComp_E2KOMG003; var oComp_E2KONH; var oComp_E2KONP002; var oComp_Idoc_Segments; // Set up EAI Lookup maps var PricingLookup = EAIGetValueMap ("SAP CG Create Pricing", "Siebel Outbound"); var CurrencyLookup = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var UnitOfMeasureLookup = EAIGetValueMap ("SAP Unit of Measure","Siebel Outbound"); var ConditionTypeLookup = EAIGetValueMap ("SAP Condition Type","Siebel Outbound"); // Other variables var VKORG; var VTWEG; var KUNNR; var MATNR; var billback; // Find and create top-level integration object oObj_COND_A01 = outputMsg.CreateIntObj("COND_A01 (COND_A)"); iObj_Promotions = inputMsg.GetIntObj("CPG SAP Connector - Create Pricing Interface (Siebel)"); // Read int object instances from EAI message while (iObj_Promotions.NextInstance ()) { oObj_COND_A01.NewInstance(); // Read "Promotions" component iComp_AccountPromotion = iObj_Promotions.GetPrimaryIntComp("CPG Plan Account Promotion"); // Create IDOC component instances oComp_Idoc_Segments = oObj_COND_A01.CreatePrimaryIntComp("Idoc Segments"); oComp_Idoc_Segments.NewRecord(); oComp_E2KOMG003 = oComp_Idoc_Segments.CreateIntComp("E2KOMG003"); if (iComp_AccountPromotion.NextRecord()) { iComp_AccountPromotionProducts = iComp_AccountPromotion.GetIntComp("CPG Plan Account Promotion Product"); while (iComp_AccountPromotionProducts.NextRecord()) { // Write "E2KOMG003" component oComp_E2KOMG003.NewRecord (); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotion); oComp_E2KOMG003.SetFieldValue("KVEWE", PricingLookup.Translate ("Usage Of Condition Table")); oComp_E2KOMG003.SetFieldValue("KOTABNR", PricingLookup.Translate ("Condition Table")); oComp_E2KOMG003.SetFieldValue("KAPPL", PricingLookup.Translate ("Application")); //condition type - Tactics oComp_E2KOMG003.SetFieldValue("KSCHL", ConditionTypeLookup.Translate(iComp_AccountPromotion.GetFieldValue("Tactics"))); oComp_E2KOMG003.CopyFieldValue("VKORG", "Sales Org"); oComp_E2KOMG003.CopyFieldValue("VTWEG", "Dis Channel"); oComp_E2KOMG003.CopyFieldValue("SPART", "Division SAP"); oComp_E2KOMG003.CopyFieldValue("KUNNR", "Account Integration Id"); oComp_E2KOMG003.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KOMG003.CopyFieldValue("MATNR","Product Integration Id"); VKORG = iComp_AccountPromotion.GetFieldValue("Sales Org"); VTWEG = iComp_AccountPromotion.GetFieldValue("Dis Channel"); KUNNR = iComp_AccountPromotion.GetFieldValue("Account Integration Id"); MATNR = iComp_AccountPromotionProducts.GetFieldValue("Product Integration Id"); oComp_E2KOMG003.SetFieldValue("VAKEY", VKORG + VTWEG + KUNNR + MATNR); // concatenate VKORG +VTWEG +KUNNR +MATNR oComp_E2KOMG003.SetFieldValue("KDGRP", ""); // Customer Group oComp_E2KOMG003.SetFieldValue("MATKL", ""); // Material Group // Write "E2KONH" component oComp_E2KONH = oComp_E2KOMG003.CreateIntComp("E2KONH"); oComp_E2KONH.NewRecord(); oComp_E2KONH.SetCopySource(iComp_AccountPromotionProducts); oComp_E2KONH.CopyFieldValue("DATAB","Start Date Promo for Acct"); oComp_E2KONH.CopyFieldValue("DATBI","End Date Promo for Acct" ); oComp_E2KONH.SetCopySource(iComp_AccountPromotion); oComp_E2KONH.CopyFieldValue("KOSRT","Joined Promotion Id"); // Write "E2KONP002" component oCom

CG SAP Pricing Condition Maps - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CG SAP Pricing Condition Maps - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CG SAP Pricing Condition Maps - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CG SAP Pricing Condition Maps - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CG SAP Pricing Condition Maps - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CNO Address SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON; //View names where the applet should be executed var OLI_VIEW = "Order Entry - Line Items View (Sales)"; var OLI_REIS_1 = "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM"; var OLI_REIS_2 = "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM"; var OLI_REIS_3 = "Sales Order-Browse Catalog Category Retention View SCM"; var QSUMVIEW = "Quote Item XA View AIP SCM"; var CNO_QI_VIEW = "Quote CNO Contact Information View AIP SCM"; // MCT 21092015 - added for defect 115283

CNO Address SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON; //View names where the applet should be executed var OLI_VIEW = "Order Entry - Line Items View (Sales)"; var OLI_REIS_1 = "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM"; var OLI_REIS_2 = "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM"; var OLI_REIS_3 = "Sales Order-Browse Catalog Category Retention View SCM"; var QSUMVIEW = "Quote Item XA View AIP SCM"; var CNO_QI_VIEW = "Quote CNO Contact Information View AIP SCM"; // MCT 21092015 - added for defect 115283

CNO Address SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Account Id SCM", ""); Outputs.SetProperty("Account Name SCM", ""); Outputs.SetProperty("Attention Of SCM", ""); Outputs.SetProperty("Residence Description denormalized SCM", ""); Outputs.SetProperty("Location Supplement denormalized SCM", ""); Outputs.SetProperty("Address Id SCM", ""); Outputs.SetProperty("Address Type Code SCM", ""); Outputs.SetProperty("Address Status SCM", ""); Outputs.SetProperty("City denormalized SCM", ""); Outputs.SetProperty("Email Address SCM", ""); Outputs.SetProperty("Country denormalized SCM", ""); Outputs.SetProperty("Postal Code denormalized SCM", ""); Outputs.SetProperty("Professional First Name SCM", ""); Outputs.SetProperty("Professional Id SCM", ""); Outputs.SetProperty("Professional Language Code SCM", ""); Outputs.SetProperty("Professional Last Name SCM", ""); Outputs.SetProperty("Professional M/M SCM", ""); Outputs.SetProperty("Professional Name Additive SCM", ""); Outputs.SetProperty("Street Address denormalized SCM", ""); Outputs.SetProperty("Street Nr. denormalized SCM", ""); Outputs.SetProperty("Fax# SCM", ""); Outputs.SetProperty("Phone# SCM", ""); Outputs.SetProperty("CO Name SCM",""); Outputs.SetProperty("Related To SCM", ""); Outputs.SetProperty("PO Number SCM",""); Outputs.SetProperty("Address Relation Type SCM",""); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 } catch(e){ throw(e); } finally{ } }

CNO Address SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Account Id SCM", ""); Outputs.SetProperty("Account Name SCM", ""); Outputs.SetProperty("Attention Of SCM", ""); Outputs.SetProperty("Residence Description denormalized SCM", ""); Outputs.SetProperty("Location Supplement denormalized SCM", ""); Outputs.SetProperty("Address Id SCM", ""); Outputs.SetProperty("Address Type Code SCM", ""); Outputs.SetProperty("Address Status SCM", ""); Outputs.SetProperty("City denormalized SCM", ""); Outputs.SetProperty("Email Address SCM", ""); Outputs.SetProperty("Country denormalized SCM", ""); Outputs.SetProperty("Postal Code denormalized SCM", ""); Outputs.SetProperty("Professional First Name SCM", ""); Outputs.SetProperty("Professional Id SCM", ""); Outputs.SetProperty("Professional Language Code SCM", ""); Outputs.SetProperty("Professional Last Name SCM", ""); Outputs.SetProperty("Professional M/M SCM", ""); Outputs.SetProperty("Professional Name Additive SCM", ""); Outputs.SetProperty("Street Address denormalized SCM", ""); Outputs.SetProperty("Street Nr. denormalized SCM", ""); Outputs.SetProperty("Fax# SCM", ""); Outputs.SetProperty("Phone# SCM", ""); Outputs.SetProperty("CO Name SCM",""); Outputs.SetProperty("Related To SCM", ""); Outputs.SetProperty("PO Number SCM",""); Outputs.SetProperty("Address Relation Type SCM",""); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 } catch(e){ throw(e); } finally{ } }

CNO Address SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************** * Function: Query in BusService "BusinessServiceName" * Author : Aingeru Sabano Lasuen (TGDSEAI1) * Purpose : Query Over the three address BC * Date : 2009-01-27 *-------------------------------------------------------------------------------------------------* * Update : 2009-11-04 TGDCALU3 Due to Issue 15486, show only CONTRACT (and MAIN) Addresses in Pick * Applet associated to field "Address Type" of the 'Delivery Address' * 2010-03-17 TGDHURO9 Defect 16555 reduce showed addressess in pick applet * 'Notification CNO Address Pick List Applet SCM' * Update : 2011-02-27 TGDSEAI1 All IP Merge include also Quote context some clean up done * 2012-02-24 TGDBLR04 Defect:48498 --> case OLI_REIS_3 was missing **************************************************************************************************/ //Variable declarations var BO:BusObject; var BC:BusComp; var strViewName; var accountID; var searchstring = ""; var searchSpecComplete = ""; var assetId; var bpId; try{ // This code should be executed only if we are in the view for the CNO strViewName = TheApplication().ActiveViewName(); switch(strViewName) { case OLI_REIS_1: case OLI_REIS_2: case OLI_REIS_3: case OLI_VIEW: case QSUMVIEW: case CNO_QI_VIEW: // Get BC search spec searchstring = Inputs.GetProperty("search-string"); // Initialize Account Id, Asset Id and BP ID BO = TheApplication().ActiveBusObject(); if(BO.Name() == "Order Entry (Sales)") { BC = BO.GetBusComp("Order Entry - Orders"); accountID = BC.GetFieldValue("Service Account Id"); assetId= BC.GetFieldValue("Service Request Asset Id SCM"); bpId = BC.GetFieldValue("Billing Profile Id"); } else if(BO.Name() == "Quote"){ BC = BO.GetBusComp("Quote"); accountID = BC.GetFieldValue("Account Id"); assetId = BC.GetFieldValue("Asset Bundle Id AIP SCM"); bpId = BC.GetFieldValue("Billing Profile Id") } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " AccountId: "+ accountID +" Asset Id: "+ assetId +" BP Id: "+ bpId); searchSpecComplete = "[Address Status SCM] = 'Active'"; // Add the search spec in the BC to the query if(searchstring != null && searchstring != "") { searchSpecComplete = searchSpecComplete + " AND " + searchstring; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " searchSpecComplete " + searchSpecComplete); // Condition Added to not allow to search for Related To SCM field if(Clib.strstr(searchstring, "Related To SCM")== null ) { //Reis Views, the Pick Applet should show only CONTRACT (and MAIN) Addresses. if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Avoid the query if no BPId exist if(bpId != null && bpId !=""){ fQueryBillingAddress(searchSpecComplete, strViewName, bpId, Outputs); }//End bpId }// End if view //Call Query Asset Address function if(assetId != null && assetId !=""){ fQueryAssetAddress(searchSpecComplete, strViewName, assetId, Outputs); } //Reis Views, the Pick Applet should show only CONTRACT (and MAIN) Addresses. if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Call Query Account Address fQueryAccountAddress(searchSpecComplete, strViewName, accountID, Outputs); }//End if view }// End if (Clib... break; default: // Do nothing in the rest of the views break; } } catch(e){ if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e);

CNO Address SCM
Query
function Query(Inputs, Outputs) { /************************************************************************************************** * Function: Query in BusService "BusinessServiceName" * Author : Aingeru Sabano Lasuen (TGDSEAI1) * Purpose : Query Over the three address BC * Date : 2009-01-27 *-------------------------------------------------------------------------------------------------* * Update : 2009-11-04 TGDCALU3 Due to Issue 15486, show only CONTRACT (and MAIN) Addresses in Pick * Applet associated to field "Address Type" of the 'Delivery Address' * 2010-03-17 TGDHURO9 Defect 16555 reduce showed addressess in pick applet * 'Notification CNO Address Pick List Applet SCM' * Update : 2011-02-27 TGDSEAI1 All IP Merge include also Quote context some clean up done * 2012-02-24 TGDBLR04 Defect:48498 --> case OLI_REIS_3 was missing **************************************************************************************************/ //Variable declarations var BO:BusObject; var BC:BusComp; var strViewName; var accountID; var searchstring = ""; var searchSpecComplete = ""; var assetId; var bpId; try{ // This code should be executed only if we are in the view for the CNO strViewName = TheApplication().ActiveViewName(); switch(strViewName) { case OLI_REIS_1: case OLI_REIS_2: case OLI_REIS_3: case OLI_VIEW: case QSUMVIEW: case CNO_QI_VIEW: // Get BC search spec searchstring = Inputs.GetProperty("search-string"); // Initialize Account Id, Asset Id and BP ID BO = TheApplication().ActiveBusObject(); if(BO.Name() == "Order Entry (Sales)") { BC = BO.GetBusComp("Order Entry - Orders"); accountID = BC.GetFieldValue("Service Account Id"); assetId= BC.GetFieldValue("Service Request Asset Id SCM"); bpId = BC.GetFieldValue("Billing Profile Id"); } else if(BO.Name() == "Quote"){ BC = BO.GetBusComp("Quote"); accountID = BC.GetFieldValue("Account Id"); assetId = BC.GetFieldValue("Asset Bundle Id AIP SCM"); bpId = BC.GetFieldValue("Billing Profile Id") } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " AccountId: "+ accountID +" Asset Id: "+ assetId +" BP Id: "+ bpId); searchSpecComplete = "[Address Status SCM] = 'Active'"; // Add the search spec in the BC to the query if(searchstring != null && searchstring != "") { searchSpecComplete = searchSpecComplete + " AND " + searchstring; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " searchSpecComplete " + searchSpecComplete); // Condition Added to not allow to search for Related To SCM field if(Clib.strstr(searchstring, "Related To SCM")== null ) { //Reis Views, the Pick Applet should show only CONTRACT (and MAIN) Addresses. if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Avoid the query if no BPId exist if(bpId != null && bpId !=""){ fQueryBillingAddress(searchSpecComplete, strViewName, bpId, Outputs); }//End bpId }// End if view //Call Query Asset Address function if(assetId != null && assetId !=""){ fQueryAssetAddress(searchSpecComplete, strViewName, assetId, Outputs); } //Reis Views, the Pick Applet should show only CONTRACT (and MAIN) Addresses. if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Call Query Account Address fQueryAccountAddress(searchSpecComplete, strViewName, accountID, Outputs); }//End if view }// End if (Clib... break; default: // Do nothing in the rest of the views break; } } catch(e){ if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e);

CNO Address SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: BS for the VBC CNO Address SCM, to initialize and fill the BC with data from ** the three new address BC *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

CNO Address SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: BS for the VBC CNO Address SCM, to initialize and fill the BC with data from ** the three new address BC *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

CNO Address SCM
fActivateFields
function fActivateFields(BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to activate the BC Fields for query on them due to the script length limit *****************************************************************/ BCAccount.ActivateField("Account Id SCM"); BCAccount.ActivateField("Account Name SCM"); BCAccount.ActivateField("Attention Of SCM"); BCAccount.ActivateField("Residence Description denormalized SCM"); BCAccount.ActivateField("Location Supplement denormalized SCM"); BCAccount.ActivateField("Address Id SCM"); BCAccount.ActivateField("Address Type Code denormalized SCM"); BCAccount.ActivateField("Address Status SCM"); BCAccount.ActivateField("City denormalized SCM"); BCAccount.ActivateField("Email Address SCM"); BCAccount.ActivateField("Country denormalized SCM"); BCAccount.ActivateField("Postal Code denormalized SCM"); BCAccount.ActivateField("Professional First Name SCM"); //BCAccount.ActivateField("Professional Id SCM"); //BCAccount.ActivateField("Job Title SCM"); BCAccount.ActivateField("Title M/F Calc for OLI SCM"); BCAccount.ActivateField("Language Code SCM"); BCAccount.ActivateField("Professional Last Name SCM"); BCAccount.ActivateField("Title SCM"); BCAccount.ActivateField("Professional Name Additive SCM"); BCAccount.ActivateField("Street Address denormalized SCM"); BCAccount.ActivateField("Street Nr. denormalized SCM"); BCAccount.ActivateField("Fax# SCM"); BCAccount.ActivateField("Phone# SCM"); BCAccount.ActivateField("CO Name SCM"); BCAccount.ActivateField("PO Box denormalized SCM"); BCAccount.ActivateField("Address Relation Type SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Attention CO Name Calc SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Asset Id"); }

CNO Address SCM
fActivateFields
function fActivateFields(BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to activate the BC Fields for query on them due to the script length limit *****************************************************************/ BCAccount.ActivateField("Account Id SCM"); BCAccount.ActivateField("Account Name SCM"); BCAccount.ActivateField("Attention Of SCM"); BCAccount.ActivateField("Residence Description denormalized SCM"); BCAccount.ActivateField("Location Supplement denormalized SCM"); BCAccount.ActivateField("Address Id SCM"); BCAccount.ActivateField("Address Type Code denormalized SCM"); BCAccount.ActivateField("Address Status SCM"); BCAccount.ActivateField("City denormalized SCM"); BCAccount.ActivateField("Email Address SCM"); BCAccount.ActivateField("Country denormalized SCM"); BCAccount.ActivateField("Postal Code denormalized SCM"); BCAccount.ActivateField("Professional First Name SCM"); //BCAccount.ActivateField("Professional Id SCM"); //BCAccount.ActivateField("Job Title SCM"); BCAccount.ActivateField("Title M/F Calc for OLI SCM"); BCAccount.ActivateField("Language Code SCM"); BCAccount.ActivateField("Professional Last Name SCM"); BCAccount.ActivateField("Title SCM"); BCAccount.ActivateField("Professional Name Additive SCM"); BCAccount.ActivateField("Street Address denormalized SCM"); BCAccount.ActivateField("Street Nr. denormalized SCM"); BCAccount.ActivateField("Fax# SCM"); BCAccount.ActivateField("Phone# SCM"); BCAccount.ActivateField("CO Name SCM"); BCAccount.ActivateField("PO Box denormalized SCM"); BCAccount.ActivateField("Address Relation Type SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Attention CO Name Calc SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Asset Id"); }

CNO Address SCM
fQueryAccountAddress
function fQueryAccountAddress(searchSpecComplete,strViewName,accountID,Outputs){ /************************************************************************************************** * Function: fQueryAccountAddress * Author : TGDSEAI1 * Purpose : Query Over the account address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located accountID: Account Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; try{ // *** Get ACCOUNT Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Address Usage SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); //Add account id to search spec searchSpecComplete = searchSpecComplete + "AND [Account Id SCM] = '" + accountID + "'"; BCAccount.SetSearchExpr(searchSpecComplete); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row,BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Account Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) }// End if } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; } }

CNO Address SCM
fQueryAccountAddress
function fQueryAccountAddress(searchSpecComplete,strViewName,accountID,Outputs){ /************************************************************************************************** * Function: fQueryAccountAddress * Author : TGDSEAI1 * Purpose : Query Over the account address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located accountID: Account Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; try{ // *** Get ACCOUNT Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Account Address Usage SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); //Add account id to search spec searchSpecComplete = searchSpecComplete + "AND [Account Id SCM] = '" + accountID + "'"; BCAccount.SetSearchExpr(searchSpecComplete); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row,BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Account Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) }// End if } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; } }

CNO Address SCM
fQueryAssetAddress
function fQueryAssetAddress(searchSpecComplete,strViewName,assetId,Outputs){ /************************************************************************************************** * Function: fQueryAssetAddress * Author : TGDSEAI1 * Purpose : Query Over the asset address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located assetId: Asset Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; var searchSpecContract = ""; try{ // *** Get CONTRACT Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Contract Address Usage Light SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); //Add Asset Id filter searchSpecContract = searchSpecComplete + " AND [Asset Id] = '" + assetId + "'"; if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Filter out the main address to avoid it appear duplicated in CNO views searchSpecContract = searchSpecContract + " AND [Address Relation Type SCM] <> 'Default'"; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " searchSpecContract: " + searchSpecContract); BCAccount.SetSearchExpr(searchSpecContract); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row, BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Contract Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) }// End if } catch(e) { if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e); } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; searchSpecContract = null; } }

CNO Address SCM
fQueryAssetAddress
function fQueryAssetAddress(searchSpecComplete,strViewName,assetId,Outputs){ /************************************************************************************************** * Function: fQueryAssetAddress * Author : TGDSEAI1 * Purpose : Query Over the asset address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located assetId: Asset Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; var searchSpecContract = ""; try{ // *** Get CONTRACT Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Contract Address Usage Light SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); //Add Asset Id filter searchSpecContract = searchSpecComplete + " AND [Asset Id] = '" + assetId + "'"; if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Filter out the main address to avoid it appear duplicated in CNO views searchSpecContract = searchSpecContract + " AND [Address Relation Type SCM] <> 'Default'"; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " searchSpecContract: " + searchSpecContract); BCAccount.SetSearchExpr(searchSpecContract); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row, BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Contract Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) }// End if } catch(e) { if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e); } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; searchSpecContract = null; } }

CNO Address SCM
fQueryBillingAddress
function fQueryBillingAddress(searchSpecComplete,strViewName,bpId,Outputs){ /************************************************************************************************** * Function: fQueryBillingAddress * Author : TGDSEAI1 * Purpose : Query Over the billing address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located bpId: Billing Profile Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; var searchSpecBilling = ""; try{ // *** Get BILLING PROFILE Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); BCAccount.ClearToQuery(); //Activate Fields fActivateFields(BCAccount); //Add the billing profile search spec searchSpecBilling = searchSpecComplete + " AND [Parent Billing Profile Id SCM] = '" + bpId + "'"; if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Filter out the main address to avoid it appear duplicated in CNO Views searchSpecBilling = searchSpecBilling + " AND [Address Relation Type SCM] <> 'Default'"; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " SearchSpecBilling: " + searchSpecBilling); //Add search spec BCAccount.SetSearchExpr(searchSpecBilling); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row, BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Billing Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) } } catch(e) { if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e); } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; searchSpecBilling = null; } }

CNO Address SCM
fQueryBillingAddress
function fQueryBillingAddress(searchSpecComplete,strViewName,bpId,Outputs){ /************************************************************************************************** * Function: fQueryBillingAddress * Author : TGDSEAI1 * Purpose : Query Over the billing address BC * Input : searchSpecComplete: search spec to be applied strViewName: View name where we are located bpId: Billing Profile Id to use in the query Outputs: Outputs to be pased to the VBC * Date : 28.02.2011 **************************************************************************************************/ //Variable declarations var BOAccount:BusObject; var BCAccount:BusComp; var row:PropertySet; var searchSpecBilling = ""; try{ // *** Get BILLING PROFILE Addresses *** BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); BCAccount.ClearToQuery(); //Activate Fields fActivateFields(BCAccount); //Add the billing profile search spec searchSpecBilling = searchSpecComplete + " AND [Parent Billing Profile Id SCM] = '" + bpId + "'"; if((strViewName!=OLI_REIS_3) && (strViewName!=OLI_REIS_1) && (strViewName!=OLI_REIS_2)) { //Filter out the main address to avoid it appear duplicated in CNO Views searchSpecBilling = searchSpecBilling + " AND [Address Relation Type SCM] <> 'Default'"; } if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " SearchSpecBilling: " + searchSpecBilling); //Add search spec BCAccount.SetSearchExpr(searchSpecBilling); BCAccount.ExecuteQuery(ForwardOnly); if(BCAccount.FirstRecord()) { do{ row = TheApplication().NewPropertySet(); //Set fields in the property set fSetField(row, BCAccount); row.SetProperty("Related To SCM", TheApplication().InvokeMethod("LookupValue", "ADDRESS_RELATED", "Billing Address")); Outputs.AddChild (row); }while(BCAccount.NextRecord()) } } catch(e) { if(TheApplication().isTraceON)TheApplication().Trace(this.Name() + " Error on Query method: " + e.message); throw(e); } finally{ //Variable destruction BOAccount = null; BCAccount = null; row = null; searchSpecBilling = null; } }

CNO Address SCM
fSetField
function fSetField(row,BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to set the property values, BC Fields *****************************************************************/ row.SetProperty("Account Id SCM", BCAccount.GetFieldValue("Account Id SCM")); row.SetProperty("Account Name SCM", BCAccount.GetFieldValue("Account Name SCM")); //row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention Of SCM")); row.SetProperty("Residence Description denormalized SCM", BCAccount.GetFieldValue("Residence Description denormalized SCM")); row.SetProperty("Location Supplement denormalized SCM", BCAccount.GetFieldValue("Location Supplement denormalized SCM")); row.SetProperty("Address Id SCM", BCAccount.GetFieldValue("Address Id SCM")); row.SetProperty("Address Type Code denormalized SCM", BCAccount.GetFieldValue("Address Type Code denormalized SCM")); row.SetProperty("Address Status SCM", BCAccount.GetFieldValue("Address Status SCM")); row.SetProperty("City denormalized SCM", BCAccount.GetFieldValue("City denormalized SCM")); row.SetProperty("Email Address SCM", BCAccount.GetFieldValue("Email Address SCM")); row.SetProperty("Country denormalized SCM", BCAccount.GetFieldValue("Country denormalized SCM")); row.SetProperty("Postal Code denormalized SCM", BCAccount.GetFieldValue("Postal Code denormalized SCM")); row.SetProperty("Professional First Name SCM", BCAccount.GetFieldValue("Professional First Name SCM")); //row.SetProperty("Professional Id SCM", BCAccount.GetFieldValue("Professional Id SCM")); //row.SetProperty("Professional Job Title SCM", BCAccount.GetFieldValue("Job Title SCM")); row.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Language Code SCM")); row.SetProperty("Professional Last Name SCM", BCAccount.GetFieldValue("Professional Last Name SCM")); row.SetProperty("Title SCM", BCAccount.GetFieldValue("Title SCM")); row.SetProperty("Title M/F Calc for OLI SCM", BCAccount.GetFieldValue("Title M/F Calc for OLI SCM")); row.SetProperty("Professional Name Additive SCM", BCAccount.GetFieldValue("Professional Name Additive SCM")); row.SetProperty("Street Address denormalized SCM", BCAccount.GetFieldValue("Street Address denormalized SCM")); row.SetProperty("Street Nr. denormalized SCM", BCAccount.GetFieldValue("Street Nr. denormalized SCM")); row.SetProperty("Fax# SCM", BCAccount.GetFieldValue("Fax# SCM")); row.SetProperty("Phone# SCM", BCAccount.GetFieldValue("Phone# SCM")); row.SetProperty("CO Name SCM", BCAccount.GetFieldValue("CO Name SCM")); row.SetProperty("PO Number SCM", BCAccount.GetFieldValue("PO Box denormalized SCM")); row.SetProperty("Address Relation Type SCM", BCAccount.GetFieldValue("Address Relation Type SCM")); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention CO Name Calc SCM"));//TGDSEAI1 - 20/08/2009 Defect 11459 }

CNO Address SCM
fSetField
function fSetField(row,BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to set the property values, BC Fields *****************************************************************/ row.SetProperty("Account Id SCM", BCAccount.GetFieldValue("Account Id SCM")); row.SetProperty("Account Name SCM", BCAccount.GetFieldValue("Account Name SCM")); //row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention Of SCM")); row.SetProperty("Residence Description denormalized SCM", BCAccount.GetFieldValue("Residence Description denormalized SCM")); row.SetProperty("Location Supplement denormalized SCM", BCAccount.GetFieldValue("Location Supplement denormalized SCM")); row.SetProperty("Address Id SCM", BCAccount.GetFieldValue("Address Id SCM")); row.SetProperty("Address Type Code denormalized SCM", BCAccount.GetFieldValue("Address Type Code denormalized SCM")); row.SetProperty("Address Status SCM", BCAccount.GetFieldValue("Address Status SCM")); row.SetProperty("City denormalized SCM", BCAccount.GetFieldValue("City denormalized SCM")); row.SetProperty("Email Address SCM", BCAccount.GetFieldValue("Email Address SCM")); row.SetProperty("Country denormalized SCM", BCAccount.GetFieldValue("Country denormalized SCM")); row.SetProperty("Postal Code denormalized SCM", BCAccount.GetFieldValue("Postal Code denormalized SCM")); row.SetProperty("Professional First Name SCM", BCAccount.GetFieldValue("Professional First Name SCM")); //row.SetProperty("Professional Id SCM", BCAccount.GetFieldValue("Professional Id SCM")); //row.SetProperty("Professional Job Title SCM", BCAccount.GetFieldValue("Job Title SCM")); row.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Language Code SCM")); row.SetProperty("Professional Last Name SCM", BCAccount.GetFieldValue("Professional Last Name SCM")); row.SetProperty("Title SCM", BCAccount.GetFieldValue("Title SCM")); row.SetProperty("Title M/F Calc for OLI SCM", BCAccount.GetFieldValue("Title M/F Calc for OLI SCM")); row.SetProperty("Professional Name Additive SCM", BCAccount.GetFieldValue("Professional Name Additive SCM")); row.SetProperty("Street Address denormalized SCM", BCAccount.GetFieldValue("Street Address denormalized SCM")); row.SetProperty("Street Nr. denormalized SCM", BCAccount.GetFieldValue("Street Nr. denormalized SCM")); row.SetProperty("Fax# SCM", BCAccount.GetFieldValue("Fax# SCM")); row.SetProperty("Phone# SCM", BCAccount.GetFieldValue("Phone# SCM")); row.SetProperty("CO Name SCM", BCAccount.GetFieldValue("CO Name SCM")); row.SetProperty("PO Number SCM", BCAccount.GetFieldValue("PO Box denormalized SCM")); row.SetProperty("Address Relation Type SCM", BCAccount.GetFieldValue("Address Relation Type SCM")); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention CO Name Calc SCM"));//TGDSEAI1 - 20/08/2009 Defect 11459 }

CNO Address for BP SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON;

CNO Address for BP SCM
(declarations)
var bIsTraceOn = TheApplication().isTraceON;

CNO Address for BP SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Account Id SCM", ""); Outputs.SetProperty("Account Name SCM", ""); Outputs.SetProperty("Attention Of SCM", ""); Outputs.SetProperty("Residence Description denormalized SCM", ""); Outputs.SetProperty("Location Supplement denormalized SCM", ""); Outputs.SetProperty("Address Id SCM", ""); Outputs.SetProperty("Address Type Code SCM", ""); Outputs.SetProperty("Address Status SCM", ""); Outputs.SetProperty("City denormalized SCM", ""); Outputs.SetProperty("Email Address SCM", ""); Outputs.SetProperty("Country denormalized SCM", ""); Outputs.SetProperty("Postal Code denormalized SCM", ""); Outputs.SetProperty("Professional First Name SCM", ""); Outputs.SetProperty("Professional Id SCM", ""); Outputs.SetProperty("Professional Language Code SCM", ""); Outputs.SetProperty("Professional Last Name SCM", ""); Outputs.SetProperty("Professional M/M SCM", ""); Outputs.SetProperty("Professional Name Additive SCM", ""); Outputs.SetProperty("Street Address denormalized SCM", ""); Outputs.SetProperty("Street Nr. denormalized SCM", ""); Outputs.SetProperty("Fax# SCM", ""); Outputs.SetProperty("Phone# SCM", ""); Outputs.SetProperty("CO Name SCM",""); Outputs.SetProperty("Related To SCM", ""); Outputs.SetProperty("PO Number SCM",""); Outputs.SetProperty("Address Relation Type SCM",""); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 } catch(e){ throw(e); } finally{ } }

CNO Address for BP SCM
Init
function Init (Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: Initialize the BC fields *****************************************************************/ try{ Outputs.SetProperty("Account Id SCM", ""); Outputs.SetProperty("Account Name SCM", ""); Outputs.SetProperty("Attention Of SCM", ""); Outputs.SetProperty("Residence Description denormalized SCM", ""); Outputs.SetProperty("Location Supplement denormalized SCM", ""); Outputs.SetProperty("Address Id SCM", ""); Outputs.SetProperty("Address Type Code SCM", ""); Outputs.SetProperty("Address Status SCM", ""); Outputs.SetProperty("City denormalized SCM", ""); Outputs.SetProperty("Email Address SCM", ""); Outputs.SetProperty("Country denormalized SCM", ""); Outputs.SetProperty("Postal Code denormalized SCM", ""); Outputs.SetProperty("Professional First Name SCM", ""); Outputs.SetProperty("Professional Id SCM", ""); Outputs.SetProperty("Professional Language Code SCM", ""); Outputs.SetProperty("Professional Last Name SCM", ""); Outputs.SetProperty("Professional M/M SCM", ""); Outputs.SetProperty("Professional Name Additive SCM", ""); Outputs.SetProperty("Street Address denormalized SCM", ""); Outputs.SetProperty("Street Nr. denormalized SCM", ""); Outputs.SetProperty("Fax# SCM", ""); Outputs.SetProperty("Phone# SCM", ""); Outputs.SetProperty("CO Name SCM",""); Outputs.SetProperty("Related To SCM", ""); Outputs.SetProperty("PO Number SCM",""); Outputs.SetProperty("Address Relation Type SCM",""); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 } catch(e){ throw(e); } finally{ } }

CNO Address for BP SCM
Query
function Query(Inputs, Outputs) { /*************************************************************************************** ** Bussiness Service: CNO Address for BP SCM ** Created: 04-11-2009 ** Created By: Luis Casado V. ** Description: Due to Issue 15486, show only BILLIG PROFILE (and MAIN) Addresses in Pick ** Applet associated to field "Address Type" of the 'Billing Address'. ***************************************************************************************/ var strViewName; var BO; var BC; var BOAccount; var BCAccount; var accountID; var searchstring; // (BEGIN) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. var searchSpecComplete = ""; // (END) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. var row; // (BEGIN) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE var BPId; // (END) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE try{ // This code should be executed only if we are in the view for the CNO strViewName = TheApplication().ActiveViewName(); // Initialize Account Id BO = TheApplication().ActiveBusObject(); BC = BO.GetBusComp("Order Entry - Orders"); accountID = BC.GetFieldValue("Service Account Id"); //BEGIN - OneCRM - TGDPADA4 - Update from Billing Profile Id SCM to Billing Profile Id as a consequence of 8.1Upg //BPId=BC.GetFieldValue("Billing Profile Id SCM"); BPId=BC.GetFieldValue("Billing Profile Id"); //END - OneCRM - TGDPADA4 - Update from Billing Profile Id SCM to Billing Profile Id as a consequence of 8.1Upg // (END) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE // Get BC search spec searchstring = Inputs.GetProperty("search-string"); // Initialize seach expresion // (BEGIN) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. if (strViewName == "Order Entry - Line Items View (Sales)") { searchSpecComplete = "[Address Relation Type SCM] <> 'Default' AND "; } searchSpecComplete = searchSpecComplete + "[Address Status SCM] = 'Active'"; // (END) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. searchSpecComplete = searchSpecComplete + " AND [Account Id SCM] = '" + accountID + "'"; // Add the search spec in the BC to the query if(searchstring != null) { searchSpecComplete = searchSpecComplete + " AND " + searchstring; } switch(strViewName) { case "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM": case "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM": case "Sales Order-Browse Catalog Category Retention View SCM": searchSpecComplete = searchSpecComplete + " AND [Parent Billing Profile Id SCM] = '" + BPId + "'"; case "Order Entry - Line Items View (Sales)": // TGDLOAL3 2008-08-12 // Condition Added to not allow to search for Related To SCM field if(Clib.strstr(searchstring, "Related To SCM")== null ) { // *** Get BILLING PROFILE Addresses *** // OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); BCAccount.SetSearchExpr(searchSpecComplete); BCAccount.ExecuteQuery(ForwardOnly); if(BCAcc

CNO Address for BP SCM
Query
function Query(Inputs, Outputs) { /*************************************************************************************** ** Bussiness Service: CNO Address for BP SCM ** Created: 04-11-2009 ** Created By: Luis Casado V. ** Description: Due to Issue 15486, show only BILLIG PROFILE (and MAIN) Addresses in Pick ** Applet associated to field "Address Type" of the 'Billing Address'. ***************************************************************************************/ var strViewName; var BO; var BC; var BOAccount; var BCAccount; var accountID; var searchstring; // (BEGIN) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. var searchSpecComplete = ""; // (END) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. var row; // (BEGIN) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE var BPId; // (END) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE try{ // This code should be executed only if we are in the view for the CNO strViewName = TheApplication().ActiveViewName(); // Initialize Account Id BO = TheApplication().ActiveBusObject(); BC = BO.GetBusComp("Order Entry - Orders"); accountID = BC.GetFieldValue("Service Account Id"); //BEGIN - OneCRM - TGDPADA4 - Update from Billing Profile Id SCM to Billing Profile Id as a consequence of 8.1Upg //BPId=BC.GetFieldValue("Billing Profile Id SCM"); BPId=BC.GetFieldValue("Billing Profile Id"); //END - OneCRM - TGDPADA4 - Update from Billing Profile Id SCM to Billing Profile Id as a consequence of 8.1Upg // (END) OneCRM R1 SCM 2009-11-11 TGDOSLU1 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE // Get BC search spec searchstring = Inputs.GetProperty("search-string"); // Initialize seach expresion // (BEGIN) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. if (strViewName == "Order Entry - Line Items View (Sales)") { searchSpecComplete = "[Address Relation Type SCM] <> 'Default' AND "; } searchSpecComplete = searchSpecComplete + "[Address Status SCM] = 'Active'"; // (END) OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. searchSpecComplete = searchSpecComplete + " AND [Account Id SCM] = '" + accountID + "'"; // Add the search spec in the BC to the query if(searchstring != null) { searchSpecComplete = searchSpecComplete + " AND " + searchstring; } switch(strViewName) { case "Sales Order-Browse Catalog Category GRAS ROSE View - Add to Cart SCM": case "Sales Order-Browse Catalog Category Retention View - Add to Cart SCM": case "Sales Order-Browse Catalog Category Retention View SCM": searchSpecComplete = searchSpecComplete + " AND [Parent Billing Profile Id SCM] = '" + BPId + "'"; case "Order Entry - Line Items View (Sales)": // TGDLOAL3 2008-08-12 // Condition Added to not allow to search for Related To SCM field if(Clib.strstr(searchstring, "Related To SCM")== null ) { // *** Get BILLING PROFILE Addresses *** // OneCRM R1 SCM 2009-11-04 TGDCALU3 - BL2: Due to Issue 15486, in Reis Views, the Pick Applet should show only BILLIG PROFILE (and MAIN) Addresses. BOAccount = TheApplication().GetBusObject("Account"); BCAccount = BOAccount.GetBusComp("Billing Profile Address Usage Light SCM"); BCAccount.ClearToQuery(); fActivateFields(BCAccount); BCAccount.SetSearchExpr(searchSpecComplete); BCAccount.ExecuteQuery(ForwardOnly); if(BCAcc

CNO Address for BP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: BS for the VBC CNO Address SCM, to initialize and fill the BC with data from ** the three new address BC *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

CNO Address for BP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: BS for the VBC CNO Address SCM, to initialize and fill the BC with data from ** the three new address BC *****************************************************************/ switch (MethodName) { case("Init"): Init(Inputs, Outputs); break; case("Query"): Query(Inputs,Outputs); break; default: break; } return (CancelOperation); }

CNO Address for BP SCM
fActivateFields
function fActivateFields(BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to activate the BC Fields for query on them due to the script length limit *****************************************************************/ BCAccount.ActivateField("Account Id SCM"); BCAccount.ActivateField("Account Name SCM"); BCAccount.ActivateField("Attention Of SCM"); BCAccount.ActivateField("Residence Description denormalized SCM"); BCAccount.ActivateField("Location Supplement denormalized SCM"); BCAccount.ActivateField("Address Id SCM"); BCAccount.ActivateField("Address Type Code denormalized SCM"); BCAccount.ActivateField("Address Status SCM"); BCAccount.ActivateField("City denormalized SCM"); BCAccount.ActivateField("Email Address SCM"); BCAccount.ActivateField("Country denormalized SCM"); BCAccount.ActivateField("Postal Code denormalized SCM"); BCAccount.ActivateField("Professional First Name SCM"); //BCAccount.ActivateField("Professional Id SCM"); //BCAccount.ActivateField("Job Title SCM"); BCAccount.ActivateField("Title M/F Calc for OLI SCM"); BCAccount.ActivateField("Language Code SCM"); BCAccount.ActivateField("Professional Last Name SCM"); BCAccount.ActivateField("Title SCM"); BCAccount.ActivateField("Professional Name Additive SCM"); BCAccount.ActivateField("Street Address denormalized SCM"); BCAccount.ActivateField("Street Nr. denormalized SCM"); BCAccount.ActivateField("Fax# SCM"); BCAccount.ActivateField("Phone# SCM"); BCAccount.ActivateField("CO Name SCM"); BCAccount.ActivateField("PO Box denormalized SCM"); BCAccount.ActivateField("Address Relation Type SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Attention CO Name Calc SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Parent Billing Profile Id SCM"); }

CNO Address for BP SCM
fActivateFields
function fActivateFields(BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to activate the BC Fields for query on them due to the script length limit *****************************************************************/ BCAccount.ActivateField("Account Id SCM"); BCAccount.ActivateField("Account Name SCM"); BCAccount.ActivateField("Attention Of SCM"); BCAccount.ActivateField("Residence Description denormalized SCM"); BCAccount.ActivateField("Location Supplement denormalized SCM"); BCAccount.ActivateField("Address Id SCM"); BCAccount.ActivateField("Address Type Code denormalized SCM"); BCAccount.ActivateField("Address Status SCM"); BCAccount.ActivateField("City denormalized SCM"); BCAccount.ActivateField("Email Address SCM"); BCAccount.ActivateField("Country denormalized SCM"); BCAccount.ActivateField("Postal Code denormalized SCM"); BCAccount.ActivateField("Professional First Name SCM"); //BCAccount.ActivateField("Professional Id SCM"); //BCAccount.ActivateField("Job Title SCM"); BCAccount.ActivateField("Title M/F Calc for OLI SCM"); BCAccount.ActivateField("Language Code SCM"); BCAccount.ActivateField("Professional Last Name SCM"); BCAccount.ActivateField("Title SCM"); BCAccount.ActivateField("Professional Name Additive SCM"); BCAccount.ActivateField("Street Address denormalized SCM"); BCAccount.ActivateField("Street Nr. denormalized SCM"); BCAccount.ActivateField("Fax# SCM"); BCAccount.ActivateField("Phone# SCM"); BCAccount.ActivateField("CO Name SCM"); BCAccount.ActivateField("PO Box denormalized SCM"); BCAccount.ActivateField("Address Relation Type SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Attention CO Name Calc SCM"); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 BCAccount.ActivateField("Parent Billing Profile Id SCM"); }

CNO Address for BP SCM
fSetField
function fSetField(row,BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to set the property values, BC Fields *****************************************************************/ row.SetProperty("Account Id SCM", BCAccount.GetFieldValue("Account Id SCM")); row.SetProperty("Account Name SCM", BCAccount.GetFieldValue("Account Name SCM")); //row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention Of SCM")); row.SetProperty("Residence Description denormalized SCM", BCAccount.GetFieldValue("Residence Description denormalized SCM")); row.SetProperty("Location Supplement denormalized SCM", BCAccount.GetFieldValue("Location Supplement denormalized SCM")); row.SetProperty("Address Id SCM", BCAccount.GetFieldValue("Address Id SCM")); row.SetProperty("Address Type Code denormalized SCM", BCAccount.GetFieldValue("Address Type Code denormalized SCM")); row.SetProperty("Address Status SCM", BCAccount.GetFieldValue("Address Status SCM")); row.SetProperty("City denormalized SCM", BCAccount.GetFieldValue("City denormalized SCM")); row.SetProperty("Email Address SCM", BCAccount.GetFieldValue("Email Address SCM")); row.SetProperty("Country denormalized SCM", BCAccount.GetFieldValue("Country denormalized SCM")); row.SetProperty("Postal Code denormalized SCM", BCAccount.GetFieldValue("Postal Code denormalized SCM")); row.SetProperty("Professional First Name SCM", BCAccount.GetFieldValue("Professional First Name SCM")); //row.SetProperty("Professional Id SCM", BCAccount.GetFieldValue("Professional Id SCM")); //row.SetProperty("Professional Job Title SCM", BCAccount.GetFieldValue("Job Title SCM")); row.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Language Code SCM")); row.SetProperty("Professional Last Name SCM", BCAccount.GetFieldValue("Professional Last Name SCM")); row.SetProperty("Title SCM", BCAccount.GetFieldValue("Title SCM")); row.SetProperty("Title M/F Calc for OLI SCM", BCAccount.GetFieldValue("Title M/F Calc for OLI SCM")); row.SetProperty("Professional Name Additive SCM", BCAccount.GetFieldValue("Professional Name Additive SCM")); row.SetProperty("Street Address denormalized SCM", BCAccount.GetFieldValue("Street Address denormalized SCM")); row.SetProperty("Street Nr. denormalized SCM", BCAccount.GetFieldValue("Street Nr. denormalized SCM")); row.SetProperty("Fax# SCM", BCAccount.GetFieldValue("Fax# SCM")); row.SetProperty("Phone# SCM", BCAccount.GetFieldValue("Phone# SCM")); row.SetProperty("CO Name SCM", BCAccount.GetFieldValue("CO Name SCM")); row.SetProperty("PO Number SCM", BCAccount.GetFieldValue("PO Box denormalized SCM")); row.SetProperty("Address Relation Type SCM", BCAccount.GetFieldValue("Address Relation Type SCM")); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention CO Name Calc SCM"));//TGDSEAI1 - 20/08/2009 Defect 11459 }

CNO Address for BP SCM
fSetField
function fSetField(row,BCAccount) { /***************************************************************** ** Bussiness Service: CNO Address SCM ** Created: 27.01.2009 ** Created By: TGDSEAI1 ** Description: function to set the property values, BC Fields *****************************************************************/ row.SetProperty("Account Id SCM", BCAccount.GetFieldValue("Account Id SCM")); row.SetProperty("Account Name SCM", BCAccount.GetFieldValue("Account Name SCM")); //row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention Of SCM")); row.SetProperty("Residence Description denormalized SCM", BCAccount.GetFieldValue("Residence Description denormalized SCM")); row.SetProperty("Location Supplement denormalized SCM", BCAccount.GetFieldValue("Location Supplement denormalized SCM")); row.SetProperty("Address Id SCM", BCAccount.GetFieldValue("Address Id SCM")); row.SetProperty("Address Type Code denormalized SCM", BCAccount.GetFieldValue("Address Type Code denormalized SCM")); row.SetProperty("Address Status SCM", BCAccount.GetFieldValue("Address Status SCM")); row.SetProperty("City denormalized SCM", BCAccount.GetFieldValue("City denormalized SCM")); row.SetProperty("Email Address SCM", BCAccount.GetFieldValue("Email Address SCM")); row.SetProperty("Country denormalized SCM", BCAccount.GetFieldValue("Country denormalized SCM")); row.SetProperty("Postal Code denormalized SCM", BCAccount.GetFieldValue("Postal Code denormalized SCM")); row.SetProperty("Professional First Name SCM", BCAccount.GetFieldValue("Professional First Name SCM")); //row.SetProperty("Professional Id SCM", BCAccount.GetFieldValue("Professional Id SCM")); //row.SetProperty("Professional Job Title SCM", BCAccount.GetFieldValue("Job Title SCM")); row.SetProperty("Language Code SCM", BCAccount.GetFieldValue("Language Code SCM")); row.SetProperty("Professional Last Name SCM", BCAccount.GetFieldValue("Professional Last Name SCM")); row.SetProperty("Title SCM", BCAccount.GetFieldValue("Title SCM")); row.SetProperty("Title M/F Calc for OLI SCM", BCAccount.GetFieldValue("Title M/F Calc for OLI SCM")); row.SetProperty("Professional Name Additive SCM", BCAccount.GetFieldValue("Professional Name Additive SCM")); row.SetProperty("Street Address denormalized SCM", BCAccount.GetFieldValue("Street Address denormalized SCM")); row.SetProperty("Street Nr. denormalized SCM", BCAccount.GetFieldValue("Street Nr. denormalized SCM")); row.SetProperty("Fax# SCM", BCAccount.GetFieldValue("Fax# SCM")); row.SetProperty("Phone# SCM", BCAccount.GetFieldValue("Phone# SCM")); row.SetProperty("CO Name SCM", BCAccount.GetFieldValue("CO Name SCM")); row.SetProperty("PO Number SCM", BCAccount.GetFieldValue("PO Box denormalized SCM")); row.SetProperty("Address Relation Type SCM", BCAccount.GetFieldValue("Address Relation Type SCM")); //TGDGOLU2 ¿ 16.04.009 ¿ Defect 5759 row.SetProperty("Attention Of SCM", BCAccount.GetFieldValue("Attention CO Name Calc SCM"));//TGDSEAI1 - 20/08/2009 Defect 11459 }

CNO Query Fleet Manager SCM
QueryCNOFM
function QueryCNOFM(Inputs,Outputs) { /***************************************************************** ** Function QueryCNOFM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the FM contacts linked to the account with CNO flag, it will return ** N if the CNO contact has no FM role, and the Id if it has *****************************************************************/ var boAccount; var bcAccountContact; var bcAccountContactDetail; var accountContactId; var isRecord; var bcAccount; var primaryCNOContactId = null; //If nothing found blank is returned Outputs.SetProperty("FM Id","N"); try { boAccount = TheApplication().GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); bcAccountContact = boAccount.GetBusComp("Account Contact SCM"); bcAccountContactDetail = boAccount.GetBusComp("Account Contact Affiliation Detail"); primaryCNOContactId = Inputs.GetProperty("Primary CNO Contact Id"); if(primaryCNOContactId != null && primaryCNOContactId != "") { with(bcAccountContact) { //Query for the Primary CNO Contact Linked to the Account SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Accnt Id", Inputs.GetProperty("Account Id")); SetSearchSpec("Contact Id", primaryCNOContactId); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); if(isRecord) { accountContactId = bcAccountContact.GetFieldValue("Id"); with(bcAccountContactDetail) { //Look in the Contact details if the contact has role FM SetViewMode(AllView); SetSearchSpec("Parent Row Id", accountContactId) SetSearchSpec("Fleet Manager SCM","Y"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { //FM Found //TheApplication().Trace(this.Name() + " fQueryCNOFM found " + contactId); Outputs.SetProperty("FM Id",accountContactId); } }//End with bcAccountContactDetail }// if }//End With bcAccountContact }//End If }//End Try catch(e){ TheApplication().Trace(this.Name() + " Error in QueryCNOFM method: " + e.toString()); throw(e); } finally{ boAccount = null; bcAccount = null; bcAccountContact = null; bcAccountContactDetail = null; isRecord = null; accountContactId = null; primaryCNOContactId = null; } }

CNO Query Fleet Manager SCM
QueryCNOFM
function QueryCNOFM(Inputs,Outputs) { /***************************************************************** ** Function QueryCNOFM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the FM contacts linked to the account with CNO flag, it will return ** N if the CNO contact has no FM role, and the Id if it has *****************************************************************/ var boAccount; var bcAccountContact; var bcAccountContactDetail; var accountContactId; var isRecord; var bcAccount; var primaryCNOContactId = null; //If nothing found blank is returned Outputs.SetProperty("FM Id","N"); try { boAccount = TheApplication().GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); bcAccountContact = boAccount.GetBusComp("Account Contact SCM"); bcAccountContactDetail = boAccount.GetBusComp("Account Contact Affiliation Detail"); primaryCNOContactId = Inputs.GetProperty("Primary CNO Contact Id"); if(primaryCNOContactId != null && primaryCNOContactId != "") { with(bcAccountContact) { //Query for the Primary CNO Contact Linked to the Account SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Accnt Id", Inputs.GetProperty("Account Id")); SetSearchSpec("Contact Id", primaryCNOContactId); ExecuteQuery(ForwardOnly); isRecord = FirstRecord(); if(isRecord) { accountContactId = bcAccountContact.GetFieldValue("Id"); with(bcAccountContactDetail) { //Look in the Contact details if the contact has role FM SetViewMode(AllView); SetSearchSpec("Parent Row Id", accountContactId) SetSearchSpec("Fleet Manager SCM","Y"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { //FM Found //TheApplication().Trace(this.Name() + " fQueryCNOFM found " + contactId); Outputs.SetProperty("FM Id",accountContactId); } }//End with bcAccountContactDetail }// if }//End With bcAccountContact }//End If }//End Try catch(e){ TheApplication().Trace(this.Name() + " Error in QueryCNOFM method: " + e.toString()); throw(e); } finally{ boAccount = null; bcAccount = null; bcAccountContact = null; bcAccountContactDetail = null; isRecord = null; accountContactId = null; primaryCNOContactId = null; } }

CNO Query Fleet Manager SCM
QueryFM
function QueryFM(Inputs,Outputs) { /***************************************************************** ** Function QueryFM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the first FM contacts linked to the account if NO FM is found ** N is returned otherwithe the AccountContactId ***************************************************************** ** TGDHAKA8: 2011-03-16 Search for FMs on Contract's BP added *****************************************************************/ var boAccount; var bcAccountContact; var bcAccountContactDetail; var accountContactId; var contactId; var isRecord; // TGDHAKA8 2011-03-16: Defect 32516 var boAsset; var bcAsset; var bpId =""; var boAccountBP; var bcContactBP; var boAccountFM; var bcContactFM; var fmFound=false; //If nothing found blank is returned Outputs.SetProperty("FM Id","N"); try { // TGDHAKA8 2011-03-16: Defect 32516: searching for an FM on Contract's Billing Profile boAsset = TheApplication().GetBusObject("Asset Management"); bcAsset = boAsset.GetBusComp("Asset Mgmt - Asset - Header"); bcAsset.SetViewMode(AllView); bcAsset.ActivateField ("Billing Profile Id"); bcAsset.ClearToQuery (); bcAsset.SetSearchSpec("Id", Inputs.GetProperty("Asset Id")); bcAsset.ExecuteQuery(ForwardOnly); if (bcAsset.FirstRecord()) { // Get Billing Profile bpId = bcAsset.GetFieldValue("Billing Profile Id"); boAccountBP = TheApplication().GetBusObject("Account"); bcContactBP = boAccountBP.GetBusComp("Contact Invoice Profile Intersection SCM"); bcContactBP.SetViewMode(AllView); bcContactBP.ActivateField("Contact Id"); bcContactBP.ClearToQuery(); bcContactBP.SetSearchSpec("Billing Profile Id", bpId); bcContactBP.ExecuteQuery(ForwardOnly); isRecord = bcContactBP.FirstRecord(); // Get Contacts assigned to Billing Profile while(isRecord && !fmFound) { boAccountFM = TheApplication().GetBusObject("Account"); bcContactFM = boAccountFM.GetBusComp("Account Contact Affiliation Detail"); bcContactFM.SetViewMode(AllView); bcContactFM.ActivateField("Parent Row Id"); bcContactFM.ClearToQuery (); bcContactFM.SetSearchSpec("Contact Id", bcContactBP.GetFieldValue("Contact Id")); bcContactFM.SetSearchSpec("Fleet Manager SCM","Y"); bcContactFM.SetSearchSpec("Active Role Flag SCM","Y"); bcContactFM.SetSearchSpec("Affiliation End Date SCM", "IS NULL"); bcContactFM.ExecuteQuery(ForwardOnly); // Check if Contact has active FM role if (bcContactFM.FirstRecord()) { Outputs.SetProperty("FM Id", bcContactFM.GetFieldValue("Parent Row Id")); fmFound=true; } isRecord = bcContactBP.NextRecord(); } } // If no FM found on Contract's Billing Profile, search in Account if (!fmFound) { boAccount = TheApplication().GetBusObject("Account"); bcAccountContactDetail = boAccount.GetBusComp("Account Contact Affiliation Detail"); with(bcAccountContactDetail) { //Look in the Contact details if the contact has role FM SetViewMode(AllView); // (BEGIN) OneCRM R1 SCM 2009-12-09 TGDCALU3 - BL2: Due to Issue 18161, activate field "Parent Row Id". ActivateField ("Parent Row Id"); ClearToQuery (); // (END) OneCRM R1 SCM 2009-12-09 TGDCALU3 - BL2: Due to Issue 18161, activate field "Parent Row Id". //OneCRM R1 SCM 2010.01.18 TGDHEAR2: Defect 7378. Field renamed. SetSearchSpec("Account Id SCM", Inputs.GetProperty("Account Id")); SetSearchSpec("Fleet Manager SCM","Y"); // TGDHAKA8 2011-03-16: FM role must be active SetSearchSpec("Active Role Flag SCM","Y"); SetSearchSpec("Affiliation End Date SCM", "IS NULL"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { //FM Found //TheApplication().Trace(this.Name() + " fQueryCNOFM found " + contactId); Outputs.SetProperty("FM Id", GetFieldValue("Parent Row Id")); } else Outputs.SetProperty("Account FM found","nein"); } } } catch(e){ T

CNO Query Fleet Manager SCM
QueryFM
function QueryFM(Inputs,Outputs) { /***************************************************************** ** Function QueryFM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the first FM contacts linked to the account if NO FM is found ** N is returned otherwithe the AccountContactId ***************************************************************** ** TGDHAKA8: 2011-03-16 Search for FMs on Contract's BP added *****************************************************************/ var boAccount; var bcAccountContact; var bcAccountContactDetail; var accountContactId; var contactId; var isRecord; // TGDHAKA8 2011-03-16: Defect 32516 var boAsset; var bcAsset; var bpId =""; var boAccountBP; var bcContactBP; var boAccountFM; var bcContactFM; var fmFound=false; //If nothing found blank is returned Outputs.SetProperty("FM Id","N"); try { // TGDHAKA8 2011-03-16: Defect 32516: searching for an FM on Contract's Billing Profile boAsset = TheApplication().GetBusObject("Asset Management"); bcAsset = boAsset.GetBusComp("Asset Mgmt - Asset - Header"); bcAsset.SetViewMode(AllView); bcAsset.ActivateField ("Billing Profile Id"); bcAsset.ClearToQuery (); bcAsset.SetSearchSpec("Id", Inputs.GetProperty("Asset Id")); bcAsset.ExecuteQuery(ForwardOnly); if (bcAsset.FirstRecord()) { // Get Billing Profile bpId = bcAsset.GetFieldValue("Billing Profile Id"); boAccountBP = TheApplication().GetBusObject("Account"); bcContactBP = boAccountBP.GetBusComp("Contact Invoice Profile Intersection SCM"); bcContactBP.SetViewMode(AllView); bcContactBP.ActivateField("Contact Id"); bcContactBP.ClearToQuery(); bcContactBP.SetSearchSpec("Billing Profile Id", bpId); bcContactBP.ExecuteQuery(ForwardOnly); isRecord = bcContactBP.FirstRecord(); // Get Contacts assigned to Billing Profile while(isRecord && !fmFound) { boAccountFM = TheApplication().GetBusObject("Account"); bcContactFM = boAccountFM.GetBusComp("Account Contact Affiliation Detail"); bcContactFM.SetViewMode(AllView); bcContactFM.ActivateField("Parent Row Id"); bcContactFM.ClearToQuery (); bcContactFM.SetSearchSpec("Contact Id", bcContactBP.GetFieldValue("Contact Id")); bcContactFM.SetSearchSpec("Fleet Manager SCM","Y"); bcContactFM.SetSearchSpec("Active Role Flag SCM","Y"); bcContactFM.SetSearchSpec("Affiliation End Date SCM", "IS NULL"); bcContactFM.ExecuteQuery(ForwardOnly); // Check if Contact has active FM role if (bcContactFM.FirstRecord()) { Outputs.SetProperty("FM Id", bcContactFM.GetFieldValue("Parent Row Id")); fmFound=true; } isRecord = bcContactBP.NextRecord(); } } // If no FM found on Contract's Billing Profile, search in Account if (!fmFound) { boAccount = TheApplication().GetBusObject("Account"); bcAccountContactDetail = boAccount.GetBusComp("Account Contact Affiliation Detail"); with(bcAccountContactDetail) { //Look in the Contact details if the contact has role FM SetViewMode(AllView); // (BEGIN) OneCRM R1 SCM 2009-12-09 TGDCALU3 - BL2: Due to Issue 18161, activate field "Parent Row Id". ActivateField ("Parent Row Id"); ClearToQuery (); // (END) OneCRM R1 SCM 2009-12-09 TGDCALU3 - BL2: Due to Issue 18161, activate field "Parent Row Id". //OneCRM R1 SCM 2010.01.18 TGDHEAR2: Defect 7378. Field renamed. SetSearchSpec("Account Id SCM", Inputs.GetProperty("Account Id")); SetSearchSpec("Fleet Manager SCM","Y"); // TGDHAKA8 2011-03-16: FM role must be active SetSearchSpec("Active Role Flag SCM","Y"); SetSearchSpec("Affiliation End Date SCM", "IS NULL"); ExecuteQuery(ForwardOnly); if(FirstRecord()) { //FM Found //TheApplication().Trace(this.Name() + " fQueryCNOFM found " + contactId); Outputs.SetProperty("FM Id", GetFieldValue("Parent Row Id")); } else Outputs.SetProperty("Account FM found","nein"); } } } catch(e){ T

CNO Query Fleet Manager SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Query Fleet Manager SCM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the FM contacts linked to the account *****************************************************************/ var strRetValue; try { strRetValue = CancelOperation; switch(MethodName) { case "Query CNO FM": QueryCNOFM(Inputs,Outputs); break; case "Query FM": QueryFM(Inputs,Outputs); break; default: break; //nothing } return (strRetValue); } catch(e) { TheApplication().Trace(this.Name() + " Error: " + e.toString()); throw(e); } finally { strRetValue = null; } }

CNO Query Fleet Manager SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /***************************************************************** ** Bussiness Service: CNO Query Fleet Manager SCM ** Created: 12.01.2009 ** Created By: TGDSEAI1 ** Description: Query for the FM contacts linked to the account *****************************************************************/ var strRetValue; try { strRetValue = CancelOperation; switch(MethodName) { case "Query CNO FM": QueryCNOFM(Inputs,Outputs); break; case "Query FM": QueryFM(Inputs,Outputs); break; default: break; //nothing } return (strRetValue); } catch(e) { TheApplication().Trace(this.Name() + " Error: " + e.toString()); throw(e); } finally { strRetValue = null; } }

CNO Template Type SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************************************************* ** Business Service: CNO Template Type SCM ** Author: TGDSEAI1 ** Created: 12/02/2009 ********************************************************************************************/ var intRetVal=ContinueOperation; try{ switch (MethodName) { case "CNO_Type": fCNOType(Inputs,Outputs); intRetVal=CancelOperation; break; default: //Do nothing break; } return (intRetVal); } catch(e){ TheApplication().Trace(this.Name() + " Error in PreInvokeMethod: " + e.toString()); throw(e); } finally { intRetVal = null; } }

CNO Template Type SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { /******************************************************************************************* ** Business Service: CNO Template Type SCM ** Author: TGDSEAI1 ** Created: 12/02/2009 ********************************************************************************************/ var intRetVal=ContinueOperation; try{ switch (MethodName) { case "CNO_Type": fCNOType(Inputs,Outputs); intRetVal=CancelOperation; break; default: //Do nothing break; } return (intRetVal); } catch(e){ TheApplication().Trace(this.Name() + " Error in PreInvokeMethod: " + e.toString()); throw(e); } finally { intRetVal = null; } }

CNO Template Type SCM
fCNOType
function fCNOType(Inputs,Outputs) { /******************************************************************************************* ** Business Service: CNO Template Type SCM ** Author: TGDSEAI1 ** Created: 12/02/2009 ** Function: fCNO Type ** Description: Method to retrieve the Versandmedium of the CNO Template ** If the template contains a OLI of SMS, Letter or eMail the Output parameter ** strSMSCNO,strLetterCNO or strEmailCNO will have a Y or N value ********************************************************************************************/ var countOLI; var countXA; var i = 0; var strSMSCNO = "N"; var strLetterCNO = "N"; var strEmailCNO = "N"; var strTypeXA; var j; var strServiceType; var strXaName; var psOli; var psXA; try{ if(Inputs.GetChildCount()>0) { //Count Number of OLI countOLI = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChildCount(); while(i<countOLI) { //Retrieve the OLI for the IO psOli = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(i); strServiceType = psOli.GetProperty("Product Service Type SCM"); if(strServiceType == "CNO") // If CNO { j = 0; //Retrieve the XA attributes countXA = psOli.GetChild(0).GetChildCount(); while(j<countXA) { psXA = psOli.GetChild(0).GetChild(j); strXaName= psXA.GetProperty("Name"); TheApplication().Trace(this.Name() + " " + j + " xaName " + strXaName); if(strXaName=="Versandmedium") { strTypeXA = psXA.GetProperty("Value"); TheApplication().Trace(this.Name() + " strTypeXA " + strTypeXA); switch(strTypeXA) { case "SMS": strSMSCNO = "Y"; break; case "Brief": strLetterCNO = "Y"; break; case "eMail": strEmailCNO = "Y"; break; default: break; }//End Switch }//End If j++; }//End while }//End If i++; }//End While }//End If Outputs.SetProperty("strSMSCNO",strSMSCNO); Outputs.SetProperty("strLetterCNO",strLetterCNO); Outputs.SetProperty("strEmailCNO",strEmailCNO); } catch(e){ TheApplication().Trace(this.Name() + " Error in fCNOType function: " + e.toString()); throw(e); } finally { countOLI = null; countXA = null; i = null; strSMSCNO = null; strLetterCNO = null; strEmailCNO = null; strTypeXA = null; j = null; strServiceType = null; psOli = null; psXA = null; strXaName = null; } }

CNO Template Type SCM
fCNOType
function fCNOType(Inputs,Outputs) { /******************************************************************************************* ** Business Service: CNO Template Type SCM ** Author: TGDSEAI1 ** Created: 12/02/2009 ** Function: fCNO Type ** Description: Method to retrieve the Versandmedium of the CNO Template ** If the template contains a OLI of SMS, Letter or eMail the Output parameter ** strSMSCNO,strLetterCNO or strEmailCNO will have a Y or N value ********************************************************************************************/ var countOLI; var countXA; var i = 0; var strSMSCNO = "N"; var strLetterCNO = "N"; var strEmailCNO = "N"; var strTypeXA; var j; var strServiceType; var strXaName; var psOli; var psXA; try{ if(Inputs.GetChildCount()>0) { //Count Number of OLI countOLI = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChildCount(); while(i<countOLI) { //Retrieve the OLI for the IO psOli = Inputs.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(i); strServiceType = psOli.GetProperty("Product Service Type SCM"); if(strServiceType == "CNO") // If CNO { j = 0; //Retrieve the XA attributes countXA = psOli.GetChild(0).GetChildCount(); while(j<countXA) { psXA = psOli.GetChild(0).GetChild(j); strXaName= psXA.GetProperty("Name"); TheApplication().Trace(this.Name() + " " + j + " xaName " + strXaName); if(strXaName=="Versandmedium") { strTypeXA = psXA.GetProperty("Value"); TheApplication().Trace(this.Name() + " strTypeXA " + strTypeXA); switch(strTypeXA) { case "SMS": strSMSCNO = "Y"; break; case "Brief": strLetterCNO = "Y"; break; case "eMail": strEmailCNO = "Y"; break; default: break; }//End Switch }//End If j++; }//End while }//End If i++; }//End While }//End If Outputs.SetProperty("strSMSCNO",strSMSCNO); Outputs.SetProperty("strLetterCNO",strLetterCNO); Outputs.SetProperty("strEmailCNO",strEmailCNO); } catch(e){ TheApplication().Trace(this.Name() + " Error in fCNOType function: " + e.toString()); throw(e); } finally { countOLI = null; countXA = null; i = null; strSMSCNO = null; strLetterCNO = null; strEmailCNO = null; strTypeXA = null; j = null; strServiceType = null; psOli = null; psXA = null; strXaName = null; } }

COMSupplementSvc
(declarations)
var oApp; var bIsTraceOn; var sLogFile; var sLogin; var boWFDeploy = null; var bcWFDeploy = null;

COMSupplementSvc
(declarations)
var oApp; var bIsTraceOn; var sLogFile; var sLogin; var boWFDeploy = null; var bcWFDeploy = null;

COMSupplementSvc
ActivateCOMProcesses
function ActivateCOMProcesses(Inputs, Outputs) { var strFileName = Inputs.GetProperty("Input File"); var sLastChar = ""; var nLen = 0; var aNotActivated = new Array(); var msg; var strError = ""; if (strFileName == null || strFileName.length == 0) { strFileName = "..\\LOG\\Workflows.txt"; } var sEnableLog = Inputs.GetProperty("Enable Logging"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } else { sLogFile = Inputs.GetProperty("Log File"); } /* TGDDERO7, 22.02.2012: Performance, parallelization of workflow activation */ var nBatchSize = ToNumber(oApp.utils.SCM_RetrieveACV("Workflow Activation Batch Size")); if (nBatchSize == 0) nBatchSize = 50; var nSleepTime = ToNumber(oApp.utils.SCM_RetrieveACV("Workflow Activation Sleep Time")); if (nSleepTime == 0) nSleepTime = 10; var strActivationMethod = oApp.utils.SCM_RetrieveACV("Workflow Activation Method"); if (strActivationMethod == null || strActivationMethod == "") strActivationMethod = "LIST"; var strInputDir = Inputs.GetProperty("Input Directory"); // 40_Workflows if (strInputDir == null || strInputDir == "") strInputDir = oApp.utils.SCM_RetrieveACV("ReleaseDeploymentImportPath") + "40_Workflows/"; var iBatch = -1; var aBatches = new Object(); var aListOfWfs = new Object(); //var bsWfProcMgrAsync = oApp.GetService("Workflow Process Manager (Async)"); // due Jan // var bsWfProcMgrAsync = oApp.GetService("Asynchronous Server Requests"); var bsWfProcMgrAsync = oApp.GetService("Server Requests SCM"); var strAsyncWfName = "Import/Activate Workflows Workflow Async SCM"; var strComponent = "WfProcMgr"; var strSiebelServer = oApp.utils.SCM_GetSiebelServerName(); var psWfIn = oApp.NewPropertySet(); var psWfOut = oApp.NewPropertySet(); var psWfChild = oApp.NewPropertySet(); psWfIn.SetProperty("Component", strComponent); psWfIn.SetProperty("ServerName", strSiebelServer); psWfIn.SetProperty("Method", "RunProcess"); psWfIn.SetProperty("DelAmount", "0"); psWfIn.SetProperty("DelUnits", "ASAP"); // due Jan psWfIn.SetProperty("Mode", "DirectDb"); psWfChild.SetProperty("ProcessName", strAsyncWfName); psWfChild.SetProperty("Flow Search Spec", ""); psWfChild.SetProperty("Enable Logging", sEnableLog); psWfChild.SetProperty("Log File", sLogFile); psWfChild.SetProperty("Batch Number", ""); psWfIn.AddChild(psWfChild); var i=0; var psWorkflows = oApp.NewPropertySet(); var iIndex = -1; var bAsyncFinished = false; var fpFin = null; var strFinFile = ""; var bsWorkflowAdmin = TheApplication().GetService("Workflow Admin Service"); var psWorkflowIn = oApp.NewPropertySet(); var psWorkflowOut = oApp.NewPropertySet(); // due Jan - added EAI Workflow Process Manager SCM psWorkflowIn.SetProperty("FlowSearchSpec", "[Process Name]='" + strAsyncWfName + "' OR [Process Name]='Import/Activate Workflows Workflow SCM' OR [Process Name]='EAI Workflow Process Manager SCM'"); bsWorkflowAdmin.InvokeMethod("Activate", psWorkflowIn, psWorkflowOut); /* TGDDERO7, 22.02.2012: Performance, parallelization of workflow activation */ /* TGDDERO7, 30.03.2012: Delete all previous LogFiles if any */ if (sLogFile != "") Clib.remove(sLogFile); var iCnt = 0; var strBatchFinalLog = strInputDir + "Batch_" + iCnt + "_finished.log"; while (Clib.remove(strBatchFinalLog) == 0) { iCnt++; strBatchFinalLog = strInputDir + "Batch_" + iCnt + "_finished.log"; } /* TGDDERO7, 30.03.2012: Delete all previous LogFiles if any */ Write2Log("ActivateCOMProcesses -> strFileName=" + strFileName ); Inputs.RemoveProperty("Input File"); var nWFCount = GetLineCount(strFileName); var nActivated = 0; Write2Log("ActivateCOMProcesses -> Opening File '" + strFileName + "' for processing..."); var fp = Clib.fopen(strFileName,"rt"); if ( fp == null ) { Write2Log("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErr

COMSupplementSvc
ActivateCOMProcesses
function ActivateCOMProcesses(Inputs, Outputs) { var strFileName = Inputs.GetProperty("Input File"); var sLastChar = ""; var nLen = 0; var aNotActivated = new Array(); var msg; var strError = ""; if (strFileName == null || strFileName.length == 0) { strFileName = "..\\LOG\\Workflows.txt"; } var sEnableLog = Inputs.GetProperty("Enable Logging"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } else { sLogFile = Inputs.GetProperty("Log File"); } /* TGDDERO7, 22.02.2012: Performance, parallelization of workflow activation */ var nBatchSize = ToNumber(oApp.utils.SCM_RetrieveACV("Workflow Activation Batch Size")); if (nBatchSize == 0) nBatchSize = 50; var nSleepTime = ToNumber(oApp.utils.SCM_RetrieveACV("Workflow Activation Sleep Time")); if (nSleepTime == 0) nSleepTime = 10; var strActivationMethod = oApp.utils.SCM_RetrieveACV("Workflow Activation Method"); if (strActivationMethod == null || strActivationMethod == "") strActivationMethod = "LIST"; var strInputDir = Inputs.GetProperty("Input Directory"); // 40_Workflows if (strInputDir == null || strInputDir == "") strInputDir = oApp.utils.SCM_RetrieveACV("ReleaseDeploymentImportPath") + "40_Workflows/"; var iBatch = -1; var aBatches = new Object(); var aListOfWfs = new Object(); //var bsWfProcMgrAsync = oApp.GetService("Workflow Process Manager (Async)"); // due Jan // var bsWfProcMgrAsync = oApp.GetService("Asynchronous Server Requests"); var bsWfProcMgrAsync = oApp.GetService("Server Requests SCM"); var strAsyncWfName = "Import/Activate Workflows Workflow Async SCM"; var strComponent = "WfProcMgr"; var strSiebelServer = oApp.utils.SCM_GetSiebelServerName(); var psWfIn = oApp.NewPropertySet(); var psWfOut = oApp.NewPropertySet(); var psWfChild = oApp.NewPropertySet(); psWfIn.SetProperty("Component", strComponent); psWfIn.SetProperty("ServerName", strSiebelServer); psWfIn.SetProperty("Method", "RunProcess"); psWfIn.SetProperty("DelAmount", "0"); psWfIn.SetProperty("DelUnits", "ASAP"); // due Jan psWfIn.SetProperty("Mode", "DirectDb"); psWfChild.SetProperty("ProcessName", strAsyncWfName); psWfChild.SetProperty("Flow Search Spec", ""); psWfChild.SetProperty("Enable Logging", sEnableLog); psWfChild.SetProperty("Log File", sLogFile); psWfChild.SetProperty("Batch Number", ""); psWfIn.AddChild(psWfChild); var i=0; var psWorkflows = oApp.NewPropertySet(); var iIndex = -1; var bAsyncFinished = false; var fpFin = null; var strFinFile = ""; var bsWorkflowAdmin = TheApplication().GetService("Workflow Admin Service"); var psWorkflowIn = oApp.NewPropertySet(); var psWorkflowOut = oApp.NewPropertySet(); // due Jan - added EAI Workflow Process Manager SCM psWorkflowIn.SetProperty("FlowSearchSpec", "[Process Name]='" + strAsyncWfName + "' OR [Process Name]='Import/Activate Workflows Workflow SCM' OR [Process Name]='EAI Workflow Process Manager SCM'"); bsWorkflowAdmin.InvokeMethod("Activate", psWorkflowIn, psWorkflowOut); /* TGDDERO7, 22.02.2012: Performance, parallelization of workflow activation */ /* TGDDERO7, 30.03.2012: Delete all previous LogFiles if any */ if (sLogFile != "") Clib.remove(sLogFile); var iCnt = 0; var strBatchFinalLog = strInputDir + "Batch_" + iCnt + "_finished.log"; while (Clib.remove(strBatchFinalLog) == 0) { iCnt++; strBatchFinalLog = strInputDir + "Batch_" + iCnt + "_finished.log"; } /* TGDDERO7, 30.03.2012: Delete all previous LogFiles if any */ Write2Log("ActivateCOMProcesses -> strFileName=" + strFileName ); Inputs.RemoveProperty("Input File"); var nWFCount = GetLineCount(strFileName); var nActivated = 0; Write2Log("ActivateCOMProcesses -> Opening File '" + strFileName + "' for processing..."); var fp = Clib.fopen(strFileName,"rt"); if ( fp == null ) { Write2Log("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErr

COMSupplementSvc
ActivateCOMProcesses_old
function ActivateCOMProcesses_old(Inputs, Outputs) { var workflowBS = TheApplication().GetService("Workflow Admin Service"); var fp = Clib.fopen("..\\LOG\\Workflows.txt","rt"); if ( fp == null ) { TheApplication().RaiseErrorText("Error opening file\n Please store file ..\\LOG\\Workflows.txt under Siebel Root Directory <SiebSrvr> or <Siebel Client> !"); } else { try { var sProcessName; var iNumActive; while ( null != (sProcessName = Clib.fgets(fp)) ) { var iProcessNameLength = sProcessName.length - 1; sProcessName = sProcessName.substring(0, iProcessNameLength); var sQuerySearchSpec = '[Process Name] = "' + sProcessName + '"'; Inputs.SetProperty("FlowSearchSpec", sQuerySearchSpec); workflowBS.InvokeMethod("Activate", Inputs, Outputs); iNumActive = Outputs.GetProperty("NumFlowActivated"); } } catch(e) { TheApplication().RaiseErrorText("Error Activating process " + sProcessName + "\n" + e.toString()); } } Clib.fclose(fp); workflowBS = null; fp = null; }

COMSupplementSvc
ActivateCOMProcesses_old
function ActivateCOMProcesses_old(Inputs, Outputs) { var workflowBS = TheApplication().GetService("Workflow Admin Service"); var fp = Clib.fopen("..\\LOG\\Workflows.txt","rt"); if ( fp == null ) { TheApplication().RaiseErrorText("Error opening file\n Please store file ..\\LOG\\Workflows.txt under Siebel Root Directory <SiebSrvr> or <Siebel Client> !"); } else { try { var sProcessName; var iNumActive; while ( null != (sProcessName = Clib.fgets(fp)) ) { var iProcessNameLength = sProcessName.length - 1; sProcessName = sProcessName.substring(0, iProcessNameLength); var sQuerySearchSpec = '[Process Name] = "' + sProcessName + '"'; Inputs.SetProperty("FlowSearchSpec", sQuerySearchSpec); workflowBS.InvokeMethod("Activate", Inputs, Outputs); iNumActive = Outputs.GetProperty("NumFlowActivated"); } } catch(e) { TheApplication().RaiseErrorText("Error Activating process " + sProcessName + "\n" + e.toString()); } } Clib.fclose(fp); workflowBS = null; fp = null; }

COMSupplementSvc
ActivateCOMProcesses_old2
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM */ function ActivateCOMProcesses_old2(Inputs, Outputs) { var strFileName = Inputs.GetProperty("Input File"); var sLastChar = ""; var nLen = 0; var aNotActivated = new Array(); var msg; var strError = ""; if (strFileName == null || strFileName.length == 0) { strFileName = "..\\LOG\\Workflows.txt"; } var sEnableLog = Inputs.GetProperty("Enable Logging"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } else { sLogFile = Inputs.GetProperty("Log File"); } Write2Log("ActivateCOMProcesses -> strFileName=" + strFileName ); Inputs.RemoveProperty("Input File"); var nWFCount = GetLineCount(strFileName); var nActivated = 0; Write2Log("ActivateCOMProcesses -> Opening File '" + strFileName + "' for processing..."); var fp = Clib.fopen(strFileName,"rt"); if ( fp == null ) { Write2Log("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErrorText(msg + " " + strFileName ); } else { Write2Log("ActivateCOMProcesses -> Initializing BusService 'Workflow Admin Service'..."); var workflowBS = oApp.GetService("Workflow Admin Service"); try { var sProcessName; var iNumActive; var iProcessNameLength = 0; var sQuerySearchSpec = ""; var iCounter = 0; while ( null != (sProcessName = Clib.fgets(fp)) ) { iCounter = iCounter + 1; nLen = sProcessName.length; if (nLen > 0) { sLastChar = sProcessName.substring(nLen - 1, nLen); if (sLastChar == "\n" || sLastChar == "\r\n") { iProcessNameLength = nLen - 1; } else { iProcessNameLength = nLen; } sProcessName = sProcessName.substring(0, iProcessNameLength); sQuerySearchSpec = '[Process Name] = "' + sProcessName + '"'; Inputs.SetProperty("FlowSearchSpec", sQuerySearchSpec); workflowBS.InvokeMethod("Activate", Inputs, Outputs); strError = ""; iNumActive = Outputs.GetProperty("NumFlowActivated"); if (iNumActive == 0) strError = " -> Error:"; Write2Log("ActivateCOMProcesses -> Result of Workflow Activation " + iCounter + " / " + nWFCount + ": " + iNumActive + strError + " - Name: '" + sProcessName + "'"); if (iNumActive > 0) { nActivated = nActivated + 1; // Performance, do that later for all activated workflows!!! //this.SetReplicationLevelAll(sProcessName); } else { aNotActivated[aNotActivated.length] = sProcessName; } } } // Performance, do that later for all activated workflows!!! this.SetReplicationLevelAll("ALL_WORKFLOWS"); } catch(e) { Write2Log("ActivateCOMProcesses -> Error Activating process '" + sProcessName + "'\n" + e.toString()); TheApplication().RaiseErrorText("Error Activating process " + sProcessName + "\n" + e.toString()); } } Clib.fclose(fp); workflowBS = null; fp = null; Write2Log("ActivateCOMProcesses -> Number of activated Workflows: " + nActivated); Write2Log(""); for (var i=0; i<aNotActivated.length; i++) { Write2Log("Workflow couldn't be activated: '" + aNotActivated[i] + "'"); } Write2Log(""); Write2Log("ActivateCOMProcesses -> Activation of Workflow Process Definitions finished."); aNotActivated = null; msg = null; }

COMSupplementSvc
ActivateCOMProcesses_old2
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM */ function ActivateCOMProcesses_old2(Inputs, Outputs) { var strFileName = Inputs.GetProperty("Input File"); var sLastChar = ""; var nLen = 0; var aNotActivated = new Array(); var msg; var strError = ""; if (strFileName == null || strFileName.length == 0) { strFileName = "..\\LOG\\Workflows.txt"; } var sEnableLog = Inputs.GetProperty("Enable Logging"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } else { sLogFile = Inputs.GetProperty("Log File"); } Write2Log("ActivateCOMProcesses -> strFileName=" + strFileName ); Inputs.RemoveProperty("Input File"); var nWFCount = GetLineCount(strFileName); var nActivated = 0; Write2Log("ActivateCOMProcesses -> Opening File '" + strFileName + "' for processing..."); var fp = Clib.fopen(strFileName,"rt"); if ( fp == null ) { Write2Log("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErrorText(msg + " " + strFileName ); } else { Write2Log("ActivateCOMProcesses -> Initializing BusService 'Workflow Admin Service'..."); var workflowBS = oApp.GetService("Workflow Admin Service"); try { var sProcessName; var iNumActive; var iProcessNameLength = 0; var sQuerySearchSpec = ""; var iCounter = 0; while ( null != (sProcessName = Clib.fgets(fp)) ) { iCounter = iCounter + 1; nLen = sProcessName.length; if (nLen > 0) { sLastChar = sProcessName.substring(nLen - 1, nLen); if (sLastChar == "\n" || sLastChar == "\r\n") { iProcessNameLength = nLen - 1; } else { iProcessNameLength = nLen; } sProcessName = sProcessName.substring(0, iProcessNameLength); sQuerySearchSpec = '[Process Name] = "' + sProcessName + '"'; Inputs.SetProperty("FlowSearchSpec", sQuerySearchSpec); workflowBS.InvokeMethod("Activate", Inputs, Outputs); strError = ""; iNumActive = Outputs.GetProperty("NumFlowActivated"); if (iNumActive == 0) strError = " -> Error:"; Write2Log("ActivateCOMProcesses -> Result of Workflow Activation " + iCounter + " / " + nWFCount + ": " + iNumActive + strError + " - Name: '" + sProcessName + "'"); if (iNumActive > 0) { nActivated = nActivated + 1; // Performance, do that later for all activated workflows!!! //this.SetReplicationLevelAll(sProcessName); } else { aNotActivated[aNotActivated.length] = sProcessName; } } } // Performance, do that later for all activated workflows!!! this.SetReplicationLevelAll("ALL_WORKFLOWS"); } catch(e) { Write2Log("ActivateCOMProcesses -> Error Activating process '" + sProcessName + "'\n" + e.toString()); TheApplication().RaiseErrorText("Error Activating process " + sProcessName + "\n" + e.toString()); } } Clib.fclose(fp); workflowBS = null; fp = null; Write2Log("ActivateCOMProcesses -> Number of activated Workflows: " + nActivated); Write2Log(""); for (var i=0; i<aNotActivated.length; i++) { Write2Log("Workflow couldn't be activated: '" + aNotActivated[i] + "'"); } Write2Log(""); Write2Log("ActivateCOMProcesses -> Activation of Workflow Process Definitions finished."); aNotActivated = null; msg = null; }

COMSupplementSvc
ActivateListOfWorkflows
function ActivateListOfWorkflows(Inputs, Outputs) { Outputs.SetProperty("NumFlowActivated", 0); var iNumFlowActivated = 0; var strListOfWfs = Inputs.GetProperty("ListOfWorkflows"); var sEnableLog = Inputs.GetProperty("Enable Logging"); var nBatchNumber = Inputs.GetProperty("Batch Number"); sLogFile = Inputs.GetProperty("Log File"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } var aListOfWfs = strListOfWfs.split("||"); var nWfCount = aListOfWfs.length; var bsWfAdm = oApp.GetService("Workflow Admin Service"); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var strFlowSearchSpec = ""; var i = 0; var iCnt = 0; var strError = ""; var iNumActive = 0; var strProcessName = ""; Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": List of Workflows = '" + strListOfWfs + "'"); for (i=0; i<nWfCount; i++) { iCnt++; strError = ""; iNumActive = 0; strProcessName = oApp.utils.allTrim(aListOfWfs[i]); strFlowSearchSpec = '[Process Name] = "' + strProcessName + '"'; psIn.SetProperty("FlowSearchSpec", strFlowSearchSpec); try { bsWfAdm.InvokeMethod("Activate", psIn, psOut); } catch (e1) { Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Workflow: '" + strProcessName + "' trying to activate again..."); this.sleep(1); try { bsWfAdm.InvokeMethod("Activate", psIn, psOut); } catch (e2) { Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Error occured activating Workflow '" + strProcessName + "': " + e2.toString()); } } iNumActive = ToNumber(psOut.GetProperty("NumFlowActivated")); iNumFlowActivated = ToNumber(iNumFlowActivated) + ToNumber(iNumActive); if (iNumActive == 0) strError = " -> Error:"; Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Result of Workflow Activation " + iCnt + " / " + nWfCount + ": " + iNumActive + strError + " - Name: '" + strProcessName + "'"); psIn.Reset(); psOut.Reset(); } Outputs.SetProperty("NumFlowActivated", iNumFlowActivated); psIn = null; psOut = null; bsWfAdm = null; aListOfWfs = null; }

COMSupplementSvc
ActivateListOfWorkflows
function ActivateListOfWorkflows(Inputs, Outputs) { Outputs.SetProperty("NumFlowActivated", 0); var iNumFlowActivated = 0; var strListOfWfs = Inputs.GetProperty("ListOfWorkflows"); var sEnableLog = Inputs.GetProperty("Enable Logging"); var nBatchNumber = Inputs.GetProperty("Batch Number"); sLogFile = Inputs.GetProperty("Log File"); if (sEnableLog.toUpperCase() == "N") { sLogFile = ""; } var aListOfWfs = strListOfWfs.split("||"); var nWfCount = aListOfWfs.length; var bsWfAdm = oApp.GetService("Workflow Admin Service"); var psIn = oApp.NewPropertySet(); var psOut = oApp.NewPropertySet(); var strFlowSearchSpec = ""; var i = 0; var iCnt = 0; var strError = ""; var iNumActive = 0; var strProcessName = ""; Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": List of Workflows = '" + strListOfWfs + "'"); for (i=0; i<nWfCount; i++) { iCnt++; strError = ""; iNumActive = 0; strProcessName = oApp.utils.allTrim(aListOfWfs[i]); strFlowSearchSpec = '[Process Name] = "' + strProcessName + '"'; psIn.SetProperty("FlowSearchSpec", strFlowSearchSpec); try { bsWfAdm.InvokeMethod("Activate", psIn, psOut); } catch (e1) { Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Workflow: '" + strProcessName + "' trying to activate again..."); this.sleep(1); try { bsWfAdm.InvokeMethod("Activate", psIn, psOut); } catch (e2) { Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Error occured activating Workflow '" + strProcessName + "': " + e2.toString()); } } iNumActive = ToNumber(psOut.GetProperty("NumFlowActivated")); iNumFlowActivated = ToNumber(iNumFlowActivated) + ToNumber(iNumActive); if (iNumActive == 0) strError = " -> Error:"; Write2Log("ActivateListOfWorkflows -> Batch " + nBatchNumber + ": Result of Workflow Activation " + iCnt + " / " + nWfCount + ": " + iNumActive + strError + " - Name: '" + strProcessName + "'"); psIn.Reset(); psOut.Reset(); } Outputs.SetProperty("NumFlowActivated", iNumFlowActivated); psIn = null; psOut = null; bsWfAdm = null; aListOfWfs = null; }

COMSupplementSvc
GetLineCount
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage */ function GetLineCount(strFileName) { try { var fp = Clib.fopen(strFileName,"rt"); var sProcessName = ""; var iCounter = 0; var msg; if ( fp == null ) { // if (bIsTraceOn) oApp.Trace("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErrorText(msg + " " + strFileName); } else { while ( null != (sProcessName = Clib.fgets(fp)) ) { iCounter = iCounter + 1; } Clib.fclose(fp); } } catch (e) { } finally { fp = null; msg = null; } return (iCounter); }

COMSupplementSvc
GetLineCount
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage */ function GetLineCount(strFileName) { try { var fp = Clib.fopen(strFileName,"rt"); var sProcessName = ""; var iCounter = 0; var msg; if ( fp == null ) { // if (bIsTraceOn) oApp.Trace("ActivateCOMProcesses -> Error opening file '" + strFileName + "'."); msg = TheApplication().LookupMessage("User Defined Errors","X_DOCUMENT_FOUND_BUT_NO_OPEN_SCM"); TheApplication().RaiseErrorText(msg + " " + strFileName); } else { while ( null != (sProcessName = Clib.fgets(fp)) ) { iCounter = iCounter + 1; } Clib.fclose(fp); } } catch (e) { } finally { fp = null; msg = null; } return (iCounter); }

COMSupplementSvc
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; sLogin = oApp.LoginName(); var sMsg = ""; var sErr = ""; try { switch (MethodName) { case "ActivateCOMProcesses": boWFDeploy = oApp.GetBusObject("Front Office Workflow"); bcWFDeploy = boWFDeploy.GetBusComp("Workflow Process Deployment"); bcWFDeploy.SetViewMode(AllView); bcWFDeploy.InvokeMethod("SetAdminMode", "TRUE"); bcWFDeploy.ActivateField("Replication Level"); this.ActivateCOMProcesses(Inputs, Outputs); break; case "ActivateListOfWorkflows": sLogFile = Inputs.GetProperty("Log File"); this.ActivateListOfWorkflows(Inputs, Outputs); break; case "Write2Log": sLogFile = Inputs.GetProperty("Log File"); sMsg = Inputs.GetProperty("Log Text"); this.Write2Log(sMsg); break; } } catch(e) { sErr = this.Name() + ".Service_PreInvokeMethod: " + e.toString(); if (bIsTraceOn) oApp.Trace(sErr); this.Write2Log(sErr); } finally { bcWFDeploy = null; boWFDeploy = null; oApp = null; } return (CancelOperation); }

COMSupplementSvc
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; sLogin = oApp.LoginName(); var sMsg = ""; var sErr = ""; try { switch (MethodName) { case "ActivateCOMProcesses": boWFDeploy = oApp.GetBusObject("Front Office Workflow"); bcWFDeploy = boWFDeploy.GetBusComp("Workflow Process Deployment"); bcWFDeploy.SetViewMode(AllView); bcWFDeploy.InvokeMethod("SetAdminMode", "TRUE"); bcWFDeploy.ActivateField("Replication Level"); this.ActivateCOMProcesses(Inputs, Outputs); break; case "ActivateListOfWorkflows": sLogFile = Inputs.GetProperty("Log File"); this.ActivateListOfWorkflows(Inputs, Outputs); break; case "Write2Log": sLogFile = Inputs.GetProperty("Log File"); sMsg = Inputs.GetProperty("Log Text"); this.Write2Log(sMsg); break; } } catch(e) { sErr = this.Name() + ".Service_PreInvokeMethod: " + e.toString(); if (bIsTraceOn) oApp.Trace(sErr); this.Write2Log(sErr); } finally { bcWFDeploy = null; boWFDeploy = null; oApp = null; } return (CancelOperation); }

COMSupplementSvc
SetReplicationLevelAll
function SetReplicationLevelAll(strWorkflowName, &psWorkflows) { var isRecord = false; with (bcWFDeploy) { bcWFDeploy.ClearToQuery(); bcWFDeploy.ActivateField("Name"); if (strWorkflowName != "ALL_WORKFLOWS") { bcWFDeploy.SetSearchSpec("Name", '"' + strWorkflowName + '"'); } // bcWFDeploy.SetSearchSpec("Replication Level", "<> 'All'"); bcWFDeploy.SetSearchSpec("Deployment Status", "Active"); // if (bIsTraceOn) oApp.Trace("SetReplicationLevelAll -> bcWFDeploy.GetSearchExpr()=" + bcWFDeploy.GetSearchExpr()); bcWFDeploy.ExecuteQuery(ForwardOnly); isRecord = bcWFDeploy.FirstRecord(); while (isRecord) { // Remove the Workflow from the PropSet, so only the // ones that could not be activated will be left in the psWorkflows. psWorkflows.RemoveProperty(bcWFDeploy.GetFieldValue("Name")); //if (bIsTraceOn) oApp.Trace("SetReplicationLevelAll -> Setting Replication Level := All for Workflow '" + strWorkflowName + "'..."); bcWFDeploy.SetFieldValue("Replication Level", "All"); bcWFDeploy.WriteRecord(); isRecord = bcWFDeploy.NextRecord(); } } }

COMSupplementSvc
SetReplicationLevelAll
function SetReplicationLevelAll(strWorkflowName, &psWorkflows) { var isRecord = false; with (bcWFDeploy) { bcWFDeploy.ClearToQuery(); bcWFDeploy.ActivateField("Name"); if (strWorkflowName != "ALL_WORKFLOWS") { bcWFDeploy.SetSearchSpec("Name", '"' + strWorkflowName + '"'); } // bcWFDeploy.SetSearchSpec("Replication Level", "<> 'All'"); bcWFDeploy.SetSearchSpec("Deployment Status", "Active"); // if (bIsTraceOn) oApp.Trace("SetReplicationLevelAll -> bcWFDeploy.GetSearchExpr()=" + bcWFDeploy.GetSearchExpr()); bcWFDeploy.ExecuteQuery(ForwardOnly); isRecord = bcWFDeploy.FirstRecord(); while (isRecord) { // Remove the Workflow from the PropSet, so only the // ones that could not be activated will be left in the psWorkflows. psWorkflows.RemoveProperty(bcWFDeploy.GetFieldValue("Name")); //if (bIsTraceOn) oApp.Trace("SetReplicationLevelAll -> Setting Replication Level := All for Workflow '" + strWorkflowName + "'..."); bcWFDeploy.SetFieldValue("Replication Level", "All"); bcWFDeploy.WriteRecord(); isRecord = bcWFDeploy.NextRecord(); } } }

COMSupplementSvc
Write2Log
function Write2Log(sLogText) { if (sLogFile != "") { if (oApp.utils) oApp.utils.Write2Log(sLogFile, sLogText); } }

COMSupplementSvc
Write2Log
function Write2Log(sLogText) { if (sLogFile != "") { if (oApp.utils) oApp.utils.Write2Log(sLogFile, sLogText); } }

COMSupplementSvc
sleep
function sleep(nSecs) { var nMillis = 0; try { SElib.dynamicLink("libc.so", "sleep", nSecs); } catch(e) { nMillis = nSecs * 1000; SElib.dynamicLink("kernel32.dll", "Sleep", STDCALL, nSecs * nMillis); } }

COMSupplementSvc
sleep
function sleep(nSecs) { var nMillis = 0; try { SElib.dynamicLink("libc.so", "sleep", nSecs); } catch(e) { nMillis = nSecs * 1000; SElib.dynamicLink("kernel32.dll", "Sleep", STDCALL, nSecs * nMillis); } }

CP Test
ReadFile
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_CANT_OPEN_FILE_SCM */ function ReadFile(Input, Output) { try { var strFileName = Input.GetProperty("Filename") var fp = Clib.fopen(strFileName, "rt"); //read text // read file if (fp == null) TheApplication().RaiseError("X_CANT_OPEN_FILE_SCM"); else var strLine = Clib.fgets(fp) // close fp Clib.fclose(fp); // check if record exists var oBO = TheApplication().GetBusObject("Account") var oBC = oBO.GetBusComp("Account") oBC.SetViewMode(AllView) oBC.ClearToQuery() oBC.ActivateField("Description") oBC.SetSearchSpec("Id", strLine) oBC.ExecuteQuery(ForwardOnly) var isRec = oBC.FirstRecord() if (isRec) { //record exists so update field oBC.SetFieldValue("Description", strLine) oBC.WriteRecord() } else { //create record and set field oBC.NewRecord(0) oBC.SetFieldValue("Name", strLine) //set req fields oBC.WriteRecord() } } catch(e) { TheApplication().RaiseErrorText(e.toString()) throw e } finally { oBO = null oBC = null } }

CP Test
ReadFile
/** Modification 21.9.2010 tgdlabr1 Added LookupMessage X_CANT_OPEN_FILE_SCM */ function ReadFile(Input, Output) { try { var strFileName = Input.GetProperty("Filename") var fp = Clib.fopen(strFileName, "rt"); //read text // read file if (fp == null) TheApplication().RaiseError("X_CANT_OPEN_FILE_SCM"); else var strLine = Clib.fgets(fp) // close fp Clib.fclose(fp); // check if record exists var oBO = TheApplication().GetBusObject("Account") var oBC = oBO.GetBusComp("Account") oBC.SetViewMode(AllView) oBC.ClearToQuery() oBC.ActivateField("Description") oBC.SetSearchSpec("Id", strLine) oBC.ExecuteQuery(ForwardOnly) var isRec = oBC.FirstRecord() if (isRec) { //record exists so update field oBC.SetFieldValue("Description", strLine) oBC.WriteRecord() } else { //create record and set field oBC.NewRecord(0) oBC.SetFieldValue("Name", strLine) //set req fields oBC.WriteRecord() } } catch(e) { TheApplication().RaiseErrorText(e.toString()) throw e } finally { oBO = null oBC = null } }

CP Test
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Read File") { ReadFile(Inputs, Outputs) return(CancelOperation) } return (ContinueOperation); }

CP Test
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Read File") { ReadFile(Inputs, Outputs) return(CancelOperation) } return (ContinueOperation); }

CPE Track BS - trackingInfo AIP SCM
(declarations)
var cBS = "CPE Track BS - trackingInfo AIP SCM"; var cArea = "CPE Track"; var bFirst; var bDebug = true;

CPE Track BS - trackingInfo AIP SCM
(declarations)
var cBS = "CPE Track BS - trackingInfo AIP SCM"; var cArea = "CPE Track"; var bFirst; var bDebug = true;

CPE Track BS - trackingInfo AIP SCM
CPETrackInfo
function CPETrackInfo(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: just sets field values fot trackingInfo VBC // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { // reset variable TheApplication().SetSharedGlobal("CPE_TRACKINFO_QUERY", false); var trackingInfoXML = TheApplication().GetProfileAttr("trackingInfoXML"); var oBS:Service = TheApplication().GetService("XML Hierarchy Converter"); var psInConv:PropertySet = TheApplication().NewPropertySet(); var psOutConv:PropertySet = TheApplication().NewPropertySet(); psInConv.SetValue(trackingInfoXML); oBS.InvokeMethod("XMLDocToXMLHier", psInConv, psOutConv); var nVBCCount = psOutConv.GetChild(0).GetChild(0).GetChildCount(); for (var iCount = 0; iCount < nVBCCount; iCount++) { Outputs.AddChild(psOutConv.GetChild(0).GetChild(0).GetChild(iCount).Copy()); } } catch (e) { throw(e); } finally { psOutConv = null; psInConv = null; oBS = null; } }

CPE Track BS - trackingInfo AIP SCM
CPETrackInfo
function CPETrackInfo(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: just sets field values fot trackingInfo VBC // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { // reset variable TheApplication().SetSharedGlobal("CPE_TRACKINFO_QUERY", false); var trackingInfoXML = TheApplication().GetProfileAttr("trackingInfoXML"); var oBS:Service = TheApplication().GetService("XML Hierarchy Converter"); var psInConv:PropertySet = TheApplication().NewPropertySet(); var psOutConv:PropertySet = TheApplication().NewPropertySet(); psInConv.SetValue(trackingInfoXML); oBS.InvokeMethod("XMLDocToXMLHier", psInConv, psOutConv); var nVBCCount = psOutConv.GetChild(0).GetChild(0).GetChildCount(); for (var iCount = 0; iCount < nVBCCount; iCount++) { Outputs.AddChild(psOutConv.GetChild(0).GetChild(0).GetChild(iCount).Copy()); } } catch (e) { throw(e); } finally { psOutConv = null; psInConv = null; oBS = null; } }

CPE Track BS - trackingInfo AIP SCM
FindChildNoPS
function FindChildNoPS(strTagName, strIgnoreNS, psHierarchy) { /* Purpose : Finds a child in a hierarchy and returns it in it's own hierarchy. Used in script rather than a business service. */ try { if (psHierarchy) { var psChild = FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS); return psChild; } else { return null; } } catch (e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
FindChildNoPS
function FindChildNoPS(strTagName, strIgnoreNS, psHierarchy) { /* Purpose : Finds a child in a hierarchy and returns it in it's own hierarchy. Used in script rather than a business service. */ try { if (psHierarchy) { var psChild = FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS); return psChild; } else { return null; } } catch (e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
FindFirstElementByName
function FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS) { /* Purpose : Finds an element in a hierarchy. */ try { var psRet = null; var strIgnNs = strIgnoreNS.toLowerCase(); var strCurrentTag = ""; if (psHierarchy.GetChildCount() < 1) { return null; } else { for (var i=0; i<psHierarchy.GetChildCount(); i++) { if ((strIgnNs == "true") || (strIgnNs == "y") || (strIgnNs == "1")) { strCurrentTag = psHierarchy.GetChild(i).GetType() if (strCurrentTag.lastIndexOf(":") > -1) { strCurrentTag = strCurrentTag.substring(strCurrentTag.lastIndexOf(":")+1); } } else { strCurrentTag = psHierarchy.GetChild(i).GetType() } if (strCurrentTag == strTagName) { return psHierarchy.GetChild(i); } else { psRet = FindFirstElementByName(psHierarchy.GetChild(i), strTagName, strIgnoreNS); if (psRet) { return psRet; } } } } } catch (e) { throw e; } finally { psRet = null; } }

CPE Track BS - trackingInfo AIP SCM
FindFirstElementByName
function FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS) { /* Purpose : Finds an element in a hierarchy. */ try { var psRet = null; var strIgnNs = strIgnoreNS.toLowerCase(); var strCurrentTag = ""; if (psHierarchy.GetChildCount() < 1) { return null; } else { for (var i=0; i<psHierarchy.GetChildCount(); i++) { if ((strIgnNs == "true") || (strIgnNs == "y") || (strIgnNs == "1")) { strCurrentTag = psHierarchy.GetChild(i).GetType() if (strCurrentTag.lastIndexOf(":") > -1) { strCurrentTag = strCurrentTag.substring(strCurrentTag.lastIndexOf(":")+1); } } else { strCurrentTag = psHierarchy.GetChild(i).GetType() } if (strCurrentTag == strTagName) { return psHierarchy.GetChild(i); } else { psRet = FindFirstElementByName(psHierarchy.GetChild(i), strTagName, strIgnoreNS); if (psRet) { return psRet; } } } } } catch (e) { throw e; } finally { psRet = null; } }

CPE Track BS - trackingInfo AIP SCM
Init
function Init(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { Outputs.SetProperty("OrderIdSiebel",""); Outputs.SetProperty("OrderNumberSAP",""); Outputs.SetProperty("PackagingNumber",""); Outputs.SetProperty("ServiceProvider",""); } catch(e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
Init
function Init(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { Outputs.SetProperty("OrderIdSiebel",""); Outputs.SetProperty("OrderNumberSAP",""); Outputs.SetProperty("PackagingNumber",""); Outputs.SetProperty("ServiceProvider",""); } catch(e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-31 Ingo Bischel 1 created //==================================================================================================== try { var bQuery = false; var property = Inputs.GetFirstProperty(); while (property != "") { if (property == "search-string") { bQuery = true; } var value = Inputs.GetProperty(property); property = Inputs.GetNextProperty(); } if (TheApplication().GetSharedGlobal("CPE_TRACKINFO_QUERY") == "true") { CPETrackInfo(Inputs, Outputs); } bFirst=false; } catch(e) { Init(Inputs, Outputs); throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-31 Ingo Bischel 1 created //==================================================================================================== try { var bQuery = false; var property = Inputs.GetFirstProperty(); while (property != "") { if (property == "search-string") { bQuery = true; } var value = Inputs.GetProperty(property); property = Inputs.GetNextProperty(); } if (TheApplication().GetSharedGlobal("CPE_TRACKINFO_QUERY") == "true") { CPETrackInfo(Inputs, Outputs); } bFirst=false; } catch(e) { Init(Inputs, Outputs); throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query(Inputs,Outputs); return (CancelOperation); break; case "CPETrackInfo": CPETrackInfo(Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ingo Bischel TGDBIIN1 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2010-03-30 Ingo Bischel 1 created //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query(Inputs,Outputs); return (CancelOperation); break; case "CPETrackInfo": CPETrackInfo(Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

CPE Track BS - trackingInfo AIP SCM
WritePropertySet
function WritePropertySet(PropSet, Level) { if ((Level == "") || (typeof(Level) == "undefined")){ Level = 0; } var indent = ""; for (var x = 0; x < Level; x++){ indent += "\t"; } var psType = PropSet.GetType(); var psValue = PropSet.GetValue(); var propName = PropSet.GetFirstProperty(); while (propName != ""){ var propValue = PropSet.GetProperty(propName); propName = PropSet.GetNextProperty(); } var children = PropSet.GetChildCount(); for (x = 0; x < children; x++){ WritePropertySet(PropSet.GetChild(x), (Level + 1)); } }

CPE Track BS - trackingInfo AIP SCM
WritePropertySet
function WritePropertySet(PropSet, Level) { if ((Level == "") || (typeof(Level) == "undefined")){ Level = 0; } var indent = ""; for (var x = 0; x < Level; x++){ indent += "\t"; } var psType = PropSet.GetType(); var psValue = PropSet.GetValue(); var propName = PropSet.GetFirstProperty(); while (propName != ""){ var propValue = PropSet.GetProperty(propName); propName = PropSet.GetNextProperty(); } var children = PropSet.GetChildCount(); for (x = 0; x < children; x++){ WritePropertySet(PropSet.GetChild(x), (Level + 1)); } }

CPE Track BS AIP SCM
(declarations)
var cWF = "EAI CPE Track AIP SCM"; var cBS = "CPE Track BS AIP SCM"; var cArea = "CPE Track"; var bFirst; var bDebug = true;

CPE Track BS AIP SCM
(declarations)
var cWF = "EAI CPE Track AIP SCM"; var cBS = "CPE Track BS AIP SCM"; var cArea = "CPE Track"; var bFirst; var bDebug = true;

CPE Track BS AIP SCM
CPETrack
function CPETrack(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: Calls a workflow to populate the CPE Track VBC // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-19 Ralf Kalmes 1 created // 2009-12-02 Ralf Kalmes 2 changed mapping of flat structure to generic algo // 2011-03-30 Basser Sultansei 3 All-IP Merge - Set Profile Attribute "trackingInfoXML" //==================================================================================================== try { // reset variable TheApplication().SetSharedGlobal("CPE_TRACK_QUERY", false); var oPSInputs:PropertySet = TheApplication().NewPropertySet(); var oPSOutputs:PropertySet = TheApplication().NewPropertySet(); var oBS:Service; oPSInputs.SetProperty("ProcessName", cWF); oPSInputs.SetProperty("Object Id", TheApplication().GetSharedGlobal("CPE_ORDER_ID")); oBS = TheApplication().GetService("Workflow Process Manager"); oBS.InvokeMethod("RunProcess", oPSInputs, oPSOutputs); // Profile Attribute is used in BS "CPE Track BS - trackingInfo AIP SCM" Method "CPETrackInfo" TheApplication().SetProfileAttr("trackingInfoXML", oPSOutputs.GetProperty("trackingInfoXML")); var psVBCIO = FindChildNoPS("ListOfCPE Track Response Flat AIP SCM", "N", oPSOutputs); if (psVBCIO) { var nVBCCount = psVBCIO.GetChildCount(); for (var iCount = 0; iCount < nVBCCount; iCount++) { Outputs.AddChild(psVBCIO.GetChild(iCount).Copy()); } } else { //Popup Error Applet: TheApplication().RaiseErrorText("BS: CPE Track BS AIP SCM, function: CPETRack: No lines are returned from the CPE Track interface"); } } catch (e) { throw(e); } finally { //destroy instance variables oPSInputs = null; oPSOutputs = null; oBS = null; } }

CPE Track BS AIP SCM
CPETrack
function CPETrack(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: Calls a workflow to populate the CPE Track VBC // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-19 Ralf Kalmes 1 created // 2009-12-02 Ralf Kalmes 2 changed mapping of flat structure to generic algo // 2011-03-30 Basser Sultansei 3 All-IP Merge - Set Profile Attribute "trackingInfoXML" //==================================================================================================== try { // reset variable TheApplication().SetSharedGlobal("CPE_TRACK_QUERY", false); var oPSInputs:PropertySet = TheApplication().NewPropertySet(); var oPSOutputs:PropertySet = TheApplication().NewPropertySet(); var oBS:Service; oPSInputs.SetProperty("ProcessName", cWF); oPSInputs.SetProperty("Object Id", TheApplication().GetSharedGlobal("CPE_ORDER_ID")); oBS = TheApplication().GetService("Workflow Process Manager"); oBS.InvokeMethod("RunProcess", oPSInputs, oPSOutputs); // Profile Attribute is used in BS "CPE Track BS - trackingInfo AIP SCM" Method "CPETrackInfo" TheApplication().SetProfileAttr("trackingInfoXML", oPSOutputs.GetProperty("trackingInfoXML")); var psVBCIO = FindChildNoPS("ListOfCPE Track Response Flat AIP SCM", "N", oPSOutputs); if (psVBCIO) { var nVBCCount = psVBCIO.GetChildCount(); for (var iCount = 0; iCount < nVBCCount; iCount++) { Outputs.AddChild(psVBCIO.GetChild(iCount).Copy()); } } else { //Popup Error Applet: TheApplication().RaiseErrorText("BS: CPE Track BS AIP SCM, function: CPETRack: No lines are returned from the CPE Track interface"); } } catch (e) { throw(e); } finally { //destroy instance variables oPSInputs = null; oPSOutputs = null; oBS = null; } }

CPE Track BS AIP SCM
FindChildNoPS
function FindChildNoPS(strTagName, strIgnoreNS, psHierarchy) { /* Purpose : Finds a child in a hierarchy and returns it in it's own hierarchy. Used in script rather than a business service. */ try { if (psHierarchy) { var psChild = FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS); return psChild; } else { return null; } } catch (e) { throw(e); } finally { } }

CPE Track BS AIP SCM
FindChildNoPS
function FindChildNoPS(strTagName, strIgnoreNS, psHierarchy) { /* Purpose : Finds a child in a hierarchy and returns it in it's own hierarchy. Used in script rather than a business service. */ try { if (psHierarchy) { var psChild = FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS); return psChild; } else { return null; } } catch (e) { throw(e); } finally { } }

CPE Track BS AIP SCM
FindFirstElementByName
function FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS) { /* Purpose : Finds an element in a hierarchy. */ try { var psRet = null; var strIgnNs = strIgnoreNS.toLowerCase(); var strCurrentTag = ""; if (psHierarchy.GetChildCount() < 1) { return null; } else { for (var i=0; i<psHierarchy.GetChildCount(); i++) { if ((strIgnNs == "true") || (strIgnNs == "y") || (strIgnNs == "1")) { strCurrentTag = psHierarchy.GetChild(i).GetType() if (strCurrentTag.lastIndexOf(":") > -1) { strCurrentTag = strCurrentTag.substring(strCurrentTag.lastIndexOf(":")+1); } } else { strCurrentTag = psHierarchy.GetChild(i).GetType() } if (strCurrentTag == strTagName) { return psHierarchy.GetChild(i); } else { psRet = FindFirstElementByName(psHierarchy.GetChild(i), strTagName, strIgnoreNS); if (psRet) { return psRet; } } } } } catch (e) { throw e; } finally { psRet = null; } }

CPE Track BS AIP SCM
FindFirstElementByName
function FindFirstElementByName(psHierarchy, strTagName, strIgnoreNS) { /* Purpose : Finds an element in a hierarchy. */ try { var psRet = null; var strIgnNs = strIgnoreNS.toLowerCase(); var strCurrentTag = ""; if (psHierarchy.GetChildCount() < 1) { return null; } else { for (var i=0; i<psHierarchy.GetChildCount(); i++) { if ((strIgnNs == "true") || (strIgnNs == "y") || (strIgnNs == "1")) { strCurrentTag = psHierarchy.GetChild(i).GetType() if (strCurrentTag.lastIndexOf(":") > -1) { strCurrentTag = strCurrentTag.substring(strCurrentTag.lastIndexOf(":")+1); } } else { strCurrentTag = psHierarchy.GetChild(i).GetType() } if (strCurrentTag == strTagName) { return psHierarchy.GetChild(i); } else { psRet = FindFirstElementByName(psHierarchy.GetChild(i), strTagName, strIgnoreNS); if (psRet) { return psRet; } } } } } catch (e) { throw e; } finally { psRet = null; } }

CPE Track BS AIP SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created // 2010-02-23 Ingo Bischel 2 added handling for additional fields (Rel.1.1 Logistics) // 2010-03-10 Ingo Bischel 2 added handling for still another additional fields (Rel.1.1 Logistics) //==================================================================================================== try { Outputs.SetProperty("ActualGoodsIssueDate",""); Outputs.SetProperty("AllocationDate",""); Outputs.SetProperty("CreatedAt",""); Outputs.SetProperty("DeliveryStatus",""); Outputs.SetProperty("ItemIdentifier",""); Outputs.SetProperty("OrderIdSiebel",""); Outputs.SetProperty("OrderNumberSAP",""); Outputs.SetProperty("OverallStatus",""); Outputs.SetProperty("ReferenceId",""); //new fields as per 2010-02-23 go here: Outputs.SetProperty("Date",""); Outputs.SetProperty("InvoiceRelevant",""); Outputs.SetProperty("ItemsReturned",""); Outputs.SetProperty("MaterialShortText",""); Outputs.SetProperty("PackagingNumber",""); Outputs.SetProperty("Reason",""); Outputs.SetProperty("ReturnNumber",""); Outputs.SetProperty("ReturnedMaterialNumber",""); Outputs.SetProperty("ServiceProvider",""); Outputs.SetProperty("Type",""); //new fields as per 2010-03-10 go here: Outputs.SetProperty("TypeDescription",""); Outputs.SetProperty("ReasonDescription",""); Outputs.SetProperty("BusinessTransactionType",""); bFirst=true; } catch(e) { throw(e); } finally { } }

CPE Track BS AIP SCM
Init
function Init (Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: Init the VBC fields // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created // 2010-02-23 Ingo Bischel 2 added handling for additional fields (Rel.1.1 Logistics) // 2010-03-10 Ingo Bischel 2 added handling for still another additional fields (Rel.1.1 Logistics) //==================================================================================================== try { Outputs.SetProperty("ActualGoodsIssueDate",""); Outputs.SetProperty("AllocationDate",""); Outputs.SetProperty("CreatedAt",""); Outputs.SetProperty("DeliveryStatus",""); Outputs.SetProperty("ItemIdentifier",""); Outputs.SetProperty("OrderIdSiebel",""); Outputs.SetProperty("OrderNumberSAP",""); Outputs.SetProperty("OverallStatus",""); Outputs.SetProperty("ReferenceId",""); //new fields as per 2010-02-23 go here: Outputs.SetProperty("Date",""); Outputs.SetProperty("InvoiceRelevant",""); Outputs.SetProperty("ItemsReturned",""); Outputs.SetProperty("MaterialShortText",""); Outputs.SetProperty("PackagingNumber",""); Outputs.SetProperty("Reason",""); Outputs.SetProperty("ReturnNumber",""); Outputs.SetProperty("ReturnedMaterialNumber",""); Outputs.SetProperty("ServiceProvider",""); Outputs.SetProperty("Type",""); //new fields as per 2010-03-10 go here: Outputs.SetProperty("TypeDescription",""); Outputs.SetProperty("ReasonDescription",""); Outputs.SetProperty("BusinessTransactionType",""); bFirst=true; } catch(e) { throw(e); } finally { } }

CPE Track BS AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created //==================================================================================================== try { var bQuery = false; var property = Inputs.GetFirstProperty(); while (property != "") { if (property == "search-string") { bQuery = true; } var value = Inputs.GetProperty(property); property = Inputs.GetNextProperty(); } if (TheApplication().GetSharedGlobal("CPE_TRACK_QUERY") == "true") { CPETrack(Inputs, Outputs); } else { } bFirst=false; } catch(e) { Init(Inputs, Outputs); throw(e); } finally { } }

CPE Track BS AIP SCM
Query
function Query(Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: query // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created //==================================================================================================== try { var bQuery = false; var property = Inputs.GetFirstProperty(); while (property != "") { if (property == "search-string") { bQuery = true; } var value = Inputs.GetProperty(property); property = Inputs.GetNextProperty(); } if (TheApplication().GetSharedGlobal("CPE_TRACK_QUERY") == "true") { CPETrack(Inputs, Outputs); } else { } bFirst=false; } catch(e) { Init(Inputs, Outputs); throw(e); } finally { } }

CPE Track BS AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query(Inputs,Outputs); return (CancelOperation); break; case "CPETrack": CPETrack(Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

CPE Track BS AIP SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { //==================================================================================================== // Authors: Ralf Kalmes, TGDKARA7 // Purpose: PreInvokeMethod // // Revision Date Who Ver Comments // ------------- --- --- -------- // 2009-08-18 Ralf Kalmes 1 created //==================================================================================================== try { switch (MethodName) { case "Init": Init(Inputs,Outputs); return (CancelOperation); break; case "Query": Query(Inputs,Outputs); return (CancelOperation); break; case "CPETrack": CPETrack(Inputs,Outputs); return (CancelOperation); break; default: return (ContinueOperation); break; } } catch(e) { throw(e); } finally { } }

CPG Deduction - SAP Short Pay BAPI Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If }//End While }//End If }//End While }//End Function

CPG Deduction - SAP Short Pay BAPI Output
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If }//End While }//End If }//End While }//End Function

CPG Deduction - SAP Short Pay BAPI Output
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If }//End While }//End If }//End While }//End Function

CPG Deduction - SAP Short Pay BAPI Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay BAPI Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay BAPI Output - old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output - old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output - old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay BAPI Output - old
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If } } } }

CPG Deduction - SAP Short Pay BAPI Output - old
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If } } } }

CPG Deduction - SAP Short Pay BAPI Output - old
CreateSAPShortPay_BAPIToSiebel
function CreateSAPShortPay_BAPIToSiebel(inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var currencyLM = new CSSEAIValueMap ("SAP Currency Code", "Siebel Inbound"); /* * Set up EAI Input Message objects */ var iDeductBAPIObj; // BAPI Deduction instance var iExportComp; // BAPI Export Parameters var iItemComp; // BAPI Line Items /* * Set up EAI Output Message objects */ var oDeductObj; // Siebel Deduction instance var oDeductComp; // CPG Deduction /* * Find and create top-level integration object */ iDeductBAPIObj = inputMsg.GetIntObj("BAPI_AR_ACC_GETSTATEMENT"); oDeductObj = outputMsg.CreateIntObj ("CPG Short Payment Interface (SAP)"); /* * Read int object instances from EAI message */ while (iDeductBAPIObj.NextInstance ()) { /* * Read "Export Parameters" component */ iExportComp = iDeductBAPIObj.GetPrimaryIntComp ("Export Parameters"); if (iExportComp.NextRecord ()) { oDeductObj.NewInstance (); oDeductObj = oDeductObj.CreatePrimaryIntComp ("CG Short Pay Deduction"); iItemComp = iExportComp.GetIntComp ("LINEITEMS"); while(iItemComp.NextRecord()) { var postKey = iItemComp.GetFieldValue ( "POST_KEY" ); if (postKey == 06) { var CustNum = iItemComp.GetFieldValue ( "CUSTOMER" ); var AmtDocCurr = iItemComp.GetFieldValue ( "AMT_DOCCUR" ); var DeductId = "SAP" + iItemComp.GetFieldValue ( "DOC_NO" ) + iItemComp.GetFieldValue ( "ITEM_NUM" ); oDeductObj.NewRecord(); oDeductObj.SetFieldValue ("Integration Id", CustNum); oDeductObj.SetFieldValue ("Deduction Amount", AmtDocCurr); oDeductObj.SetFieldValue ("Currency Code", currencyLM.Translate (iItemComp.GetFieldValue ("CURRENCY"))); oDeductObj.SetFieldValue ("Deduction Id", DeductId); }//End If } } } }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay BAPI Output - old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output -old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output -old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output -old
(declarations)
#include "eaisiebel.js"

CPG Deduction - SAP Short Pay Siebel Output -old
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output -old
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output -old
CreateSAPShortPay_SiebelToBAPI
function CreateSAPShortPay_SiebelToBAPI (inputMsg, outputMsg) { /* * Set up EAI Lookup maps */ var CompCodeLM = EAIGetValueMap ("SAP Short Pay", "Siebel Outbound"); var FromDate = inputMsg.GetArgument ("FromDate"); var ToDate = inputMsg.GetArgument ("ToDate"); var oDeductBAPIComp; var iAccountComp; /* * Find and create top-level integration object */ var iAccountObj = inputMsg.GetIntObj ("CG Short Pay"); var oDeductBAPIObj = outputMsg.CreateIntObj ("BAPI_AR_ACC_GETSTATEMENT_INPUT"); while (iAccountObj.NextInstance ()) { /* * Create "CPG Deduction" object in output message */ oDeductBAPIObj.NewInstance (); /* * Read "CPG Deduction" component */ oDeductBAPIComp = oDeductBAPIObj.CreatePrimaryIntComp("Import Parameters"); iAccountComp = iAccountObj.GetPrimaryIntComp ("CG SAP Short Pay Account"); if (iAccountComp.NextRecord ()) { oDeductBAPIComp.NewRecord (); oDeductBAPIComp.SetFieldValue ("CUSTOMER", iAccountComp.GetFieldValue("Integration Id")); oDeductBAPIComp.SetFieldValue ("DATE_FROM", FromDate); oDeductBAPIComp.SetFieldValue ("DATE_TO", ToDate); oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM.Translate("COMP_CODE")); // oDeductBAPIComp.SetFieldValue ("COMPANYCODE", CompCodeLM); } } }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CPG Deduction - SAP Short Pay Siebel Output -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CRMGP LAA BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch (MethodName) { case "Init" : Outputs.SetProperty ("Name", ""); return (CancelOperation); break; case "Query" : var test = TheApplication().NewPropertySet (); Outputs.AddChild (test); test.SetType ("Status"); test.SetProperty ("Status", "5"); test.SetProperty ("Error Field", "Name"); test.SetProperty ("Error Text", "Text"); return (CancelOperation); break; } return (ContinueOperation); }

CRMGP LAA BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch (MethodName) { case "Init" : Outputs.SetProperty ("Name", ""); return (CancelOperation); break; case "Query" : var test = TheApplication().NewPropertySet (); Outputs.AddChild (test); test.SetType ("Status"); test.SetProperty ("Status", "5"); test.SetProperty ("Error Field", "Name"); test.SetProperty ("Error Text", "Text"); return (CancelOperation); break; } return (ContinueOperation); }

CRMGP LAA BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { switch (MethodName) { case "Init" : Outputs.SetProperty ("Name", ""); return (CancelOperation); break; case "Query" : var test = TheApplication().NewPropertySet (); Outputs.AddChild (test); test.SetType ("Status"); test.SetProperty ("Status", "5"); test.SetProperty ("Error Field", "Name"); test.SetProperty ("Error Text", "Text"); return (CancelOperation); break; } return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS Promo - Credit Memo via FI - BAPI
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS Promo - Credit Memo via FI - BAPI
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS Promo - Credit Memo via FI - BAPI -old
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI -old
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI -old
(declarations)
#include "eaisiebel.js"

CS Promo - Credit Memo via FI - BAPI -old
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI -old
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI -old
CreateCreditMemo_SiebelToBAPI
function CreateCreditMemo_SiebelToBAPI(inputMsg, outputMsg) { var currencyLM = EAIGetValueMap ("SAP Currency Code","Siebel Outbound"); var CrMemoLM = EAIGetValueMap ("SAP CG Promo - Credit Memo" , "Siebel Outbound"); /* Set up EAI Input Message objects */ var iCrMemoObj; var iPromoDealComp; /* Set up EAI Output Message objects */ var iBAPIObj; // BAPI instance var oImportComp; // top level BAPI segment var oSALESORDERComp; // BAPI Order Header var oACCOUNTRECEIVABLEComp; // BAPI Order Header var oACCOUNTGLComp; // BAPI Order Header var oCURRENCYAMOUNTComp; // BAPI Order Header /* Find and create top-level integration object */ iCrMemoObj = inputMsg.GetIntObj ("CPG SAP Connector - Credit Credit Memo via FI (Siebel)"); var oBAPIObj = outputMsg.CreateIntObj ("BAPI_ACC_BILLING_POST"); while (iCrMemoObj.NextInstance ()) { /* Read input component */ iPromoDealComp = iCrMemoObj.GetPrimaryIntComp ("CPG Promo Deal Payment"); if (iPromoDealComp.NextRecord ()) { /* Create "BAPI" object */ oBAPIObj.NewInstance (); /* Create "BAPI" component in output message */ oImportComp = oBAPIObj.CreatePrimaryIntComp ("Import Parameters"); oImportComp.NewRecord (); oACCOUNTRECEIVABLEComp = oImportComp.CreateIntComp ("ACCOUNTRECEIVABLE",false); oACCOUNTGLComp = oImportComp.CreateIntComp ("ACCOUNTGL",false); oCURRENCYAMOUNTComp = oImportComp.CreateIntComp ("CURRENCYAMOUNT",false); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_TYPE", CrMemoLM.Translate("Reference Procedure")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_KEY", iPromoDealComp.GetFieldValue("Id")); oImportComp.SetFieldValue ("DOCUMENTHEADER-OBJ_SYS", CrMemoLM.Translate("SAP Logical System Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-USERNAME", CrMemoLM.Translate("SAP User Name")); oImportComp.SetFieldValue ("DOCUMENTHEADER-HEADER_TXT", iPromoDealComp.GetFieldValue("Mdf Type")); oImportComp.SetFieldValue ("DOCUMENTHEADER-COMP_CODE", CrMemoLM.Translate("SAP Comp Code")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-PSTNG_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-TRANS_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-VALUE_DATE", iPromoDealComp.GetFieldValue("Created Date")); oImportComp.SetFieldValue ("DOCUMENTHEADER-DOC_TYPE", CrMemoLM.Translate("DOC_TYPE")); oImportComp.SetFieldValue ("DOCUMENTHEADER-REF_DOC_NO", ""); oACCOUNTRECEIVABLEComp.NewRecord (); oACCOUNTRECEIVABLEComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); oACCOUNTRECEIVABLEComp.SetFieldValue ("CUSTOMER", iPromoDealComp.GetFieldValue("Account Integration Id")); oACCOUNTGLComp.NewRecord (); oACCOUNTGLComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oACCOUNTGLComp.SetFieldValue ("GL_ACCOUNT", CrMemoLM.Translate ("GL_ACCOUNT")); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC")); var amount = iPromoDealComp.GetFieldValue("Trade Fund Amount"); amount = amount * CrMemoLM.Translate ("AMOUNT_SIGN"); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount); oCURRENCYAMOUNTComp.NewRecord (); oCURRENCYAMOUNTComp.SetFieldValue ("ITEMNO_ACC", CrMemoLM.Translate ("ITEMNO_ACC2")); oCURRENCYAMOUNTComp.SetFieldValue ("CURRENCY", currencyLM.Translate (iPromoDealComp.GetFieldValue("Currency Code"))); oCURRENCYAMOUNTComp.SetFieldValue ("AMT_DOCCUR", amount * -1 ); } } }

CS Promo - Credit Memo via FI - BAPI -old
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI -old
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI -old
CreateDummyBAPICommit
function CreateDummyBAPICommit (inputMsg, outputMsg) { /* * Set up EAI Output Message Objects */ var oCommitObj; // BAPI instance var oCommitComp; // BAPI Component oCommitObj = outputMsg.CreateIntObj ("BAPI_TRANSACTION_COMMIT(input)"); oCommitObj.NewInstance(); oCommitComp = oCommitObj.CreatePrimaryIntComp ("Import Parameters"); oCommitComp.NewRecord (); }

CS Promo - Credit Memo via FI - BAPI -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS Promo - Credit Memo via FI - BAPI -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap(MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2EDP05002"); oEDP05Comp.NewRecord (); oEDP05Comp.SetFieldValue ("KSCHL", resLM.Translate ("Condition Type")); oEDP0

CS SAP Deduction Resolution Maps
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2EDP05002"); oEDP05Comp.NewRecord (); oEDP05Comp.SetFieldValue ("KSCHL", resLM.Translate ("Condition Type")); oEDP0

CS SAP Deduction Resolution Maps
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2EDP05002"); oEDP05Comp.NewRecord (); oEDP05Comp.SetFieldValue ("KSCHL", resLM.Translate ("Condition Type")); oEDP0

CS SAP Deduction Resolution Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps -old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps -old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps -old
(declarations)
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002, Siebel Systems, Inc., All rights reserved. // // $Revision: 1 $ // $Date: 02/04/2002 10:29a $ // $Author: Jacchan $ of last update // // CREATOR: JACCHAN // // DESCRIPTION // Javascript maps from Siebel CG Promotion to SAP // /////////////////////////////////////////////////////////////////////////////// #include "eaisiebel.js"

CS SAP Deduction Resolution Maps -old
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2ED

CS SAP Deduction Resolution Maps -old
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2ED

CS SAP Deduction Resolution Maps -old
SendSiebelResolution_ToIDOC
function SendSiebelResolution_ToIDOC (inputMsg, outputMsg) { /* Set up EAI Lookup maps */ var currencyLM = EAIGetValueMap ("SAP Currency Code", "Siebel Outbound"); var resLM = EAIGetValueMap ("SAP CG Deduction Resolution", "Siebel Outbound"); /* Set up EAI Input Message objects */ var iResObj; // Siebel CS SAP Deduction Resolution var iResComp; // CS SAP Deduction Resolution /* Set up EAI Output Message objects */ var oIDOCObj; // IDOC instance var oIDOCComp; // top level IDOC segment var oEDK14Comp; // IDOC Order Header var oEDKA1Comp; // IDOC Order Header var oEDP01Comp; // IDOC Order Header var oEDP19Comp; // IDOC Order Header var oEDP05Comp; // IDOC Order Header var oEDK01Comp; var oEDKA3Comp; var amtField; var creditId; var orderType; var resType; /* Find and create top-level integration object */ iResObj = inputMsg.GetIntObj ("CG SAP Connector - Create Credit/Debit Request (Siebel)"); oIDOCObj = outputMsg.CreateIntObj ("ORDERS03 (ORDERS)"); while (iResObj.NextInstance ()) { /* Read root Account component */ iResComp = iResObj.GetPrimaryIntComp ("CS SAP Deduction Resolution"); if( iResComp.NextRecord() ) { /* Create "IDOC" object */ oIDOCObj.NewInstance (); /* Create "IDOC" component in output message */ oIDOCComp = oIDOCObj.CreatePrimaryIntComp ("Idoc Segments"); oIDOCComp.NewRecord (); resType = iResComp.GetFieldValue("Type"); creditId = iResComp.GetFieldValue("Payment Credit Num"); if (!Clib.strcmpi(resType, "Write Off") || !Clib.strcmpi(resType, "Chargeback")) { orderType = resLM.Translate ("Order Type Value Debit"); if (!Clib.strcmpi(resType, "Write Off")) { amtField = "Write-off Amount"; } else { amtField = "Chargeback Amount"; } } else { orderType = resLM.Translate ("Order Type Value Credit"); if (creditId.length <= 0) { amtField = "Trade Fund Amount"; } else { amtField = "Credit Memo Amount"; } } //E1EDK14 Segment oEDK14Comp = oIDOCComp.CreateIntComp ("E2EDK14"); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Order Type")); oEDK14Comp.SetFieldValue ("ORGID", orderType); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Sales Org")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Sales Org")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Distr Channel")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Distr Channel")); oEDK14Comp.NewRecord (); oEDK14Comp.SetFieldValue ("QUALF", resLM.Translate ("Division")); oEDK14Comp.SetFieldValue ("ORGID", iResComp.GetFieldValue("Division")); //E1EDK01 Segment - Required Segement oEDK01Comp = oIDOCComp.CreateIntComp ("E2EDK01005"); oEDK01Comp.NewRecord (); //E1EDP01 Segment oEDP01Comp = oIDOCComp.CreateIntComp ("E2EDP01006"); oEDP01Comp.NewRecord (); oEDP01Comp.SetFieldValue ("MENGE", 1); oEDP01Comp.SetFieldValue ("CURCY", currencyLM.Translate (iResComp.GetFieldValue("Currency Code"))); //E1EDKA1 Segment oEDKA1Comp = oIDOCComp.CreateIntComp ("E2EDKA1003"); oEDKA1Comp.NewRecord (); oEDKA1Comp.SetFieldValue ("PARVW", resLM.Translate ("Sold To")); oEDKA1Comp.SetFieldValue ("PARTN", iResComp.GetFieldValue("Integration Id")); //E1EDKA1 Segment - Required Segement oEDKA3Comp = oEDKA1Comp.CreateIntComp ("E2EDKA3"); oEDKA3Comp.NewRecord (); //E1EDP19 Segment oEDP19Comp = oEDP01Comp.CreateIntComp ("E2EDP19001"); oEDP19Comp.NewRecord (); oEDP19Comp.SetFieldValue ("QUALF", resLM.Translate ("IDOC Obj")); oEDP19Comp.SetFieldValue ("IDTNR", resLM.Translate ("Material")); //E1EDP05 Segment oEDP05Comp = oEDP01Comp.CreateIntComp ("E2ED

CS SAP Deduction Resolution Maps -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps -old
Service_InvokeMethod
function Service_InvokeMethod (MethodName, Inputs, Outputs) { }

CS SAP Deduction Resolution Maps -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps -old
Service_PreCanInvokeMethod
function Service_PreCanInvokeMethod (MethodName, &CanInvoke) { return (ContinueOperation); }

CS SAP Deduction Resolution Maps -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CS SAP Deduction Resolution Maps -old
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { return EAIExecuteMap (MethodName, Inputs, Outputs); }

CSV User Import BS Repository SCM
(declarations)
var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; var aColumn = new Array();

CSV User Import BS Repository SCM
(declarations)
var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; var aColumn = new Array();

CSV User Import BS Repository SCM
FileExists
function FileExists (strFileName:String) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks whether a given file exists in the file system // // Input: strFileName // -> c:\temp\import.csv // Output: return (bool) // -> true or false // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oFile: File; try { oFile = Clib.fopen(strFileName, "r"); if (oFile != null) { Clib.fclose(oFile); if(bIsTraceOn) oApp.Trace(this.Name() + ": FileExists: " + strFileName); return true; } else { return false; } } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": FileExists - Error: "+e.toString()); throw(e); } finally { oFile = null; } }

CSV User Import BS Repository SCM
FileExists
function FileExists (strFileName:String) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Checks whether a given file exists in the file system // // Input: strFileName // -> c:\temp\import.csv // Output: return (bool) // -> true or false // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oFile: File; try { oFile = Clib.fopen(strFileName, "r"); if (oFile != null) { Clib.fclose(oFile); if(bIsTraceOn) oApp.Trace(this.Name() + ": FileExists: " + strFileName); return true; } else { return false; } } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": FileExists - Error: "+e.toString()); throw(e); } finally { oFile = null; } }

CSV User Import BS Repository SCM
ImportData
function ImportData (strFileName:String, aColumn:Array, Outputs:PropertySet, strSep:String, iHeaderRows:Number) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Reads a given CSV file to upsert Siebel Users, Skills and Skill Items // // Input: strFileName // -> c:\temp\import.csv // aColumn // -> Column definition - see "Initialize" for details // Outputs // -> PropertySet for result and issues // strSep // -> CSV Seperator (e.g. ";") // iHeaderRows // -> how many header rows should be ignored while reading? // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO: BusObject; var oBC: BusComp; var oFile: File; var strLine: String; var aCSV: Array; var strValue: String; var i: Number; var iRow: Number; try { iRow = 0; oApp.Trace(this.Name() + ": ImportData: Start"); oApp.Trace(this.Name() + ": ImportData: Opening CSV File " + strFileName + " ..."); oBO = oApp.GetBusObject("Employee"); oBC = oBO.GetBusComp("Employee"); oFile = Clib.fopen(strFileName,"rt"); if (oFile != null) { //Data lines while ( "null" != (strLine = Clib.fgets([10000],oFile))) { iRow++; ////////////////////////// // ignore x header rows // ////////////////////////// if (iRow > iHeaderRows) { //Remove line break strLine = strLine.replace(/\n\r/g,""); strLine = strLine.replace(/\n/g,""); strLine = strLine.replace(/[\n\r]/g,""); strLine = strLine.replace(/[\n]/g,""); aCSV = strLine.split(strSep); for(i = 0; i <= aCSV.length; i++) { strValue = aCSV[i]; if (aColumn[i].Type == "CSV") { //value conversion: 0|falsch => N if (aColumn[i].Bool == "Y") if (strValue.toString() == "0" || strValue.toUpperCase() == "FALSCH") { strValue = "N"; } //value conversion: 1|wahr => Y if (aColumn[i].Bool == "Y") if (strValue.toString() == "1" || strValue.toUpperCase() == "WAHR") { strValue = "Y"; } //trim string: "text" => text if (strValue.substring(0,1) == "\"") { strValue = strValue.substring(1, strValue.length-1); } aColumn[i].Value = strValue; } } strValue = ""; for(i = 0; i < aColumn.length; i++) { strValue += "[" + aColumn[i].Name + "," + aColumn[i].Value + "," + aColumn[i].Key + "," + aColumn[i].Type + "," + aColumn[i].Area + "," + aColumn[i].Detail + "]"; } //Outputs.SetProperty(iRow, strValue); oApp.Trace(this.Name() + ": CSV Row " + iRow + ": " + strValue); try { MergeUser(oBO, oBC, aColumn, iRow, Outputs); } catch (e) {} } } Clib.fclose(oFile); } else { oApp.RaiseErrorText("Cannot open " + strFileName); } oApp.Trace(this.Name() + ": File " + strFileName + " was closed."); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ImportData - Error: " + e.toString()); throw(e); } finally { aCSV = null; oFile = null; oBO = null; oBC = null; } }

CSV User Import BS Repository SCM
ImportData
function ImportData (strFileName:String, aColumn:Array, Outputs:PropertySet, strSep:String, iHeaderRows:Number) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Reads a given CSV file to upsert Siebel Users, Skills and Skill Items // // Input: strFileName // -> c:\temp\import.csv // aColumn // -> Column definition - see "Initialize" for details // Outputs // -> PropertySet for result and issues // strSep // -> CSV Seperator (e.g. ";") // iHeaderRows // -> how many header rows should be ignored while reading? // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oBO: BusObject; var oBC: BusComp; var oFile: File; var strLine: String; var aCSV: Array; var strValue: String; var i: Number; var iRow: Number; try { iRow = 0; oApp.Trace(this.Name() + ": ImportData: Start"); oApp.Trace(this.Name() + ": ImportData: Opening CSV File " + strFileName + " ..."); oBO = oApp.GetBusObject("Employee"); oBC = oBO.GetBusComp("Employee"); oFile = Clib.fopen(strFileName,"rt"); if (oFile != null) { //Data lines while ( "null" != (strLine = Clib.fgets([10000],oFile))) { iRow++; ////////////////////////// // ignore x header rows // ////////////////////////// if (iRow > iHeaderRows) { //Remove line break strLine = strLine.replace(/\n\r/g,""); strLine = strLine.replace(/\n/g,""); strLine = strLine.replace(/[\n\r]/g,""); strLine = strLine.replace(/[\n]/g,""); aCSV = strLine.split(strSep); for(i = 0; i <= aCSV.length; i++) { strValue = aCSV[i]; if (aColumn[i].Type == "CSV") { //value conversion: 0|falsch => N if (aColumn[i].Bool == "Y") if (strValue.toString() == "0" || strValue.toUpperCase() == "FALSCH") { strValue = "N"; } //value conversion: 1|wahr => Y if (aColumn[i].Bool == "Y") if (strValue.toString() == "1" || strValue.toUpperCase() == "WAHR") { strValue = "Y"; } //trim string: "text" => text if (strValue.substring(0,1) == "\"") { strValue = strValue.substring(1, strValue.length-1); } aColumn[i].Value = strValue; } } strValue = ""; for(i = 0; i < aColumn.length; i++) { strValue += "[" + aColumn[i].Name + "," + aColumn[i].Value + "," + aColumn[i].Key + "," + aColumn[i].Type + "," + aColumn[i].Area + "," + aColumn[i].Detail + "]"; } //Outputs.SetProperty(iRow, strValue); oApp.Trace(this.Name() + ": CSV Row " + iRow + ": " + strValue); try { MergeUser(oBO, oBC, aColumn, iRow, Outputs); } catch (e) {} } } Clib.fclose(oFile); } else { oApp.RaiseErrorText("Cannot open " + strFileName); } oApp.Trace(this.Name() + ": File " + strFileName + " was closed."); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ImportData - Error: " + e.toString()); throw(e); } finally { aCSV = null; oFile = null; oBO = null; oBC = null; } }

CSV User Import BS Repository SCM
InitializeColumns
function InitializeColumns (aColumn:Array) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Configuration of CSV file structure // // Input: aColumn // -> column definition | specialized objects & attributes // -> CSV columns and static values must be defined here // // Example of current file structure... // // ID;Phone_WL_Ziel_Queue_Name;Phone_WL_Transfer_Hours_Notes;Phone_WL_Ziel_Public_phone_Number;Partner;RES;SME;CBU;Fix_Voice;Mobile;Fix_IT_IP;Water Utilities;Routing_ID;Language;Ziel_ID;Ziel_ID_VQ;Aktiv_Inaktiv;Aktiv nur in Softphone;Login // 74;RES FAS SPOC Service;Mo-Fr 07:30-18:00;;FALSCH;WAHR;WAHR;WAHR;FALSCH;FALSCH;WAHR;WAHR;1250012;German;00844854134;;WAHR;FALSCH;QUEUE_NAME_LOGIN // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var aCol: Object; var iCol: Number; try { oApp.Trace(this.Name() + ": InitializeColumns"); /*---------------------------------------------- Basics Description ------------------------------------------------ Name Fieldname Value Fieldvalue Key Unique Key ------------------------------------------------ Type Description ------------------------------------------------ CSV Value from CSV STATIC Static Value ------------------------------------------------ Area Detail ------------------------------------------------ Ignore - Employee - Position - Segment SME, RES, CBU, Partner Service IP, FIX, Mobile Industry_CTI Water Utilities ----------------------------------------------*/ ///////////////////////////////////////////////// iCol = 1; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = ""; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Ignore"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 2; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Last Name"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 3; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Comment"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 4; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Cell Phone #"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 5; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Low Char 1"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Segment"; aCol.Detail = "Partner"; aCol.Bool = "Y"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 6; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Low Char 1"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = "";

CSV User Import BS Repository SCM
InitializeColumns
function InitializeColumns (aColumn:Array) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Configuration of CSV file structure // // Input: aColumn // -> column definition | specialized objects & attributes // -> CSV columns and static values must be defined here // // Example of current file structure... // // ID;Phone_WL_Ziel_Queue_Name;Phone_WL_Transfer_Hours_Notes;Phone_WL_Ziel_Public_phone_Number;Partner;RES;SME;CBU;Fix_Voice;Mobile;Fix_IT_IP;Water Utilities;Routing_ID;Language;Ziel_ID;Ziel_ID_VQ;Aktiv_Inaktiv;Aktiv nur in Softphone;Login // 74;RES FAS SPOC Service;Mo-Fr 07:30-18:00;;FALSCH;WAHR;WAHR;WAHR;FALSCH;FALSCH;WAHR;WAHR;1250012;German;00844854134;;WAHR;FALSCH;QUEUE_NAME_LOGIN // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var aCol: Object; var iCol: Number; try { oApp.Trace(this.Name() + ": InitializeColumns"); /*---------------------------------------------- Basics Description ------------------------------------------------ Name Fieldname Value Fieldvalue Key Unique Key ------------------------------------------------ Type Description ------------------------------------------------ CSV Value from CSV STATIC Static Value ------------------------------------------------ Area Detail ------------------------------------------------ Ignore - Employee - Position - Segment SME, RES, CBU, Partner Service IP, FIX, Mobile Industry_CTI Water Utilities ----------------------------------------------*/ ///////////////////////////////////////////////// iCol = 1; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = ""; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Ignore"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 2; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Last Name"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 3; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Comment"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 4; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Cell Phone #"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Employee"; aCol.Detail = ""; aCol.Bool = "N"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 5; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Low Char 1"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = ""; aCol.Type = "CSV"; aCol.Area = "Segment"; aCol.Detail = "Partner"; aCol.Bool = "Y"; aColumn[iCol-1] = aCol; aCol = null; ///////////////////////////////////////////////// iCol = 6; /// CSV Column Definition /// ///////////////////////////////////////////////// aCol = new Object(); aCol.Name = "Low Char 1"; aCol.LOV = ""; aCol.Value = ""; aCol.Key = "";

CSV User Import BS Repository SCM
MergeUser
function MergeUser (oBO:BusObject, oBC:BusComp, aColumn:Array, iRow:Number, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Upserts a CSV line into Siebel // In case of issues the current row is written to Outputs and Trace Log. // // Input: oBO // -> Business Object // oBC // -> Business Component // aColumn // -> Column definition - see "Initialize" for details // iRow // -> Current row number (for debugging) // Outputs // -> PropertySet for result and issues // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var i: Number; var strSearch: String; var oBCPos: BusComp; var oBCSkill: BusComp; var oBCSkillItem: BusComp; var strOP: String; try { oApp.Trace(this.Name() + ": Merge User <" + iRow + ">"); strOP = ""; //generate search expression for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Key == "Y") strSearch = "[" + aColumn[i].Name + "]='" + aColumn[i].Value + "'"; } with (oBC) { SetViewMode(AllView); //activate basic employee fields for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") ActivateField(aColumn[i].Name); } //"special" activation ActivateField("Primary Position Id"); ActivateField("Queue Flag SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { // employee found - update fields strOP = "Update"; for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") { if (aColumn[i].LOV == "") { SetFieldValue(aColumn[i].Name, aColumn[i].Value); } else { SetFieldValue(aColumn[i].Name, oApp.InvokeMethod("LookupValue",aColumn[i].LOV,aColumn[i].Value)); } // special clone field if (aColumn[i].Name == "Inactive User Flag SCM") { SetFieldValue("Queue Flag SCM", aColumn[i].Value); } } } } else { // employee not found - insert fields strOP = "Insert"; NewRecord(NewAfter); for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") { if (aColumn[i].LOV == "") { SetFieldValue(aColumn[i].Name, aColumn[i].Value); } else { SetFieldValue(aColumn[i].Name, oApp.InvokeMethod("LookupValue",aColumn[i].LOV,aColumn[i].Value)); } // special clone field if (aColumn[i].Name == "Inactive User Flag SCM") { SetFieldValue("Queue Flag SCM", aColumn[i].Value); } } } // initalize position mvg oBCPos = oBC.GetMVGBusComp("Position").GetAssocBusComp(); with (oBCPos) { SetViewMode(AllView); ActivateField("Name"); ClearToQuery(); // find static position name for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Position") strSearch = "[" + aColumn[i].Name + "]='" + aColumn[i].Value + "'"; } SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strSearch = GetFieldValue("Id"); Associate(NewBefore); } } SetFieldValue("Primary Position Id", strSearch); } WriteRecord(); } // check and correct skill assignment oBCSkill = oBO.GetBusComp("Employee Skill"); oBCSkillItem = oBO.GetBusComp("Employee Skill Item Test"); with (oBCSkill) { // find a segment skill, if so, cleanup skill items strSearch = "N"; for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Segment") strSearch = "Y"; } if (strSearch == "Y") { SetViewMode(AllView); ActivateField("Item Type Name"); ClearToQuery(); SetSearchExpr("[Item Type Name]='Segment_Employee_Skill_SCM'"); ExecuteQuery(ForwardOnly); if (!FirstRecord()) { NewRecord(NewAfter); SetFieldValue("Item Type Name"

CSV User Import BS Repository SCM
MergeUser
function MergeUser (oBO:BusObject, oBC:BusComp, aColumn:Array, iRow:Number, Outputs:PropertySet) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: Upserts a CSV line into Siebel // In case of issues the current row is written to Outputs and Trace Log. // // Input: oBO // -> Business Object // oBC // -> Business Component // aColumn // -> Column definition - see "Initialize" for details // iRow // -> Current row number (for debugging) // Outputs // -> PropertySet for result and issues // // Date: 2014-01-21 // Author: Mario Geiss //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var i: Number; var strSearch: String; var oBCPos: BusComp; var oBCSkill: BusComp; var oBCSkillItem: BusComp; var strOP: String; try { oApp.Trace(this.Name() + ": Merge User <" + iRow + ">"); strOP = ""; //generate search expression for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Key == "Y") strSearch = "[" + aColumn[i].Name + "]='" + aColumn[i].Value + "'"; } with (oBC) { SetViewMode(AllView); //activate basic employee fields for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") ActivateField(aColumn[i].Name); } //"special" activation ActivateField("Primary Position Id"); ActivateField("Queue Flag SCM"); ClearToQuery(); SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { // employee found - update fields strOP = "Update"; for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") { if (aColumn[i].LOV == "") { SetFieldValue(aColumn[i].Name, aColumn[i].Value); } else { SetFieldValue(aColumn[i].Name, oApp.InvokeMethod("LookupValue",aColumn[i].LOV,aColumn[i].Value)); } // special clone field if (aColumn[i].Name == "Inactive User Flag SCM") { SetFieldValue("Queue Flag SCM", aColumn[i].Value); } } } } else { // employee not found - insert fields strOP = "Insert"; NewRecord(NewAfter); for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Employee") { if (aColumn[i].LOV == "") { SetFieldValue(aColumn[i].Name, aColumn[i].Value); } else { SetFieldValue(aColumn[i].Name, oApp.InvokeMethod("LookupValue",aColumn[i].LOV,aColumn[i].Value)); } // special clone field if (aColumn[i].Name == "Inactive User Flag SCM") { SetFieldValue("Queue Flag SCM", aColumn[i].Value); } } } // initalize position mvg oBCPos = oBC.GetMVGBusComp("Position").GetAssocBusComp(); with (oBCPos) { SetViewMode(AllView); ActivateField("Name"); ClearToQuery(); // find static position name for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Position") strSearch = "[" + aColumn[i].Name + "]='" + aColumn[i].Value + "'"; } SetSearchExpr(strSearch); ExecuteQuery(ForwardOnly); if (FirstRecord()) { strSearch = GetFieldValue("Id"); Associate(NewBefore); } } SetFieldValue("Primary Position Id", strSearch); } WriteRecord(); } // check and correct skill assignment oBCSkill = oBO.GetBusComp("Employee Skill"); oBCSkillItem = oBO.GetBusComp("Employee Skill Item Test"); with (oBCSkill) { // find a segment skill, if so, cleanup skill items strSearch = "N"; for(i = 0; i < aColumn.length; i++) { if (aColumn[i].Area == "Segment") strSearch = "Y"; } if (strSearch == "Y") { SetViewMode(AllView); ActivateField("Item Type Name"); ClearToQuery(); SetSearchExpr("[Item Type Name]='Segment_Employee_Skill_SCM'"); ExecuteQuery(ForwardOnly); if (!FirstRecord()) { NewRecord(NewAfter); SetFieldValue("Item Type Name"

CSV User Import BS Repository SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { var strFileName: String; var iHeaderRows: Number; var strSep: String; if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Start"); try { if (Inputs.PropertyExists("FileName")) { strFileName = Inputs.GetProperty("FileName"); } else { Outputs.SetProperty("Error", "Please enter <FileName>"); } if (Inputs.PropertyExists("HeaderRows")) { iHeaderRows = 1 * Inputs.GetProperty("HeaderRows"); } else { iHeaderRows = 0; } if (Inputs.PropertyExists("Separator")) { strSep = Inputs.GetProperty("Separator"); } else { strSep = ";"; } switch (MethodName) { case "Import": if (bIsTraceOn) oApp.Trace(this.Name() + ": Import - Start"); //Check if file exists if(!FileExists(strFileName)) { oApp.RaiseErrorText(Name()+": File '" + strFileName + "' not found."); } //Define & Initialize the content of the file InitializeColumns(aColumn); //Load data from file ImportData(strFileName, aColumn, Outputs, strSep, iHeaderRows); Outputs.SetProperty("CSV", "Imported finished"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Import - End"); break; } } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke - Error: " + e.toString()); Outputs.SetProperty("Error", e.toString()); throw(e); } finally { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); aColumn = null; oApp = null; return (CancelOperation); } }

CSV User Import BS Repository SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) { var strFileName: String; var iHeaderRows: Number; var strSep: String; if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Start"); try { if (Inputs.PropertyExists("FileName")) { strFileName = Inputs.GetProperty("FileName"); } else { Outputs.SetProperty("Error", "Please enter <FileName>"); } if (Inputs.PropertyExists("HeaderRows")) { iHeaderRows = 1 * Inputs.GetProperty("HeaderRows"); } else { iHeaderRows = 0; } if (Inputs.PropertyExists("Separator")) { strSep = Inputs.GetProperty("Separator"); } else { strSep = ";"; } switch (MethodName) { case "Import": if (bIsTraceOn) oApp.Trace(this.Name() + ": Import - Start"); //Check if file exists if(!FileExists(strFileName)) { oApp.RaiseErrorText(Name()+": File '" + strFileName + "' not found."); } //Define & Initialize the content of the file InitializeColumns(aColumn); //Load data from file ImportData(strFileName, aColumn, Outputs, strSep, iHeaderRows); Outputs.SetProperty("CSV", "Imported finished"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Import - End"); break; } } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke - Error: " + e.toString()); Outputs.SetProperty("Error", e.toString()); throw(e); } finally { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); aColumn = null; oApp = null; return (CancelOperation); } }

CSV to BC Import SCM
(declarations)
var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; var MAX_ERRORS = 10;

CSV to BC Import SCM
(declarations)
var oApp = TheApplication(); var bIsTraceOn = oApp.isTraceON; var MAX_ERRORS = 10;

CSV to BC Import SCM
CleanUpBC
function CleanUpBC(BObj,BComp) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CleanUpMasterMappings: // Delete all BC records in DB // Input: - // Output: - // Trigger: Service_PreInvokeMethod // Date: 03.07.2012 // Author: Inma Reis //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bo:BusObject; var bc:BusComp; var iCounter:Number; var bDeleted; try { if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Start"); bo = oApp.GetBusObject(BObj); bc = bo.GetBusComp(BComp); iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); /*ActivateField("Action Code"); ActivateField("Apply Previous Contract Date Flg"); ActivateField("CP Terms Of Notice"); ActivateField("Commitment Period"); ActivateField("Effective Date"); ActivateField("End Date"); ActivateField("Grace Period"); ActivateField("Grace Period Start Date"); ActivateField("Newly Added Flg"); ActivateField("Next Commitment Type"); ActivateField("Penalty Amount"); ActivateField("Penalty Rule"); ActivateField("Previous Commitment Type"); ActivateField("RC UOM"); ActivateField("Retention Flg"); ActivateField("Scenario"); ActivateField("Start Date"); ActivateField("Terms Of Notice");*/ ExecuteQuery(ForwardBackward); while (FirstRecord()) { if (bIsTraceOn) oApp.Trace(this.Name() + ": " + GetFieldValue("Id")); DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Record " + iCounter + " deleted."); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Error!"+e.toString()); throw(e); }//end catch finally { iCounter = null; bc = null; bo = null; } }

CSV to BC Import SCM
CleanUpBC
function CleanUpBC(BObj,BComp) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CleanUpMasterMappings: // Delete all BC records in DB // Input: - // Output: - // Trigger: Service_PreInvokeMethod // Date: 03.07.2012 // Author: Inma Reis //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bo:BusObject; var bc:BusComp; var iCounter:Number; var bDeleted; try { if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Start"); bo = oApp.GetBusObject(BObj); bc = bo.GetBusComp(BComp); iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); /*ActivateField("Action Code"); ActivateField("Apply Previous Contract Date Flg"); ActivateField("CP Terms Of Notice"); ActivateField("Commitment Period"); ActivateField("Effective Date"); ActivateField("End Date"); ActivateField("Grace Period"); ActivateField("Grace Period Start Date"); ActivateField("Newly Added Flg"); ActivateField("Next Commitment Type"); ActivateField("Penalty Amount"); ActivateField("Penalty Rule"); ActivateField("Previous Commitment Type"); ActivateField("RC UOM"); ActivateField("Retention Flg"); ActivateField("Scenario"); ActivateField("Start Date"); ActivateField("Terms Of Notice");*/ ExecuteQuery(ForwardBackward); while (FirstRecord()) { if (bIsTraceOn) oApp.Trace(this.Name() + ": " + GetFieldValue("Id")); DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Record " + iCounter + " deleted."); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": CleanUpBC: Error!"+e.toString()); throw(e); }//end catch finally { iCounter = null; bc = null; bo = null; } }

CSV to BC Import SCM
DeleteBCRecords
function DeleteBCRecords(BObj,BComp,Segment) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // DeleteBCRecords: // Delete all BC records in DB for a given Customer Segment // Input: BO, BC and Segment // Output: - // Trigger: Service_PreInvokeMethod // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bo:BusObject; var bc:BusComp; var iCounter:Number; try { if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Start"); bo = oApp.GetBusObject(BObj); bc = bo.GetBusComp(BComp); iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Segment SCM", Segment); SetSearchSpec("Adjustment Group Name", "Gestures of Goodwill SCM"); ExecuteQuery(ForwardBackward); while (FirstRecord()) { if (bIsTraceOn) oApp.Trace(this.Name() + ": " + GetFieldValue("Id")); DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Record " + iCounter + " deleted."); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Error!"+e.toString()); throw(e); } //end catch finally { iCounter = null; bc = null; bo = null; } }

CSV to BC Import SCM
DeleteBCRecords
function DeleteBCRecords(BObj,BComp,Segment) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // DeleteBCRecords: // Delete all BC records in DB for a given Customer Segment // Input: BO, BC and Segment // Output: - // Trigger: Service_PreInvokeMethod // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bo:BusObject; var bc:BusComp; var iCounter:Number; try { if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Start"); bo = oApp.GetBusObject(BObj); bc = bo.GetBusComp(BComp); iCounter = 0; with (bc) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Segment SCM", Segment); SetSearchSpec("Adjustment Group Name", "Gestures of Goodwill SCM"); ExecuteQuery(ForwardBackward); while (FirstRecord()) { if (bIsTraceOn) oApp.Trace(this.Name() + ": " + GetFieldValue("Id")); DeleteRecord(); iCounter = iCounter + 1; if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Record " + iCounter + " deleted."); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": DeleteBCRecords: Error!"+e.toString()); throw(e); } //end catch finally { iCounter = null; bc = null; bo = null; } }

CSV to BC Import SCM
ImportData
function ImportData(sTempFileName,separator,BObj,BComp) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // ImportAdoptionMapping: // Gets the values from the csv file, line by line. The file must meet these conditions: // - First line is a header, which will contain the Field Names as they are in the BC. // - The file can have data just for info not to be imported. Thus, all the columns after the header called "Import" will be ignored // - The column "Import" will have a Y or N depending on if we want the record imported // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 04.07.2012 // Author: Inma Reis // Project: May Release 2012 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sFileLine; var aSplit; var cFieldName:chars; var cFieldValue:chars; var psHeading:Array; var psAttribute:Array; var nEndOfData:Number; var oBO = oApp.GetBusObject(BObj); var oBC = oBO.GetBusComp(BObj); try { psHeading = new Array(); psAttribute = new Array(); oApp.Trace(this.Name() + ": ImportData: Start"); oApp.Trace(this.Name() + ": ImportData: Opening CSV File " + sTempFileName + " ..."); fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { //Header line sFileLine = Clib.fgets([10000],fp); oApp.Trace(this.Name() + ": Header Line :" + sFileLine); aSplit = sFileLine.split(separator); for(var a = 0; a < aSplit.length && nEndOfData == null; a++) { cFieldName = aSplit[a]; if(cFieldName == "Import") nEndOfData = a-1; else psHeading[a] = cFieldName; } if (nEndOfData == null) nEndOfData = aSplit.length; //Data lines while ( null != (sFileLine = Clib.fgets([10000],fp)) ) { //Remove trailing end of line character sFileLine = sFileLine.substring(0,sFileLine.length-1); aSplit = sFileLine.split(separator); if (aSplit[nEndOfData+1] == "N") oApp.Trace(this.Name() + ": Data Line SKIPPED:" + sFileLine); else { oApp.Trace(this.Name() + ": Data Line import:" + sFileLine); for(var b = 0; b <= nEndOfData; b++) { cFieldValue = aSplit[b]; psAttribute[b] = cFieldValue; } InsertLine(oBO,oBC,psHeading,psAttribute); } aSplit = null; psAttribute = new Array(); } Clib.fclose(fp); } else TheApplication().RaiseErrorText("Cannot open " + sTempFileName); // Create Attribute Mapping oApp.Trace(this.Name() + ": File " + sTempFileName + " was closed."); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ImportData: Error!"+e.toString()); throw(e); } finally { psAttribute = null; psHeading = null; aSplit = null; sFileLine = null; fp = null; oBO = null; oBC = null; } }

CSV to BC Import SCM
ImportData
function ImportData(sTempFileName,separator,BObj,BComp) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // ImportAdoptionMapping: // Gets the values from the csv file, line by line. The file must meet these conditions: // - First line is a header, which will contain the Field Names as they are in the BC. // - The file can have data just for info not to be imported. Thus, all the columns after the header called "Import" will be ignored // - The column "Import" will have a Y or N depending on if we want the record imported // Input: - // Output: - // Trigger: Service_InvokeMethod // Date: 04.07.2012 // Author: Inma Reis // Project: May Release 2012 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sFileLine; var aSplit; var cFieldName:chars; var cFieldValue:chars; var psHeading:Array; var psAttribute:Array; var nEndOfData:Number; var oBO = oApp.GetBusObject(BObj); var oBC = oBO.GetBusComp(BObj); try { psHeading = new Array(); psAttribute = new Array(); oApp.Trace(this.Name() + ": ImportData: Start"); oApp.Trace(this.Name() + ": ImportData: Opening CSV File " + sTempFileName + " ..."); fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { //Header line sFileLine = Clib.fgets([10000],fp); oApp.Trace(this.Name() + ": Header Line :" + sFileLine); aSplit = sFileLine.split(separator); for(var a = 0; a < aSplit.length && nEndOfData == null; a++) { cFieldName = aSplit[a]; if(cFieldName == "Import") nEndOfData = a-1; else psHeading[a] = cFieldName; } if (nEndOfData == null) nEndOfData = aSplit.length; //Data lines while ( null != (sFileLine = Clib.fgets([10000],fp)) ) { //Remove trailing end of line character sFileLine = sFileLine.substring(0,sFileLine.length-1); aSplit = sFileLine.split(separator); if (aSplit[nEndOfData+1] == "N") oApp.Trace(this.Name() + ": Data Line SKIPPED:" + sFileLine); else { oApp.Trace(this.Name() + ": Data Line import:" + sFileLine); for(var b = 0; b <= nEndOfData; b++) { cFieldValue = aSplit[b]; psAttribute[b] = cFieldValue; } InsertLine(oBO,oBC,psHeading,psAttribute); } aSplit = null; psAttribute = new Array(); } Clib.fclose(fp); } else TheApplication().RaiseErrorText("Cannot open " + sTempFileName); // Create Attribute Mapping oApp.Trace(this.Name() + ": File " + sTempFileName + " was closed."); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": ImportData: Error!"+e.toString()); throw(e); } finally { psAttribute = null; psHeading = null; aSplit = null; sFileLine = null; fp = null; oBO = null; oBC = null; } }

CSV to BC Import SCM
InsertLine
function InsertLine(oBO:BusObject, oBC:BusComp, psHeading:Array, psAttribute:Array) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Creates records in the BC from the given tables with field names and field values // Input: psHeading: includes heading of mapping sheet // psAttribute: includes attributes of one product // Output: - // Trigger: // Date: 04.07.2012 // Author: Inma Reis //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var d = psHeading.length; oBC.NewRecord(NewAfter); for(var c = 0; c < d; c++) { oBC.SetFieldValue(psHeading[c],psAttribute[c]); } oBC.WriteRecord(); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Error!"+e.toString()); throw(e); }//end catch }

CSV to BC Import SCM
InsertLine
function InsertLine(oBO:BusObject, oBC:BusComp, psHeading:Array, psAttribute:Array) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Creates records in the BC from the given tables with field names and field values // Input: psHeading: includes heading of mapping sheet // psAttribute: includes attributes of one product // Output: - // Trigger: // Date: 04.07.2012 // Author: Inma Reis //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ try { var d = psHeading.length; oBC.NewRecord(NewAfter); for(var c = 0; c < d; c++) { oBC.SetFieldValue(psHeading[c],psAttribute[c]); } oBC.WriteRecord(); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Error!"+e.toString()); throw(e); }//end catch }

CSV to BC Import SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CSV to BC Import SCM: // Imports a CSV file into a Siebel BC. The first row (header row) of the each column of the file must contain the corresponding BC field names // Input: - // Output: - // Trigger: // Date: 03.07.2012 // Author: Inma Reis // Project: ACR500 // Notes: Copied from BS "Product Master List Load Service SCM" and made a bit more generic to accept different BCs. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn = (ContinueOperation); var sTempFileName = Inputs.GetProperty("FileName"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Start"); try { switch (MethodName){ case "LoadAgreementConfiguration": { //Check if file exists if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace(this.Name() + ": File is existing: " + sTempFileName); //Clean up table CleanUpBC("EAI Agreement Configuration SCM","EAI Agreement Configuration SCM"); //Load data from file ImportData(sTempFileName,";","EAI Agreement Configuration SCM","EAI Agreement Configuration SCM"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); sReturn = (CancelOperation); break; } case "LoadEmpowermentRules": { //Check if file exists if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace(this.Name() + ": File is existing: " + sTempFileName); fLoadEmpowermentRules(sTempFileName); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); sReturn = (CancelOperation); break; } default: sReturn = (CancelOperation); break; } } //end try catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Error!"+e.toString()); throw(e); } //end catch finally { sTempFileName = null; } //end finally return sReturn; }

CSV to BC Import SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // CSV to BC Import SCM: // Imports a CSV file into a Siebel BC. The first row (header row) of the each column of the file must contain the corresponding BC field names // Input: - // Output: - // Trigger: // Date: 03.07.2012 // Author: Inma Reis // Project: ACR500 // Notes: Copied from BS "Product Master List Load Service SCM" and made a bit more generic to accept different BCs. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ { var sReturn = (ContinueOperation); var sTempFileName = Inputs.GetProperty("FileName"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Start"); try { switch (MethodName){ case "LoadAgreementConfiguration": { //Check if file exists if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace(this.Name() + ": File is existing: " + sTempFileName); //Clean up table CleanUpBC("EAI Agreement Configuration SCM","EAI Agreement Configuration SCM"); //Load data from file ImportData(sTempFileName,";","EAI Agreement Configuration SCM","EAI Agreement Configuration SCM"); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); sReturn = (CancelOperation); break; } case "LoadEmpowermentRules": { //Check if file exists if(!fileExists(sTempFileName)) oApp.RaiseErrorText(Name()+": tempfile '" + sTempFileName + "' not found."); else if (bIsTraceOn) TheApplication().Trace(this.Name() + ": File is existing: " + sTempFileName); fLoadEmpowermentRules(sTempFileName); if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: End"); sReturn = (CancelOperation); break; } default: sReturn = (CancelOperation); break; } } //end try catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Service_PreInvoke: Error!"+e.toString()); throw(e); } //end catch finally { sTempFileName = null; } //end finally return sReturn; }

CSV to BC Import SCM
fCheckDuplicate
function fCheckDuplicate(arrProducts:Array, sProductId:String) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // This method will check if a Product Id is in the array // Input: arrProducts, sProductId // Output: boolean // Date: 11.05.2016 // Author: Pedro Ferreira //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bRet:bool = false; try { if(bIsTraceOn) oApp.Trace(this.Name() + ": fCheckDuplicate: " + sProductId); for(var count = 0; count < arrProducts.length; count++) { if (arrProducts[count] == sProductId) { bRet = true; break; } } return bRet; } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": fCheckDuplicate: Error! " + e.toString()); return false; } finally { } }

CSV to BC Import SCM
fCheckDuplicate
function fCheckDuplicate(arrProducts:Array, sProductId:String) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // This method will check if a Product Id is in the array // Input: arrProducts, sProductId // Output: boolean // Date: 11.05.2016 // Author: Pedro Ferreira //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var bRet:bool = false; try { if(bIsTraceOn) oApp.Trace(this.Name() + ": fCheckDuplicate: " + sProductId); for(var count = 0; count < arrProducts.length; count++) { if (arrProducts[count] == sProductId) { bRet = true; break; } } return bRet; } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": fCheckDuplicate: Error! " + e.toString()); return false; } finally { } }

CSV to BC Import SCM
fImpDataEmpowermentRules
function fImpDataEmpowermentRules(sTempFileName,separator,BObj,BComp,sSegment) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // fImpDataEmpowermentRules: // Gets the values from the csv file, line by line. The file must meet these conditions: // - First line is a header, which will contain the Field Names as they are in the BC. // - The file can have data just for info not to be imported. Thus, all the columns after the header called "Import" will be ignored // - The column "Import" will have a Y or N depending on if we want the record imported // Input: - // Output: - // Trigger: fLoadEmpowermentRules // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) // Project: May Release 2016 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sFileLine; var aSplit; var cFieldName:chars; var cFieldValue:chars; var psHeading:Array; var psAttribute:Array; var nEndOfData:Number; var oBO = oApp.GetBusObject(BObj); var oAdjGroupBC = oBO.GetBusComp("Adjustment Group"); var oBC = oBO.GetBusComp(BComp); var oBCAux = oBO.GetBusComp(BComp); // to load array with values from the opposite segment to avoid duplicates var oPickBC: BusComp; var iColAmount: Number = 0; var sErrorLines = ""; var iLineNumber: Number = 1; var bImport: bool = false; var sAdjGroupId = ""; var arrProducts = new Array(); var iArrProdIdx: Number = 0; var bDuplicate: bool = false; var strSearchExpr = ""; var isRecord: bool; var iMaxErrors:Number = 0; try { psHeading = new Array(); psAttribute = new Array(); oApp.Trace(this.Name() + ": fImpDataEmpowermentRules: Start"); oApp.Trace(this.Name() + ": fImpDataEmpowermentRules: Opening CSV File " + sTempFileName + " ..."); fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { // Get the Adjustment Group Id to be imported oAdjGroupBC.SetViewMode(AllView); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", "Gestures of Goodwill SCM"); oAdjGroupBC.ExecuteQuery(ForwardOnly); if(oAdjGroupBC.FirstRecord()) { sAdjGroupId = oAdjGroupBC.GetFieldValue("Id"); // Load the array with the opposite segment Product Ids to guarantee uniqueness when inserting the records oBCAux.SetViewMode(AllView); oBCAux.ClearToQuery(); strSearchExpr = "[Adjustment Group Id] = '" + sAdjGroupId + "' AND ([Segment SCM] <> '" + sSegment + "' OR [Segment SCM] IS NULL)"; oBCAux.SetSearchExpr(strSearchExpr); oBCAux.ExecuteQuery(ForwardOnly); isRecord = oBCAux.FirstRecord(); while (isRecord) { arrProducts[iArrProdIdx] = oBCAux.GetFieldValue("Product Id"); iArrProdIdx ++; isRecord = oBCAux.NextRecord(); } //Header line sFileLine = Clib.fgets([10000],fp); oApp.Trace(this.Name() + ": Header Line :" + sFileLine); aSplit = sFileLine.split(separator); for(var a = 0; a < aSplit.length && nEndOfData == null; a++) { cFieldName = aSplit[a]; if(cFieldName == "Import") nEndOfData = a-1; else psHeading[a] = cFieldName; } if (nEndOfData == null) nEndOfData = aSplit.length; //Data lines while ( null != (sFileLine = Clib.fgets([10000],fp)) && iMaxErrors < MAX_ERRORS ) { iLineNumber = iLineNumber + 1; //Remove trailing end of line character sFileLine = sFileLine.substring(0,sFileLine.length-1); aSplit = sFileLine.split(separator); if (aSplit[nEndOfData+1] == "N") oApp.Trace(this.Name() + ": Data Line SKIPPED:" + sFileLine); else { oApp.Trace(this.Name() + ": Data Line import:" + sFileLine); for(var b = 0; b <= nEndOfData; b++) { cFieldValue = aSplit[b]; psAttribute[b] = cFieldValue;

CSV to BC Import SCM
fImpDataEmpowermentRules
function fImpDataEmpowermentRules(sTempFileName,separator,BObj,BComp,sSegment) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // fImpDataEmpowermentRules: // Gets the values from the csv file, line by line. The file must meet these conditions: // - First line is a header, which will contain the Field Names as they are in the BC. // - The file can have data just for info not to be imported. Thus, all the columns after the header called "Import" will be ignored // - The column "Import" will have a Y or N depending on if we want the record imported // Input: - // Output: - // Trigger: fLoadEmpowermentRules // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) // Project: May Release 2016 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp; var sFileLine; var aSplit; var cFieldName:chars; var cFieldValue:chars; var psHeading:Array; var psAttribute:Array; var nEndOfData:Number; var oBO = oApp.GetBusObject(BObj); var oAdjGroupBC = oBO.GetBusComp("Adjustment Group"); var oBC = oBO.GetBusComp(BComp); var oBCAux = oBO.GetBusComp(BComp); // to load array with values from the opposite segment to avoid duplicates var oPickBC: BusComp; var iColAmount: Number = 0; var sErrorLines = ""; var iLineNumber: Number = 1; var bImport: bool = false; var sAdjGroupId = ""; var arrProducts = new Array(); var iArrProdIdx: Number = 0; var bDuplicate: bool = false; var strSearchExpr = ""; var isRecord: bool; var iMaxErrors:Number = 0; try { psHeading = new Array(); psAttribute = new Array(); oApp.Trace(this.Name() + ": fImpDataEmpowermentRules: Start"); oApp.Trace(this.Name() + ": fImpDataEmpowermentRules: Opening CSV File " + sTempFileName + " ..."); fp = Clib.fopen(sTempFileName,"rt"); if ( fp != null ) { // Get the Adjustment Group Id to be imported oAdjGroupBC.SetViewMode(AllView); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", "Gestures of Goodwill SCM"); oAdjGroupBC.ExecuteQuery(ForwardOnly); if(oAdjGroupBC.FirstRecord()) { sAdjGroupId = oAdjGroupBC.GetFieldValue("Id"); // Load the array with the opposite segment Product Ids to guarantee uniqueness when inserting the records oBCAux.SetViewMode(AllView); oBCAux.ClearToQuery(); strSearchExpr = "[Adjustment Group Id] = '" + sAdjGroupId + "' AND ([Segment SCM] <> '" + sSegment + "' OR [Segment SCM] IS NULL)"; oBCAux.SetSearchExpr(strSearchExpr); oBCAux.ExecuteQuery(ForwardOnly); isRecord = oBCAux.FirstRecord(); while (isRecord) { arrProducts[iArrProdIdx] = oBCAux.GetFieldValue("Product Id"); iArrProdIdx ++; isRecord = oBCAux.NextRecord(); } //Header line sFileLine = Clib.fgets([10000],fp); oApp.Trace(this.Name() + ": Header Line :" + sFileLine); aSplit = sFileLine.split(separator); for(var a = 0; a < aSplit.length && nEndOfData == null; a++) { cFieldName = aSplit[a]; if(cFieldName == "Import") nEndOfData = a-1; else psHeading[a] = cFieldName; } if (nEndOfData == null) nEndOfData = aSplit.length; //Data lines while ( null != (sFileLine = Clib.fgets([10000],fp)) && iMaxErrors < MAX_ERRORS ) { iLineNumber = iLineNumber + 1; //Remove trailing end of line character sFileLine = sFileLine.substring(0,sFileLine.length-1); aSplit = sFileLine.split(separator); if (aSplit[nEndOfData+1] == "N") oApp.Trace(this.Name() + ": Data Line SKIPPED:" + sFileLine); else { oApp.Trace(this.Name() + ": Data Line import:" + sFileLine); for(var b = 0; b <= nEndOfData; b++) { cFieldValue = aSplit[b]; psAttribute[b] = cFieldValue;

CSV to BC Import SCM
fLoadEmpowermentRules
function fLoadEmpowermentRules(sFileName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Main function to Load Empowerment Rules // Input: - // Output: - // Trigger: // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oTransactBS:Service = oApp.GetService("EAI Transaction Service"); var oClearCacheBS:Service = oApp.GetService("Workflow Process Manager"); var oErrorMessageBS:Service; var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var psClearCacheIn:PropertySet = oApp.NewPropertySet(); var psClearCacheOut:PropertySet = oApp.NewPropertySet(); var psErrorMessageIn:PropertySet; var psErrorMessageOut:PropertySet; var sSegment:chars; var sImportDataRes = ""; var sErrorMsg:chars; var oAdjGroupBO = oApp.GetBusObject("Kulanz Admin BO SCM"); var oAdjGroupBC = oAdjGroupBO.GetBusComp("Adjustment Group"); try { if (bIsTraceOn) oApp.Trace(this.Name() + ": fLoadEmpowermentRules: Start"); // Get Customer Segment to be considered sSegment = oApp.GetProfileAttr("EmpowermentSegmentSCM"); // Begin Transaction oTransactBS.InvokeMethod("BeginTransaction", psIn, psOut); //Clean up table from the records for a given Segment if (sSegment == "RES" || sSegment == "SME") DeleteBCRecords("Kulanz Admin BO SCM", "Product-Based Adjustment", sSegment); //Load data from file sImportDataRes = fImpDataEmpowermentRules(sFileName,";","Kulanz Admin BO SCM","Product-Based Adjustment",sSegment); // End Transaction if (sImportDataRes.length > 0) // change condition psIn.SetProperty("Is Abort", "True"); else psIn.SetProperty("Is Abort", "False"); oTransactBS.InvokeMethod("EndTransaction", psIn, psOut); // Clear cache & Refresh UI if (sImportDataRes.length == 0) { // Clear Cache psIn.SetProperty("ProcessName", "PSP Refresh Cache On Cache Key Empowerment Rules SCM"); psIn.SetProperty("Adjustment Group Name", "Gestures of Goodwill SCM"); oClearCacheBS.InvokeMethod("RunProcess", psIn, psOut); // Refresh UI oAdjGroupBC.SetViewMode(AllView); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", "Gestures of Goodwill SCM"); oAdjGroupBC.ExecuteQuery(ForwardOnly); } else { oErrorMessageBS = oApp.GetService("Generic Retention SCM"); if (oErrorMessageBS != null) { psErrorMessageIn = oApp.NewPropertySet(); psErrorMessageOut = oApp.NewPropertySet(); psErrorMessageIn.SetProperty("Code", "CSV_IMPORT_ERROR_MSG_SCM"); psErrorMessageIn.SetProperty("Parameter1", sImportDataRes); oErrorMessageBS.InvokeMethod("Get Error Message", psErrorMessageIn, psErrorMessageOut); sErrorMsg = psErrorMessageOut.GetProperty("Result"); oApp.RaiseErrorText(sErrorMsg); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": fLoadEmpowermentRules: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Error!"+e.toString()); psIn.SetProperty("Is Abort", "True"); // rollback transaction oTransactBS.InvokeMethod("EndTransaction", psIn, psOut); throw(e); } //end catch finally { psOut = null; psIn = null; psClearCacheIn = null; psClearCacheIn = null; psErrorMessageIn = null; psErrorMessageOut = null; oTransactBS = null; oClearCacheBS = null; oErrorMessageBS = null; oAdjGroupBC = null; oAdjGroupBO = null; } }

CSV to BC Import SCM
fLoadEmpowermentRules
function fLoadEmpowermentRules(sFileName) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // Main function to Load Empowerment Rules // Input: - // Output: - // Trigger: // Date: 26.02.2016 // Author: Pedro Ferreira (taadape2) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var oTransactBS:Service = oApp.GetService("EAI Transaction Service"); var oClearCacheBS:Service = oApp.GetService("Workflow Process Manager"); var oErrorMessageBS:Service; var psIn:PropertySet = oApp.NewPropertySet(); var psOut:PropertySet = oApp.NewPropertySet(); var psClearCacheIn:PropertySet = oApp.NewPropertySet(); var psClearCacheOut:PropertySet = oApp.NewPropertySet(); var psErrorMessageIn:PropertySet; var psErrorMessageOut:PropertySet; var sSegment:chars; var sImportDataRes = ""; var sErrorMsg:chars; var oAdjGroupBO = oApp.GetBusObject("Kulanz Admin BO SCM"); var oAdjGroupBC = oAdjGroupBO.GetBusComp("Adjustment Group"); try { if (bIsTraceOn) oApp.Trace(this.Name() + ": fLoadEmpowermentRules: Start"); // Get Customer Segment to be considered sSegment = oApp.GetProfileAttr("EmpowermentSegmentSCM"); // Begin Transaction oTransactBS.InvokeMethod("BeginTransaction", psIn, psOut); //Clean up table from the records for a given Segment if (sSegment == "RES" || sSegment == "SME") DeleteBCRecords("Kulanz Admin BO SCM", "Product-Based Adjustment", sSegment); //Load data from file sImportDataRes = fImpDataEmpowermentRules(sFileName,";","Kulanz Admin BO SCM","Product-Based Adjustment",sSegment); // End Transaction if (sImportDataRes.length > 0) // change condition psIn.SetProperty("Is Abort", "True"); else psIn.SetProperty("Is Abort", "False"); oTransactBS.InvokeMethod("EndTransaction", psIn, psOut); // Clear cache & Refresh UI if (sImportDataRes.length == 0) { // Clear Cache psIn.SetProperty("ProcessName", "PSP Refresh Cache On Cache Key Empowerment Rules SCM"); psIn.SetProperty("Adjustment Group Name", "Gestures of Goodwill SCM"); oClearCacheBS.InvokeMethod("RunProcess", psIn, psOut); // Refresh UI oAdjGroupBC.SetViewMode(AllView); oAdjGroupBC.ClearToQuery(); oAdjGroupBC.SetSearchSpec("Name", "Gestures of Goodwill SCM"); oAdjGroupBC.ExecuteQuery(ForwardOnly); } else { oErrorMessageBS = oApp.GetService("Generic Retention SCM"); if (oErrorMessageBS != null) { psErrorMessageIn = oApp.NewPropertySet(); psErrorMessageOut = oApp.NewPropertySet(); psErrorMessageIn.SetProperty("Code", "CSV_IMPORT_ERROR_MSG_SCM"); psErrorMessageIn.SetProperty("Parameter1", sImportDataRes); oErrorMessageBS.InvokeMethod("Get Error Message", psErrorMessageIn, psErrorMessageOut); sErrorMsg = psErrorMessageOut.GetProperty("Result"); oApp.RaiseErrorText(sErrorMsg); } } if (bIsTraceOn) oApp.Trace(this.Name() + ": fLoadEmpowermentRules: End"); } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": Error!"+e.toString()); psIn.SetProperty("Is Abort", "True"); // rollback transaction oTransactBS.InvokeMethod("EndTransaction", psIn, psOut); throw(e); } //end catch finally { psOut = null; psIn = null; psClearCacheIn = null; psClearCacheIn = null; psErrorMessageIn = null; psErrorMessageOut = null; oTransactBS = null; oClearCacheBS = null; oErrorMessageBS = null; oAdjGroupBC = null; oAdjGroupBO = null; } }

CSV to BC Import SCM
fileExists
function fileExists(sFileName:chars) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // This method will proof id file is existing // Input: sFileName // Output: boolean // Date: 15.03.2012 // Author: Tine Hofmann // Project: May Release 2012 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp:File; try { if(bIsTraceOn) oApp.Trace(this.Name() + ": fileExists: " + sFileName); fp = Clib.fopen(sFileName, "r"); if (fp != null) { Clib.fclose(fp); return true; } else return false; } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": fileExists: Error!"+e.toString()); throw(e); } finally { fp = null; } }

CSV to BC Import SCM
fileExists
function fileExists(sFileName:chars) { /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++// // Description: // This method will proof id file is existing // Input: sFileName // Output: boolean // Date: 15.03.2012 // Author: Tine Hofmann // Project: May Release 2012 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var fp:File; try { if(bIsTraceOn) oApp.Trace(this.Name() + ": fileExists: " + sFileName); fp = Clib.fopen(sFileName, "r"); if (fp != null) { Clib.fclose(fp); return true; } else return false; } catch(e) { if (bIsTraceOn) oApp.Trace(this.Name() + ": fileExists: Error!"+e.toString()); throw(e); } finally { fp = null; } }

CTI Agent SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var returncode=ContinueOperation; switch(MethodName) { case "Init": fnInit(Inputs,Outputs); returncode = CancelOperation; break; case "Query": fnQuery(Inputs,Outputs); returncode = CancelOperation; break; default: returncode = ContinueOperation; break; } return (returncode); }

CTI Agent SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var returncode=ContinueOperation; switch(MethodName) { case "Init": fnInit(Inputs,Outputs); returncode = CancelOperation; break; case "Query": fnQuery(Inputs,Outputs); returncode = CancelOperation; break; default: returncode = ContinueOperation; break; } return (returncode); }

CTI Agent SCM
fnInit
function fnInit(Inputs,Outputs) { Outputs.SetProperty("NumVoice",""); Outputs.SetProperty("NumNRT",""); }

CTI Agent SCM
fnInit
function fnInit(Inputs,Outputs) { Outputs.SetProperty("NumVoice",""); Outputs.SetProperty("NumNRT",""); }

CTI Agent SCM
fnQuery
function fnQuery(Inputs,Outputs) { try { var psCTI = TheApplication().NewPropertySet(); var sVoice; var sNRT; sVoice = TheApplication().GetProfileAttr("CTIAgent_NumVoice"); sNRT = TheApplication().GetProfileAttr("CTIAgent_NumNRT"); if ( sVoice == "" ) sVoice = "0"; if ( sNRT == "" ) sNRT = "0"; psCTI.SetProperty("NumVoice", sVoice ); psCTI.SetProperty("NumNRT", sNRT ); Outputs.AddChild(psCTI); } catch(e) { // Nothing TheApplication().RaiseErrorText("ERROR: " + e.errText + "\n" + e.toString() ); } }

CTI Agent SCM
fnQuery
function fnQuery(Inputs,Outputs) { try { var psCTI = TheApplication().NewPropertySet(); var sVoice; var sNRT; sVoice = TheApplication().GetProfileAttr("CTIAgent_NumVoice"); sNRT = TheApplication().GetProfileAttr("CTIAgent_NumNRT"); if ( sVoice == "" ) sVoice = "0"; if ( sNRT == "" ) sNRT = "0"; psCTI.SetProperty("NumVoice", sVoice ); psCTI.SetProperty("NumNRT", sNRT ); Outputs.AddChild(psCTI); } catch(e) { // Nothing TheApplication().RaiseErrorText("ERROR: " + e.errText + "\n" + e.toString() ); } }

CTI BS SCM
(declarations)
var oApp:Application; var bIsTraceOn;

CTI BS SCM
(declarations)
var oApp:Application; var bIsTraceOn:bool;

CTI BS SCM
AgentStatus
function AgentStatus(Inputs:PropertySet){ /******************************************************* ** Name: AgentStatus ** Created: 18.01.2010 ** Created By: TGDLOAL3 ** Description: Script created to update agent status on GUI when needed ** Notes: Created due to SmallCR 18461 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var bs:Service; var status:chars; var psIn:PropertySet; var psOut:PropertySet; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".AgentStatus START"); status = Inputs.GetProperty("AgentStatus"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); if(status=="ACW"){ if(oApp.GetProfileAttr("AgentStatus")=="Not Ready" && oApp.GetProfileAttr("NotReadyReason") !="pre-booking"){ status="Not Ready"; oApp.SetProfileAttr("ACW",""); } } oApp.SetProfileAttr("AgentStatus", status); bs = oApp.GetService("Communications Client"); psIn.SetProperty("Text",status); bs.InvokeMethod("ShowStatusText",psIn,psOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".AgentStatus ERROR:" + e.message); throw e; } finally{ bs=null; status=null; psIn=null; psOut=null; } }

CTI BS SCM
AgentStatus
function AgentStatus(Inputs){ /******************************************************* ** Name: AgentStatus ** Created: 18.01.2010 ** Created By: TGDLOAL3 ** Description: Script created to update agent status on GUI when needed ** Notes: Created due to SmallCR 18461 ******************************************************/ var bs:Service; var status:chars; var psIn:PropertySet; var psOut:PropertySet; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".AgentStatus START"); status = Inputs.GetProperty("AgentStatus"); psIn = oApp.NewPropertySet(); psOut = oApp.NewPropertySet(); if(status=="ACW"){ if(oApp.GetProfileAttr("AgentStatus")=="Not Ready" && oApp.GetProfileAttr("NotReadyReason") !="pre-booking"){ status="Not Ready"; oApp.SetProfileAttr("ACW",""); } } oApp.SetProfileAttr("AgentStatus", status); bs = oApp.GetService("Communications Client"); psIn.SetProperty("Text",status); bs.InvokeMethod("ShowStatusText",psIn,psOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".AgentStatus ERROR:" + e.message); throw e; } finally{ bs=null; status=null; psIn=null; psOut=null; } }

CTI BS SCM
CancelPushActivity
function CancelPushActivity(Inputs:PropertySet){ /******************************************************* ** Name: CancelPushActivity ** Created: ** Created By: ** Description: ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBCSR:BusComp; var oBCSRPush:BusComp; var oBCAct:BusComp; var dNow:Date; var sSRId:chars; var sPushStatus:chars; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var sSubType:chars; var sAccountId:chars = ""; var sPushId:chars; var sSRPushId:chars; var sComment:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelPushActivity START"); if (Inputs.PropertyExists("Service Request Id")){ sSRId = Inputs.GetProperty("Service Request Id"); sPushId = Inputs.GetProperty("Push Id"); sSubType = Inputs.GetProperty("Source"); if (bIsTraceOn) oApp.Trace(this.Name() + ".CancelPushActivity - sSRId = " + sSRId + " / sPushId = '" + sPushId + "' / sSubType = " + sSubType); if (sSubType != "IWD"){ sSubType = "Symphony"; } oBOSR = oApp.GetBusObject("Service Request"); oBCSR = oBOSR.GetBusComp("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCAct.ActivateField("Comment"); oBCAct.ActivateField("End Date"); oBCAct.ActivateField("Sub Type EAI SCM"); oBCAct.ActivateField("Done"); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Id SCM"); oBCSRPush.ActivateField("Push Status CD SCM"); oBCSRPush.ActivateField("Push Timestamp SCM"); oBCSR.SetViewMode(AllView); oBCSR.ClearToQuery(); oBCSR.SetSearchSpec("Id", sSRId); oBCSR.ExecuteQuery(ForwardOnly); if (oBCSR.FirstRecord()){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelPushActivity: Found SR"); sAccountId = oBCSR.GetFieldValue("Account Id"); } oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelPushActivity - found PushSR"); sSRPushId = oBCSRPush.GetFieldValue("Push Id SCM"); sPushStatus = oBCSRPush.GetFieldValue("Push Status CD SCM"); sPushTimeStamp = oBCSRPush.GetFieldValue("Push Timestamp SCM"); if (bIsTraceOn) oApp.Trace("CancelPushActivity - sSRPushId = '" + sSRPushId + "' / sPushStatus = " + sPushStatus); if (sPushId == sSRPushId){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CancelPushActivity - Clear Push"); oBCSRPush.SetFieldValue("Push Id SCM", ""); oBCSRPush.SetFieldValue("Push Status CD SCM", ""); oBCSRPush.WriteRecord(); } sLogin = oApp.LoginId(); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()){ //TAACUJU1 24/03/2016 - Defect 5451 - Comment must be truncated to avoid exceeded length errors if (bIsTraceOn) oApp.Trace("CancelPushActivity - found Activity"); sComment = oBCAct.GetFieldValue("Comment") + " - Task Cancelled"; oBCAct.SetFieldValue("Comment", sComment.substring(0,1499)); } else { oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Cancelled"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Sub Type SCM", sSubType); oB

CTI BS SCM
CancelPushActivity
function CancelPushActivity(Inputs:PropertySet) { var oBOSR:BusObject; var oBCSR:BusComp; var oBCSRPush:BusComp; var oBCAct:BusComp; var dNow:Date; var sSRId:chars; var sPushStatus:chars; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var sSubType:chars; var sAccountId; var sPushId:chars; var sSRPushId:chars; var sComment:chars; try { if (Inputs.PropertyExists("Service Request Id")) { sSRId = Inputs.GetProperty("Service Request Id"); sPushId = Inputs.GetProperty("Push Id"); sSubType = Inputs.GetProperty("Source"); if (bIsTraceOn) oApp.Trace("CancelPushActivity - sSRId = " + sSRId + " / sPushId = '" + sPushId + "' / sSubType = " + sSubType); sAccountId = ""; if (sSubType != "IWD") { sSubType = "Symphony"; } oBOSR = oApp.GetBusObject("Service Request"); oBCSR = oBOSR.GetBusComp("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCAct.ActivateField("Comment"); oBCAct.ActivateField("End Date"); oBCAct.ActivateField("Sub Type EAI SCM"); oBCAct.ActivateField("Done"); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Id SCM"); oBCSRPush.ActivateField("Push Status CD SCM"); oBCSRPush.ActivateField("Push Timestamp SCM"); oBCSR.SetViewMode(AllView); oBCSR.ClearToQuery(); oBCSR.SetSearchSpec("Id", sSRId); oBCSR.ExecuteQuery(ForwardOnly); if (oBCSR.FirstRecord()) { if (bIsTraceOn) oApp.Trace("CancelPushActivity - found SR"); sAccountId = oBCSR.GetFieldValue("Account Id"); } oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()) { if (bIsTraceOn) oApp.Trace("CancelPushActivity - found PushSR"); sSRPushId = oBCSRPush.GetFieldValue("Push Id SCM"); sPushStatus = oBCSRPush.GetFieldValue("Push Status CD SCM"); sPushTimeStamp = oBCSRPush.GetFieldValue("Push Timestamp SCM"); if (bIsTraceOn) oApp.Trace("CancelPushActivity - sSRPushId = '" + sSRPushId + "' / sPushStatus = " + sPushStatus); if (sPushId == sSRPushId) { if (bIsTraceOn) oApp.Trace("CancelPushActivity - Clear Push"); oBCSRPush.SetFieldValue("Push Id SCM", ""); oBCSRPush.SetFieldValue("Push Status CD SCM", ""); oBCSRPush.WriteRecord(); } sLogin = oApp.LoginId(); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()) { //TAACUJU1 24/03/2016 - Defect 5451 - Comment must be truncated to avoid exceeded length errors if (bIsTraceOn) oApp.Trace("CancelPushActivity - found Activity"); sComment = oBCAct.GetFieldValue("Comment") + " - Task Cancelled"; oBCAct.SetFieldValue("Comment", sComment.substring(0,1499)); } else { oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Cancelled"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Sub Type SCM", sSubType); oBCAct.SetFieldValue("Task Id SCM", sPushId); oBCAct.SetFieldValue("Comment", sPushId); oBCAct.SetFieldValue("Start Time", sPushTimeStamp); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Status", "Closed"); } oBCAct.SetFieldValue("End Date", sNow); oBCAct.SetF

CTI BS SCM
CheckSetPrebooking
function CheckSetPrebooking() { //TSGGUJA1 21.01.09 we are in pre-booking situation so we establish variables in that way: //we establish the text to no ready and then we put the value pre-booking in the NotReadyReason //variable. try { //TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review var sInput = oApp.NewPropertySet(); var sOutput = oApp.NewPropertySet(); //we check if there is no reason to go to not ready which means that we are in pre booking //or there is a reason so we do not need doing anymore var reason = oApp.GetProfileAttr("NotReadyReason"); if (reason == "" || reason == null){ oApp.SetProfileAttr("NotReadyReason", "pre-booking"); } //var svcCTI = oApp.GetService("Communications Client"); sInput.SetProperty("AgentStatus","Not Ready"); AgentStatus(sInput); //svcCTI.InvokeMethod("ShowStatusText",sInput,sOutput); //TSGGUJA1 21.01.09 END //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review } catch (e){ oApp.Trace(" Error Raised: CheckSetPrebooking " + e); } finally{ sInput = null; sOutput = null; reason = null; // svcCTI = null; } //END TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review return; }

CTI BS SCM
CheckSetPrebooking
function CheckSetPrebooking(){ /******************************************************* ** Name: CheckSetPrebooking ** Created: ** Created By: ** Description: we are in pre-booking situation so we establish variables in that way: we establish the text to no ready and then we put the value pre-booking in the NotReadyReason variable. ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var reason:chars try { if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckSetPrebooking START"); sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); //we check if there is no reason to go to not ready which means that we are in pre booking or there is a reason so we do not need doing anymore reason = oApp.GetProfileAttr("NotReadyReason"); if (reason == "" || reason == null){ oApp.SetProfileAttr("NotReadyReason", "pre-booking"); } sInput.SetProperty("AgentStatus","Not Ready"); AgentStatus(sInput); } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckSetPrebooking ERROR: " + e.message); } finally{ sInput = null; sOutput = null; reason = null; } return; }

CTI BS SCM
CheckSetStatus
function CheckSetStatus(Inputs, Outputs) { //TSGGUJA1 21.01.09: Result is a genesys variable which indicates whether a method matches or not //with that we have, and if so, we execute the associated event response (1) or if not (0) we pass to the //following event handler. //The parameter result is required in a Sercice method called by an event handler. //So here we want to determinate if we are in pre-booking or not. try { var statusreason = oApp.GetProfileAttr("NotReadyReason"); var ACW = oApp.GetProfileAttr("ACW"); if (statusreason == "pre-booking" || ACW == "ACW") { Outputs.SetProperty("Result",1); } else { Outputs.SetProperty("Result",0); } } catch (e){ oApp.Trace(" Error Raised: CheckSetStatus " + e); } finally{ statusreason = null; //TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review } return; }

CTI BS SCM
CheckSetStatus
function CheckSetStatus(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: CheckSetPrebooking ** Created: ** Created By: ** Description: Result is a genesys variable which indicates whether a method matches or not with that we have, and if so, we execute the associated event response (1) or if not (0) we pass to the following event handler. The parameter result is required in a Sercice method called by an event handler. So here we want to determinate if we are in pre-booking or not. ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var statusreason:chars; var ACW:chars; if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckSetStatus START"); try { statusreason = oApp.GetProfileAttr("NotReadyReason"); ACW = oApp.GetProfileAttr("ACW"); if (statusreason == "pre-booking" || ACW == "ACW"){ Outputs.SetProperty("Result",1); } else { Outputs.SetProperty("Result",0); } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".CheckSetStatus Error: " + e.message); } finally{ statusreason = null; ACW = null; } return; }

CTI BS SCM
CloseCallActivity
function CloseCallActivity() { /******************************************************* ** Name: CloseCallActivity ** Created: 21.08.2002 ** Created By: EM ** Description: Search and close the call activity ** with this ConnId (Global Variable) ** TGDGOLU2 - 22.01.2009 - Code added to solve a problem related with the start date ** TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review ******************************************************/ var strLoginId; var boAction; var bcAction; var sConnId; var isRecord = null; var i=0; var intNumberSR; var strCLI; var callduration; var sStart; var strStart = ""; var sStop; var strStop; var dateForm; var timeForm = ""; var totalDuration; //****** BEGIN get and set Globale Variable *******************// try { sStart = oApp.GetProfileAttr("strStart"); // BEGIN TGDGOLU2 - 22.01.2009 - Avoid start value being empty or null if (sStart != "" && sStart != null){ // END TGDGOLU2 - 22.01.2009 - Avoid start value being empty or null strStart = new Date (sStart); sStop = oApp.GetProfileAttr("strStop"); strStop = new Date (sStop); strLoginId = oApp.LoginId(); sConnId = oApp.GetProfileAttr("strConnID"); intNumberSR = oApp.GetProfileAttr("intNumberSR"); dateForm = (strStop.getMonth() + 1) + "/" + strStop.getDate() + "/" + strStop.getFullYear(); timeForm = dateForm + " " + strStop.getHours() + ":" + strStop.getMinutes() + ":" + strStop.getSeconds(); //****** END get and set Globale Variable *********************// totalDuration = strStop - strStart; if (intNumberSR != 0) { if ( (sConnId != null) && (sConnId != "") ) // TGDCRAN2 06.09.2010 Added defensive coding check { callduration = Math.round(totalDuration / (intNumberSR*1000)); boAction = oApp.GetBusObject("Service Request"); bcAction = boAction.GetBusComp("Action Clone SCM"); with (bcAction) { ClearToQuery(); SetViewMode(AllView); ActivateField("Call Id"); ActivateField("Started"); ActivateField("Done"); ActivateField("ACD Call Duration"); ActivateField("Comment"); ActivateField("Status"); ActivateField("Created By Id"); // TGDMAEM1 25.8.11: Added as search spec strLoginId as the same call id will be used by multiple user SetSearchSpec("Created By Id", strLoginId); SetSearchSpec("Call Id", sConnId); ExecuteQuery(ForwardBackward); isRecord = FirstRecord(); } while (isRecord) { bcAction.SetFieldValue("ACD Call Duration", callduration); bcAction.SetFieldValue("Done", timeForm); //bcAction.SetFieldValue("Status", "Closed"); bcAction.WriteRecord(); i++; isRecord = bcAction.NextRecord(); } } // if sConnId != "" } } // BEGIN TGDGOLU2 - 22.01.2009 - Avoid start value being empty or null // BEGIN TGDGOLU2 - 03.03.2009 - Refresh to verify updates performed in activities // TGDMAEM1 04.05.2010 Inactivated as wrong and not needed /* var boname = oApp.ActiveBusObject().Name(); var boactiv = oApp.ActiveBusObject(); if ( boname == "Account" ) { var bcAccount = boactiv.GetBusComp("Account"); var bcSR = boactiv.GetBusComp("Service Request"); var bcservice = boactiv.GetBusComp("Action"); with (bcservice) { ClearToQuery(); ExecuteQuery(ForwardBackward); } } */ // END TGDGOLU2 - 22.01.2009 - Refresh to verify updates performed in activities } catch (e) { oApp.Trace( "EXCEPTION RAISED " + e ); oApp.Trace( timeForm ); oApp.Trace( sStart ); oApp.Trace( strStart ); //throw (e); } finally { // 20041214 Modifed as part of v7.7 migration // Corrected order of object destruction... bcAction = null; boAction = null; //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review sConnId= null; isRecord = null; i = null; intNumberSR = null; strCLI = null; calld

CTI BS SCM
CloseCallActivity
function CloseCallActivity(){ /******************************************************* ** Name: CloseCallActivity ** Created: 21.08.2002 ** Created By: EM ** Description: Search and close the call activity with this ConnId (Global Variable) ** TGDGOLU2 - 22.01.2009 - Code added to solve a problem related with the start date ** TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boAction:BusObject; var bcAction:BusComp; var strLoginId:chars; var sConnId:chars; var intNumberSR:chars; var sStart:chars; var sStop: chars; var dateForm:chars; var timeForm:chars = ""; var isRecord:bool; var i:float =0; var callduration: float; var totalDuration:float ; var strStart: Date; var strStop: Date; //****** BEGIN get and set Globale Variable *******************// if(bIsTraceOn) oApp.Trace(this.Name() + ".CloseCallActivity START"); try{ sStart = oApp.GetProfileAttr("strStart"); if (sStart != "" && sStart != null){//Avoid start value being empty or null strStart = new Date (sStart); sStop = oApp.GetProfileAttr("strStop"); strStop = new Date (sStop); strLoginId = oApp.LoginId(); sConnId = oApp.GetProfileAttr("strConnID"); intNumberSR = oApp.GetProfileAttr("intNumberSR"); dateForm = (strStop.getMonth() + 1) + "/" + strStop.getDate() + "/" + strStop.getFullYear(); timeForm = dateForm + " " + strStop.getHours() + ":" + strStop.getMinutes() + ":" + strStop.getSeconds(); if(bIsTraceOn) oApp.Trace(this.Name() + ".CloseCallActivity - timeForm: " + timeForm); //****** END get and set Globale Variable *********************// totalDuration = strStop - strStart; if (intNumberSR != "0"){ if((sConnId != null) && (sConnId != "")){ // TGDCRAN2 06.09.2010 Added defensive coding check callduration = Math.round(totalDuration / (intNumberSR*1000)); boAction = oApp.GetBusObject("Service Request"); bcAction = boAction.GetBusComp("Action Clone SCM"); with (bcAction){ ClearToQuery(); SetViewMode(AllView); ActivateField("Call Id"); ActivateField("Started"); ActivateField("Done"); ActivateField("ACD Call Duration"); ActivateField("Comment"); ActivateField("Status"); ActivateField("Created By Id"); SetSearchSpec("Created By Id", strLoginId);// TGDMAEM1 25.8.11: Added as search spec strLoginId as the same call id will be used by multiple user SetSearchSpec("Call Id", sConnId); ExecuteQuery(ForwardBackward); isRecord = FirstRecord(); } while (isRecord){ bcAction.SetFieldValue("ACD Call Duration", callduration); bcAction.SetFieldValue("Done", timeForm); //bcAction.SetFieldValue("Status", "Closed"); bcAction.WriteRecord(); i++; isRecord = bcAction.NextRecord(); } } // if sConnId != "" } } } catch (e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".CloseCallActivity ERROR:" + e.message); } finally{ bcAction = null; boAction = null; sConnId= null; isRecord = null; i = null; intNumberSR = null; callduration = null; sStart = null; strStart = null; sStop = null; strStop = null; dateForm = null; timeForm = null; totalDuration = null; } return; }

CTI BS SCM
ClosePushActivity
function ClosePushActivity(sSRId:chars, sPushId:chars, sComment:chars){ /******************************************************* ** Name: ClosePushActivity ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var dNow:Date; var sPushStatus:chars; var sCommentOld:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - sSRId = " + sSRId + " / sPushId = " + sPushId + " / sComment = " + sComment); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.SetViewMode(AllView); oBCAct.ActivateField("Comment"); oBCAct.ActivateField("End Date"); oBCAct.ActivateField("Done"); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Id SCM"); oBCSRPush.ActivateField("Push Status CD SCM"); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.SetSearchSpec("Push Id SCM", sPushId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - found SR"); sPushStatus = oBCSRPush.GetFieldValue("Push Status CD SCM"); if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - sPushStatus = " + sPushStatus); if (sPushStatus == oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WORK")){ oBCSRPush.SetFieldValue("Push Id SCM", ""); oBCSRPush.SetFieldValue("Push Status CD SCM", ""); oBCSRPush.WriteRecord(); } } sLogin = oApp.LoginId(); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()){ if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - found Activity"); sCommentOld = oBCAct.GetFieldValue("Comment"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.SetFieldValue("Comment", sCommentOld + " - Task Closed ( " + sComment + " )"); oBCAct.SetFieldValue("End Date", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.WriteRecord(); } if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - END"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".ClosePushActivity - Error: " + e.toString()); } finally{ dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
ClosePushActivity
function ClosePushActivity(sSRId:chars, sPushId:chars, sComment:chars) { var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var dNow:Date; var sPushStatus:chars; var sCommentOld:chars; try { if (bIsTraceOn) oApp.Trace("ClosePushActivity - sSRId = " + sSRId + " / sPushId = " + sPushId + " / sComment = " + sComment); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.SetViewMode(AllView); oBCAct.ActivateField("Comment"); oBCAct.ActivateField("End Date"); oBCAct.ActivateField("Done"); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Id SCM"); oBCSRPush.ActivateField("Push Status CD SCM"); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.SetSearchSpec("Push Id SCM", sPushId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()) { if (bIsTraceOn) oApp.Trace("ClosePushActivity - found SR"); sPushStatus = oBCSRPush.GetFieldValue("Push Status CD SCM"); if (bIsTraceOn) oApp.Trace("ClosePushActivity - sPushStatus = " + sPushStatus); if (sPushStatus == oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WORK")) { oBCSRPush.SetFieldValue("Push Id SCM", ""); oBCSRPush.SetFieldValue("Push Status CD SCM", ""); oBCSRPush.WriteRecord(); } } sLogin = oApp.LoginId(); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()) { if (bIsTraceOn) oApp.Trace("ClosePushActivity - found Activity"); sCommentOld = oBCAct.GetFieldValue("Comment"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.SetFieldValue("Comment", sCommentOld + " - Task Closed ( " + sComment + " )"); oBCAct.SetFieldValue("End Date", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.WriteRecord(); } if (bIsTraceOn) oApp.Trace("ClosePushActivity - END"); } catch(e) { if (bIsTraceOn) oApp.Trace("ClosePushActivity - Error: " + e.toString()); } finally { dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
CreateCallActivity
function CreateCallActivity (Inputs) { /******************************************************* ** Name: CreateCallActivity ** Created: 21.08.2002 ** Created By: EM ** Description: Create a Call Activity ******************************************************/ // Updated: 12.04.2010 for NRTMayPilot var boactiv; var bo2; var bcaction; var boservice; var bcservice; var boname; var ctidata; var dStart; var strLoginId; var sStatus; var strStart; var strStop; var strAnrufActiv; var strCallType; var strCallTypeExt; var strIVRLanguage; var sSRId; var sConnId; var sSubConnId; var sSysRefID; var sCLI; var dateForm; var timeForm; var timeFormEnd; //TSGGUJA1 06.02.2009 New variable to store the time when we finish creating the activityy var intNumberSR=0; //OneCRM R1.0 SCM 15.10.2009 TSGBJEA1: Defect# 14784 (CTI) var CLIdigit = 0; // NRTMayPilot - tidy up to avoid syntax error var strhours = ""; var strminutes = ""; var strseconds = ""; var strSRActivityType; // NRTMayPilot var strNRTActiv; // NRTMayPilot var bAllowCallbackRetries = false; var aShopBrokerId; try { strStart = oApp.GetProfileAttr ("strStart"); strStop = oApp.GetProfileAttr ("strStop"); strAnrufActiv = oApp.GetProfileAttr("strAnrufActiv"); strCallType = oApp.GetProfileAttr("strCallType"); strCallTypeExt = oApp.GetProfileAttr("strCallTypeExt"); strIVRLanguage = oApp.GetProfileAttr("strIVRLanguage"); strSRActivityType = oApp.GetProfileAttr("strSRActivityType"); // NRTMayPilot strNRTActiv = oApp.GetProfileAttr("PushActive"); // NRTMayPilot aShopBrokerId = oApp.GetProfileAttr("aShopBrokerId"); strLoginId = oApp.LoginId(); // var strCreateNeeded = oApp.GetProfileAttr ("CreateNeeded"); if (bIsTraceOn) { oApp.Trace("strStart = " + strStart); oApp.Trace("strStop = " + strStop); oApp.Trace("strAnrufActiv = " + strAnrufActiv); oApp.Trace("strCallType = " + strCallType); oApp.Trace("strCallTypeExt = " + strCallTypeExt); oApp.Trace("strIVRLanguage = " + strIVRLanguage); } if (strStart!="") { sSRId = Inputs.GetProperty("sSRId"); // Check if an activity exist with same ConnId and same SR Id boname = oApp.ActiveBusObject().Name(); boactiv = oApp.ActiveBusObject(); if (strNRTActiv=="Y") // NRTMayPilot { // NRTMayPilot boname = "Service Request"; // NRTMayPilot } // NRTMayPilot boservice = oApp.GetBusObject(boname); bcservice = boservice.GetBusComp("Service Request"); with (bcservice) { ActivateField("Owned By Id"); ActivateField("Status"); ActivateField("IVR Language CD SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", sSRId); ExecuteQuery(ForwardOnly); if (FirstRecord()) { // SR found sStatus = GetFieldValue("Status"); if ( sStatus == "Closed")// && strCreateNeeded != 1) { // SR status is closed... no Activity will be created! } else { bcaction = boservice.GetBusComp("Action Clone SCM"); sConnId = oApp.GetProfileAttr ("strConnID"); sSubConnId = oApp.GetProfileAttr ("strSubConnID"); sSysRefID = oApp.GetProfileAttr ("aSysRefID"); // TGDMAEM1 06.02.2012: added calltype = 2 as ivr_caller make only sense by inbound calls if (oApp.GetProfileAttr("IVR_Caller") != "" && oApp.GetProfileAttr("IVR_Caller") != null && strCallType == 2) { sCLI = oApp.GetProfileAttr("IVR_Caller"); } else { sCLI = oApp.GetProfileAttr ("strCLI"); } with (bcaction) { ActivateField("Call Id"); ActivateField("Status"); ActivateField("Created By Id"); // TGDMAEM1 3.9.13: added for RICO ActivateField("Sample Reference Number"); ActivateField("System Name SCM"); SetViewMode(AllView); ClearToQuery();

CTI BS SCM
CreateCallActivity
function CreateCallActivity (Inputs:PropertySet){ /******************************************************* ** Name: CreateCallActivity ** Created: 21.08.2002 ** Created By: EM ** Description: Create a Call Activity ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boactiv:BusObject; var boservice:BusObject; var bo2:BusComp; var bcaction:BusComp; var bcservice:BusComp; var strLoginId:chars = ""; var boname:chars = ""; var sStatus:chars = ""; var strStart:chars = ""; var strStop:chars = ""; var strAnrufActiv:chars = ""; var strCallType:chars = ""; var strCallTypeExt:chars = ""; var strIVRLanguage:chars = ""; var sSRId:chars = ""; var sConnId:chars = ""; var sSubConnId:chars = ""; var sSysRefID:chars = ""; var sCLI:chars = ""; var dateForm:chars = ""; var timeForm:chars = ""; var timeFormEnd:chars = ""; var strhours:chars = ""; var strminutes:chars = ""; var strseconds:chars = ""; var strSRActivityType:chars = ""; var strNRTActiv:chars = ""; var aShopBrokerId:chars = ""; var sCallbackAttempts:chars = ""; var sRetryAttempts:chars = ""; var bAllowCallbackRetries:bool = false; var intNumberSR:chars; var lenhours:float = 0; var lenminutes:float = 0; var lenseconds:float = 0; var iCallbackAttempts:float = 0; var iRetryAttempts:float = 0; var dStart:Date; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".CreateCallActivity START"); strStart = oApp.GetProfileAttr ("strStart"); strStop = oApp.GetProfileAttr ("strStop"); strAnrufActiv = oApp.GetProfileAttr("strAnrufActiv"); strCallType = oApp.GetProfileAttr("strCallType"); strCallTypeExt = oApp.GetProfileAttr("strCallTypeExt"); strIVRLanguage = oApp.GetProfileAttr("strIVRLanguage"); strSRActivityType = oApp.GetProfileAttr("strSRActivityType"); // NRTMayPilot strNRTActiv = oApp.GetProfileAttr("PushActive"); // NRTMayPilot aShopBrokerId = oApp.GetProfileAttr("aShopBrokerId"); strLoginId = oApp.LoginId(); if (bIsTraceOn) { oApp.Trace(this.Name() + ".CreateCallActivity strStart = " + strStart); oApp.Trace(this.Name() + ".CreateCallActivity strStop = " + strStop); oApp.Trace(this.Name() + ".CreateCallActivity strAnrufActiv = " + strAnrufActiv); oApp.Trace(this.Name() + ".CreateCallActivity strCallType = " + strCallType); oApp.Trace(this.Name() + ".CreateCallActivity strCallTypeExt = " + strCallTypeExt); oApp.Trace(this.Name() + ".CreateCallActivity strIVRLanguage = " + strIVRLanguage); } if (strStart!=""){ sSRId = Inputs.GetProperty("sSRId"); // Check if an activity exist with same ConnId and same SR Id boname = oApp.ActiveBusObject().Name(); boactiv = oApp.ActiveBusObject(); if (strNRTActiv=="Y"){// NRTMayPilot boname = "Service Request"; // NRTMayPilot } // NRTMayPilot boservice = oApp.GetBusObject("Service Request");//TAASAAI2 11.01.2017 SO-3495 As we call it from different BOs that dont have the same bcs do not get the name of the active one bcservice = boservice.GetBusComp("Service Request"); with (bcservice){ ActivateField("Owned By Id"); ActivateField("Status"); ActivateField("IVR Language CD SCM"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec("Id", sSRId); ExecuteQuery(ForwardOnly); if (FirstRecord()){ // SR found sStatus = GetFieldValue("Status"); if ( sStatus == "Closed"){// && strCreateNeeded != 1) // SR status is closed... no Activity will be created! } else { bcaction = boservice.GetBusComp("Action Clone SCM"); sConnId = oApp.GetProfileAttr ("strConnID"); sSubConnId = oApp.GetProfileAttr ("strSubConnID"); sSysRefID = oApp.GetProfileAttr ("aSysRefID"); // TGDMAEM1 06.02.2012: added calltype = 2 as ivr_caller make only sense by inbound calls if (oApp.GetProfileAttr("IVR_Caller") != "" && oApp.GetProfileAttr("IVR_Caller") != null &

CTI BS SCM
CreatePushActivity
function CreatePushActivity(sSRId:chars, sPushId:chars, sAccountId:chars, sComment:chars){ /******************************************************* ** Name: CreatePushActivity ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var dNow:Date; try{ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushActivity - sSRId = " + sSRId + " / sPushId = " + sPushId + " / sComment = " + sComment); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Timestamp SCM"); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.SetSearchSpec("Push Id SCM", sPushId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushActivity - found SR"); sPushTimeStamp = oBCSRPush.GetFieldValue("Push Timestamp SCM"); sLogin = oApp.LoginId(); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()){ // record exists => nothing todo if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushActivity - found Activity"); } else { dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Accepted"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Task Id SCM", sPushId); oBCAct.SetFieldValue("Comment", sPushId + " ( " + sComment + " )"); oBCAct.SetFieldValue("Start Time", sPushTimeStamp); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } } if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushActivity - END"); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushActivity - Error: " + e.toString()); } finally{ dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
CreatePushActivity
function CreatePushActivity(sSRId:chars, sPushId:chars, sAccountId:chars, sComment:chars) { var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sPushTimeStamp:chars; var sLogin:chars; var sNow:chars; var dNow:Date; try { if (bIsTraceOn) oApp.Trace("CreatePushActivity - sSRId = " + sSRId + " / sPushId = " + sPushId + " / sComment = " + sComment); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request Push SCM"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ActivateField("Push Timestamp SCM"); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Parent Id", sSRId); oBCSRPush.SetSearchSpec("Push Id SCM", sPushId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()) { if (bIsTraceOn) oApp.Trace("CreatePushActivity - found SR"); sPushTimeStamp = oBCSRPush.GetFieldValue("Push Timestamp SCM"); sLogin = oApp.LoginId(); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Task Id SCM", sPushId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()) { // record exists => nothing todo if (bIsTraceOn) oApp.Trace("CreatePushActivity - found Activity"); } else { dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Accepted"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Task Id SCM", sPushId); oBCAct.SetFieldValue("Comment", sPushId + " ( " + sComment + " )"); oBCAct.SetFieldValue("Start Time", sPushTimeStamp); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } } if (bIsTraceOn) oApp.Trace("CreatePushActivity - END"); } catch(e) { if (bIsTraceOn) oApp.Trace("CreatePushActivity - Error: " + e.toString()); } finally { dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
CreatePushPreviewActivity
function CreatePushPreviewActivity(sSRId:String, sInteractionId:String, sAccountId:String){ /******************************************************* ** Name: CreatePushPreviewActivity ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; try{ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushPreviewActivity - sSRId = " + sSRId ); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Id", sSRId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushPreviewActivity - found SR"); sLogin = oApp.LoginId(); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Call Id", sInteractionId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()){ // record exists => nothing todo if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - found Activity"); } else { dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Accepted"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Call Id", sInteractionId); //oBCAct.SetFieldValue("Comment", sPushId); oBCAct.SetFieldValue("Start Time", sNow); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushPreviewActivity - Error: SR record not found."); } if (bIsTraceOn) oApp.Trace(this.Name() + ".CreatePushPreviewActivity - END"); } catch(e){ if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - Error: " + e.toString()); } finally{ dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
CreatePushPreviewActivity
function CreatePushPreviewActivity(sSRId:String, sInteractionId:String, sAccountId:String) { var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; try { if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - sSRId = " + sSRId ); oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Id", sSRId); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()) { if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - found SR"); sLogin = oApp.LoginId(); oBCAct.InvokeMethod("SetAdminMode", "TRUE"); oBCAct.ClearToQuery(); oBCAct.SetSearchSpec("Activity SR Id", sSRId); oBCAct.SetSearchSpec("Call Id", sInteractionId); oBCAct.SetSearchSpec("Created By Id", sLogin); oBCAct.ExecuteQuery(ForwardOnly); if (oBCAct.FirstRecord()) { // record exists => nothing todo if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - found Activity"); } else { dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter); oBCAct.SetFieldValue("Activity SR Id", sSRId); oBCAct.SetFieldValue("Account Id", sAccountId); oBCAct.SetFieldValue("Type", "Task Accepted"); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Call Id", sInteractionId); //oBCAct.SetFieldValue("Comment", sPushId); oBCAct.SetFieldValue("Start Time", sNow); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } } else { if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - Error: SR record not found."); } if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - END"); } catch(e) { if (bIsTraceOn) oApp.Trace("CreatePushPreviewActivity - Error: " + e.toString()); } finally { dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
CustomerSearch
function CustomerSearch (Inputs){ /******************************************************* ** Name: CustomerSearch ** Created: 21.08.2002 ** Created By: EM ** Description: Search and display the customer on the ** entry screen ** Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ******************************************************/ var boAccount:BusObject; var bcAccount:BusComp; var boAsset:BusObject; //TGDHEVI1 30.10.09 var bcAsset:BusComp; var bcSR:BusComp; var sMSISDN:chars = ""; var inputs:PropertySet; // inputs for BS var outputs:PropertySet; // outputs for BS var aDate:Date; var varView:chars = ""; var strLoginName:chars = ""; var strLogMsg:chars = ""; var strTime:chars = ""; var sAccount_Id:chars = ""; // Account Row Id var sRootAsset_Id:chars = ""; var sAsset_Id:chars = ""; // TSGGUJA1 12.01.09 New variable var sSR_Id:chars = ""; // TGDMAEM1 08.09.15 var sStatus:chars = ""; //TGDHEVI1 07.10.09 try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch START"); // Time Conversion aDate = new Date; strLoginName = oApp.LoginName(); strLogMsg = strLoginName + "\t"; strTime = "" + aDate.getHours() + ":" + aDate.getMinutes() + ":" + aDate.getSeconds() + ":" + aDate.getMilliseconds(); sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); boAccount = oApp.GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); sAsset_Id = Inputs.GetProperty("sAsset_Id"); // TSGGUJA1 12.01.09 Initialize New variable sSR_Id = Inputs.GetProperty("sSR_Id"); if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch sAccount_Id : " + sAccount_Id); if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch sAsset_Id : " + sAsset_Id); if ( sAccount_Id != "" && sAccount_Id != " " && sAccount_Id != "0" && sAccount_Id != null ){ //Begin //TGDGEMAM 2016-04-19: CR-1605-WP-1041-001 => Performance Enhancements Symphony oApp.SetProfileAttr("SearchForRecordStatus",""); oApp.SetProfileAttr("SearchForRecord",""); oApp.SetProfileAttr("CleanAssetBC",""); if ( sAsset_Id != "" && sAsset_Id != " " && sAsset_Id != "0" && sAsset_Id != null ){ //--------------- Calculating the Asset Status --------------------- oApp.SetProfileAttr("SearchForRecordStatus","Active"); oApp.SetProfileAttr("SearchForRecord",sAsset_Id); oApp.SetProfileAttr("CleanAssetBC","N"); // TGDMAEM1 19.05.15: Added next line so that focusing on the right asset is working // Reprocase issue was: Navigate to entry screen to a customer with contracts and then inbound call with identfied contract was focusing the last record instead of the searched record oApp.SetProfileAttr("BlockContractFocus", "Y"); // TGDMAEM1 28.8.14: Replaced BO/BC due to defect - Asset Management / Asset Mgmt - Asset (Order Mgmt) boAsset = oApp.GetBusObject("Asset Mgmt - Asset Lite FE SCM"); bcAsset = boAsset.GetBusComp("Asset Mgmt - Asset Lite FE SCM"); with (bcAsset){ ActivateField("Root Asset Id"); ClearToQuery(); SetSearchSpec( "Id", sAsset_Id );//we search in Asset Id column for our asset ExecuteQuery(ForwardBackward); if (FirstRecord()){ sStatus= GetFieldValue("Status"); sRootAsset_Id = GetFieldValue("Root Asset Id"); if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch sRootAsset_Id : " + sRootAsset_Id); oApp.SetProfileAttr("SearchForRecord",sRootAsset_Id); oApp.SetProfileAttr("SearchForRecordStatus",sStatus); } }//End with BcAsset } // End if sAssetId is not null with (bcAccount){ ClearToQuery(); SetViewMode(OrganizationView); ActivateField("Comment SCM"); SetSearchSpec("Id", sAccount_Id); // TGDGEMAM 2016-04-19: CR-1605-WP-1041-001 => Performance Enhancements Symphony if (oApp.GetProfileAttr("SearchForRecord") != "") { bcAsset = boAccount.GetBusComp("Asset Mgmt - Asset

CTI BS SCM
CustomerSearch
function CustomerSearch (Inputs){ /******************************************************* ** Name: CustomerSearch ** Created: 21.08.2002 ** Created By: EM ** Description: Search and display the customer on the ** entry screen ** Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boAccount:BusObject; var bcAccount:BusComp; var boAsset:BusObject; //TGDHEVI1 30.10.09 var bcAsset:BusComp; var bcSR:BusComp; var sMSISDN:chars = ""; var inputs:PropertySet; // inputs for BS var outputs:PropertySet; // outputs for BS var aDate:Date; var varView:chars = ""; var strLoginName:chars = ""; var strLogMsg:chars = ""; var strTime:chars = ""; var sAccount_Id:chars = ""; // Account Row Id var sRootAsset_Id:chars = ""; var sAsset_Id:chars = ""; // TSGGUJA1 12.01.09 New variable var sSR_Id:chars = ""; // TGDMAEM1 08.09.15 var sStatus:chars = ""; //TGDHEVI1 07.10.09 try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch START"); // Time Conversion aDate = new Date; strLoginName = oApp.LoginName(); strLogMsg = strLoginName + "\t"; strTime = "" + aDate.getHours() + ":" + aDate.getMinutes() + ":" + aDate.getSeconds() + ":" + aDate.getMilliseconds(); sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); boAccount = oApp.GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); sAsset_Id = Inputs.GetProperty("sAsset_Id"); // TSGGUJA1 12.01.09 Initialize New variable sSR_Id = Inputs.GetProperty("sSR_Id"); if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch sAccount_Id : " + sAccount_Id + " - sAsset_Id:" + sAsset_Id + " - sMSISDN:" + sMSISDN + " - sSR_Id: " + sSR_Id); if ( sAccount_Id != "" && sAccount_Id != " " && sAccount_Id != "0" && sAccount_Id != null ){ //Begin //TGDGEMAM 2016-04-19: CR-1605-WP-1041-001 => Performance Enhancements Symphony oApp.SetProfileAttr("SearchForRecordStatus",""); oApp.SetProfileAttr("SearchForRecord",""); oApp.SetProfileAttr("CleanAssetBC",""); // TGDMAEM1 16.6.16: Moved outside the asset_id is null block, bec, we have long running query (fetch) when asset_id is not provided // TGDMAEM1 19.05.15: Added next line so that focusing on the right asset is working // Reprocase issue was: Navigate to entry screen to a customer with contracts and then inbound call with identfied contract was focusing the last record instead of the searched record oApp.SetProfileAttr("BlockContractFocus", "Y"); if ( sAsset_Id != "" && sAsset_Id != " " && sAsset_Id != "0" && sAsset_Id != null ){ //--------------- Calculating the Asset Status --------------------- oApp.SetProfileAttr("SearchForRecordStatus","Active"); oApp.SetProfileAttr("SearchForRecord",sAsset_Id); oApp.SetProfileAttr("CleanAssetBC","N"); // TGDMAEM1 28.8.14: Replaced BO/BC due to defect - Asset Management / Asset Mgmt - Asset (Order Mgmt) boAsset = oApp.GetBusObject("Asset Mgmt - Asset Lite FE SCM"); bcAsset = boAsset.GetBusComp("Asset Mgmt - Asset Lite FE SCM"); with (bcAsset){ ActivateField("Root Asset Id"); ClearToQuery(); SetSearchSpec( "Id", sAsset_Id );//we search in Asset Id column for our asset ExecuteQuery(ForwardBackward); if (FirstRecord()){ sStatus= GetFieldValue("Status"); sRootAsset_Id = GetFieldValue("Root Asset Id"); if(bIsTraceOn)oApp.Trace(this.Name() + ".CustomerSearch sRootAsset_Id : " + sRootAsset_Id); oApp.SetProfileAttr("SearchForRecord",sRootAsset_Id); oApp.SetProfileAttr("SearchForRecordStatus",sStatus); } }//End with BcAsset } // End if sAssetId is not null with (bcAccount){ ClearToQuery(); SetViewMode(OrganizationView); ActivateField("Comment SCM"); SetSearchSpec("Id", sAccount_Id); // TGDGEMAM 20

CTI BS SCM
OpenSearchCenter
function OpenSearchCenter(){ var varView:chars = ""; var bsSearch:Service; var psOpenIn:PropertySet; var psOpenOut:PropertySet; var nOpen; var strLoginName; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".OpenSearchCenter START"); //Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 //varView = "Account Entry View SCM"; strLoginName = oApp.LoginName(); if ( fnIsFirstLevelAgent (strLoginName)){ varView = "MCE Homescreen View SCM"; } else{ varView = "Account Entry View SCM"; } psOpenIn = oApp.NewPropertySet(); psOpenOut = oApp.NewPropertySet(); bsSearch = oApp.GetService("Search Client Service"); bsSearch.InvokeMethod("IsSrchCenterOn",psOpenIn, psOpenOut); nOpen = psOpenOut.GetProperty("IsSrchCenterOn"); if (nOpen == 0){ // Only open search center if not already open if (oApp.GetProfileAttr("OpenSrchCenter") == "NI"){ // Also open ITSM Popup oApp.SetProfileAttr("OpenSrchCenter","YI"); } else{ oApp.SetProfileAttr("OpenSrchCenter","Y"); } } oApp.GotoView(varView); return; } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".OpenSearchCenter ERROR:" + e.message); throw(e); } finally{ psOpenOut = null; psOpenIn = null; bsSearch = null; } }

CTI BS SCM
OpenSearchCenter
function OpenSearchCenter(){ /******************************************************* ** Name: OpenSearchCenter ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var varView:chars = ""; var bsSearch:Service; var psOpenIn:PropertySet; var psOpenOut:PropertySet; var nOpen:chars; var strLoginName:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".OpenSearchCenter START"); //Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 //varView = "Account Entry View SCM"; strLoginName = oApp.LoginName(); if ( fnIsFirstLevelAgent (strLoginName)){ varView = "MCE Homescreen View SCM"; } else{ varView = "Account Entry View SCM"; } psOpenIn = oApp.NewPropertySet(); psOpenOut = oApp.NewPropertySet(); bsSearch = oApp.GetService("Search Client Service"); bsSearch.InvokeMethod("IsSrchCenterOn",psOpenIn, psOpenOut); nOpen = psOpenOut.GetProperty("IsSrchCenterOn"); if (nOpen == 0){ // Only open search center if not already open if (oApp.GetProfileAttr("OpenSrchCenter") == "NI"){ // Also open ITSM Popup oApp.SetProfileAttr("OpenSrchCenter","YI"); } else{ oApp.SetProfileAttr("OpenSrchCenter","Y"); } } oApp.GotoView(varView); return; } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".OpenSearchCenter ERROR:" + e.message); throw(e); } finally{ psOpenOut = null; psOpenIn = null; bsSearch = null; } }

CTI BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs){ var intRetVal; try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; intRetVal = CancelOperation; if( bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName : " + MethodName); switch (MethodName){ // CR0426. Revised status handling... case "HandleEventAgentNotReady": bsHandleEventAgentNotReady(Inputs,Outputs); break; case "SetProfileAttr": bsSetProfileAttr(Inputs,Outputs); break; // CR0426. Revised status handling... case "CustomerSearch": CustomerSearch(Inputs); break; case "ACW": break; case "CloseCallActivity": CloseCallActivity(); break; case "OpenSearchCenter": OpenSearchCenter(); break; case "CreateCallActivity": CreateCallActivity(Inputs); break; case "bsEventEstablished": bsForceNotReadyImmediate(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventEstablishedWithPop": bsForceNotReadyImmediate(Inputs, Outputs); bsEventEstablishedSearchCustomer(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventEstablishedForFirstLevel": bsForceNotReadyImmediate(Inputs, Outputs); bsFirstLevelTransfer(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventReleased": bsEventReleased(Inputs, Outputs); break; case "bsEventRingingManualAnswer": bsEventRingingManualAnswer(Inputs, Outputs); break; case "bsEventRingingAutoAnswer": bsEventRingingAutoAnswer(Inputs, Outputs); break; case "bsAutoAnswer": bsAutoAnswer(Inputs, Outputs); break; case "bsAutoAnswerDiffHotline": bsAutoAnswerDiffHotline(Inputs, Outputs); break; case "bsAutoAnswerSearchCenter": bsAutoAnswerSearchCenter(Inputs, Outputs); break; case "bsMakeRecall": bsMakeRecall(Inputs); break; case "bsOpenMediaSelected": bsForceNotReadyImmediate(Inputs, Outputs); bsOpenMediaSelected(Inputs,Outputs); break; case "bsOpenMediaSelectedITSM": bsOpenMediaSelectedITSM(Inputs,Outputs); break; case "bsOpenMediaSelectedPreview": bsForceNotReadyImmediate(Inputs, Outputs); bsOpenMediaSelectedPreview(Inputs,Outputs); break; case "bsOpenMediaReleasedPreview": bsOpenMediaReleasedPreview(Inputs,Outputs); break; case "bsOpenMediaReschedule": bsOpenMediaReschedule(Inputs,Outputs); break; case "bsMarkDoneSR": bsMarkDoneSR(Inputs,Outputs); break; case "bsHandleOpenMediaStatus": bsHandleOpenMediaStatus(Inputs,Outputs); break; case "bsCreateCallbackActivity": bsCreateCallbackActivity(Inputs,Outputs); break; case "bsCloseCallbackActivity": bsCloseCallbackActivity(Inputs,Outputs); break; case "bsNotReadyWorkitem": bsNotReadyWorkitem(Inputs,Outputs); break; case "bsNotReadyOutboundPreview": bsNotReadyOutboundPreview(Inputs,Outputs); break; case "bsNotReadyWorkitem_Param": bsNotReadyWorkitem_Param(Inputs,Outputs); break; case "bsNotReadyOutboundPreview_Param": bsNotReadyOutboundPreview_Param(Inputs,Outputs); break; case "bsReasonChangeForSR": bsReasonChangeForSR(Inputs,Outputs); break; case "bsReasonChangeForOutboundPreview": bsReasonChangeForOutboundPreview(Inputs,Outputs); break; case "bsAutoAnswerSR": bsAutoAnswerSR(Inputs,Outputs); break; case "bsWhisperAndAutoAnswerSR":

CTI BS SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs:PropertySet, Outputs:PropertySet){ var intRetVal; try{ oApp = TheApplication(); bIsTraceOn = oApp.isTraceON; intRetVal = CancelOperation; if( bIsTraceOn) oApp.Trace(this.Name() + ".Service_PreInvokeMethod MethodName : " + MethodName); switch (MethodName){ // CR0426. Revised status handling... case "HandleEventAgentNotReady": bsHandleEventAgentNotReady(Inputs,Outputs); break; case "SetProfileAttr": bsSetProfileAttr(Inputs,Outputs); break; // CR0426. Revised status handling... case "CustomerSearch": CustomerSearch(Inputs); break; case "ACW": break; case "CloseCallActivity": CloseCallActivity(); break; case "OpenSearchCenter": OpenSearchCenter(); break; case "CreateCallActivity": CreateCallActivity(Inputs); break; case "bsEventEstablished": bsForceNotReadyImmediate(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventEstablishedWithPop": bsForceNotReadyImmediate(Inputs, Outputs); bsEventEstablishedSearchCustomer(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventEstablishedForFirstLevel": bsForceNotReadyImmediate(Inputs, Outputs); bsFirstLevelTransfer(Inputs, Outputs); bsEventEstablished(Inputs,Outputs); break; case "bsEventReleased": bsEventReleased(Inputs, Outputs); break; case "bsEventRingingManualAnswer": bsEventRingingManualAnswer(Inputs, Outputs); break; case "bsEventRingingAutoAnswer": bsEventRingingAutoAnswer(Inputs, Outputs); break; case "bsAutoAnswer": bsAutoAnswer(Inputs, Outputs); break; case "bsAutoAnswerDiffHotline": bsAutoAnswerDiffHotline(Inputs, Outputs); break; case "bsAutoAnswerSearchCenter": bsAutoAnswerSearchCenter(Inputs, Outputs); break; case "bsMakeRecall": bsMakeRecall(Inputs); break; case "bsOpenMediaSelected": bsForceNotReadyImmediate(Inputs, Outputs); bsOpenMediaSelected(Inputs,Outputs); break; case "bsOpenMediaSelectedITSM": bsOpenMediaSelectedITSM(Inputs,Outputs); break; case "bsOpenMediaSelectedPreview": bsForceNotReadyImmediate(Inputs, Outputs); bsOpenMediaSelectedPreview(Inputs,Outputs); break; case "bsOpenMediaReleasedPreview": bsOpenMediaReleasedPreview(Inputs,Outputs); break; case "bsOpenMediaReschedule": bsOpenMediaReschedule(Inputs,Outputs); break; case "bsMarkDoneSR": bsMarkDoneSR(Inputs,Outputs); break; case "bsHandleOpenMediaStatus": bsHandleOpenMediaStatus(Inputs,Outputs); break; case "bsCreateCallbackActivity": bsCreateCallbackActivity(Inputs,Outputs); break; case "bsCloseCallbackActivity": bsCloseCallbackActivity(Inputs,Outputs); break; case "bsNotReadyWorkitem": bsNotReadyWorkitem(Inputs,Outputs); break; case "bsNotReadyOutboundPreview": bsNotReadyOutboundPreview(Inputs,Outputs); break; case "bsNotReadyWorkitem_Param": bsNotReadyWorkitem_Param(Inputs,Outputs); break; case "bsNotReadyOutboundPreview_Param": bsNotReadyOutboundPreview_Param(Inputs,Outputs); break; case "bsReasonChangeForSR": bsReasonChangeForSR(Inputs,Outputs); break; case "bsReasonChangeForOutboundPreview": bsReasonChangeForOutboundPreview(Inputs,Outputs); break; case "bsAutoAnswerSR": bsAutoAnswerSR(Inputs,Outputs); break; case "bsWh

CTI BS SCM
bsAutoAnswer
function bsAutoAnswer(Inputs, Outputs){ /******************************************************* ** Name: bsAutoAnswer: Answer the call ** EMA: 08.09.2003 ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (aState == true){ //Not Ready // No AutoAnswer } else{ if (bState == false) { sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput= null; sOutput=null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswer ERROR:" + e.message); throw e; } finally{ sInput= null; sOutput = null; sCTI = null; bsAnswerCall = null; aState = null; bState = null; } }

CTI BS SCM
bsAutoAnswer
function bsAutoAnswer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsAutoAnswer: Answer the call ** EMA: 08.09.2003 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (aState == true){ //Not Ready // No AutoAnswer } else{ if (bState == false) { sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput= null; sOutput=null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswer ERROR:" + e.message); throw e; } finally{ sInput= null; sOutput = null; sCTI = null; bsAnswerCall = null; aState = null; bState = null; } }

CTI BS SCM
bsAutoAnswerDiffHotline
function bsAutoAnswerDiffHotline(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsAutoAnswerDiffHotline ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; var aMSISDN:chars = ""; var aIVRLanguage:chars = ""; var aPOPUP:chars = ""; var aWTIME:chars = ""; var sError:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerDiffHotline START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (Inputs.PropertyExists("sMSISDN")){ aMSISDN = Inputs.GetProperty("sMSISDN"); } else{ aMSISDN = "Nicht definiert"; } if (Inputs.PropertyExists("aIVRLanguage")){ aIVRLanguage = Inputs.GetProperty("aIVRLanguage"); } else{ aIVRLanguage = ""; } switch (aIVRLanguage){ case "GE": aIVRLanguage="Deutsch"; break; // TGDMAEM1 3.10.2012 IVR could also send DEU for German. case "DE": aIVRLanguage="Deutsch"; break; case "FR": aIVRLanguage="Französich"; break; case "IT": aIVRLanguage="Italienisch"; break; case "EN": aIVRLanguage="Englisch"; break; default: aIVRLanguage="Nicht definiert"; break; } if (Inputs.PropertyExists("aPOPUP")){ aPOPUP = Inputs.GetProperty("aPOPUP"); } else{ aPOPUP = ""; } if(Inputs.PropertyExists("aWTIME")){ aWTIME = Inputs.GetProperty("aWTIME"); } else{ aWTIME = ""; } if (aState == true) {//Not Ready // No AutoAnswer } else{// 20041214 Modifed as part of v7.7 migration if (bState == false){ sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sError = 'a \n \r \t' + aPOPUP + '\n \n \r \r Kundensprache : ' + aIVRLanguage + '\n \r Kunden Natel-Nr : ' + aMSISDN + '\n \r Wartezeit: ' + aWTIME + '\n \n \r \r '; oApp.RaiseError("THOR:Popup", aPOPUP, aIVRLanguage, aMSISDN, aWTIME); sInput = null; sOutput = null; } } sCTI = null; } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerDiffHotline ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; sCTI = null; bsAnswerCall = null; } }

CTI BS SCM
bsAutoAnswerDiffHotline
function bsAutoAnswerDiffHotline(Inputs, Outputs){ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; var aMSISDN:chars = ""; var aIVRLanguage:chars = ""; var aPOPUP:chars = ""; var aWTIME:chars = ""; var sError:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerDiffHotline START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (Inputs.PropertyExists("sMSISDN")){ aMSISDN = Inputs.GetProperty("sMSISDN"); } else{ aMSISDN = "Nicht definiert"; } if (Inputs.PropertyExists("aIVRLanguage")){ aIVRLanguage = Inputs.GetProperty("aIVRLanguage"); } else{ aIVRLanguage = ""; } switch (aIVRLanguage){ case "GE": aIVRLanguage="Deutsch"; break; // TGDMAEM1 3.10.2012 IVR could also send DEU for German. case "DE": aIVRLanguage="Deutsch"; break; case "FR": aIVRLanguage="Französich"; break; case "IT": aIVRLanguage="Italienisch"; break; case "EN": aIVRLanguage="Englisch"; break; default: aIVRLanguage="Nicht definiert"; break; } if (Inputs.PropertyExists("aPOPUP")){ aPOPUP = Inputs.GetProperty("aPOPUP"); } else{ aPOPUP = ""; } if(Inputs.PropertyExists("aWTIME")){ aWTIME = Inputs.GetProperty("aWTIME"); } else{ aWTIME = ""; } if (aState == true) {//Not Ready // No AutoAnswer } else{// 20041214 Modifed as part of v7.7 migration if (bState == false){ sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sError = 'a \n \r \t' + aPOPUP + '\n \n \r \r Kundensprache : ' + aIVRLanguage + '\n \r Kunden Natel-Nr : ' + aMSISDN + '\n \r Wartezeit: ' + aWTIME + '\n \n \r \r '; oApp.RaiseError("THOR:Popup", aPOPUP, aIVRLanguage, aMSISDN, aWTIME); sInput = null; sOutput = null; } } sCTI = null; } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerDiffHotline ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; sCTI = null; bsAnswerCall = null; } }

CTI BS SCM
bsAutoAnswerSR
function bsAutoAnswerSR (Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsAutoAnswerSR ** Created: 22.01.2008 ** Created By: TGDCRAN1 ** Description: Call OpenMediaAccept device command to answer the "ringing" SR ** Notes: (i) DriverWorkTrackID ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sDriverWorkTrackID:chars = ""; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSR START"); // Confirm mandatory parameters are passed... sDriverWorkTrackID = Inputs.GetProperty("DriverWorkTrackID"); if (sDriverWorkTrackID == "" ) throw("DriverWorkTrackID parameter is missing"); // Call OpenMediaAccept Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sDriverWorkTrackID ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaAccept"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSR ERROR:" + e.message); throw(e); } finally { svcCTI = null; pDataSet = null; pIn = null; pOut = null; } return; }

CTI BS SCM
bsAutoAnswerSR
function bsAutoAnswerSR (Inputs, Outputs){ /******************************************************* ** Name: bsAutoAnswerSR ** Created: 22.01.2008 ** Created By: TGDCRAN1 ** Description: Call OpenMediaAccept device command to answer the "ringing" SR ** Notes: (i) DriverWorkTrackID ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sDriverWorkTrackID:chars = ""; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSR START"); // Confirm mandatory parameters are passed... sDriverWorkTrackID = Inputs.GetProperty("DriverWorkTrackID"); if (sDriverWorkTrackID == "" ) throw("DriverWorkTrackID parameter is missing"); // Call OpenMediaAccept Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sDriverWorkTrackID ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaAccept"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSR ERROR:" + e.message); throw(e); } finally { svcCTI = null; pDataSet = null; pIn = null; pOut = null; } return; }

CTI BS SCM
bsAutoAnswerSearchCenter
function bsAutoAnswerSearchCenter(Inputs, Outputs){ /******************************************************* ** Name: bsAutoAnswerSearchCenter: Open the Search Center and Answer the call ** EMA 27.01.2004 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSearchCenter START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (aState == true){//Not Ready // No AutoAnswer } else{ if (bState == false){ OpenSearchCenter(); sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput = null; sOutput = null; } } sCTI = null; } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSearchCenter ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; sCTI = null; bsAnswerCall = null; } }

CTI BS SCM
bsAutoAnswerSearchCenter
function bsAutoAnswerSearchCenter(Inputs, Outputs){ /******************************************************* ** Name: bsAutoAnswerSearchCenter: Open the Search Center and Answer the call ** EMA 27.01.2004 ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSearchCenter START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn"); if (aState == true){//Not Ready // No AutoAnswer } else{ if (bState == false){ OpenSearchCenter(); sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput = null; sOutput = null; } } sCTI = null; } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsAutoAnswerSearchCenter ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; sCTI = null; bsAnswerCall = null; } }

CTI BS SCM
bsCloseCallbackActivity
function bsCloseCallbackActivity(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsCloseCallbackActivity ** Created: 26.06.2012 ** Created By: TGDCRAN2 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBOAction:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; var sSRNum:chars; var sActivityType:chars; var sActivitySubType:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sActivityType = Inputs.GetProperty("sActivityType"); sActivitySubType = Inputs.GetProperty("sActivitySubType"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sSRIntegrationId="+sSRNum); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sActivityType="+sActivityType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sActivitySubType="+sActivitySubType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity bsUpdateCallbackActivity - SRNum = " + sSRNum ); if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ){ oBOSR = oApp.GetBusObject("Service Request"); oBOAction = oBOSR.GetBusComp("Action Clone SCM"); oBOAction.SetViewMode(AllView); oBOAction.InvokeMethod("SetAdminMode", "TRUE"); oBOAction.ClearToQuery(); oBOAction.SetSearchExpr("[Service Request Integration Id SCM]='" + sSRNum + "' AND [Type]='" + sActivityType + "' AND [Status]='Open'" ); oBOAction.ExecuteQuery(ForwardOnly); if (oBOAction.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity found Push Callback activity"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBOAction.SetFieldValue("Sub Type SCM", sActivitySubType); oBOAction.SetFieldValue("Done", sNow); oBOAction.SetFieldValue("Status", "Closed"); oBOAction.WriteRecord(); if(sActivitySubType == "Successful"){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity Check for Open Call Activities"); oBOAction.SetViewMode(AllView); oBOAction.ClearToQuery(); oBOAction.SetSearchExpr("[Service Request Integration Id SCM]='" + sSRNum + "' AND [Type]='Call' AND [Sub Type SCM] = 'Callback' AND [Status]='Open'"); oBOAction.ExecuteQuery(ForwardOnly); if (oBOAction.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity Open Callback activity found"); oBOAction.SetFieldValue("Done", sNow); oBOAction.SetFieldValue("Status", "Closed"); oBOAction.WriteRecord(); } } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: Push Callback activity record not found."); } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: Missing SR Number."); } if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - END"); // Previously done in DEF file - moved to script oApp.SetProfileAttr("CTIRequestPreBooking","FALSE"); // Ensure script continues within CTI configuration... Outputs.SetProperty("Continue", "1"); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: " + e.toString()); } finally{ dNow = null; oBOAction = null; oBOSR = null; } }

CTI BS SCM
bsCloseCallbackActivity
function bsCloseCallbackActivity(Inputs, Outputs){ /******************************************************* ** Name: bsCloseCallbackActivity ** Created: 26.06.2012 ** Created By: TGDCRAN2 ******************************************************/ var oBOSR:BusObject; var oBOAction:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; var sSRNum:chars; var sActivityType:chars; var sActivitySubType:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sActivityType = Inputs.GetProperty("sActivityType"); sActivitySubType = Inputs.GetProperty("sActivitySubType"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sSRIntegrationId="+sSRNum); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sActivityType="+sActivityType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity sActivitySubType="+sActivitySubType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity bsUpdateCallbackActivity - SRNum = " + sSRNum ); if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ){ oBOSR = oApp.GetBusObject("Service Request"); oBOAction = oBOSR.GetBusComp("Action Clone SCM"); oBOAction.SetViewMode(AllView); oBOAction.InvokeMethod("SetAdminMode", "TRUE"); oBOAction.ClearToQuery(); oBOAction.SetSearchExpr("[Service Request Integration Id SCM]='" + sSRNum + "' AND [Type]='" + sActivityType + "' AND [Status]='Open'" ); oBOAction.ExecuteQuery(ForwardOnly); if (oBOAction.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity found Push Callback activity"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBOAction.SetFieldValue("Sub Type SCM", sActivitySubType); oBOAction.SetFieldValue("Done", sNow); oBOAction.SetFieldValue("Status", "Closed"); oBOAction.WriteRecord(); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: Push Callback activity record not found."); } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: Missing SR Number."); } if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - END"); // Previously done in DEF file - moved to script oApp.SetProfileAttr("CTIRequestPreBooking","FALSE"); // Ensure script continues within CTI configuration... Outputs.SetProperty("Continue", "1"); } catch(e){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCloseCallbackActivity - Error: " + e.toString()); } finally{ dNow = null; oBOAction = null; oBOSR = null; } }

CTI BS SCM
bsCreateCallbackActivity
function bsCreateCallbackActivity(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsCreateCallbackActivity ** Created: 26.06.2012 ** Created By: TGDCRAN2 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; var sSRNum:chars; var sActivityType:chars; var sActivitySubType:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sActivityType = Inputs.GetProperty("sActivityType"); sActivitySubType = Inputs.GetProperty("sActivitySubType"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sSRIntegrationId="+sSRNum); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sActivityType="+sActivityType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sActivitySubType="+sActivitySubType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - SRNum = " + sSRNum ); if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ){ oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Integration Id SCM", sSRNum); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - found SR"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter);; oBCAct.SetFieldValue("Type", sActivityType); oBCAct.SetFieldValue("Sub Type SCM", sActivitySubType); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Start Time", sNow); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - Error: SR record not found."); } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - Error: Missing SR Number."); } // Ensure script continues within CTI configuration... Outputs.SetProperty("Continue", "1"); if (bIsTraceOn) oApp.Trace("bsCreateCallbackActivity - END"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity ERROR:" + e.message); } finally{ dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
bsCreateCallbackActivity
function bsCreateCallbackActivity(Inputs, Outputs){ /******************************************************* ** Name: bsCreateCallbackActivity ** Created: 26.06.2012 ** Created By: TGDCRAN2 ******************************************************/ var oBOSR:BusObject; var oBCSRPush:BusComp; var oBCAct:BusComp; var sLogin:chars; var sNow:chars; var dNow:Date; var sSRNum:chars; var sActivityType:chars; var sActivitySubType:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sActivityType = Inputs.GetProperty("sActivityType"); sActivitySubType = Inputs.GetProperty("sActivitySubType"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sSRIntegrationId="+sSRNum); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sActivityType="+sActivityType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity sActivitySubType="+sActivitySubType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - SRNum = " + sSRNum ); if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ){ oBOSR = oApp.GetBusObject("Service Request"); oBCSRPush = oBOSR.GetBusComp("Service Request"); oBCAct = oBOSR.GetBusComp("Action Clone SCM"); oBCAct.SetViewMode(AllView); oBCSRPush.SetViewMode(AllView); oBCSRPush.ClearToQuery(); oBCSRPush.SetSearchSpec("Integration Id SCM", sSRNum); oBCSRPush.ExecuteQuery(ForwardOnly); if (oBCSRPush.FirstRecord()){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - found SR"); dNow = new Date(Clib.time() * 1000); sNow = Clib.rsprintf("%02d/%02d/%04d %02d:%02d:%02d", (dNow.getMonth() + 1), dNow.getDate(), dNow.getFullYear(), dNow.getHours(), dNow.getMinutes(), dNow.getSeconds()); oBCAct.NewRecord(NewAfter);; oBCAct.SetFieldValue("Type", sActivityType); oBCAct.SetFieldValue("Sub Type SCM", sActivitySubType); oBCAct.SetFieldValue("Primary Call Activity SCM", "N"); oBCAct.SetFieldValue("Start Time", sNow); oBCAct.SetFieldValue("Effective Date", sNow); oBCAct.SetFieldValue("Started", sNow); oBCAct.SetFieldValue("Done", sNow); oBCAct.SetFieldValue("Status", "Closed"); oBCAct.WriteRecord(); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - Error: SR record not found."); } } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity - Error: Missing SR Number."); } // Ensure script continues within CTI configuration... Outputs.SetProperty("Continue", "1"); if (bIsTraceOn) oApp.Trace("bsCreateCallbackActivity - END"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsCreateCallbackActivity ERROR:" + e.message); } finally{ dNow = null; oBCAct = null; oBCSRPush = null; oBOSR = null; } }

CTI BS SCM
bsEventEstablished
function bsEventEstablished(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsEventEstablished ** Created: 03.09.2002 ** Created By: EM ** Description: define the global variable ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var psInput:PropertySet; var strStart:Date; var aConnID:chars = ""; var aSubConnID:chars = ""; var aSysRefID:chars = ""; var aCLI:chars = ""; var aAccntId:chars = ""; var aMSISDN:chars = ""; var aCallType:chars = ""; var aCallTypeExt:chars = ""; var aIVRLanguage:chars = ""; var aBookmark:chars; var actDTMF:chars; var ACW:chars; var sCallbackFlag:chars = ""; var sPushSRId:chars = ""; var aShopBrokerId:chars = ""; var aRICORowId:chars = ""; var aRICOBC:chars = ""; var aRICODialNb:chars =""; var aRICODLogin:chars = ""; var sSysFpInteractionId:chars = ""; var sProp:chars = ""; var strSRRowId:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished START"); // 2008-11-03;tgdstre0; strStart = new Date(Clib.time() * 1000); oApp.SetProfileAttr("strStart", strStart); oApp.SetProfileAttr("strAnrufActiv", 1); oApp.SetProfileAttr("intNumberSR", 0); if (Inputs.PropertyExists("aConnID")){ aConnID = Inputs.GetProperty("aConnID"); oApp.SetProfileAttr("strConnID", aConnID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aConnID) = " + aConnID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aConnID) = empty"); oApp.SetProfileAttr("strConnID", ""); } // TGDMAEM1 3.9.13: Added for RICO if (Inputs.PropertyExists("aSubConnID")){ aSubConnID = Inputs.GetProperty("aSubConnID"); oApp.SetProfileAttr("strSubConnID", aSubConnID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSubConnID) = " + aSubConnID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSubConnID) = empty"); oApp.SetProfileAttr("strSubConnID", ""); } // TGDMAEM1 16.1.14: Added for RICO - defect 78508 if (Inputs.PropertyExists("aSysRefID")){ aSysRefID = Inputs.GetProperty("aSysRefID"); oApp.SetProfileAttr("aSysRefID", aSysRefID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSysRefID) = " + aSysRefID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSysRefID) = empty"); oApp.SetProfileAttr("aSysRefID", ""); } if (Inputs.PropertyExists("aCLI")){ aCLI = Inputs.GetProperty("aCLI"); oApp.SetProfileAttr("strCLI", aCLI); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCLI) = " + aCLI); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCLI) = empty"); oApp.SetProfileAttr("strCLI", ""); } if (Inputs.PropertyExists("aAccntId")){ aAccntId = Inputs.GetProperty("aAccntId"); oApp.SetProfileAttr("strAccntId", aAccntId); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aAccntId) = " + aAccntId); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aAccntId) = empty"); oApp.SetProfileAttr("strAccntId", ""); } if (Inputs.PropertyExists("aMSISDN")){ aMSISDN = Inputs.GetProperty("aMSISDN"); oApp.SetProfileAttr("strMSISDN", aMSISDN); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aMSISDN) = " + aMSISDN); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aMSISDN) = empty"); oApp.SetProfileAttr("strMSISDN", ""); } if (Inputs.PropertyExists("aCallType")){ aCallType = Inputs.GetProperty("aCallType"); oApp.SetProfileAttr("strCallType", aCallType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCallType) = " + aCallType); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCallType) = empty"); oApp.SetProfileAttr("strCallType", ""); } //WP8

CTI BS SCM
bsEventEstablished
function bsEventEstablished(Inputs, Outputs){ /******************************************************* ** Name: bsEventEstablished ** Created: 03.09.2002 ** Created By: EM ** Description: define the global variable ******************************************************/ var psInput:PropertySet; var strStart:Date; var aConnID:chars = ""; var aSubConnID:chars = ""; var aSysRefID:chars = ""; var aCLI:chars = ""; var aAccntId:chars = ""; var aMSISDN:chars = ""; var aCallType:chars = ""; var aCallTypeExt:chars = ""; var aIVRLanguage:chars = ""; var aBookmark:chars; var actDTMF:chars; var ACW:chars; var sCallbackFlag:chars = ""; var sPushSRId:chars = ""; var aShopBrokerId:chars = ""; var aRICORowId:chars = ""; var aRICOBC:chars = ""; var aRICODialNb:chars =""; var aRICODLogin:chars = ""; var sSysFpInteractionId:chars = ""; var sProp:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished START"); // 2008-11-03;tgdstre0; strStart = new Date(Clib.time() * 1000); oApp.SetProfileAttr("strStart", strStart); oApp.SetProfileAttr("strAnrufActiv", 1); oApp.SetProfileAttr("intNumberSR", 0); if (Inputs.PropertyExists("aConnID")){ aConnID = Inputs.GetProperty("aConnID"); oApp.SetProfileAttr("strConnID", aConnID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aConnID) = " + aConnID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aConnID) = empty"); oApp.SetProfileAttr("strConnID", ""); } // TGDMAEM1 3.9.13: Added for RICO if (Inputs.PropertyExists("aSubConnID")){ aSubConnID = Inputs.GetProperty("aSubConnID"); oApp.SetProfileAttr("strSubConnID", aSubConnID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSubConnID) = " + aSubConnID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSubConnID) = empty"); oApp.SetProfileAttr("strSubConnID", ""); } // TGDMAEM1 16.1.14: Added for RICO - defect 78508 if (Inputs.PropertyExists("aSysRefID")){ aSysRefID = Inputs.GetProperty("aSysRefID"); oApp.SetProfileAttr("aSysRefID", aSysRefID); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSysRefID) = " + aSysRefID); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aSysRefID) = empty"); oApp.SetProfileAttr("aSysRefID", ""); } if (Inputs.PropertyExists("aCLI")){ aCLI = Inputs.GetProperty("aCLI"); oApp.SetProfileAttr("strCLI", aCLI); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCLI) = " + aCLI); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCLI) = empty"); oApp.SetProfileAttr("strCLI", ""); } if (Inputs.PropertyExists("aAccntId")){ aAccntId = Inputs.GetProperty("aAccntId"); oApp.SetProfileAttr("strAccntId", aAccntId); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aAccntId) = " + aAccntId); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aAccntId) = empty"); oApp.SetProfileAttr("strAccntId", ""); } if (Inputs.PropertyExists("aMSISDN")){ aMSISDN = Inputs.GetProperty("aMSISDN"); oApp.SetProfileAttr("strMSISDN", aMSISDN); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aMSISDN) = " + aMSISDN); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aMSISDN) = empty"); oApp.SetProfileAttr("strMSISDN", ""); } if (Inputs.PropertyExists("aCallType")){ aCallType = Inputs.GetProperty("aCallType"); oApp.SetProfileAttr("strCallType", aCallType); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCallType) = " + aCallType); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablished (aCallType) = empty"); oApp.SetProfileAttr("strCallType", ""); } //WP855 - 01.02.2016 Voiceprint Performance issues fSendCallStatusMessage("1",oApp.GetProfileAttr("CTISearchResultSCM"),oApp.GetP

CTI BS SCM
bsEventEstablishedSearchCustomer
function bsEventEstablishedSearchCustomer(Inputs, Outputs){ var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sSR_Id:chars = ""; var sMSISDN:chars = ""; var sAsset_Id:chars = ""; // TSGGUJA1 12.01.09 new variable to store the asset recieved var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablishedSearchCustomer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn") if (aState == true){//Not Ready // No AutoAnswer } else { // 20041214 Modifed as part of v7.7 migration // if (bState == true) if (bState == false) { sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); // BEGIN TSGGUJA1 12.01.09 taking the asset id and sVDN sAsset_Id = Inputs.GetProperty("sAsset_Id"); if (Inputs.PropertyExists("sSysSRId")){ sSR_Id = Inputs.GetProperty("sSysSRId"); } else{ sSR_Id = null; } // Setting profile attribute of VDN for ePhinany if (Inputs.GetProperty("sVDN") == null || Inputs.GetProperty("sVDN") == "" || Inputs.GetProperty("sVDN")== "Not supplied"){ oApp.SetProfileAttr("sFXVDN", 0); } else{ oApp.SetProfileAttr("sFXVDN", Inputs.GetProperty("sVDN")); } // END TSGGUJA1 12.01.09 taking the asset id and sVDN sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); sInput.SetProperty("sAsset_Id",sAsset_Id); // TSGGUJA1 12.01.09 passing the asset id sInput.SetProperty("sSR_Id",sSR_Id); CustomerSearch(sInput); sInput = null; sOutput = null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablishedSearchCustomer ERROR:" + e.message); throw (e); } finally{ sCTI = null; sInput= null; sOutput=null; bsAnswerCall = null; //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review sAccount_Id = null; sMSISDN = null; sAsset_Id = null; sSR_Id = null; aState = null; bState = null; //END TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review } return; }

CTI BS SCM
bsEventEstablishedSearchCustomer
function bsEventEstablishedSearchCustomer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsEventEstablishedSearchCustomer ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sSR_Id:chars = ""; var sMSISDN:chars = ""; var sAsset_Id:chars = ""; // TSGGUJA1 12.01.09 new variable to store the asset recieved var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablishedSearchCustomer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn") if (aState == true){//Not Ready // No AutoAnswer if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablishedSearchCustomer NotReady END"); } else { // 20041214 Modifed as part of v7.7 migration // if (bState == true) if (bState == false) { sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); // BEGIN TSGGUJA1 12.01.09 taking the asset id and sVDN sAsset_Id = Inputs.GetProperty("sAsset_Id"); if (Inputs.PropertyExists("sSysSRId")){ sSR_Id = Inputs.GetProperty("sSysSRId"); } else{ sSR_Id = null; } // Setting profile attribute of VDN for ePhinany if (Inputs.GetProperty("sVDN") == null || Inputs.GetProperty("sVDN") == "" || Inputs.GetProperty("sVDN")== "Not supplied"){ oApp.SetProfileAttr("sFXVDN", 0); } else{ oApp.SetProfileAttr("sFXVDN", Inputs.GetProperty("sVDN")); } // END TSGGUJA1 12.01.09 taking the asset id and sVDN sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); sInput.SetProperty("sAsset_Id",sAsset_Id); // TSGGUJA1 12.01.09 passing the asset id sInput.SetProperty("sSR_Id",sSR_Id); CustomerSearch(sInput); sInput = null; sOutput = null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventEstablishedSearchCustomer ERROR:" + e.message); throw (e); } finally{ sCTI = null; sInput= null; sOutput=null; bsAnswerCall = null; //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review sAccount_Id = null; sMSISDN = null; sAsset_Id = null; sSR_Id = null; aState = null; bState = null; //END TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review } return; }

CTI BS SCM
bsEventReleased
function bsEventReleased(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsEventReleased ** Created: 26.08.2002 ** Created By: EM ** Description: Search all created activty during the last call and update the Calll Duration and status field (Done) ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var strStop:Date; var actDTMF:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased START") // 2008-11-03;tgdstre0; strStop = new Date(Clib.time() * 1000); //END TGDGOLU2 - November Consolidation oApp.SetProfileAttr("strStop",strStop); oApp.SetProfileAttr("strAnrufActiv", 0); //28.01.2015 WP855 Voicerpint oApp.SetProfileAttr("CTISearchResultSCM", ""); fSendCallStatusMessage("0","",""); CloseCallActivity(); Outputs.SetProperty("Continue",1); // BEGIN TSGGUJA1 12.01.09 Setting to 0 required profiles after call released oApp.SetProfileAttr("sWTime", 0); oApp.SetProfileAttr("sFXVDN", 0); // TGDMAEM1 09.12.14: MXC Footprint oApp.SetProfileAttr("sSysFpInteractionId",""); if (Inputs.PropertyExists("actDTMF")){ actDTMF = Inputs.GetProperty("actDTMF"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(actDTMF) = " + actDTMF); oApp.SetProfileAttr("actDTMF", actDTMF); } else{ if (bIsTraceOn) oApp.Trace("bsEventReleased(actDTMF) = empty"); } if (Inputs.PropertyExists("ACW")){ //actDTMF = Inputs.GetProperty("ACW"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(ACW) = ACW"); if(oApp.GetProfileAttr("AgentStatus")=="Not Ready"){ oApp.SetProfileAttr("ACW", ""); }else { oApp.SetProfileAttr("ACW", "ACW"); } } else { if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(ACW) = empty"); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased ERROR: " + e.message); throw e; } //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review finally{ strStop = null; actDTMF = null; } //END TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review return; }

CTI BS SCM
bsEventReleased
function bsEventReleased(Inputs, Outputs){ /******************************************************* ** Name: bsEventReleased ** Created: 26.08.2002 ** Created By: EM ** Description: Search all created activty during the ** last call and update the Calll Duration ** and status field (Done) ******************************************************/ var strStop:Date; var actDTMF:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased START") // 2008-11-03;tgdstre0; strStop = new Date(Clib.time() * 1000); //END TGDGOLU2 - November Consolidation oApp.SetProfileAttr("strStop",strStop); oApp.SetProfileAttr("strAnrufActiv", 0); //28.01.2015 WP855 Voicerpint oApp.SetProfileAttr("CTISearchResultSCM", ""); fSendCallStatusMessage("0","",""); CloseCallActivity(); Outputs.SetProperty("Continue",1); // BEGIN TSGGUJA1 12.01.09 Setting to 0 required profiles after call released oApp.SetProfileAttr("sWTime", 0); oApp.SetProfileAttr("sFXVDN", 0); // TGDMAEM1 09.12.14: MXC Footprint oApp.SetProfileAttr("sSysFpInteractionId",""); if (Inputs.PropertyExists("actDTMF")){ actDTMF = Inputs.GetProperty("actDTMF"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(actDTMF) = " + actDTMF); oApp.SetProfileAttr("actDTMF", actDTMF); } else{ if (bIsTraceOn) oApp.Trace("bsEventReleased(actDTMF) = empty"); } if (Inputs.PropertyExists("ACW")){ //actDTMF = Inputs.GetProperty("ACW"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(ACW) = ACW"); if(oApp.GetProfileAttr("AgentStatus")=="Not Ready"){ oApp.SetProfileAttr("ACW", ""); } else oApp.SetProfileAttr("ACW", "ACW"); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased(ACW) = empty"); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventReleased ERROR: " + e.message); throw e; } //BEGIN TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review finally{ strStop = null; actDTMF = null; } //END TGDGOLU2 - 18.02.2009 - CTI enhancement after Oracle expert review return; }

CTI BS SCM
bsEventRingingAutoAnswer
function bsEventRingingAutoAnswer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsEventRingingAutoAnswer ** Created: 03.09.2002 ** Created By: EM ** Description: Search and display the customer on the entry screen and then Answer the call ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ // search the customer var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sMSISDN:chars = ""; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingAutoAnswer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn") if (aState == true) {//Not Ready // No AutoAnswer } else{ // 20041214 Modifed as part of v7.7 migration // if (bState == true) if (bState == false) { sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); CustomerSearch(sInput); sInput = null; sOutput = null; // AnswerCall sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput = null; sOutput = null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingAutoAnswer ERROR:" + e.message); throw e; } finally{ sCTI=null; sInput=null; sOutput=null; bsAnswerCall=null; } return; }

CTI BS SCM
bsEventRingingAutoAnswer
function bsEventRingingAutoAnswer(Inputs, Outputs){ /******************************************************* ** Name: bsEventRingingAutoAnswer ** Created: 03.09.2002 ** Created By: EM ** Description: Search and display the customer on the ** entry screen and then Answer the call ******************************************************/ // search the customer var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sMSISDN:chars = ""; var bsAnswerCall:Service; var sCTI = oApp.GetCTIService(); var aState:bool; var bState:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingAutoAnswer START"); aState = sCTI.IsCommandChecked("ChangeNotReadyState"); bState = sCTI.IsCommandEnabled("LogIn") if (aState == true) {//Not Ready // No AutoAnswer } else{ // 20041214 Modifed as part of v7.7 migration // if (bState == true) if (bState == false) { sAccount_Id = Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); CustomerSearch(sInput); sInput = null; sOutput = null; // AnswerCall sInput = oApp.NewPropertySet(); sOutput = oApp.NewPropertySet(); bsAnswerCall = oApp.GetService("Communications Session Manager"); sInput.SetProperty("DeviceCommand","AnswerCall"); bsAnswerCall.InvokeMethod("InvokeCommand", sInput, sOutput); sInput = null; sOutput = null; } } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingAutoAnswer ERROR:" + e.message); throw e; } finally{ sCTI=null; sInput=null; sOutput=null; bsAnswerCall=null; } return; }

CTI BS SCM
bsEventRingingManualAnswer
function bsEventRingingManualAnswer(Inputs, Outputs){ /******************************************************* ** Name: bsEventRingingManualAnswer ** Created: 03.09.2002 ** Created By: EM ** Description: Search and display the customer on the ** entry screen ******************************************************/ // Search the customer var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sMSISDN:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingManualAnswer START"); sAccount_Id= Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); CustomerSearch(sInput); } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingManualAnswer ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; } return; }

CTI BS SCM
bsEventRingingManualAnswer
function bsEventRingingManualAnswer(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsEventRingingManualAnswer ** Created: 03.09.2002 ** Created By: EM ** Description: Search and display the customer on the entry screen ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ // Search the customer var sInput:PropertySet; var sOutput:PropertySet; var sAccount_Id:chars = ""; var sMSISDN:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingManualAnswer START"); sAccount_Id= Inputs.GetProperty("sAccount_Id"); sMSISDN = Inputs.GetProperty("sMSISDN"); sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",sAccount_Id); sInput.SetProperty("sMSISDN",sMSISDN); CustomerSearch(sInput); } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsEventRingingManualAnswer ERROR:" + e.message); throw e; } finally{ sInput = null; sOutput = null; } return; }

CTI BS SCM
bsFirstLevelTransfer
function bsFirstLevelTransfer(Inputs,Outputs){ /******************************************************* ** Name: bsFirstLevelTransfer ** Created: 30.03.2015 ** Created By: TGDMAEM1 ** Description: Created to handle screen pop to agent who does not have 1st-level entry view ** Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 *****************************************************/ var boAccount:BusObject; var bcAccount:BusComp; var varView:chars = ""; var sTransferRowId:chars = ""; var strLoginName:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer START"); if (Inputs.PropertyExists("aTransferRowId")){ sTransferRowId = Inputs.GetProperty("aTransferRowId"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer(aTransferRowId) = " + sTransferRowId); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer(aTransferRowId) = empty"); } //varView = "Account Entry View SCM"; boAccount = oApp.GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); if ( sTransferRowId.length > 0 ){ with (bcAccount){ ClearToQuery(); SetViewMode(OrganizationView); ActivateField("Comment SCM"); SetSearchSpec("Id", sTransferRowId); ExecuteQuery(ForwardBackward); if (FirstRecord()){ strLoginName = oApp.LoginName(); if ( fnIsFirstLevelAgent (strLoginName)){ varView = "MCE Homescreen View SCM"; } else{ varView = "Account Entry View SCM"; } oApp.GotoView(varView , boAccount ); } // else if no record found then we cannot populate screen for target agent } } // else if no RowID then we cannot populate screen for target agent } // try catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer ERROR:" + e.message); throw(e); } finally{ } }

CTI BS SCM
bsFirstLevelTransfer
function bsFirstLevelTransfer(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: bsFirstLevelTransfer ** Created: 30.03.2015 ** Created By: TGDMAEM1 ** Description: Created to handle screen pop to agent who does not have 1st-level entry view ** Updated: TAADEDA3-24.09.2015-WP-898 - MCE MyArea Homescreen Nov 15 ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing *****************************************************/ var boAccount:BusObject; var bcAccount:BusComp; var varView:chars = ""; var sTransferRowId:chars = ""; var strLoginName:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer START"); if (Inputs.PropertyExists("aTransferRowId")){ sTransferRowId = Inputs.GetProperty("aTransferRowId"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer(aTransferRowId) = " + sTransferRowId); } else{ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer(aTransferRowId) = empty"); } //varView = "Account Entry View SCM"; boAccount = oApp.GetBusObject("Account"); bcAccount = boAccount.GetBusComp("Account"); if ( sTransferRowId.length > 0 ){ with (bcAccount){ ClearToQuery(); SetViewMode(OrganizationView); ActivateField("Comment SCM"); SetSearchSpec("Id", sTransferRowId); ExecuteQuery(ForwardBackward); if (FirstRecord()){ strLoginName = oApp.LoginName(); if ( fnIsFirstLevelAgent (strLoginName)){ varView = "MCE Homescreen View SCM"; } else{ varView = "Account Entry View SCM"; } oApp.GotoView(varView , boAccount ); } // else if no record found then we cannot populate screen for target agent } } // else if no RowID then we cannot populate screen for target agent } // try catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsFirstLevelTransfer ERROR:" + e.message); throw(e); } finally{ } }

CTI BS SCM
bsForceNotReadyImmediate
function bsForceNotReadyImmediate(Inputs, Outputs){ var sConfigName:chars = ""; var sCTI; var svcCommClient:Service; var pIn:PropertySet; var pOut:PropertySet; var bVoiceLogInEnabled, bVoiceLogOutEnabled; var bVoiceNotReadyEnabled, bWorkitemNotReadyEnabled, bOutboundPreviewNotReadyEnabled; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate START"); if (Inputs.PropertyExists("aConfigurationName")){ sConfigName = Inputs.GetProperty("aConfigurationName"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: called for configuration " + sConfigName); if ( sConfigName.indexOf("NRAfterI") > 0 ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: executing"); svcCommClient = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); sCTI = oApp.GetCTIService(); bVoiceLogInEnabled = sCTI.IsCommandEnabled("LogIn"); bVoiceLogOutEnabled = sCTI.IsCommandEnabled("LogOut"); bVoiceNotReadyEnabled = sCTI.IsCommandEnabled("NotReady"); bWorkitemNotReadyEnabled = sCTI.IsCommandEnabled("@workitem@OpenMediaNotReady"); bOutboundPreviewNotReadyEnabled = sCTI.IsCommandEnabled("@outboundpreview@OpenMediaNotReady"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Button status: bVoiceLogInEnabled="+bVoiceLogInEnabled+" bVoiceLogOutEnabled="+bVoiceLogOutEnabled); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Button status: bVoiceNotReadyEnabled="+bVoiceNotReadyEnabled+" bWorkitemNotReadyEnabled="+bWorkitemNotReadyEnabled+" bOutboundPreviewNotReadyEnabled="+bOutboundPreviewNotReadyEnabled); if ( ( bVoiceLogInEnabled==false ) && ( bVoiceLogOutEnabled=true ) ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Executing NotReady command"); pIn.SetProperty("DeviceCommand", "NotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } if(bWorkitemNotReadyEnabled == true ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Executing @workitem@OpenMediaNotReady command"); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } if(bOutboundPreviewNotReadyEnabled == true){ if (bIsTraceOn) oApp.Trace("bsForceNotReadyImmediate: Executing @outboundpreview@OpenMediaNotReady command"); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } } } else{ // cnfiguration name parameter is supplied, therefore just pass through... } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate ERROR:" + e.message); throw(e); } finally{ svcCommClient = null; pIn = null; pOut = null; sCTI = null; } }

CTI BS SCM
bsForceNotReadyImmediate
function bsForceNotReadyImmediate(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsForceNotReadyImmediate ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sConfigName:chars = ""; var sCTI; var svcCommClient:Service; var pIn:PropertySet; var pOut:PropertySet; var bVoiceLogInEnabled, bVoiceLogOutEnabled; var bVoiceNotReadyEnabled, bWorkitemNotReadyEnabled, bOutboundPreviewNotReadyEnabled; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate START"); if (Inputs.PropertyExists("aConfigurationName")){ sConfigName = Inputs.GetProperty("aConfigurationName"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: called for configuration " + sConfigName); if ( sConfigName.indexOf("NRAfterI") > 0 ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: executing"); svcCommClient = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); sCTI = oApp.GetCTIService(); bVoiceLogInEnabled = sCTI.IsCommandEnabled("LogIn"); bVoiceLogOutEnabled = sCTI.IsCommandEnabled("LogOut"); bVoiceNotReadyEnabled = sCTI.IsCommandEnabled("NotReady"); bWorkitemNotReadyEnabled = sCTI.IsCommandEnabled("@workitem@OpenMediaNotReady"); bOutboundPreviewNotReadyEnabled = sCTI.IsCommandEnabled("@outboundpreview@OpenMediaNotReady"); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Button status: bVoiceLogInEnabled="+bVoiceLogInEnabled+" bVoiceLogOutEnabled="+bVoiceLogOutEnabled); if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Button status: bVoiceNotReadyEnabled="+bVoiceNotReadyEnabled+" bWorkitemNotReadyEnabled="+bWorkitemNotReadyEnabled+" bOutboundPreviewNotReadyEnabled="+bOutboundPreviewNotReadyEnabled); if ( ( bVoiceLogInEnabled==false ) && ( bVoiceLogOutEnabled=true ) ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Executing NotReady command"); pIn.SetProperty("DeviceCommand", "NotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } if(bWorkitemNotReadyEnabled == true ){ if (bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate: Executing @workitem@OpenMediaNotReady command"); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } if(bOutboundPreviewNotReadyEnabled == true){ if (bIsTraceOn) oApp.Trace("bsForceNotReadyImmediate: Executing @outboundpreview@OpenMediaNotReady command"); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCommClient.InvokeMethod("InvokeCommand",pIn,pOut); } } } else{ // cnfiguration name parameter is supplied, therefore just pass through... } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsForceNotReadyImmediate ERROR:" + e.message); throw(e); } finally{ svcCommClient = null; pIn = null; pOut = null; sCTI = null; } }

CTI BS SCM
bsHandleEventAgentNotReady
function bsHandleEventAgentNotReady(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsHandleEventAgentNotReady ** Created: ** Created By: ** Description: ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI; var pIn:PropertySet; var pOut:PropertySet; var sWorkMode:chars = ""; var sReasonCode:chars =""; var sReasonCode2:chars = ""; var sStatusTextMsg:chars = ""; var sPreBookingFlag:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsHandleEventAgentNotReady START"); sWorkMode = Inputs.GetProperty("WorkMode"); sReasonCode = Inputs.GetProperty("ReasonCode"); // ReasonCode set by Siebel has underscore (used to force to type string) sReasonCode2 = Inputs.GetProperty("ReasonCode2"); // When ReasonCode updated from VoiceInt, it appears without underscore sPreBookingFlag = oApp.GetProfileAttr("CTIRequestPreBooking"); if (sWorkMode.length>0){ oApp.SetProfileAttr("CTILastWorkMode",sWorkMode); } else{ // sWorkMode = oApp.GetProfileAttr("CTILastWorkMode"); } if (sReasonCode.length>0){ oApp.SetProfileAttr("CTILastReasonCode",sReasonCode); } else{ if (sReasonCode2.length>0){ oApp.SetProfileAttr("CTILastReasonCode",sReasonCode2); sReasonCode = sReasonCode2; } else { // sReasonCode = oApp.GetProfileAttr("CTILastReasonCode"); } } // Build message if ( sPreBookingFlag == "TRUE" ){ sStatusTextMsg = "SCM:Voice:NotReady:4:PreBooking"; } else{ sStatusTextMsg = "SCM:Voice:NotReady:" + sWorkMode + ":" + sReasonCode; } svcCTI = oApp.GetService("Communications Client") pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pIn.SetProperty("Text", sStatusTextMsg ); svcCTI.InvokeMethod("ShowStatusText", pIn, pOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsHandleEventAgentNotReady ERROR:" + e.message); throw(e); } finally{ pIn = null; pOut = null; svcCTI = null; } return; }

CTI BS SCM
bsHandleEventAgentNotReady
function bsHandleEventAgentNotReady(Inputs, Outputs){ /******************************************************* ** Name: bsHandleEventAgentNotReady ** Created: ** Created By: ** Description: ** Notes: (i) ******************************************************/ var svcCTI; var pIn:PropertySet; var pOut:PropertySet; var sWorkMode:chars = ""; var sReasonCode:chars =""; var sReasonCode2:chars = ""; var sStatusTextMsg:chars = ""; var sPreBookingFlag:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsHandleEventAgentNotReady START"); sWorkMode = Inputs.GetProperty("WorkMode"); sReasonCode = Inputs.GetProperty("ReasonCode"); // ReasonCode set by Siebel has underscore (used to force to type string) sReasonCode2 = Inputs.GetProperty("ReasonCode2"); // When ReasonCode updated from VoiceInt, it appears without underscore sPreBookingFlag = oApp.GetProfileAttr("CTIRequestPreBooking"); if (sWorkMode.length>0){ oApp.SetProfileAttr("CTILastWorkMode",sWorkMode); } else{ // sWorkMode = oApp.GetProfileAttr("CTILastWorkMode"); } if (sReasonCode.length>0){ oApp.SetProfileAttr("CTILastReasonCode",sReasonCode); } else{ if (sReasonCode2.length>0){ oApp.SetProfileAttr("CTILastReasonCode",sReasonCode2); sReasonCode = sReasonCode2; } else{ // sReasonCode = oApp.GetProfileAttr("CTILastReasonCode"); } } // Build message if ( sPreBookingFlag == "TRUE" ) { sStatusTextMsg = "SCM:Voice:NotReady:4:PreBooking"; } else{ sStatusTextMsg = "SCM:Voice:NotReady:" + sWorkMode + ":" + sReasonCode; } svcCTI = oApp.GetService("Communications Client") pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pIn.SetProperty("Text", sStatusTextMsg ); svcCTI.InvokeMethod("ShowStatusText", pIn, pOut); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsHandleEventAgentNotReady ERROR:" + e.message); throw(e); } finally{ pIn = null; pOut = null; svcCTI = null; } return; }

CTI BS SCM
bsHandleOpenMediaStatus
function bsHandleOpenMediaStatus(Inputs,Outputs) { /******************************************************* ** Name: bsHandleOpenMediaStatus ** Created: 12.04.2010 ** Created By: TGDCRAN2 ** Description: Needed to handle agent status changes for OpenMedia ** This is because Gplus driver does not support EventNotReadyForMedia/EventReadyForMedia ** Notes: (i) Inputs sCommands string Attached data string received looks like this: Commands = <@workitem@OpenMediaReady=16&@workitem@OpenMediaNotReady=18> ... ******************************************************/ var arrUserDataLookup:Array; var arrUserData:Array; var arrKV:Array; var pIn:PropertySet; var pOut:PropertySet; var sCommands:chars = ""; var sOpenMediaNotReadyPrev:chars = ""; var sOpenMediaReadyPrev:chars = ""; var sOpenMediaNotReadyNow:chars = ""; var sOpenMediaReadyNow:chars = ""; var sOpenMediaLoginNow:chars = ""; var sOpenMediaLoginPrev:chars = ""; var svcCTI; var sFlagReady:chars = ""; var sFlagLogin:chars = ""; var sStatusTextMsg:chars = ""; var sPreBookingFlag:chars = ""; var sAppletReasonCode:chars = ""; var sSuppressNRTMessages:chars = ""; var i:float = 0; var j:float = 0; var sKey:chars = ""; var sValue:chars = ""; var sCTI; var bState; try { if(bIsTraceOn)oApp.Trace(this.Name() + ".bsHandleOpenMediaStatus START"); arrUserDataLookup = new Array; sCommands = Inputs.GetProperty("sCommands"); sCommands = sCommands.substring(1,sCommands.length-1); // remove the leading '<' and trailing '>' arrUserData = sCommands.split("&"); // split into KV pairs for ( i = 0; i < arrUserData.length; i++ ) // for each KV pair... { arrKV = arrUserData[i].split("="); // split into the separate key and value strings sKey="KeyName"; sValue=""; for ( j = 0; j < arrKV.length; j++ ) { if (j==0) sKey = arrKV[j]; if (j==1) sValue = arrKV[j]; } arrUserDataLookup[sKey] = sValue; // create an indexed array --> example ... arrUserDataLookup["OpenMediaLogin"] } sOpenMediaReadyNow = arrUserDataLookup["@workitem@OpenMediaReady"]; sOpenMediaNotReadyNow = arrUserDataLookup["@workitem@OpenMediaNotReady"]; sOpenMediaLoginNow = arrUserDataLookup["OpenMediaLogin"]; sPreBookingFlag = oApp.GetProfileAttr("CTIRequestPreBooking"); if (sOpenMediaReadyNow == "undefined") { // Not been passed as part of this update } else { // Button status has been passed as part of this update ... so, work out if it has been changed... sOpenMediaReadyPrev = oApp.GetProfileAttr("sOpenMediaReadyPrev"); if ( sOpenMediaReadyNow != sOpenMediaReadyPrev ) { switch(sOpenMediaReadyNow) { case "16": oApp.SetProfileAttr("sOpenMediaAgentReady", "Y" ); sFlagReady = "Y"; break; case "18": oApp.SetProfileAttr("sOpenMediaAgentReady", "N" ); break; default: oApp.SetProfileAttr("sOpenMediaAgentReady", "" ); break; } oApp.SetProfileAttr("sOpenMediaReadyPrev", sOpenMediaReadyNow ); } // if its changed } if (sOpenMediaNotReadyNow == "undefined") { // Not been passed as part of this update } else { // Button status has been passed as part of this update ... so, work out if it has been changed... sOpenMediaNotReadyPrev = oApp.GetProfileAttr("sOpenMediaNotReadyPrev"); if ( sOpenMediaNotReadyNow != sOpenMediaNotReadyPrev ) { switch(sOpenMediaNotReadyNow) { case "16": oApp.SetProfileAttr("sOpenMediaAgentNotReady", "Y" ); sFlagReady = "N"; break; case "18": oApp.SetProfileAttr("sOpenMediaAgentNotReady", "N" ); break; default: oApp.SetProfileAttr("sOpenMediaAgentNotReady", "" );

CTI BS SCM
bsHandleOpenMediaStatus
function bsHandleOpenMediaStatus(Inputs:PropertySet,Outputs:PropertySet){ /******************************************************* ** Name: bsHandleOpenMediaStatus ** Created: 12.04.2010 ** Created By: TGDCRAN2 ** Description: Needed to handle agent status changes for OpenMedia ** This is because Gplus driver does not support EventNotReadyForMedia/EventReadyForMedia ** Notes:(i) Inputs sCommands string Attached data string received looks like this: Commands = <@workitem@OpenMediaReady=16&@workitem@OpenMediaNotReady=18> ... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var arrUserDataLookup:Array; var arrUserData:Array; var arrKV:Array; var pIn:PropertySet; var pOut:PropertySet; var sCommands:chars = ""; var sOpenMediaNotReadyPrev:chars = ""; var sOpenMediaReadyPrev:chars = ""; var sOpenMediaNotReadyNow:chars = ""; var sOpenMediaReadyNow:chars = ""; var sOpenMediaLoginNow:chars = ""; var sOpenMediaLoginPrev:chars = ""; var svcCTI:Service; var sFlagReady:chars = ""; var sFlagLogin:chars = ""; var sStatusTextMsg:chars = ""; var sPreBookingFlag:chars = ""; var sAppletReasonCode:chars = ""; var sSuppressNRTMessages:chars = ""; var i:float = 0; var j:float = 0; var sKey:chars = ""; var sValue:chars = ""; var sCTI; var bState; try{ if(bIsTraceOn)oApp.Trace(this.Name() + ".bsHandleOpenMediaStatus START"); arrUserDataLookup = new Array; sCommands = Inputs.GetProperty("sCommands"); sCommands = sCommands.substring(1,sCommands.length-1); // remove the leading '<' and trailing '>' arrUserData = sCommands.split("&"); // split into KV pairs for ( i = 0; i < arrUserData.length; i++ ){ // for each KV pair... arrKV = arrUserData[i].split("="); // split into the separate key and value strings sKey="KeyName"; sValue=""; for ( j = 0; j < arrKV.length; j++ ){ if (j==0) sKey = arrKV[j]; if (j==1) sValue = arrKV[j]; } arrUserDataLookup[sKey] = sValue; // create an indexed array --> example ... arrUserDataLookup["OpenMediaLogin"] } sOpenMediaReadyNow = arrUserDataLookup["@workitem@OpenMediaReady"]; sOpenMediaNotReadyNow = arrUserDataLookup["@workitem@OpenMediaNotReady"]; sOpenMediaLoginNow = arrUserDataLookup["OpenMediaLogin"]; sPreBookingFlag = oApp.GetProfileAttr("CTIRequestPreBooking"); if (sOpenMediaReadyNow == "undefined"){ // Not been passed as part of this update } else { // Button status has been passed as part of this update ... so, work out if it has been changed... sOpenMediaReadyPrev = oApp.GetProfileAttr("sOpenMediaReadyPrev"); if(sOpenMediaReadyNow != sOpenMediaReadyPrev ){ switch(sOpenMediaReadyNow){ case "16": oApp.SetProfileAttr("sOpenMediaAgentReady", "Y" ); sFlagReady = "Y"; break; case "18": oApp.SetProfileAttr("sOpenMediaAgentReady", "N" ); break; default: oApp.SetProfileAttr("sOpenMediaAgentReady", "" ); break; } oApp.SetProfileAttr("sOpenMediaReadyPrev", sOpenMediaReadyNow ); } // if its changed } if(sOpenMediaNotReadyNow == "undefined"){ // Not been passed as part of this update } else { // Button status has been passed as part of this update ... so, work out if it has been changed... sOpenMediaNotReadyPrev = oApp.GetProfileAttr("sOpenMediaNotReadyPrev"); if(sOpenMediaNotReadyNow != sOpenMediaNotReadyPrev ){ switch(sOpenMediaNotReadyNow){ case "16": oApp.SetProfileAttr("sOpenMediaAgentNotReady", "Y" ); sFlagReady = "N"; break; case "18": oApp.SetProfileAttr("sOpenMediaAgentNotReady", "N" ); break; default: oApp.SetProfileAttr("sOpenMediaAgentNotReady", "" ); break; } oApp.SetProfileAttr("sOpenMediaNotReadyPrev", sOpenMediaNotReadyNow ); } // if it's changed } if (sOpenMediaLoginNow == "undefined"){ // Not been passed as part of this update } else {

CTI BS SCM
bsMakeRecall
function bsMakeRecall(Inputs) { /******************************************************* ** Name: bsMakeRecall ** Created: 16.01.2003 ** Created By: EM ** Description: Call a number given in Input and ** adding a 0 at beginning to come out ** of the SCM Network ******************************************************/ var ctiservice; var sCallNum; oApp.Trace(" jgc: bsMakeRecall."); try { sCallNum = Inputs.GetProperty("sCallNum"); sCallNum = "00" + sCallNum; ctiservice = oApp.GetCTIService(); if (ctiservice != null) // CTI is enabled { ctiservice.InvokeCommand("MakeCall", sCallNum); } } catch (e) { throw e; } finally { ctiservice = null; } return; }

CTI BS SCM
bsMakeRecall
function bsMakeRecall(Inputs:PropertySet){ /******************************************************* ** Name: bsMakeRecall ** Created: 16.01.2003 ** Created By: EM ** Description: Call a number given in Input and adding a 0 at beginning to come out of the SCM Network ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var ctiservice; var sCallNum:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsMakeRecall START"); sCallNum = Inputs.GetProperty("sCallNum"); sCallNum = "00" + sCallNum; ctiservice = oApp.GetCTIService(); if (ctiservice != null){ // CTI is enabled ctiservice.InvokeCommand("MakeCall", sCallNum); } } catch (e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsMakeRecall ERROR:" + e.message); throw e; } finally{ ctiservice = null; } return; }

CTI BS SCM
bsMarkDoneSR
function bsMarkDoneSR (Inputs, Outputs) { /******************************************************* ** Name: bsMarkDoneSR ** Created: 27.03.2010 ** Created By: TGDCRAN2 ** Description: Mark WorkItemDone and update the SR Push Status ** Notes: (i) Inputs TrackingID and ThirdPartyId and Stop Queue ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sTrackingID:chars; var sSRId:chars; var sQueue:chars; var sPushId:chars; try { // Confirm mandatory parameters are passed... sTrackingID = Inputs.GetProperty("TrackingID"); if (sTrackingID == "" ) throw("TrackingID parameter is missing"); sSRId = Inputs.GetProperty("ThirdPartyId"); if (sSRId == "" ) throw("ThirdPartyId parameter is missing"); sQueue = Inputs.GetProperty("Queue"); if (sQueue == "" ) throw("Queue parameter is missing"); // Call OpenMediaPlaceInQueue Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sTrackingID ); pDataSet.SetProperty("Queue", sQueue); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaPlaceInQueue"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); sPushId = oApp.GetProfileAttr("PushId"); ClosePushActivity(sSRId, sPushId, sTrackingID); // Reset Profile Attr oApp.SetProfileAttr("PushActive", "N"); oApp.SetProfileAttr("PushId", ""); } catch(e) { oApp.Trace("CTI BS SCM.bsMarkDoneSR : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsMarkDoneSR
function bsMarkDoneSR (Inputs, Outputs){ /******************************************************* ** Name: bsMarkDoneSR ** Created: 27.03.2010 ** Created By: TGDCRAN2 ** Description: Mark WorkItemDone and update the SR Push Status ** Notes:(i) Inputs TrackingID and ThirdPartyId and Stop Queue ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sTrackingID:chars; var sSRId:chars; var sQueue:chars; var sPushId:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsMarkDoneSR START"); // Confirm mandatory parameters are passed... sTrackingID = Inputs.GetProperty("TrackingID"); if (sTrackingID == "" ) throw("TrackingID parameter is missing"); sSRId = Inputs.GetProperty("ThirdPartyId"); if (sSRId == "" ) throw("ThirdPartyId parameter is missing"); sQueue = Inputs.GetProperty("Queue"); if (sQueue == "" ) throw("Queue parameter is missing"); // Call OpenMediaPlaceInQueue Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sTrackingID ); pDataSet.SetProperty("Queue", sQueue); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaPlaceInQueue"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); sPushId = oApp.GetProfileAttr("PushId"); ClosePushActivity(sSRId, sPushId, sTrackingID); // Reset Profile Attr oApp.SetProfileAttr("PushActive", "N"); oApp.SetProfileAttr("PushId", ""); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsMarkDoneSR ERROR:" + e.message); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyOutboundPreview
function bsNotReadyOutboundPreview(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsNotReadyOutboundPreview ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsNotReadyOutboundPreview START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ){ sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsNotReadyOutboundPreview: Error = " + e.errText + " : " + e.toString()); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyOutboundPreview
function bsNotReadyOutboundPreview(Inputs, Outputs) { /******************************************************* ** Name: bsNotReadyOutboundPreview ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsNotReadyOutboundPreview : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyOutboundPreview_Param
function bsNotReadyOutboundPreview_Param(Inputs, Outputs) { /******************************************************* ** Name: bsNotReadyOutboundPreview ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; var sRealReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; sRealReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); if (Inputs.PropertyExists("ReasonCode") ) { sRealReasonCode = Inputs.GetProperty("ReasonCode"); } pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sRealReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsNotReadyOutboundPreview : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyOutboundPreview_Param
function bsNotReadyOutboundPreview_Param(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsNotReadyOutboundPreview ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; var sRealReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsNotReadyOutboundPreview_Param START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; sRealReasonCode = ""; if(Inputs.PropertyExists("_ReasonCode")){ sReasonCode = Inputs.GetProperty("_ReasonCode"); if (Inputs.PropertyExists("ReasonCode") ){ sRealReasonCode = Inputs.GetProperty("ReasonCode"); } pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sRealReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".bsNotReadyOutboundPreview_Param: Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyWorkitem
function bsNotReadyWorkitem(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsNotReadyWorkitem ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsNotReadyWorkitem START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ){ sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".bsNotReadyWorkitem: Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyWorkitem
function bsNotReadyWorkitem(Inputs, Outputs) { /******************************************************* ** Name: bsNotReadyWorkitem ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsNotReadyWorkitem : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyWorkitem_Param
function bsNotReadyWorkitem_Param(Inputs, Outputs) { /******************************************************* ** Name: bsNotReadyWorkitem ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; var sRealReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; sRealReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); if (Inputs.PropertyExists("ReasonCode") ) { sRealReasonCode = Inputs.GetProperty("ReasonCode"); } pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sRealReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsNotReadyWorkitem : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsNotReadyWorkitem_Param
function bsNotReadyWorkitem_Param(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsNotReadyWorkitem ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; var sRealReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsNotReadyWorkitem_Param START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; sRealReasonCode = ""; if(Inputs.PropertyExists("_ReasonCode")){ sReasonCode = Inputs.GetProperty("_ReasonCode"); if (Inputs.PropertyExists("ReasonCode")){ sRealReasonCode = Inputs.GetProperty("ReasonCode"); } pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sRealReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaNotReady"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn)oApp.Trace(this.Name() + ".bsNotReadyWorkitem_Param: ERROR: " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsOpenMediaReleasedPreview
function bsOpenMediaReleasedPreview(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsOpenMediaReleasedPreview ** Created: 26.06.2012 ** Created By: TGDCRAN2 ** Description: All OpenMediaRelease handlers for "outboundpreview" have been consolidated into this ** script. This is because of the added complexity of how the various Activity records are handled. ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sSRNum:chars = ""; var sQueue:chars = ""; var sConfiguration:chars = ""; var sRequestedPreBooking:chars = ""; var sRequestedReschedule:chars = ""; var sRequestedReject:chars = ""; var sRequestedCancel:chars = ""; var sCallReasonCode:chars = ""; var sNotReadyCommand:chars = ""; var sStatusTextMsg:chars = ""; var sNRAfterProfile:chars = ""; var sAttempts:chars = ""; var sMaxAttempts:chars = ""; var sCallbackAttempts:chars = ""; var sRetryAttempts:chars = ""; var iAttempts:float = 0; var iMaxAttempts:float = 0; var iCallbackAttempts:float = 0; var iRetryAttempts:float = 0; var bTakenBack:bool; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sQueue = Inputs.GetProperty("sQueue"); sConfiguration = Inputs.GetProperty("sConfiguration"); sAttempts = Inputs.GetProperty("sAttempts"); sMaxAttempts = Inputs.GetProperty("sMaxAttempts"); sRequestedPreBooking = oApp.GetProfileAttr("CTIRequestPreBooking"); sRequestedReschedule = oApp.GetProfileAttr("CTIRequestReschedule"); sRequestedReject = oApp.GetProfileAttr("CTIRejectedSRFlag"); sRequestedCancel = oApp.GetProfileAttr("CTICancelSRFlag"); sCallReasonCode = oApp.GetProfileAttr("CTICallReasonCode"); bTakenBack = false; sNRAfterProfile = ( sConfiguration.indexOf("NRAfter")>0 ? "TRUE" : "FALSE" ); if(bIsTraceOn){ oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sSysIntegrationID: " + sSRNum); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sQueue: " + sQueue); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sConfiguration: " + sConfiguration); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sAttempts: "+ sAttempts); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sMaxAttempts: " + sMaxAttempts); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sCallReasonCode: " + sCallReasonCode); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sRequestedPreBooking: " + sRequestedPreBooking); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sRequestedReschedule: " + sRequestedReschedule); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sRequestedReject: " + sRequestedReject); oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview sRequestedCancel: " + sRequestedCancel); } // Determine which Activity to update/create... if ((sRequestedReschedule=="TRUE")||(sRequestedReject=="TRUE")||(sRequestedCancel=="TRUE")){ if (sRequestedReschedule=="TRUE"){// Reschedule request requires new Activity if (bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview Create new reschedule activity"); Inputs.SetProperty("sActivityType","Push Callback"); Inputs.SetProperty("sActivitySubType","Rescheduled"); bsCreateCallbackActivity(Inputs, Outputs); } if (sRequestedReject=="TRUE"){// Rejected request requires new Activity if (bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReleasedPreview Create new rejected activity"); Inputs.SetProperty("sActivityType","Push Callback"); Inputs.SetProperty("sActivitySubType","Rejected"); bsCreateCallbackActivity(Inputs, Outputs); // Need to clear the "SR" message - CancelSRMessageDisplay sStatusTextMsg = "SCM:NRT:Ready"; } if (sRequestedCa

CTI BS SCM
bsOpenMediaReleasedPreview
function bsOpenMediaReleasedPreview(Inputs, Outputs) { /******************************************************* ** Name: bsOpenMediaReleasedPreview ** Created: 26.06.2012 ** Created By: TGDCRAN2 ** Description: All OpenMediaRelease handlers for "outboundpreview" have been consolidated into this ** script. This is because of the added complexity of how the various Activity records are handled. ******************************************************/ var boSR; var bcSR; var svcCTI; var pIn; var pOut; var pDataSet; var pInAct; var sSRNum; var sSRId; var sQueue; var sConfiguration; var sTrackingID; var sSRActivityType; var SRStatus; var sAccountId:chars; var sRequestedPreBooking; var sRequestedReschedule; var sRequestedReject; var sRequestedCancel; var sCallReasonCode; var sNotReadyCommand; var sStatusTextMsg; var sNRAfterProfile; var sAttempts; var sMaxAttempts; var iAttempts = 0, iMaxAttempts = 0; var bTakenBack; try { sSRNum = Inputs.GetProperty("sSysIntegrationID"); sQueue = Inputs.GetProperty("sQueue"); sConfiguration = Inputs.GetProperty("sConfiguration"); sAttempts = Inputs.GetProperty("sAttempts"); sMaxAttempts = Inputs.GetProperty("sMaxAttempts"); sRequestedPreBooking = oApp.GetProfileAttr("CTIRequestPreBooking"); sRequestedReschedule = oApp.GetProfileAttr("CTIRequestReschedule"); sRequestedReject = oApp.GetProfileAttr("CTIRejectedSRFlag"); sRequestedCancel = oApp.GetProfileAttr("CTICancelSRFlag"); sCallReasonCode = oApp.GetProfileAttr("CTICallReasonCode"); sNotReadyCommand = ""; sStatusTextMsg = ""; bTakenBack = false; sNRAfterProfile = ( sConfiguration.indexOf("NRAfter")>0 ? "TRUE" : "FALSE" ); if (bIsTraceOn) oApp.Trace ("bsOpenMediaReleasedPreview"); if (bIsTraceOn) oApp.Trace ("sSysIntegrationID="+sSRNum); if (bIsTraceOn) oApp.Trace ("sQueue="+sQueue); if (bIsTraceOn) oApp.Trace ("sConfiguration="+sConfiguration); if (bIsTraceOn) oApp.Trace ("sAttempts="+sAttempts); if (bIsTraceOn) oApp.Trace ("sMaxAttempts="+sMaxAttempts); if (bIsTraceOn) oApp.Trace ("sCallReasonCode="+sCallReasonCode); if (bIsTraceOn) oApp.Trace ("sRequestedPreBooking="+sRequestedPreBooking); if (bIsTraceOn) oApp.Trace ("sRequestedReschedule="+sRequestedReschedule); if (bIsTraceOn) oApp.Trace ("sRequestedReject="+sRequestedReject); if (bIsTraceOn) oApp.Trace ("sRequestedCancel="+sRequestedCancel); // Determine which Activity to update/create... if ((sRequestedReschedule=="TRUE")||(sRequestedReject=="TRUE")||(sRequestedCancel=="TRUE")) { if (sRequestedReschedule=="TRUE") // Reschedule request requires new Activity { if (bIsTraceOn) oApp.Trace ("Create new reschedule activity"); Inputs.SetProperty("sActivityType","Push Callback"); Inputs.SetProperty("sActivitySubType","Rescheduled"); bsCreateCallbackActivity(Inputs, Outputs); } if (sRequestedReject=="TRUE") // Rejected request requires new Activity { if (bIsTraceOn) oApp.Trace ("Create new rejected activity"); Inputs.SetProperty("sActivityType","Push Callback"); Inputs.SetProperty("sActivitySubType","Rejected"); bsCreateCallbackActivity(Inputs, Outputs); // Need to clear the "SR" message - CancelSRMessageDisplay // ????? sStatusTextMsg = "SCM:NRT:Ready"; } if (sRequestedCancel=="TRUE") // Rejected request requires new Activity { if (bIsTraceOn) oApp.Trace ("Cancel original activity"); Inputs.SetProperty("sActivityType","Push Callback"); Inputs.SetProperty("sActivitySubType","Cancelled"); bsCloseCallbackActivity(Inputs, Outputs); } } else { // check for SRs that have been taken back first... if ( sQueue != "__STOP__" ) { if (bIsTraceOn) oApp.Trace ("Record has been taken back - create new rejected activity"); Inputs

CTI BS SCM
bsOpenMediaReschedule
function bsOpenMediaReschedule(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsOpenMediaReschedule ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to reschedule functionality because of additional complexity to ** retrieve Commit Time, perform valdiation and automatically call MarkDone ** Notes: There are two calls to this business service. This is to try elongate the time between calling reschedule and MarkDone so agent has more chance to see the success "reschedule" message ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boActive:BusObject; var boSR:BusObject; var bcSR:BusComp; var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var dtNow:Date; var dtCommitTime:Date; var sSRId:chars = ""; var sCommitTime:chars = ""; var sStatusTextMsg:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); // (1) Set the flag to indicate Reschedule is requested... oApp.SetProfileAttr("CTIRequestReschedule","TRUE"); // (2) Retrieve the Reschedule Time This is based on Genesys Voice business service, method SentOCSRescheduleRequest Modified version due to valdiation of reschedule time sSRId = oApp.GetProfileAttr("CTIPushPreviewSRId"); // Try to get Commit Time from active busobject, if available... boActive = oApp.ActiveBusObject(); if (boActive != null){ bcSR = boActive.GetBusComp("Service Request"); if (bcSR != null){ sCommitTime = bcSR.GetFieldValue("Commit Time"); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule Retrieved Commit Time from Active BusObject - "+ sCommitTime); } } // Otherwise re-query SR to retrieve the Commit Time... if ( ( sCommitTime == "" ) && ( sSRId.length > 0 )){ // Did not retrieve COmmit Time from Active BusObject, therefore need to requery for it... boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Commit Time"); bcSR.SetSearchSpec("Id", sSRId); bcSR.ExecuteQuery(ForwardOnly); if ( bcSR.FirstRecord() ){ sCommitTime = bcSR.GetFieldValue("Commit Time"); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule Retrieved Commit Time from new instantiation of SR -" + sCommitTime); } } // (3) Validate the Commit Time if ( sCommitTime.length > 0 ){ dtNow = new Date(); dtCommitTime = new Date(sCommitTime); if (dtCommitTime>dtNow){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule Commit Time is in future - " + sCommitTime ); // Valid! } else { sStatusTextMsg = "Reschedule Date/Time must be in the future"; } } else { sStatusTextMsg = "Reschedule Date/Time could not be retrieved"; } // (4) Send the Reschedule Date/Time if ( sStatusTextMsg.length == "" ){ // if no errors so far, continue... if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule Sending RecordRescheduleWithArg Command"); pIn.SetProperty("RSTime", sCommitTime); svcCTI.InvokeMethod("RecordRescheduleWithArg",pIn,pOut); } // (5) Send Call Completion Stats to force Genesys call_result to "Unknown Call Result" Note: By setting profile attribute we automaticall trigger MarkDone like when MarkDone if ( sStatusTextMsg.length == ""){ // if no errors so far, continue... if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaReschedule Sending PushPreviewSendCallResultAfterReschedule Command"); pIn.Reset(); pOut.Reset(); svcCTI.InvokeMethod("PushPreviewSendCallResultAfterReschedule",pIn,pOut);

CTI BS SCM
bsOpenMediaReschedule
function bsOpenMediaReschedule(Inputs, Outputs) { /******************************************************* ** Name: bsOpenMediaReschedule ** Created: 27.06.2012 ** Created By: TGDCRAN2 ** Description: Scripted call to reschedule functionality because of additional complexity to ** retrieve Commit Time, perform valdiation and automatically call MarkDone ** Notes: There are two calls to this business service. This is to try elongate the time between ** calling reschedule and MarkDone so agent has more chance to see the success "reschedule" message ******************************************************/ var boActive; var boSR; var bcSR; var sSRId; var sCommitTime; var dtNow; var dtCommitTime; var sStatusTextMsg; var svcCTI; var pIn; var pOut; var pDataSet; try { if (bIsTraceOn) oApp.Trace ("***** bsOpenMediaReschedule"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sCommitTime = ""; sStatusTextMsg = ""; // (1) Set the flag to indicate Reschedule is requested... oApp.SetProfileAttr("CTIRequestReschedule","TRUE"); // (2) Retrieve the Reschedule Time // This is based on Genesys Voice business service, method SentOCSRescheduleRequest // Modified version due to valdiation of reschedule time sSRId = oApp.GetProfileAttr("CTIPushPreviewSRId"); // Try to get Commit Time from active busobject, if available... boActive = oApp.ActiveBusObject(); if (boActive != null) { bcSR = boActive.GetBusComp("Service Request"); if (bcSR != null) { sCommitTime = bcSR.GetFieldValue("Commit Time"); if (bIsTraceOn) oApp.Trace ("Retrieved Commit Time from Active BusObject - "+ sCommitTime); } } // Otherwise re-query SR to retrieve the Commit Time... if ( ( sCommitTime == "" ) && ( sSRId.length > 0 ) ) { // Did not retrieve COmmit Time from Active BusObject, therefore need to requery for it... boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Commit Time"); bcSR.SetSearchSpec("Id", sSRId); bcSR.ExecuteQuery(ForwardOnly); if ( bcSR.FirstRecord() ) { sCommitTime = bcSR.GetFieldValue("Commit Time"); if (bIsTraceOn) oApp.Trace ("Retrieved Commit Time from new instantiation of SR -" + sCommitTime); } } // (3) Validate the Commit Time if ( sCommitTime.length > 0 ) { dtNow = new Date(); dtCommitTime = new Date(sCommitTime); if (dtCommitTime>dtNow) { if (bIsTraceOn) oApp.Trace ("Commit Time is in future - " + sCommitTime ); // Valid! } else { sStatusTextMsg = "Reschedule Date/Time must be in the future"; } } else { sStatusTextMsg = "Reschedule Date/Time could not be retrieved"; } // (4) Send the Reschedule Date/Time if ( sStatusTextMsg.length == "" ) // if no errors so far, continue... { if (bIsTraceOn) oApp.Trace ("Sending RecordRescheduleWithArg Command"); pIn.SetProperty("RSTime", sCommitTime); svcCTI.InvokeMethod("RecordRescheduleWithArg",pIn,pOut); } // (5) Send Call Completion Stats to force Genesys call_result to "Unknown Call Result" // Note: By setting profile attribute we automaticall trigger MarkDone // like when MarkDone if ( sStatusTextMsg.length == "" ) // if no errors so far, continue... { if (bIsTraceOn) oApp.Trace ("Sending PushPreviewSendCallResultAfterReschedule Command"); pIn.Reset(); pOut.Reset(); svcCTI.InvokeMethod("PushPreviewSendCallResultAfterReschedule",pIn,pOut); } // (6) Send th

CTI BS SCM
bsOpenMediaSelected
function bsOpenMediaSelected (Inputs, Outputs) { /******************************************************* ** Name: bsOpenMediaSelected ** Created: 18.01.2008 ** Created By: TGDCRAN1 ** Description: Screen pop for inbound Service Request ** Notes: [27.03.2010] TGDCRAN2 - Revised for iWD [06.09.2011] TGDCRAN2 - add counter for agent summary ******************************************************/ var boSR; var bcSR; var svcCTI; var pIn; var pOut; var pDataSet; var pInAct; var sSRId; var sView; var sClosedErrMsg; var sTrackingID; var sSRActivityType; var sPushStatus; var SRStatus; var sAccountId:chars; var sPushId:chars; var sStatus_Work; var sStatus_Waiting; try { sSRId = Inputs.GetProperty("sThirdPartyId"); sView = Inputs.GetProperty("sViewName"); sClosedErrMsg = Inputs.GetProperty("sClosedErrMsg"); sTrackingID = Inputs.GetProperty("sTrackingID"); sSRActivityType = Inputs.GetProperty("sSRActivityType"); if ( sSRId != "" && sSRId != " " && sSRId != "0" ) { boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); // Set status Profile Attrs oApp.SetProfileAttr("PushSRId", sSRId); oApp.SetProfileAttr("PushActive", "Y"); // Query for SR bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Push Id SCM"); bcSR.ActivateField("Push Status CD SCM"); bcSR.ActivateField("Status"); bcSR.SetSearchSpec("Id", sSRId); bcSR.ExecuteQuery(ForwardBackward); if ( bcSR.FirstRecord() ) { sStatus_Waiting = oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WAITING"); sStatus_Work = oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WORK"); // SR found // First check the PushStatus. If the SR has been "pulled" since first being routed, then filter it out by displaying a message and not screen pop sPushStatus = bcSR.GetFieldValue("Push Status CD SCM"); SRStatus = bcSR.GetFieldValue("Status"); if( bIsTraceOn) oApp.Trace("CTI BS SCM.bsOpenMediaSelected : sPushStatus = " + sPushStatus + " / SRStatus = " + SRStatus); if ( ( sPushStatus != sStatus_Waiting && sPushStatus != sStatus_Work ) || SRStatus == "Closed" || SRStatus == "Cancelled") { // Mark it as done, call OpenMediaPlaceInQueue Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sTrackingID ); // TGDMAEM1 20.10.2011 Due to IWD 8, Replaced __STOP__ with iWD_Completed pDataSet.SetProperty("Queue", "iWD_Completed"); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaPlaceInQueue"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); // Reset Profile Attr oApp.SetProfileAttr("PushActive", "N"); // Notify the agent that the SR has been removed from his Toolbar pIn.Reset(); pOut.Reset(); pIn.SetProperty("Text",sClosedErrMsg); // Note: Message defined in CTI configuration svcCTI.InvokeMethod("ShowStatusText",pIn,pOut); } else { // SR Screenpop logic... // Update the Push Status bcSR.SetFieldValue("Push Status CD SCM", sStatus_Work); bcSR.WriteRecord(); // 2011-09-05; TGDSTRE0; iRMA v2 sAccountId = bcSR.GetFieldValue("Account Id"); sPushId = bcSR.GetFieldValue("Push Id SCM"); // 2010-07-06;TGDSTRE0; # 25350 - save PushId and update only if same oApp.SetProfileAttr("PushId", sPushId); CreatePushActivity(sSRId, sPushId, sAccountId, sTrackingID); // Invoke the take ownership script on the SR BusComp... bcSR.InvokeMethod("TakeOwnership"); // Increment counter for num

CTI BS SCM
bsOpenMediaSelected
function bsOpenMediaSelected (Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsOpenMediaSelected ** Created: 18.01.2008 ** Created By: TGDCRAN1 ** Description: Screen pop for inbound Service Request ** Notes: ** [27.03.2010] TGDCRAN2 - Revised for iWD ** [06.09.2011] TGDCRAN2 - add counter for agent summary ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boSR:BusObject; var bcSR:BusComp; var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sSRId:chars = ""; var sView:chars = ""; var sClosedErrMsg:chars = ""; var sTrackingID: chars = ""; var sSRActivityType:chars = ""; var sPushStatus: chars = ""; var SRStatus: chars = ""; var sAccountId:chars; var sPushId:chars; var sStatus_Work:chars; var sStatus_Waiting:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelected START"); sSRId = Inputs.GetProperty("sThirdPartyId"); sView = Inputs.GetProperty("sViewName"); sClosedErrMsg = Inputs.GetProperty("sClosedErrMsg"); sTrackingID = Inputs.GetProperty("sTrackingID"); sSRActivityType = Inputs.GetProperty("sSRActivityType"); if ( sSRId != "" && sSRId != " " && sSRId != "0" ){ boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); // Set status Profile Attrs oApp.SetProfileAttr("PushSRId", sSRId); oApp.SetProfileAttr("PushActive", "Y"); // Query for SR bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Push Id SCM"); bcSR.ActivateField("Push Status CD SCM"); bcSR.ActivateField("Status"); bcSR.SetSearchSpec("Id", sSRId); bcSR.ExecuteQuery(ForwardBackward); if ( bcSR.FirstRecord() ){ sStatus_Waiting = oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WAITING"); sStatus_Work = oApp.InvokeMethod ("LookupValue", "PUSH_STATUS_CD_SCM", "WORK"); // SR found First check the PushStatus. If the SR has been "pulled" since first being routed, then filter it out by displaying a message and not screen pop sPushStatus = bcSR.GetFieldValue("Push Status CD SCM"); SRStatus = bcSR.GetFieldValue("Status"); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelected sPushStatus = " + sPushStatus + " / SRStatus = " + SRStatus); if ((sPushStatus != sStatus_Waiting && sPushStatus != sStatus_Work ) || SRStatus == "Closed" || SRStatus == "Cancelled"){ // Mark it as done, call OpenMediaPlaceInQueue Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("TrackingID", sTrackingID ); // TGDMAEM1 20.10.2011 Due to IWD 8, Replaced __STOP__ with iWD_Completed pDataSet.SetProperty("Queue", "iWD_Completed"); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaPlaceInQueue"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); // Reset Profile Attr oApp.SetProfileAttr("PushActive", "N"); // Notify the agent that the SR has been removed from his Toolbar pIn.Reset(); pOut.Reset(); pIn.SetProperty("Text",sClosedErrMsg); // Note: Message defined in CTI configuration svcCTI.InvokeMethod("ShowStatusText",pIn,pOut); } else { // SR Screenpop logic...Update the Push Status bcSR.SetFieldValue("Push Status CD SCM", sStatus_Work); bcSR.WriteRecord(); // 2011-09-05; TGDSTRE0; iRMA v2 sAccountId = bcSR.GetFieldValue("Account Id"); sPushId = bcSR.GetFieldValue("Push Id SCM"); // 2010-07-06;TGDSTRE0; # 25350 - save PushId and update only if same oApp.SetProfileAttr("PushId", sPushId); CreatePushActivity(sSRId, sPushId, sAccountId, sTrackingID); // I

CTI BS SCM
bsOpenMediaSelectedITSM
function bsOpenMediaSelectedITSM (Inputs, Outputs) { /******************************************************* ** Name: bsOpenMediaSelectedITSM ** Created: 3.8.14 ** Created By: TGDMAEM1 ** Description: Screen pop for inbound ITSM Tickets ** Notes: ******************************************************/ //MANU var sIncId; var aAccntId; var aMSISDN; var sInput; var sAsset_Id; try { if (Inputs.PropertyExists("sIncId")) { sIncId = Inputs.GetProperty("sIncId"); oApp.SetProfileAttr("CTI_IncId",sIncId); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sIncId) = " + sIncId); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sIncId) = empty"); oApp.SetProfileAttr("CTI_IncId", ""); } if (Inputs.PropertyExists("aAccntId")) { aAccntId = Inputs.GetProperty("aAccntId"); oApp.SetProfileAttr("strAccntId", aAccntId); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aAccntId) = " + aAccntId); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aAccntId) = empty"); oApp.SetProfileAttr("strAccntId", ""); } if (Inputs.PropertyExists("aMSISDN")) { aMSISDN = Inputs.GetProperty("aMSISDN"); oApp.SetProfileAttr("strMSISDN", aMSISDN); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aMSISDN) = " + aMSISDN); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aMSISDN) = empty"); oApp.SetProfileAttr("strMSISDN", ""); } if (Inputs.PropertyExists("sAsset_Id")) { sAsset_Id = Inputs.GetProperty("sAsset_Id"); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sAsset_Id) = " + sAsset_Id); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sAsset_Id) = empty"); } sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",aAccntId); sInput.SetProperty("sMSISDN",aMSISDN); sInput.SetProperty("sITSM","Y"); sInput.SetProperty("sAsset_Id",sAsset_Id); CustomerSearch(sInput); sInput = null; // Set status Profile Attrs oApp.SetProfileAttr("PushSRId", sIncId); oApp.SetProfileAttr("PushActive", "Y"); fnIncrement("CTIAgent_NumNRT"); } catch(e) { oApp.Trace("CTI BS SCM.bsOpenMediaSelectedITSM : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { } return; }

CTI BS SCM
bsOpenMediaSelectedITSM
function bsOpenMediaSelectedITSM (Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsOpenMediaSelectedITSM ** Created: 3.8.14 ** Created By: TGDMAEM1 ** Description: Screen pop for inbound ITSM Tickets ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sIncId:chars = ""; var aAccntId:chars = ""; var aMSISDN:chars = ""; var sInput:PropertySet; var sAsset_Id:chars = ""; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedITSM START"); if (Inputs.PropertyExists("sIncId")){ sIncId = Inputs.GetProperty("sIncId"); oApp.SetProfileAttr("CTI_IncId",sIncId); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sIncId) = " + sIncId); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sIncId) = empty"); oApp.SetProfileAttr("CTI_IncId", ""); } if (Inputs.PropertyExists("aAccntId")){ aAccntId = Inputs.GetProperty("aAccntId"); oApp.SetProfileAttr("strAccntId", aAccntId); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aAccntId) = " + aAccntId); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aAccntId) = empty"); oApp.SetProfileAttr("strAccntId", ""); } if (Inputs.PropertyExists("aMSISDN")){ aMSISDN = Inputs.GetProperty("aMSISDN"); oApp.SetProfileAttr("strMSISDN", aMSISDN); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aMSISDN) = " + aMSISDN); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(aMSISDN) = empty"); oApp.SetProfileAttr("strMSISDN", ""); } if (Inputs.PropertyExists("sAsset_Id")){ sAsset_Id = Inputs.GetProperty("sAsset_Id"); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sAsset_Id) = " + sAsset_Id); } else { if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedITSM(sAsset_Id) = empty"); } sInput = oApp.NewPropertySet(); sInput.SetProperty("sAccount_Id",aAccntId); sInput.SetProperty("sMSISDN",aMSISDN); sInput.SetProperty("sITSM","Y"); sInput.SetProperty("sAsset_Id",sAsset_Id); CustomerSearch(sInput); sInput = null; // Set status Profile Attrs oApp.SetProfileAttr("PushSRId", sIncId); oApp.SetProfileAttr("PushActive", "Y"); fnIncrement("CTIAgent_NumNRT"); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedITSM Error = " + e.errText + " : " + e.toString() ); throw (e); } finally{ sInput = null; } return; }

CTI BS SCM
bsOpenMediaSelectedPreview
function bsOpenMediaSelectedPreview (Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsOpenMediaSelectedPreview ** Created: 30.06.2012 ** Created By: TGDCRAN2 ** Description: Called on "OpenMediaAccepted" event for all "outboundpreview" media type. ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boSR:BusObject; var bcSR:BusComp; var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sSRNum:chars; var sSRId:chars; var sView:chars; var sClosedErrMsg:chars; var sTrackingID:chars; var sSRActivityType:chars; var sCallbackAttempts:chars = ""; var SRStatus:chars; var sAccountId:chars; try{ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview START"); sSRNum = Inputs.GetProperty("sSysIntegrationID"); sView = Inputs.GetProperty("sViewName"); sClosedErrMsg = Inputs.GetProperty("sClosedErrMsg"); sTrackingID = Inputs.GetProperty("sTrackingID"); sSRActivityType = Inputs.GetProperty("sSRActivityType"); if (Inputs.PropertyExists("sCallbackAttempts")){ sCallbackAttempts = Inputs.GetProperty("sCallbackAttempts"); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview (sCallbackAttempts): " + sCallbackAttempts); } else { sCallbackAttempts = "0"; // default it to 0 if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview (sCallbackAttempts): empty/missing"); } oApp.SetProfileAttr("sCallbackAttempts", sCallbackAttempts); if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ){ boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); // Query for SR bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Status"); bcSR.ActivateField("Call Back Retry Count SCM"); bcSR.SetSearchSpec("Integration Id SCM", sSRNum); bcSR.ExecuteQuery(ForwardBackward); if (bcSR.FirstRecord()){ // SR found... sSRId = bcSR.GetFieldValue("Id"); // check SR status SRStatus = bcSR.GetFieldValue("Status"); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview : SRStatus = " + SRStatus); // Need to bypass an SR which is already Closed/Cancelled if((SRStatus != "Open") && (SRStatus != "Waiting") ){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview SR is in incorrect status for Push, therefore remove..."); // We need to send MarkDone to remove interaction svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); if(bIsTraceOn) oApp.Trace(this.Name() + ".bsOpenMediaSelectedPreview Sending Command - OpenMediaOcsRecordProcessed"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("GSW_TREATMENT", "RecordTreatCampaign" ); pDataSet.SetProperty("TrackingID", sTrackingID ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaOcsRecordProcessed"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); // Notify the agent that the SR has been removed from his Toolbar pIn.Reset(); pOut.Reset(); pIn.SetProperty("Text", sClosedErrMsg); // Note: Message defined in CTI configuration svcCTI.InvokeMethod("ShowStatusText",pIn,pOut); } else{ // Set flag to indicate we are handling a Push Preview oApp.SetProfileAttr("CTIPushPreviewActive","TRUE"); oApp.SetProfileAttr("CTIPushPreviewSRId",sSRId); oApp.SetProfileAttr("CTIPushPreviewRetryAttempts", bcSR.GetFieldValue("Call Back Retry Count SCM") ); // SO1599 TGDCRAN 02.12.2012 // SR Screenpop logic... sAccountId = bcSR.GetFieldValue("Account Id"); // Invoke the take ownership script on the SR BusComp... bcSR.InvokeMethod("TakeOwnership");

CTI BS SCM
bsOpenMediaSelectedPreview
function bsOpenMediaSelectedPreview (Inputs, Outputs) { /******************************************************* ** Name: bsOpenMediaSelectedPreview ** Created: 30.06.2012 ** Created By: TGDCRAN2 ** Description: Called on "OpenMediaAccepted" event for all "outboundpreview" media type. ** Notes: ******************************************************/ var boSR; var bcSR; var svcCTI; var pIn; var pOut; var pDataSet; var pInAct; var sSRNum; var sSRId; var sView; var sClosedErrMsg; var sTrackingID; var sSRActivityType; var sCallbackAttempts = ""; var SRStatus; var sAccountId:chars; try { sSRNum = Inputs.GetProperty("sSysIntegrationID"); sView = Inputs.GetProperty("sViewName"); sClosedErrMsg = Inputs.GetProperty("sClosedErrMsg"); sTrackingID = Inputs.GetProperty("sTrackingID"); sSRActivityType = Inputs.GetProperty("sSRActivityType"); // SO1599 TGDCRAN 02.12.2012 START if (Inputs.PropertyExists("sCallbackAttempts")) { sCallbackAttempts = Inputs.GetProperty("sCallbackAttempts"); if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedPreview(sCallbackAttempts) = " + sCallbackAttempts); } else { sCallbackAttempts = "0"; // default it to 0 if (bIsTraceOn) oApp.Trace("bsOpenMediaSelectedPreview(sCallbackAttempts) = empty/missing"); } oApp.SetProfileAttr("sCallbackAttempts", sCallbackAttempts); // END if ( sSRNum != "" && sSRNum != " " && sSRNum != "0" ) { boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); // Query for SR bcSR.ClearToQuery(); bcSR.SetViewMode(AllView); bcSR.ActivateField("Status"); bcSR.ActivateField("Call Back Retry Count SCM"); bcSR.SetSearchSpec("Integration Id SCM", sSRNum); bcSR.ExecuteQuery(ForwardBackward); if ( bcSR.FirstRecord() ) { // SR found... sSRId = bcSR.GetFieldValue("Id"); // check SR status SRStatus = bcSR.GetFieldValue("Status"); if( bIsTraceOn) oApp.Trace("CTI BS SCM.bsOpenMediaSelectedPreview : SRStatus = " + SRStatus); // Need to bypass an SR which is already Closed/Cancelled if ( (SRStatus != "Open") && (SRStatus != "Waiting") ) { if (bIsTraceOn) oApp.Trace ("SR is in incorrect status for Push, therefore remove..."); // We need to send MarkDone to remove interaction svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); if (bIsTraceOn) oApp.Trace ("Sending Command - OpenMediaOcsRecordProcessed"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("GSW_TREATMENT", "RecordTreatCampaign" ); pDataSet.SetProperty("TrackingID", sTrackingID ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "OpenMediaOcsRecordProcessed"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); // Notify the agent that the SR has been removed from his Toolbar pIn.Reset(); pOut.Reset(); pIn.SetProperty("Text", sClosedErrMsg); // Note: Message defined in CTI configuration svcCTI.InvokeMethod("ShowStatusText",pIn,pOut); } else { // Set flag to indicate we are handling a Push Preview oApp.SetProfileAttr("CTIPushPreviewActive","TRUE"); oApp.SetProfileAttr("CTIPushPreviewSRId",sSRId); oApp.SetProfileAttr("CTIPushPreviewRetryAttempts", bcSR.GetFieldValue("Call Back Retry Count SCM") ); // SO1599 TGDCRAN 02.12.2012 // SR Screenpop logic... sAccountId = bcSR.GetFieldValue("Account Id"); // Invoke the take ownership script on the SR BusComp... bcSR.InvokeMethod("TakeOwnership"); // Increment counter for number of NRTs processed fnIncrement("CTIAgent_NumNRT"); // Finally, scre

CTI BS SCM
bsPlayWhisperTone
function bsPlayWhisperTone (Inputs:PropertySet, Outputs:PropertySet) { /******************************************************* ** Name: bsPlayWhisperTone ** Created: 06.09.2011 ** Created By: TGDCRAN2 ** Description: Play Whisper Tone when receiving a NRT request ** Notes: Parameters(i) WhisperToneConfirm - LogicalTest to confirm playback, (ii) WhisperToneExt - Extension to play whisper ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sConfirm:chars; var sExtension:chars; var sLogin:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsPlayWhisperTone START"); sConfirm = Inputs.GetProperty("WhisperToneConfirm"); // Confirm whether we should play whisper tone... if ( sConfirm.toLowerCase == "true" ){ // Confirm mandatory parameters are passed... sExtension = Inputs.GetProperty("WhisperToneExt"); if (sExtension == "" ) throw("WhisperToneExt parameter is missing"); sLogin = Inputs.GetProperty("SysSymphonyLogin"); if (sLogin == "" ) throw("SysSymphonyLogin parameter is missing"); // Call MakeCall Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("PhoneNumber", sExtension ); pDataSet.SetProperty("SysSymphonyLogin", sLogin ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "MakeCall"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsPlayWhisperTone: Error: " + e.errText + " : " + e.toString() ); throw (e); } finally { svcCTI = null; pDataSet = null; pIn = null; pOut = null; } return; }

CTI BS SCM
bsPlayWhisperTone
function bsPlayWhisperTone (Inputs, Outputs) { /******************************************************* ** Name: bsPlayWhisperTone ** Created: 06.09.2011 ** Created By: TGDCRAN2 ** Description: Play Whisper Tone when receiving a NRT request ** Notes: Parameters (i) WhisperToneConfirm - LogicalTest to confirm playback (ii) WhisperToneExt - Extension to play whisper ******************************************************/ var svcCTI:Service; var pIn; var pOut; var pDataSet; var sConfirm; var sExtension; var sLogin; try { // Confirm whether we should play whisper tone... sConfirm = Inputs.GetProperty("WhisperToneConfirm"); if ( sConfirm.toLowerCase == "true" ) { // Confirm mandatory parameters are passed... sExtension = Inputs.GetProperty("WhisperToneExt"); if (sExtension == "" ) throw("WhisperToneExt parameter is missing"); sLogin = Inputs.GetProperty("SysSymphonyLogin"); if (sLogin == "" ) throw("SysSymphonyLogin parameter is missing"); // Call MakeCall Device Command svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); pDataSet.SetType("DataSet"); pDataSet.SetProperty("PhoneNumber", sExtension ); pDataSet.SetProperty("SysSymphonyLogin", sLogin ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "MakeCall"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } finally { svcCTI = null; pDataSet = null; pIn = null; pOut = null; } return; }

CTI BS SCM
bsReasonChangeForOutboundPreview
function bsReasonChangeForOutboundPreview(Inputs, Outputs) { /******************************************************* ** Name: bsReasonChangeForOutboundPreview ** Created By: TGDMAEM1 ** Description: Scripted call to OpenMediaChangeMediaStateReason because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaChangeMediaStateReason"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsReasonChangeForOutboundPreview : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsReasonChangeForOutboundPreview
function bsReasonChangeForOutboundPreview(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsReasonChangeForOutboundPreview ** Created By: TGDMAEM1 ** Description: Scripted call to OpenMediaChangeMediaStateReason because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsReasonChangeForOutboundPreview START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ){ sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@outboundpreview@OpenMediaChangeMediaStateReason"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsReasonChangeForOutboundPreview : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsReasonChangeForSR
function bsReasonChangeForSR(Inputs, Outputs) { /******************************************************* ** Name: bsReasonChangeForSR ** Created: 27.06.2012 ** Created By: TGDMAEM1 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes: (i) Inputs are passed from the NotReady group command... ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ) { sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaChangeMediaStateReason"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e) { oApp.Trace("CTI BS SCM.bsReasonChangeForSR : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsReasonChangeForSR
function bsReasonChangeForSR(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsReasonChangeForSR ** Created: 27.06.2012 ** Created By: TGDMAEM1 ** Description: Scripted call to OpenMediaNotReady because ReasonCode params differ to voice NotReady command ** Notes:(i) Inputs are passed from the NotReady group command... ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var svcCTI:Service; var pIn:PropertySet; var pOut:PropertySet; var pDataSet:PropertySet; var sReasonCode:chars; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsReasonChangeForSR START"); svcCTI = oApp.GetService("Communications Client"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); pDataSet = oApp.NewPropertySet(); sReasonCode = ""; if (Inputs.PropertyExists("_ReasonCode") ){ sReasonCode = Inputs.GetProperty("_ReasonCode"); pDataSet.SetType("DataSet"); pDataSet.SetProperty("ReasonCode", sReasonCode ); pDataSet.SetProperty("ReasonValue", sReasonCode ); pIn.AddChild(pDataSet); pIn.SetProperty("DeviceCommand", "@workitem@OpenMediaChangeMediaStateReason"); svcCTI.InvokeMethod("InvokeCommand",pIn,pOut); } } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsReasonChangeForSR : Error = " + e.errText + " : " + e.toString() ); throw (e); } finally { pDataSet = null; pOut = null; pIn = null; svcCTI = null; } return; }

CTI BS SCM
bsSetProfileAttr
function bsSetProfileAttr(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: bsSetProfileAttr ** Created: ** Created By: ** Description: ** Notes: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var sName:chars; var sValue:chars; var sContinue:chars; var arrKeys:Array; var arrValues:Array; try { if(bIsTraceOn) oApp.Trace(this.Name() + ".bsSetProfileAttr START"); sName = Inputs.GetProperty("Name"); sValue = Inputs.GetProperty("Value"); sContinue = Inputs.GetProperty("Continue"); if (sContinue=="") sContinue = "1"; arrKeys = new Array; arrValues = new Array; arrKeys = sName.split(","); // split into an array of Keys arrValues = sValue.split(","); // split into an array of Keys for ( var i = 0; i < arrKeys.length; i++ ){ // for each KV pair... oApp.SetProfileAttr(arrKeys[i],arrValues[i]); if (bIsTraceOn) oApp.Trace("CTI BS SCM.bsSetProfileAttr for " + arrKeys[i] + "=" + arrValues[i]); } Outputs.SetProperty("Result", sContinue); Outputs.SetProperty("Continue", sContinue); } catch(e){ if(bIsTraceOn) oApp.Trace(this.Name() + ".bsSetProfileAttr : Error: " + e.message); throw (e); } finally{ } return; }

CTI BS SCM
bsSetProfileAttr
function bsSetProfileAttr(Inputs, Outputs) { /******************************************************* ** Name: bsSetProfileAttr ** Created: ** Created By: ** Description: ** Notes: (i) ******************************************************/ var sName; var sValue; var sContinue; var arrKeys; var arrValues; try { sName = Inputs.GetProperty("Name"); sValue = Inputs.GetProperty("Value"); sContinue = Inputs.GetProperty("Continue"); if (sContinue=="") sContinue = "1"; arrKeys = new Array; arrValues = new Array; arrKeys = sName.split(","); // split into an array of Keys arrValues = sValue.split(","); // split into an array of Keys for ( var i = 0; i < arrKeys.length; i++ ) // for each KV pair... { oApp.SetProfileAttr(arrKeys[i],arrValues[i]); if (bIsTraceOn) oApp.Trace("Called CTI BS SCM.bsSetProfileAttr for " + arrKeys[i] + "=" + arrValues[i]); } Outputs.SetProperty("Result", sContinue); Outputs.SetProperty("Continue", sContinue); } // No catch block - just allow exceptions to propagate to the calling CTI configuration... finally { } return; }

CTI BS SCM
fCheckSRStatus
function fCheckSRStatus(strSRId:chars){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fCheckSRStatus ** Created: 09.01.2017 TAASAAI1 Aingeru Sabando SO-3495 ** Description: Get SR from the call context **************************************************************************************************************/ var oBCSR:BusComp; var strSRStatus:chars = ""; var bClosed:bool = true; if( bIsTraceOn) oApp.Trace(this.Name() + ".fCheckSRStatus START"); try{ oBCSR = oApp.GetBusObject("Account").GetBusComp("Service Request Performance SCM"); oBCSR.SetViewMode(AllView); oBCSR.ActivateField("Status LIC"); oBCSR.ClearToQuery(); oBCSR.SetSearchSpec("Id", strSRId); oBCSR.ExecuteQuery(ForwardOnly); if(oBCSR.FirstRecord()){ strSRStatus = oBCSR.GetFieldValue("Status LIC"); if( bIsTraceOn) oApp.Trace(this.Name() + ".fCheckSRStatus SRStatus: " + strSRStatus); if(strSRStatus != "Closed"){ bClosed = false; } } } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fCheckSRStatus" + e.message); throw(e); } finally{ oBCSR = null; strSRStatus = null; } return(bClosed); }

CTI BS SCM
fGetContextSRId
function fGetContextSRId(){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fGetContextSRId ** Created: 09.01.2017 TAASAAI1 Aingeru Sabando SO-3495 ** Description: Get SR from the call context **************************************************************************************************************/ var oBOActive:BusObject; var oBC:BusComp; var sBOName:chars = ""; var strSRId:chars = ""; if( bIsTraceOn) oApp.Trace(this.Name() + ".fGetContextSRId START"); try{ oBOActive = oApp.ActiveBusObject(); sBOName = oBOActive.Name(); if( bIsTraceOn) oApp.Trace(this.Name() + ".fGetContextSRId sBOName: " + sBOName); switch(sBOName){ case "Service Request": oBC = oBOActive.GetBusComp("Service Request"); try{ strSRId = oBC.GetFieldValue("Id"); } catch(e){ strSRId = ""; } break; case "Action": oBC = oBOActive.GetBusComp("Action"); try{ strSRId = oBC.GetFieldValue("Activity SR Id"); } catch(e){ strSRId = ""; } break; case "Order Entry (Sales)": oBC = oBOActive.GetBusComp("Order Entry - Orders"); try{ strSRId = oBC.GetFieldValue("Service Request Id"); } catch(e){ strSRId = ""; } break; case "Quote": oBC = oBOActive.GetBusComp("Quote"); try{ strSRId = oBC.GetFieldValue("Service Request Id"); } catch(e){ strSRId = ""; } break; default: strSRId = ""; break } if( bIsTraceOn) oApp.Trace(this.Name() + ".fGetContextSRId strSRId: " + strSRId); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fGetContextSRId" + e.message); throw(e); } finally{ oBC = null; oBOActive = null; } return(strSRId); }

CTI BS SCM
fSendCallStatusMessage
function fSendCallStatusMessage(strActiv,strCTISearch,strCallType){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fSendCallStatusMessage ** Created: 16.11.2015 TAASAAI1 Aingeru Sabando WP855 ** Description: Script validation **************************************************************************************************************/ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage START"); var psInput:PropertySet; var psOutput:PropertySet; var bsService:Service; var strMessage:chars = ""; try{ psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); bsService = oApp.GetService("Communications Client"); //CP Stands for Call Parameters; strMessage = "SCM:CP:" + strActiv +":" + strCTISearch + ":" + strCallType; if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage strMessage:" + strMessage); psInput.SetProperty("Text", strMessage); bsService.InvokeMethod("ShowStatusText", psInput, psOutput); if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage Call BS"); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage" + e.message); throw(e); } finally{ } }

CTI BS SCM
fSendCallStatusMessage
function fSendCallStatusMessage(strActiv,strCTISearch,strCallType){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fSendCallStatusMessage ** Created: 16.11.2015 TAASAAI1 Aingeru Sabando WP855 ** Description: Script validation **************************************************************************************************************/ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage START"); var psInput:PropertySet; var psOutput:PropertySet; var bsService:Service; var strMessage:chars = ""; try{ psInput = oApp.NewPropertySet(); psOutput = oApp.NewPropertySet(); bsService = oApp.GetService("Communications Client"); //CP Stands for Call Parameters; strMessage = "SCM:CP:" + strActiv +":" + strCTISearch + ":" + strCallType; if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage strMessage:" + strMessage); psInput.SetProperty("Text", strMessage); bsService.InvokeMethod("ShowStatusText", psInput, psOutput); if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage Call BS"); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSendCallStatusMessage" + e.message); throw(e); } finally{ } }

CTI BS SCM
fSimulateCall
function fSimulateCall(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fSendCallStatusMessage ** Created: 16.11.2015 TAASAAI1 Aingeru Sabando WP855 ** Description: Script validation **************************************************************************************************************/ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSimulateCall START"); var strStart:Date; try{ strStart = new Date(Clib.time() * 1000); oApp.SetProfileAttr("strStart", strStart); oApp.SetProfileAttr("strAnrufActiv", 1); fSendCallStatusMessage("1",oApp.GetProfileAttr("CTISearchResultSCM"),oApp.GetProfileAttr("strCallType")); CustomerSearch(Inputs); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSimulateCall" + e.message); throw(e); } finally{ strStart = null; } }

CTI BS SCM
fSimulateCall
function fSimulateCall(Inputs:PropertySet, Outputs:PropertySet){ /************************************************************************************************************** ** BS: BS CTI SCM ** Function: fSendCallStatusMessage ** Created: 16.11.2015 TAASAAI1 Aingeru Sabando WP855 ** Description: Script validation **************************************************************************************************************/ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSimulateCall START"); var strStart:Date; try{ strStart = new Date(Clib.time() * 1000); oApp.SetProfileAttr("strStart", strStart); oApp.SetProfileAttr("strAnrufActiv", 1); fSendCallStatusMessage("1",oApp.GetProfileAttr("CTISearchResultSCM"),oApp.GetProfileAttr("strCallType")); CustomerSearch(Inputs); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fSimulateCall" + e.message); throw(e); } finally{ strStart = null; } }

CTI BS SCM
fnApplyDialingRules
function fnApplyDialingRules (s) { if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at Status is" + s); // Only Decimal or +* s=s.replace(/[^\d+*]/g,""); if ( s.indexOf("+41") == 0 ) { s = "00" + s.substring(3); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+423") == 0 ) { s = "000423" + s.substring(4); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+99") == 0 ) { s = s.substring(3); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+") == 0 ) { s = "000" + s.substring(1); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("79") == 0 ) { s = "00" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("079") == 0 ) { s = "0" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } /* TGDMAEM1 - This rule is not good, deactivated. if ( s.indexOf("0") == 0 ) { s = "0" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } */ // No additional dialing filter found, just return if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); }

CTI BS SCM
fnApplyDialingRules
function fnApplyDialingRules (s) { if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at Status is" + s); // Only Decimal or +* s=s.replace(/[^\d+*]/g,""); if ( s.indexOf("+41") == 0 ) { s = "00" + s.substring(3); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+423") == 0 ) { s = "000423" + s.substring(4); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+99") == 0 ) { s = s.substring(3); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("+") == 0 ) { s = "000" + s.substring(1); if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("79") == 0 ) { s = "00" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } if ( s.indexOf("079") == 0 ) { s = "0" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } /* TGDMAEM1 - This rule is not good, deactivated. if ( s.indexOf("0") == 0 ) { s = "0" + s; if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); } */ // No additional dialing filter found, just return if( bIsTraceOn) oApp.Trace("MethodName : fnApplyDialingRules - Number at End is" + s); return (s); }

CTI BS SCM
fnEnhanceRicoData
function fnEnhanceRicoData(Inputs, Outputs) { // Inbound var sRICORowId; var sRICOBC; // Outbound var sAccountNum=""; var sSRIntegrationId=""; var sSRDomain=""; var sSRType=""; var sSourceSystem=""; var sRefNum=""; var sAssetIntegrationId=""; var sBPId=""; var sSRLang=""; var sAccountId=""; // Objects var bo; var bc; try { sRICORowId = Inputs.GetProperty("sRICORowId"); sRICOBC = Inputs.GetProperty("sRICOBC"); //Begin switch (sRICOBC) // BC Name { case "Account": // Return customer number for this ID bo = oApp.GetBusObject("Account"); bc = bo.GetBusComp("Account"); with (bc) { SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Account Nr."); sAccountId = sRICORowId; } } break; case "Asset Mgmt - Asset (Order Mgmt)": // Return customer number for this ID bo = oApp.GetBusObject("Asset Mgmt - Asset (Order Mgmt)"); bc = bo.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (bc) { ActivateField("Service Account Number SCM"); ActivateField("Service Account Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Service Account Number SCM"); sAccountId = GetFieldValue("Service Account Id"); } } break; case "Action": // Return SRIntegrationId, SRDomain, SRType, SourceSystem, Ref Number, SCN, AssetIntegrationId, SRLanguage bo = oApp.GetBusObject("Action EAI SCM"); bc = bo.GetBusComp("Action EAI SCM"); with (bc) { ActivateField("Activity SR Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sRICORowId = GetFieldValue("Activity SR Id"); } } // as all info comes from the SR, we search for the SR Id and then we execute the case "Service Request" // break; not wanted case "Service Request": // Return SRIntegrationId, SRDomain, SRType, SourceSystem, Ref Number, SCN, AssetIntegrationId, SRLanguage bo = oApp.GetBusObject("Service Request"); bc = bo.GetBusComp("Service Request"); with (bc) { ActivateField("Account Number"); //ActivateField("Area"); //ActivateField("Sub Area"); //ActivateField("Source System SCM"); //ActivateField("Reference Number SCM"); ActivateField("Integration Id SCM"); //ActivateField("Asset Integration Id"); //ActivateField("SR Language Name SCM"); //ActivateField("Billing Profile Integration Id SCM"); ActivateField("Account Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Account Number"); sSRIntegrationId=GetFieldValue("Integration Id SCM"); //sSRDomain=GetFieldValue("Area"); //sSRType=GetFieldValue("Sub Area"); //sSourceSystem=GetFieldValue("Source System SCM"); //sRefNum=GetFieldValue("Reference Number SCM"); //sAssetIntegrationId=GetFieldValue("Asset Integration Id"); //sBPId=GetFieldValue("Billing Profile Integration Id SCM"); //sSRLang=GetFieldValue("SR Language Name SCM"); sAccountId = GetFieldValue("Account Id"); } } break; default: break; } Outputs.SetProperty("sAccountNum", sAccountNum); Outputs.SetProperty("sSRIntegrationId", sSRIntegrationId); Outputs.SetProperty("sSRDomain", sSRDomain); Outputs.SetProperty("sSRType", sSRType); Outputs.SetProperty("sSourceSystem", sSourceSystem); Outputs.SetProperty("sRefNum", sRefNum); Outputs.SetProperty("sAssetIntegrationId", sAssetIntegrationId); Outputs.SetProperty

CTI BS SCM
fnEnhanceRicoData
function fnEnhanceRicoData(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fnEnhanceRicoData ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var bo:BusObject; var bc:BusComp; var sRICORowId:chars = ""; var sRICOBC:chars = ""; var sAccountNum:chars = ""; var sSRIntegrationId:chars = ""; var sAccountId:chars = ""; try{ sRICORowId = Inputs.GetProperty("sRICORowId"); sRICOBC = Inputs.GetProperty("sRICOBC"); //Begin switch (sRICOBC){ // BC Name case "Account": // Return customer number for this ID bo = oApp.GetBusObject("Account"); bc = bo.GetBusComp("Account"); with (bc){ SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Account Nr."); sAccountId = sRICORowId; } } break; case "Asset Mgmt - Asset (Order Mgmt)": // Return customer number for this ID bo = oApp.GetBusObject("Asset Mgmt - Asset (Order Mgmt)"); bc = bo.GetBusComp("Asset Mgmt - Asset (Order Mgmt)"); with (bc){ ActivateField("Service Account Number SCM"); ActivateField("Service Account Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Service Account Number SCM"); sAccountId = GetFieldValue("Service Account Id"); } } break; case "Action": // Return SRIntegrationId, SRDomain, SRType, SourceSystem, Ref Number, SCN, AssetIntegrationId, SRLanguage bo = oApp.GetBusObject("Action EAI SCM"); bc = bo.GetBusComp("Action EAI SCM"); with (bc){ ActivateField("Activity SR Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sRICORowId = GetFieldValue("Activity SR Id"); } } // as all info comes from the SR, we search for the SR Id and then we execute the case "Service Request" // break; not wanted case "Service Request": // Return SRIntegrationId, SRDomain, SRType, SourceSystem, Ref Number, SCN, AssetIntegrationId, SRLanguage bo = oApp.GetBusObject("Service Request"); bc = bo.GetBusComp("Service Request"); with (bc){ ActivateField("Account Number"); ActivateField("Integration Id SCM"); ActivateField("Account Id"); SetViewMode(AllView); ClearToQuery(); SetSearchSpec( "Id", sRICORowId ); ExecuteQuery(ForwardBackward); if (FirstRecord()){ sAccountNum = GetFieldValue("Account Number"); sSRIntegrationId=GetFieldValue("Integration Id SCM"); sAccountId = GetFieldValue("Account Id"); } } break; default: break; } Outputs.SetProperty("sAccountNum",sAccountNum); Outputs.SetProperty("sSRIntegrationId", sSRIntegrationId); Outputs.SetProperty("sAccountId", sAccountId); Outputs.SetProperty("sRefNum",""); Outputs.SetProperty("sSRDomain",""); Outputs.SetProperty("sSRType",""); Outputs.SetProperty("sSourceSystem", ""); Outputs.SetProperty("sAssetIntegrationId", ""); Outputs.SetProperty("sBPId", ""); Outputs.SetProperty("sSRLang", ""); } finally { bc = null; bo = null; } return; }

CTI BS SCM
fnIncrement
function fnIncrement (sProfileAttrName) { if ( sProfileAttrName != "" ) { var iNum = 0; var sNum = TheApplication().GetProfileAttr(sProfileAttrName); if ( !isNaN(sNum) ) // Note: if the conversion fails then iNum=0 is used { iNum = ToInteger(sNum); } iNum++; TheApplication().SetProfileAttr(sProfileAttrName, iNum); } return(CancelOperation); }

CTI BS SCM
fnIncrement
function fnIncrement (sProfileAttrName) { if ( sProfileAttrName != "" ) { var iNum = 0; var sNum = TheApplication().GetProfileAttr(sProfileAttrName); if ( !isNaN(sNum) ) // Note: if the conversion fails then iNum=0 is used { iNum = ToInteger(sNum); } iNum++; TheApplication().SetProfileAttr(sProfileAttrName, iNum); } return(CancelOperation); }

CTI BS SCM
fnIsFirstLevelAgent
function fnIsFirstLevelAgent (sLoginName) { /******************************************************* ** Name: fnIsFirstLevelAgent ** Created: 30.03.2015 ** Created By: TGDMAEM1 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ** Resp: SCM MCE Homescreen ******************************************************/ var objApp; var boUser; var bcUser; var bcResp; var bHasFirstLevelResp; var sHasFirstLevelResp; try { objApp = TheApplication(); bHasFirstLevelResp = false; sHasFirstLevelResp = objApp.GetProfileAttr("CTI_FIRSTLEVELAGENT"); switch (sHasFirstLevelResp.toUpperCase() ) { case "TRUE": bHasFirstLevelResp = true; break; case "FALSE": bHasFirstLevelResp = false; break; default: // ProfileAttr not been set yet, so do a one-time lookup.... boUser = objApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", sLoginName ); bcUser.ExecuteQuery(); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM MCE Homescreen"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord() ) { // found responsibility therefore he is a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "TRUE"); bHasFirstLevelResp = true; } else { // no responsibility therefore he is not a 1st level agent objApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "FALSE"); bHasFirstLevelResp = false; } break; } // switch return( bHasFirstLevelResp ); } // no catch block required --> exceptions should propagate to the calling function finally { bcResp = null; bcUser = null; boUser = null; objApp = null; } }

CTI BS SCM
fnIsFirstLevelAgent
function fnIsFirstLevelAgent (sLoginName:chars){ /******************************************************* ** Name: fnIsFirstLevelAgent ** Created: 30.03.2015 ** Created By: TGDMAEM1 ** Description: Created for SO1835 to distinguish 1st-level agents for different call handling ** Resp: SCM MCE Homescreen ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boUser:BusObject; var bcUser:BusComp; var bcResp:BusComp; var sHasFirstLevelResp:chars; var bHasFirstLevelResp:bool; try{ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnIsFirstLevelAgent START"); bHasFirstLevelResp = false; sHasFirstLevelResp = oApp.GetProfileAttr("CTI_FIRSTLEVELAGENT"); switch (sHasFirstLevelResp.toUpperCase()){ case "TRUE": bHasFirstLevelResp = true; break; case "FALSE": bHasFirstLevelResp = false; break; default: // ProfileAttr not been set yet, so do a one-time lookup.... boUser = oApp.GetBusObject("Users"); bcUser = boUser.GetBusComp("User"); bcUser.SetViewMode(AllView); bcUser.ClearToQuery(); bcUser.SetSearchSpec("Login Name", sLoginName ); bcUser.ExecuteQuery(ForwardOnly); bcResp = bcUser.GetMVGBusComp("Responsibility"); bcResp.SetSearchSpec("Name", "SCM MCE Homescreen"); bcResp.ExecuteQuery("ForwardOnly"); if ( bcResp.FirstRecord()){ // found responsibility therefore he is a 1st level agent oApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "TRUE"); bHasFirstLevelResp = true; } else { // no responsibility therefore he is not a 1st level agent oApp.SetProfileAttr("CTI_FIRSTLEVELAGENT", "FALSE"); bHasFirstLevelResp = false; } break; } // switch } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnIsFirstLevelAgent ERROR: " + e.message); throw(e); } finally{ bcResp = null; bcUser = null; boUser = null; } return( bHasFirstLevelResp ); }

CTI BS SCM
fnRICOAsynchCall
function fnRICOAsynchCall(aRICORowId:chars, aRICOBC:chars, aRICODialNb:chars, aRICODLogin:chars, aConnID:chars, strStart:Date){ /******************************************************* ** Name: OpenSearchCenter ** Created: ** Created By: ** Description: ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var oBS:Service; var psWorkflowIn:PropertySet; var psWorkflowOut:PropertySet; var psWorkflowChildIn:PropertySet; var dStart:Date; var dateForm:chars; var timeForm:chars = ""; var strhours:chars = ""; var strminutes:chars = ""; var strseconds:chars = ""; var lenhours:float; var lenminutes:float; var lenseconds:float; try{ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnRICOAsynchCall START"); if ( aRICORowId != "" && aRICORowId != " " && aRICORowId != "0" && aRICORowId != null ){// only if RowId is known it make sense to continue dStart = new Date(strStart); dateForm = (dStart.getMonth() + 1) + "/" + dStart.getDate() + "/" + dStart.getFullYear(); lenhours = dStart.getHours().toString().length; lenminutes = dStart.getMinutes().toString().length; lenseconds = dStart.getSeconds().toString().length; if (lenhours == 1){ strhours = "0" + dStart.getHours().toString(); } else { strhours = dStart.getHours().toString(); } if (lenminutes == 1){ strminutes = "0" + dStart.getMinutes().toString(); } else { strminutes = dStart.getMinutes().toString(); } if (lenseconds == 1) { strseconds = "0" + dStart.getSeconds().toString(); } else { strseconds = dStart.getSeconds().toString(); } timeForm = dateForm + " " + strhours + ":" + strminutes + ":" + strseconds; if( bIsTraceOn) oApp.Trace(this.Name() + ".fnRICOAsynchCall dateForm: " + dateForm + " - timeForm: " + timeForm); oBS = oApp.GetService("Asynchronous Server Requests"); psWorkflowChildIn = oApp.NewPropertySet(); psWorkflowIn = oApp.NewPropertySet(); psWorkflowOut = oApp.NewPropertySet(); psWorkflowChildIn.SetProperty("ProcessName", "RICO Outbound Call Wrapper SCM"); psWorkflowChildIn.SetProperty("context", "Outbound"); psWorkflowChildIn.SetProperty("RICORowId", aRICORowId); psWorkflowChildIn.SetProperty("RICOBC", aRICOBC); psWorkflowChildIn.SetProperty("RICODialNb", aRICODialNb); psWorkflowChildIn.SetProperty("RICODLogin", aRICODLogin); psWorkflowChildIn.SetProperty("ConnID", aConnID); psWorkflowChildIn.SetProperty("strStart", timeForm); with (psWorkflowIn){ SetProperty("Component", "WfProcMgr"); SetProperty("DelAmount", "0"); SetProperty("DelUnits", "ASAP"); AddChild(psWorkflowChildIn); } oBS.InvokeMethod("SubmitRequest", psWorkflowIn,psWorkflowOut); } } catch (e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnRICOAsynchCall ERROR: " + e.message); throw(e); } finally{ psWorkflowIn = null; psWorkflowOut = null; psWorkflowChildIn = null; oBS = null; dStart = null; } }

CTI BS SCM
fnRICOAsynchCall
function fnRICOAsynchCall(aRICORowId, aRICOBC, aRICODialNb, aRICODLogin, aConnID, strStart) { var oBS; var psWorkflowIn; var psWorkflowOut; var psWorkflowChildIn; var dStart; var dateForm; var strhours = ""; var strminutes = ""; var strseconds = ""; var lenhours; var lenminutes; var lenseconds; var timeForm; try { if ( aRICORowId != "" && aRICORowId != " " && aRICORowId != "0" && aRICORowId != null ) { // only if RowId is known it make sense to continue dStart = new Date(strStart); dateForm = (dStart.getMonth() + 1) + "/" + dStart.getDate() + "/" + dStart.getFullYear(); lenhours = dStart.getHours().toString().length; lenminutes = dStart.getMinutes().toString().length; lenseconds = dStart.getSeconds().toString().length; if (lenhours == 1) { strhours = 0 + dStart.getHours().toString(); } else { strhours = dStart.getHours().toString(); } if (lenminutes == 1) { strminutes = 0 + dStart.getMinutes().toString(); } else { strminutes = dStart.getMinutes().toString(); } if (lenseconds == 1) { strseconds = 0 + dStart.getSeconds().toString(); } else { strseconds = dStart.getSeconds().toString(); } timeForm = dateForm + " " + strhours + ":" + strminutes + ":" + strseconds; oBS = TheApplication().GetService("Asynchronous Server Requests"); psWorkflowChildIn = TheApplication().NewPropertySet(); psWorkflowIn = TheApplication().NewPropertySet(); psWorkflowOut = TheApplication().NewPropertySet(); psWorkflowChildIn.SetProperty("ProcessName", "RICO Outbound Call Wrapper SCM"); psWorkflowChildIn.SetProperty("context", "Outbound"); psWorkflowChildIn.SetProperty("RICORowId", aRICORowId); psWorkflowChildIn.SetProperty("RICOBC", aRICOBC); psWorkflowChildIn.SetProperty("RICODialNb", aRICODialNb); psWorkflowChildIn.SetProperty("RICODLogin", aRICODLogin); psWorkflowChildIn.SetProperty("ConnID", aConnID); psWorkflowChildIn.SetProperty("strStart", timeForm); with (psWorkflowIn) { SetProperty("Component", "WfProcMgr"); SetProperty("DelAmount", "0"); SetProperty("DelUnits", "ASAP"); AddChild(psWorkflowChildIn); } oBS.InvokeMethod("SubmitRequest", psWorkflowIn,psWorkflowOut); } } catch (e) { } finally { psWorkflowIn = null; psWorkflowOut = null; psWorkflowChildIn = null; oBS = null; dStart = null; } }

CTI BS SCM
fnResubmitFailedRouteRequests
function fnResubmitFailedRouteRequests(Inputs, Outputs) { /******************************************************* ** Name: fnResubmitFailedRouteRequests ** Created: 15.02.2008 ** Created By: TGDCRAN1 ** Description: Resubmit any failed route requests. ** Notes: New workflow process to interface to Genesys CTI to create routing requests for any SR record that previously failed. If a previous route request failed, then the Genesys Itx Id SCM field contains the string ERROR followed by the error code returned from Genesys ******************************************************/ try { var boSR; var bcSR; var svc; var pIn; var pOut; var bFound; var nCount = 0; svc = TheApplication().GetService("Workflow Process Manager"); pIn = TheApplication().NewPropertySet(); pOut = TheApplication().NewPropertySet(); boSR = TheApplication().GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); bcSR.SetViewMode(AllView); bcSR.ClearToQuery(); bcSR.SetSearchExpr("[Genesys Itx Id SCM] LIKE 'ERROR*'"); bcSR.SetSortSpec("Created (ASCENDING)"); bcSR.ExecuteQuery(ForwardOnly); bFound = bcSR.FirstRecord(); while (bFound) { pIn.Reset(); pOut.Reset(); pIn.SetProperty("ProcessName","Genesys Route Request SCM"); pIn.SetProperty("RowId", bcSR.GetFieldValue("Id") ); pIn.SetProperty("NRT Re-routing Flag", "N" ); svc.InvokeMethod("RunProcess",pIn,pOut); nCount = nCount + 1; bFound = bcSR.NextRecord(); } Outputs.SetProperty("Result", "Resubmitted " + nCount + " Service Request records"); } // no catch block required --> expections should propagate to the calling fucntion finally { bcSR = null; boSR = null; pIn = null; pOut = null; svc = null; } }

CTI BS SCM
fnResubmitFailedRouteRequests
function fnResubmitFailedRouteRequests(Inputs:PropertySet, Outputs:PropertySet){ /******************************************************* ** Name: fnResubmitFailedRouteRequests ** Created: 15.02.2008 ** Created By: TGDCRAN1 ** Description: Resubmit any failed route requests. ** Notes: New workflow process to interface to Genesys CTI to create routing requests for any SR record that previously failed. If a previous route request failed, then the Genesys Itx Id SCM field contains the string ERROR followed by the error code returned from Genesys ** Update: 10.01.2017 TAASAAI2 Aingeru Sabando Lasuen SO-3495 Strong Typing ******************************************************/ var boSR:BusObject; var bcSR:BusComp; var svc:Service; var pIn:PropertySet; var pOut:PropertySet; var bFound:bool; var nCount = 0; try{ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnResubmitFailedRouteRequests START"); svc = oApp.GetService("Workflow Process Manager"); pIn = oApp.NewPropertySet(); pOut = oApp.NewPropertySet(); boSR = oApp.GetBusObject("Service Request"); bcSR = boSR.GetBusComp("Service Request"); bcSR.SetViewMode(AllView); bcSR.ClearToQuery(); bcSR.SetSearchExpr("[Genesys Itx Id SCM] LIKE 'ERROR*'"); bcSR.SetSortSpec("Created (ASCENDING)"); bcSR.ExecuteQuery(ForwardOnly); bFound = bcSR.FirstRecord(); while (bFound){ pIn.Reset(); pOut.Reset(); pIn.SetProperty("ProcessName","Genesys Route Request SCM"); pIn.SetProperty("RowId", bcSR.GetFieldValue("Id") ); pIn.SetProperty("NRT Re-routing Flag", "N" ); svc.InvokeMethod("RunProcess",pIn,pOut); nCount = nCount + 1; bFound = bcSR.NextRecord(); } Outputs.SetProperty("Result", "Resubmitted " + nCount + " Service Request records"); } catch(e){ if( bIsTraceOn) oApp.Trace(this.Name() + ".fnResubmitFailedRouteRequests ERROR: " + e.message); throw(e); } finally{ bcSR = null; boSR = null; pIn = null; pOut = null; svc = null; } }

CTI Dashboard BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var returncode; switch(MethodName) { case "Init": fnInit(Inputs,Outputs); returncode = CancelOperation; break; case "Query": fnQuery(Inputs,Outputs); returncode = CancelOperation; break; default: returncode = ContinueOperation; break; } return (returncode); }

CTI Dashboard BS
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var returncode; switch(MethodName) { case "Init": fnInit(Inputs,Outputs); returncode = CancelOperation; break; case "Query": fnQuery(Inputs,Outputs); returncode = CancelOperation; break; default: returncode = ContinueOperation; break; } return (returncode); }

CTI Dashboard BS
fnInit
function fnInit(Inputs,Outputs) { Outputs.SetProperty("AccountId",""); Outputs.SetProperty("IVRLanguage",""); Outputs.SetProperty("MSISDN",""); Outputs.SetProperty("WaitTime",""); Outputs.SetProperty("Hotline",""); Outputs.SetProperty("Id",""); // BEGIN TGDGOLU2 - 12.01.09 - Initiate value of new Outputs Outputs.SetProperty("TransferCourt SCM",""); Outputs.SetProperty("IVRInfo SCM",""); Outputs.SetProperty("Customer SCM",""); Outputs.SetProperty("Caller SCM",""); Outputs.SetProperty("TransferAgent SCM",""); // TGDGOLU2 - 12.01.09 - Initiate value of new Outputs }

CTI Dashboard BS
fnInit
function fnInit(Inputs,Outputs) { Outputs.SetProperty("AccountId",""); Outputs.SetProperty("IVRLanguage",""); Outputs.SetProperty("MSISDN",""); Outputs.SetProperty("WaitTime",""); Outputs.SetProperty("Hotline",""); Outputs.SetProperty("Id",""); // BEGIN TGDGOLU2 - 12.01.09 - Initiate value of new Outputs Outputs.SetProperty("TransferCourt SCM",""); Outputs.SetProperty("IVRInfo SCM",""); Outputs.SetProperty("Customer SCM",""); Outputs.SetProperty("Caller SCM",""); Outputs.SetProperty("TransferAgent SCM",""); // TGDGOLU2 - 12.01.09 - Initiate value of new Outputs }

CTI Dashboard BS
fnQuery
function fnQuery(Inputs,Outputs) { //TGDGOLU2 - 09.01.09 - Function modified to recover values coming from Genesys for new variables //TGDCRAN2 - 27.04.10 - Updated for lang codes DEU/FRA/ITA/ENU for iRMA var psCTI = TheApplication().NewPropertySet(); var sMSISDN, sLang; try { sLang = TheApplication().GetProfileAttr("IVR_Language"); switch (sLang) { case "GE": // TGDMAEM1 3.10.2012 IVR could also send DE for German. case "DE": case "DEU": sLang="Deutsch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "FR": case "FRA": sLang="Französisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "IT": case "ITA": sLang="Italienisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "EN": case "ENU": sLang="Englisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; default: sLang="Nicht definiert"; } psCTI.SetProperty("Id",""); psCTI.SetProperty("IVRLanguage",sLang); psCTI.SetProperty("AccountId","Nothing"); psCTI.SetProperty("MSISDN", TheApplication().GetProfileAttr("IVR_MSISDN")); if (TheApplication().GetProfileAttr("IVR_WaitTime") == null || TheApplication().GetProfileAttr("IVR_WaitTime") == "" || TheApplication().GetProfileAttr("IVR_WaitTime")=="Not supplied") { psCTI.SetProperty("WaitTime", "N/A"); TheApplication().SetProfileAttr("sWTime", 0) //TGDGOLU2 - 12.01.09 - Set profile attribute of Wait Time for ePhinany } else { psCTI.SetProperty("WaitTime", TheApplication().GetProfileAttr("IVR_WaitTime")); //TGDLOAL3 25.01.2010: There was an scripting issue. It must be SetProfileAttr instead of GetProfileAttr TheApplication().SetProfileAttr("sWTime", TheApplication().GetProfileAttr("IVR_WaitTime")) //TGDGOLU2 - 12.01.09 - Set profile attribute of Wait Time for ePhinany } psCTI.SetProperty("Hotline", TheApplication().GetProfileAttr("IVR_Hotline")); //BEGIN - TGDGOLU2 - 12.01.09 - Set values of the parameters coming form Genesys psCTI.SetProperty("TransferCourt SCM", TheApplication().GetProfileAttr("IVR_Transfer")); psCTI.SetProperty("IVRInfo SCM", TheApplication().GetProfileAttr("IVR_INFO")); psCTI.SetProperty("Customer SCM", TheApplication().GetProfileAttr("IVR_Customer")); psCTI.SetProperty("Caller SCM", TheApplication().GetProfileAttr("IVR_Caller")); psCTI.SetProperty("TransferAgent SCM", TheApplication().GetProfileAttr("IVR_TransferAgent")); //END - TGDGOLU2 - 12.01.09 - Set values of the parameters coming form Genesys Outputs.AddChild(psCTI); } catch(e) { // Nothing //TheApplication().RaiseErrorText("ERROR: " + e.errText + "\n" + e.toString() ); } finally { psCTI = null; //TGDGOLU2 - 27.01.09 Consolidation } }

CTI Dashboard BS
fnQuery
function fnQuery(Inputs,Outputs) { //TGDGOLU2 - 09.01.09 - Function modified to recover values coming from Genesys for new variables //TGDCRAN2 - 27.04.10 - Updated for lang codes DEU/FRA/ITA/ENU for iRMA var psCTI = TheApplication().NewPropertySet(); var sMSISDN, sLang; try { sLang = TheApplication().GetProfileAttr("IVR_Language"); switch (sLang) { case "GE": // TGDMAEM1 3.10.2012 IVR could also send DE for German. case "DE": case "DEU": sLang="Deutsch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "FR": case "FRA": sLang="Französisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "IT": case "ITA": sLang="Italienisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; case "EN": case "ENU": sLang="Englisch"; sLang = TheApplication().InvokeMethod("LookupValue", "Language_SCM", sLang); break; default: sLang="Nicht definiert"; } psCTI.SetProperty("Id",""); psCTI.SetProperty("IVRLanguage",sLang); psCTI.SetProperty("AccountId","Nothing"); psCTI.SetProperty("MSISDN", TheApplication().GetProfileAttr("IVR_MSISDN")); if (TheApplication().GetProfileAttr("IVR_WaitTime") == null || TheApplication().GetProfileAttr("IVR_WaitTime") == "" || TheApplication().GetProfileAttr("IVR_WaitTime")=="Not supplied") { psCTI.SetProperty("WaitTime", "N/A"); TheApplication().SetProfileAttr("sWTime", 0) //TGDGOLU2 - 12.01.09 - Set profile attribute of Wait Time for ePhinany } else { psCTI.SetProperty("WaitTime", TheApplication().GetProfileAttr("IVR_WaitTime")); //TGDLOAL3 25.01.2010: There was an scripting issue. It must be SetProfileAttr instead of GetProfileAttr TheApplication().SetProfileAttr("sWTime", TheApplication().GetProfileAttr("IVR_WaitTime")) //TGDGOLU2 - 12.01.09 - Set profile attribute of Wait Time for ePhinany } psCTI.SetProperty("Hotline", TheApplication().GetProfileAttr("IVR_Hotline")); //BEGIN - TGDGOLU2 - 12.01.09 - Set values of the parameters coming form Genesys psCTI.SetProperty("TransferCourt SCM", TheApplication().GetProfileAttr("IVR_Transfer")); psCTI.SetProperty("IVRInfo SCM", TheApplication().GetProfileAttr("IVR_INFO")); psCTI.SetProperty("Customer SCM", TheApplication().GetProfileAttr("IVR_Customer")); psCTI.SetProperty("Caller SCM", TheApplication().GetProfileAttr("IVR_Caller")); psCTI.SetProperty("TransferAgent SCM", TheApplication().GetProfileAttr("IVR_TransferAgent")); //END - TGDGOLU2 - 12.01.09 - Set values of the parameters coming form Genesys Outputs.AddChild(psCTI); } catch(e) { // Nothing //TheApplication().RaiseErrorText("ERROR: " + e.errText + "\n" + e.toString() ); } finally { psCTI = null; //TGDGOLU2 - 27.01.09 Consolidation } }

CUG GetProfAttr VBC SCM
Init
function Init (Inputs, Outputs) { Outputs.SetProperty("Id", ""); Outputs.SetProperty("Value", ""); // For debugging purpose... //logPropSet(Outputs, "InitOutputs.xml"); return (CancelOperation); }

CUG GetProfAttr VBC SCM
Init
function Init (Inputs, Outputs) { Outputs.SetProperty("Id", ""); Outputs.SetProperty("Value", ""); // For debugging purpose... //logPropSet(Outputs, "InitOutputs.xml"); return (CancelOperation); }

CUG GetProfAttr VBC SCM
Query
function Query(Inputs, Outputs) { // For debugging purpose... // logPropSet(Inputs, "QueryInputs.xml"); var pAttrName, pAttrValue; var searchString, searchStringElements; var token; var row1; token = "\""; searchString = Inputs.GetProperty("search-string"); searchStringElements = searchString.split(token); pAttrName = searchStringElements[1]; // set Profile Attribute manually for test purposes // TheApplication().SetProfileAttr(pAttrName,"Y"); pAttrValue = TheApplication().GetProfileAttr(pAttrName); row1=TheApplication().NewPropertySet(); row1.SetProperty("Id", pAttrName); row1.SetProperty("Value", pAttrValue); Outputs.AddChild (row1); // For debugging purpose... //logPropSet(Outputs, "QueryOutputs.xml" ); // clean up row1 = null; return (CancelOperation); }

CUG GetProfAttr VBC SCM
Query
function Query(Inputs, Outputs) { // For debugging purpose... // logPropSet(Inputs, "QueryInputs.xml"); var pAttrName, pAttrValue; var searchString, searchStringElements; var token; var row1; token = "\""; searchString = Inputs.GetProperty("search-string"); searchStringElements = searchString.split(token); pAttrName = searchStringElements[1]; // set Profile Attribute manually for test purposes // TheApplication().SetProfileAttr(pAttrName,"Y"); pAttrValue = TheApplication().GetProfileAttr(pAttrName); row1=TheApplication().NewPropertySet(); row1.SetProperty("Id", pAttrName); row1.SetProperty("Value", pAttrValue); Outputs.AddChild (row1); // For debugging purpose... //logPropSet(Outputs, "QueryOutputs.xml" ); // clean up row1 = null; return (CancelOperation); }

CUG GetProfAttr VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { return(Init(Inputs, Outputs)); } else if (MethodName == "Query") { return(Query(Inputs, Outputs)); } else { return (ContinueOperation); } }

CUG GetProfAttr VBC SCM
Service_PreInvokeMethod
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "Init") { return(Init(Inputs, Outputs)); } else if (MethodName == "Query") { return(Query(Inputs, Outputs)); } else { return (ContinueOperation); } }

CUG GetProfAttr VBC SCM
logPropSet
function logPropSet(inputPS, fileName) { // Use EAI XML Write to File business service to write // inputPS property set to fileName file in c:\temp directory. var fileSvc = TheApplication().GetService("EAI XML Write to File"); var outPS = TheApplication().NewPropertySet(); var fileLoc = "c:\\temp\\" + fileName; var tmpProp = inputPS.Copy(); tmpProp.SetProperty("FileName", fileLoc); fileSvc.InvokeMethod("WritePropSet", tmpProp, outPS); // clean up outPS = null; fileSvc = null; tmpProp = null; }

CUG GetProfAttr VBC SCM
logPropSet
function logPropSet(inputPS, fileName) { // Use EAI XML Write to File business service to write // inputPS property set to fileName file in c:\temp directory. var fileSvc = TheApplication().GetService("EAI XML Write to File"); var outPS = TheApplication().NewPropertySet(); var fileLoc = "c:\\temp\\" + fileName; var tmpProp = inputPS.Copy(); tmpProp.SetProperty("FileName", fileLoc); fileSvc.InvokeMethod("WritePropSet", tmpProp, outPS); // clean up outPS = null; fileSvc = null; tmpProp = null; }

CUG Utilities SCM
GetAllPortsSCM
function GetAllPortsSCM(Inputs, Outputs) { try { var oBS = TheApplication().GetService("Remote Complex Object Instance Service"); var oIn = TheApplication().NewPropertySet(); var oOut = TheApplication().NewPropertySet(); oIn.SetProperty("Product Id", Inputs.GetProperty("Product Id")); oIn.SetProperty("GetPortDomain", "N"); oBS.InvokeMethod("GetAllPorts", oIn, oOut); Outputs.AddChild(oOut); } catch(e){ throw(e); } finally { oBS = null; oIn = null; oOut = null; } }

CUG Utilities SCM
GetAllPortsSCM
function GetAllPortsSCM(Inputs, Outputs) { try { var oBS = TheApplication().GetService("Remote Complex Object Instance Service"); var oIn = TheApplication().NewPropertySet(); var oOut = TheApplication().NewPropertySet(); oIn.SetProperty("Product Id", Inputs.GetProperty("Product Id")); oIn.SetProperty("GetPortDomain", "N"); oBS.InvokeMethod("GetAllPorts", oIn, oOut); Outputs.AddChild(oOut); } catch(e){ throw(e); } finally { oBS = null; oIn = null; oOut = null; } }

CUG Utilities SCM
LogData
function LogData(DataString, file) { try { Clib.fputs((DataString + "\n"), file); Clib.fflush(file); } catch (e){ // no action } }

CUG Utilities SCM
LogData
function LogData(DataString, file) { try { Clib.fputs((DataString + "\n"), file); Clib.fflush(file); } catch (e){ // no action } }

CUG Utilities SCM
LookupMessage
function LookupMessage(Inputs, Outputs) { /************************************************************************************************************** ** Name: LookupMessage ** Created: 15.11.2012 ** Modified By: TGDSEAI1 ** Description: Get a message after substitute some parameter, modified to add one more argument ** Inputs: strCode, name of the ACV *************************************************************************************************************/ //Initialize Variables var key =""; var category = ""; var children = ""; var arg1 = ""; var arg2 = ""; var arg3 = ""; var arg4 = ""; var translMsg = ""; try { //Check required inputs if (Inputs.PropertyExists("Key")) { key = Inputs.GetProperty("Key"); Inputs.RemoveProperty("Key"); } else { TheApplication().RaiseErrorText("Required Input Argument Key is null"); } if (Inputs.PropertyExists("Category")) { category = Inputs.GetProperty("Category"); Inputs.RemoveProperty("Category"); } else { TheApplication().RaiseErrorText("Required Input Argument Category is null"); } if (Inputs.PropertyExists("Debug")) { Inputs.RemoveProperty("Debug"); } //Check additional optional parameters children = Inputs.GetPropertyCount(); arg1 = Inputs.GetProperty("Arg1"); arg2 = Inputs.GetProperty("Arg2"); arg3 = Inputs.GetProperty("Arg3"); arg4 = Inputs.GetProperty("Arg4"); switch (children) { case (0): translMsg = TheApplication().LookupMessage(category, key); break; case (1): if ((arg1!= "") && (arg1!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1); } else { TheApplication().RaiseErrorText("Input Argument Arg1 is null"); } break; case (2): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 is null"); } break; case(3): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null) && (arg3!= "") && (arg3!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2, arg3); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 or Arg3 is null"); } break; case(4): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null) && (arg3!= "") && (arg3!=null) && (arg4!= "") && (arg4!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2, arg3, arg4); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 or Arg3 or Arg4 is null"); } break; default: translMsg = "too many or wrong optional args: the number of input optional args, "+children+", is larger than the maximum, 4, or invalid"; break; } Outputs.SetProperty("TranslatedMessage", translMsg); } catch (e) { if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error:" + e.message); throw(e); } finally{ //Variable destruction key = null; category = null; children = null; arg1 = null; arg2 = null; arg3 = null; arg4 = null; } }

CUG Utilities SCM
LookupMessage
function LookupMessage(Inputs, Outputs) { /************************************************************************************************************** ** Name: LookupMessage ** Created: 15.11.2012 ** Modified By: TGDSEAI1 ** Description: Get a message after substitute some parameter, modified to add one more argument ** Inputs: strCode, name of the ACV *************************************************************************************************************/ //Initialize Variables var key =""; var category = ""; var children = ""; var arg1 = ""; var arg2 = ""; var arg3 = ""; var arg4 = ""; var translMsg = ""; try { //Check required inputs if (Inputs.PropertyExists("Key")) { key = Inputs.GetProperty("Key"); Inputs.RemoveProperty("Key"); } else { TheApplication().RaiseErrorText("Required Input Argument Key is null"); } if (Inputs.PropertyExists("Category")) { category = Inputs.GetProperty("Category"); Inputs.RemoveProperty("Category"); } else { TheApplication().RaiseErrorText("Required Input Argument Category is null"); } if (Inputs.PropertyExists("Debug")) { Inputs.RemoveProperty("Debug"); } //Check additional optional parameters children = Inputs.GetPropertyCount(); arg1 = Inputs.GetProperty("Arg1"); arg2 = Inputs.GetProperty("Arg2"); arg3 = Inputs.GetProperty("Arg3"); arg4 = Inputs.GetProperty("Arg4"); switch (children) { case (0): translMsg = TheApplication().LookupMessage(category, key); break; case (1): if ((arg1!= "") && (arg1!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1); } else { TheApplication().RaiseErrorText("Input Argument Arg1 is null"); } break; case (2): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 is null"); } break; case(3): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null) && (arg3!= "") && (arg3!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2, arg3); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 or Arg3 is null"); } break; case(4): if ((arg2!= "") && (arg2!=null) && (arg1!= "") && (arg1!=null) && (arg3!= "") && (arg3!=null) && (arg4!= "") && (arg4!=null)) { translMsg = TheApplication().LookupMessage(category, key, arg1, arg2, arg3, arg4); } else { TheApplication().RaiseErrorText("Input Argument Arg1 or Arg2 or Arg3 or Arg4 is null"); } break; default: translMsg = "too many or wrong optional args: the number of input optional args, "+children+", is larger than the maximum, 4, or invalid"; break; } Outputs.SetProperty("TranslatedMessage", translMsg); } catch (e) { if(TheApplication().isTraceON) TheApplication().Trace(this.Name() + " Error:" + e.message); throw(e); } finally{ //Variable destruction key = null; category = null; children = null; arg1 = null; arg2 = null; arg3 = null; arg4 = null; } }

CUG Utilities SCM
PropertySetToFile
function PropertySetToFile (PropSet, fileName, title) { try { var file = Clib.fopen(fileName, "at"); LogData(("\n---------------------------------------------------"), file); LogData(("Start Process " + Clib.asctime(Clib.gmtime(Clib.time()))), file); LogData(title, file); LogData("PROVIDED PROPERTY SET", file); WritePropertySet(PropSet, file, 0); Clib.fclose(file); return (CancelOperation); } catch (e) { // fail silently } }

CUG Utilities SCM
PropertySetToFile
function PropertySetToFile (PropSet, fileName, title) { try { var file = Clib.fopen(fileName, "at"); LogData(("\n---------------------------------------------------"), file); LogData(("Start Process " + Clib.asctime(Clib.gmtime(Clib.time()))), file); LogData(title, file); LogData("PROVIDED PROPERTY SET", file); WritePropertySet(PropSet, file, 0); Clib.fclose(file); return (CancelOperation); } catch (e) { // fail silently } }

CUG Utilities SCM
RemoveFirstProperty
function RemoveFirstProperty (Inputs, Outputs) { var Children; var FirstProperty; var ChildPS; try{ if(Inputs.GetChildCount() > 0){ ChildPS = Inputs.GetChild(0).Copy(); //TGDHEJA1 16.1.08 use Copy instead of ref FirstProperty = ChildPS.GetChild(0).Copy(); //TGDHEJA1 16.1.08 use Copy instead of ref ChildPS.RemoveChild(0); Children = ChildPS.GetChildCount(); Outputs.SetProperty("Number of Remaining Objects", Children); Outputs.AddChild(ChildPS); Outputs.AddChild(FirstProperty); } }finally{ Children = null; FirstProperty = null; ChildPS = null; } }

CUG Utilities SCM
RemoveFirstProperty
function RemoveFirstProperty (Inputs, Outputs) { var Children; var FirstProperty; var ChildPS; try{ if(Inputs.GetChildCount() > 0){ ChildPS = Inputs.GetChild(0).Copy(); //TGDHEJA1 16.1.08 use Copy instead of ref FirstProperty = ChildPS.GetChild(0).Copy(); //TGDHEJA1 16.1.08 use Copy instead of ref ChildPS.RemoveChild(0); Children = ChildPS.GetChildCount(); Outputs.SetProperty("Number of Remaining Objects", Children); Outputs.AddChild(ChildPS); Outputs.AddChild(FirstProperty); } }finally{ Children = null; FirstProperty = null; ChildPS = null; } }

CUG Utilities SCM
RemoveFirstPropertyCUGAbo
function RemoveFirstPropertyCUGAbo(Inputs, Outputs) { /*************************************************************************************************** ** Author: Jan Hengst ** Date: 17.01.2008 ** Descr: Removes a child line item from line item structure and returns both the new ** structure and the removed line item as property sets. ** Inputs: hierarchical PropertySet corresponding to a root line item (subset of SIS OM Asset ** structure: SiebelMessage.ListOfSIS OM Asset.Header.ListOfLine Item.Line Item) ** Outputs: Line Item - line item PropertySet (removed line item) ** Root Line Item - root line item PropertySet ** Number of Remaining Objects - number of remaining child line items ***************************************************************************************************/ var psRootItem; var psChild; var psRemovedItem; try { if(Inputs.GetChildCount() > 0) { psRootItem = Inputs.GetChild(0).Copy(); // original root item ps // the type is modified to distinguish the root structure // from the removed

No comments:

Post a Comment