Sunteți pe pagina 1din 13

The following is more or less a conversion of the steps that already exist in Siebel Books, but they have

been converted to use eScript instead of Siebel VB script. If mistakes or improvements are found, please correct, or, let Walter Floyd know so that I can correct. 1. Start Tools 2. Go to Project objects 3. Create a new Project 3.1. Name = AAVBC 3.2. Locked = checked 4. Go the Business Service objects 5. Create Business Service 5.1. Name = AATestVBCBS 5.2. Project = AAVBC 5.3. Class = CSSService 6. Add BS Scripts 6.1. PreInvokeMethod See Below 6.2. Init See Below 6.3. Query See Below 6.4. Update See Below 6.5. PreInsert See Below 6.6. Delete See Below 7. Create test file > AATest.txt Sample Below. 8. Create VBC - control N on BC, not wizard. 8.1. Name = AATestVBC 8.2. Project = AAVBC 8.3. Class = CSSBCVExtern 9. Create Fields 9.1. KeyId 9.2. Field1 9.3. Field2 10. Define BC User Properties 10.1. Name = Service Name Value = AATestVBCBS 10.2. Name = Service Parameters Value = G:\1WMF\BLE\OSS-3872636752\AATest.txt;3;KeyId,Field1,Field2 11. Create a Link 11.1. Name = Service Request/AATestVBC 11.2. Project = AAVBC 11.3. Parent BC = Service Request 11.4. Child BC = AATestVBC 11.5. Source Field = Id

11.6. Destination Field = KeyId 12. Add AATestVBC to Service Request BO 12.1. BusComp = AATestVBC 12.2. Link = Service Request/AATestVBC 13. Create an Applet (form) AATestApplet using Wizard -> File -> New Object -> Applet -> Form Applet -> Ok 13.1. AAVBC 13.2. AATestApplet 13.3. AATestApplet 13.4. AATestVBC 13.5. Preserve 13.6. Use Grid 13.7. Next 13.8. Edit Mode 13.9. Next 13.10. KeyId 13.11. Field1 13.12. Field2 13.13. Next 13.14. Next 13.15. Finish 14. Create an Applet (List) AATestListApplet using Wizard -> File -> New Object -> Applet -> List Applet -> Ok 14.1. AAVBC 14.2. AATestListApplet 14.3. AATestListApplet 14.4. AATestVBC 14.5. Preserve 14.6. Next 14.7. Selelct Applet List (Base/EditList) into Edit List Mode 14.8. Next 14.9. Id 14.10. KeyId 14.11. Field1 14.12. Field2 14.13. Next 14.14. Next 14.15. Finish 15. Create a view 15.1. Name = AATestView 15.2. Project = AAVBC 15.3. Business Object = Service Request 15.4. Update Behavior = Preserve 15.5. Add a View Web Template 15.5.1. Name = Edit 15.5.2. Web Template = View Detail

15.5.3. Add View Web Template Items 15.5.3.1. Name = Service Request List Applet 15.5.3.2. Item Identifier = 1 15.5.3.3. Applet = Service Request List Applet 15.5.3.4. Applet Mode = Edit List 15.5.3.5. Name = AATestApplet 15.5.3.6. Item Identifier = 2 15.5.3.7. Applet = AATestApplet 15.5.3.8. Applet Mode = Edit 15.5.3.9. Name = AATestListApplet 15.5.3.10. Item Identifier = 3 15.5.3.11. Applet Mode = Edit List 16. Add AATestView to Service Request Screen 16.1. View = AATestView 16.2. Sequence = 93(?) 16.3. Parent Category = Service Request List 16.4. ViewBar Text String Override = AATestViewBar 16.5. Menu Text String Override = AATestViewMenu 16.6. Status Text String Override = AATestViewStatus 17. Compile All Changes. 18. Start Client. 19. Navigate to Service Request View and extract an actual Row Id to add to the AATest.txt file on all rows. 20. Register view Site Map -> Administration Application -> Views -> New -> Name = AATestView 21. Set responsibility Site Map -> Administration Application -> Responsibility -> New -> Name = AATest -> Save -> Views applet -> Add -> Name = AATestView -> Save -> Users applet -> Add -> Siebel Administrator -> Save -> Exit Client and restart. 22. Service Request > SR List > Drill on SR with the Row Id used in AATest.txt > Select AATestView tab The following is the test to be used to create AATest.txt. KeyId Field1 Field2 1-24AKL End User 111 1-24AKL Partner Apps 222 1-24AKL Server Tasks 333

1-24AKL Administrator 444 1-24AKL Serf 555 var FieldCount; var NoOfRecords; var DataSource; var ColumnsReqd; var VBCName;

function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { var ParamText; VBCName = Inputs.GetProperty("Business Component Name"); ParamText = Inputs.GetProperty("Parameters"); if (ParamText != "") { var semipos1 = ParamText.indexOf(";"); DataSource = ParamText.substring(0, ToInteger(semipos1)); ParamText = ParamText.substring(ToInteger(semipos1) + 1,ParamText.length); var semipos2 = ToInteger(ParamText.indexOf(";")) + 1; FieldCount = ParamText.substring(0,(ToInteger(semipos2) - 1)); ColumnsReqd = ParamText.substring(semipos2); } switch (MethodName) { case "Init": Init(Inputs, Outputs); return (CancelOperation); break; case "Query": Query(Inputs, Outputs); return (CancelOperation); break; case "Update": Update(Inputs, Outputs); return (CancelOperation); break; case "PreInsert": PreInsert(Inputs, Outputs);

return (CancelOperation); break; case "Insert": Insert(Inputs, Outputs); return (CancelOperation); break; case "Delete": Delete(Inputs, Outputs); return (CancelOperation); break; } return (ContinueOperation); }

function Delete (Inputs, Outputs) { } function Init (Inputs, Outputs) { var theFieldName = new Array; var ParamText; var theKey; // Identify setup details of calling VBC and add as Parameter to Service ParamText = Inputs.GetProperty("Parameters"); VBCName = Inputs.GetProperty("Business Component Name"); Outputs.SetProperty(VBCName, ParamText); Outputs.SetProperty(VBCName + "Qry", "None"); //G:\1WMF\USI-38-3538639851\wmf.txt;3;WMF1,WMF2,WMF3 if (ParamText != "") { // var semipos1 = Clib.strchr(ParamText, ";"); var semipos1 = ParamText.indexOf(";"); DataSource = ParamText.substring(0, ToInteger(semipos1)); ParamText = ParamText.substring(ToInteger(semipos1) + 1,ParamText.length); var semipos2 = ToInteger(ParamText.indexOf(";")) + 1; FieldCount = ParamText.substring(0,(ToInteger(semipos2) - 1)); ColumnsReqd = ParamText.substring(semipos2); } // Initialise the full list of Fields Available var fp = Clib.fopen(DataSource,"r");

for (var Count = 0; Count < FieldCount; Count++) { theKey = Clib.fgets(fp); theFieldName[Count] = rtrim(theKey); Outputs.SetProperty(theFieldName[Count], ""); } Clib.fclose(fp); } function Insert (Inputs, Outputs) { var InputFields = new Array; var InputValues = new Array; var NoOfValues = 0; var InputPS = TheApplication().NewPropertySet(); var OutputStr = ""; var i = 0; var fp = ""; var Count = 0; var theKey = ""; //********************************************************************** ********** //' * Establish the Value Pairs to Be Used for Insert from the Inputs Property Set * //' *********************************************************************** ************ if (Inputs.GetFirstProperty() != "") { InputPS = Inputs.GetChild(0); InputFields[0] = InputPS.GetFirstProperty(); InputValues[0] = InputPS.GetProperty(InputPS.GetFirstProperty()); NoOfValues = ToInteger(NoOfValues) + 1; for (i = 1; i < FieldCount; i++) { InputFields[i] = InputPS.GetNextProperty(); if (InputFields[i] != "") { InputValues[i] = InputPS.GetProperty(InputFields[i]); NoOfValues = ToInteger(NoOfValues) + 1; } } } //' ***********************************************************************

//' * Create the Output String for Writing to the File in the right order * //' *********************************************************************** ** fp = Clib.fopen(DataSource,"r"); for (Count = 0; Count < FieldCount; Count++) { theKey = rtrim(Clib.fgets(fp)); for (i = 0; i < NoOfValues; i++) { if (InputFields[i] == theKey) { OutputStr = OutputStr + "\n" + InputValues[i]; } } } Clib.fclose(fp); fp = Clib.fopen(DataSource,"a"); Clib.fputs(OutputStr,fp); Clib.fclose(fp); } function PreInsert (Inputs, Outputs) { //' ****************************************************************** **************** //' * A Pre Insert Method is Required before any insert is applied, Its use to provide //' * Default Values, This Service does not provide any defaults, But must return a //' * populated property set, so this points to the first field by default //' ****************************************************************** **************** var newRow = TheApplication().NewPropertySet(); var commapos = ColumnsReqd.indexOf(","); var wf = ColumnsReqd.substring(0,ToInteger(commapos)); newRow.SetProperty(ColumnsReqd.substring(0,ToInteger(commapos)),""); Outputs.AddChild(newRow); } function Query (Inputs, Outputs) { //' *********************************************************************** ****

//' * The adding of properties in the me.SetProperty statements in this * //' * code is used To store key information and the relevant data against * //' * parameters identified by the VBC name. This technique is used to create * //' * a persistantstore and negate yhe need for repeat calls to the external * //' * source for the same data. * //' *********************************************************************** ****** try { var Row = new Array; var theFieldName = new Array; var QueryValues = new Array; var QueryFields = new Array; var QueryList = TheApplication().NewPropertySet(); var ColList = ""; var ColData = ""; var QryData = ""; var OutColCount = 0; var OutRowCount = 0; var NoOfQs = 0; var RowMatches; var DoQuery = 1; var Count; var i = 0; var x = 0; var fp = ""; var r = 0; var semipos1; var theKey; var theValue; var theField; var e; //' *********************************************************************** ***** //' * Establish the list of Columns Which define the Query Values from the VBC * //' *********************************************************************** ******** QueryList = Inputs.GetChild(0); { QueryFields[0] = QueryList.GetFirstProperty(); QueryValues[0] = QueryList.GetProperty(QueryList.GetFirstProperty());

NoOfQs = ToInteger(NoOfQs) + 1; QryData = QueryFields[0] + "=" + QueryValues[0]; for (Count = 1; Count < FieldCount; Count++) { QueryFields[Count] = QueryList.GetNextProperty(); if (QueryFields[Count] != "") { QueryValues[Count] = QueryList.GetProperty(QueryList.GetFirstProperty()); NoOfQs = ToInteger(NoOfQs) + 1; QryData = QueryFields[Count] + "=" + QueryValues[Count]; } } } //' *********************************************************************** ********** //' * Establish If Query is same as Last Time for this VBC and If So Set Query Flag * //' * to use Persistant Cache //' *********************************************************************** ************ if (this.GetProperty(VBCName + "Qry") != QryData) { this.SetProperty(VBCName + "Qry", QryData) } else { DoQuery = 0 } //' *********************************************************************** ********** //' * Establish Full List of Columns Available and Which ones are needed by the VBC * //' * Where not required, Identify this with Column Value Not Required CVNR * //' *********************************************************************** ************* if (DoQuery == 1) { fp = Clib.fopen(DataSource,"r"); for (Count = 0; Count < FieldCount; Count++) { theKey = Clib.fgets(fp); if (ColumnsReqd.indexOf(theKey) == -1) { theFieldName[Count] = rtrim(theKey);

OutColCount = ToInteger(OutColCount) + 1; } else { theFieldName[Count] = "CVNR"; } } this.SetProperty(VBCName + "ColCnt", ToString(OutColCount)); //' *********************************************************************** ********** //' * Retreveal of Data from Text File, Including ignoring Columns Not Required and * //' * Ignoring rows which do not match the selection criterion * //' *********************************************************************** ************* for (r = 0; r < 999; r++) { RowMatches = 1; //set to true theKey = Clib.fgets(fp); if (theKey != null) { theValue = rtrim(theKey); Row[r] = TheApplication().NewPropertySet(); if (theFieldName[0] != "CVNR") { Row[r].SetProperty(theFieldName[0], theValue); ColList = theFieldName[0]; ColData = theValue; for (x = 0; x < NoOfQs; x++) { if (QueryFields[x] == theFieldName[0] && QueryValues[x] != theValue) { RowMatches = 0; } } } for (Count = 1; Count < FieldCount; Count++) { theKey = Clib.fgets(fp); theValue = rtrim(theKey); if (theFieldName[Count] != "CVNR") { Row[r].SetProperty(theFieldName[Count], theValue); ColList = theFieldName[Count]; ColData = theValue;

for (x = 0; x < NoOfQs; x++) { if (QueryFields[x] == theFieldName[Count] && QueryValues[x] != theValue) { RowMatches = 0; } } } } if (RowMatches == 1) { Outputs.AddChild(Row[r]); OutRowCount = ToInteger(OutRowCount) + 1; this.SetProperty(VBCName + ToString(OutColCount), ColData); } } // end if (theValue != "") else { r = 999; } } // end for (r = 0; r < 999; r++) Clib.fclose(fp); this.SetProperty(VBCName + "RowCnt", ToString(OutRowCount)); this.SetProperty(VBCName + "Col", ColList); } // END if (DoQuery == 1) else { //' *********************************************************************** ********* //' * Re Create Output property set from the Persistant Cache held in the Business * //' * Service Property Set //' *********************************************************************** *********** OutColCount = ToString(GetProperty(VBCName + "ColCnt")); OutRowCount = ToString(GetProperty(VBCName + "RowCnt")); for (i = 0; x < OutRowCount; i++) { ColList = GetProperty(VBCName + "Col"); ColData = GetProperty(VBCName + ToString(i)); Row[r] = TheApplication().NewPropertySet(); for (x = 0; x < (ToInteger(OutColCount) - 1); x++) { semipos1 = ColList.indexOf(";"); theField = ColList.substring(0, ToInteger(semipos1));

ColList = ColList.substring(ToInteger(semipos1) +1); semipos1 = ColData.indexOf(";"); theValue = ColData.substring(0, ToInteger(semipos1)); ColData = ColData.substring(ToInteger(semipos1) +1); Row[i].SetProperty(theField, theValue); } Outputs.AddChild(Row[i]); } } //end else if (DoQuery == 1) } //end try catch(e) { if (Clib.strstr(e.errText, "SBL-EXL-00151") != null) { throw e; } else { if(defined(e.errText)) { TheApplication().RaiseErrorText("An exception occurred in the Query Function of the " + this.Name() + " object. " + "ERROR: " + e.errText + "STACK: " + e.toString()); } else { TheApplication().RaiseErrorText("An exception occurred in the Query Function of the " + this.Name() + " object. " + "ERROR: " + e.errText + "STACK: " + e.toString()); } } } // end catch } function rtrim(s) { // count number of trailing spaces var c = 0; var len = s.length; while ((c < len) && ((s.substr(len-c-1,1) == " ") || (s.substr(len-c-1,1) == "\n"))) { c = c + 1; } // rtrim return s.substr(0,len-c); }

function Update (Inputs, Outputs) { }

S-ar putea să vă placă și