Bookshelf Home | Contents | Index | PDF | ![]() ![]() |
Integration Platform Technologies: Siebel Enterprise Application Integration > Siebel Virtual Business Components > Custom Business Service Examples > Siebel VB Business Service Example for a VBCThe following is an example of Siebel VB implementation of a business service for a VBC. The fields configured for this simple VBC are AccountId, Name, Phone, and Location. CAUTION: Do not use Siebel CRM system fields, such as Id, as output properties. Undesired application behavior might result. Declare Function stringReplace(mystr As String, fromchar As String, tochar As String) As String Declare Function getData(execSQL As String, Results As PropertySet) As Integer Function getData(execSQL As String, Results As PropertySet) As Integer Dim sSrv As String, sDbn As String Dim sUsr As String, sPsw As String Dim oCon As Object, oRec As Object ' *** SQL Server connectivity parameters sSrv = "v817.siebel.com" '*** Oracle tns sUsr = "system" '*** SQL Server: a user's login Id sPsw = "manager" '*** SQL Server: a user's password ' *** Create SQL Server ADODB connection dynamically Set oCon = CreateObject("ADODB.Connection") oCon.Open "Provider=MSDAORA;" & _ "Data Source=" & sSrv & ";" & _ "User ID=" & sUsr & ";" & "Password=" & sPsw & ";" Set oRec = oCon.Execute(execSQL) ' *** Process SQL query result and save into file Set Row=TheApplication.NewPropertySet() Row.SetProperty "AccountId", oRec.Fields.Item("AccountId").Value Row.SetProperty "Name", oRec.Fields.Item("Name").Value Row.SetProperty "Location", oRec.Fields.Item("Location").Value Row.SetProperty "Phone", oRec.Fields.Item("Phone").Value Sub Init(Inputs As PropertySet, Outputs As PropertySet) Outputs.SetProperty "AccountId", "" Outputs.SetProperty "Name", "" Outputs.SetProperty "Phone", "" Outputs.SetProperty "Location", "" Sub Query(Inputs As PropertySet, Outputs As PropertySet) sselectStmt = "select * from siebel.Contact2 " ssearchstring = Inputs.GetProperty("search-string") If Len(ssearchstring) > 0 Then ssearchstring = stringReplace(ssearchString, "*", "%") ssearchstring = stringReplace(ssearchString, "[", " ") ssearchstring = stringReplace(ssearchString, "]", " ") ssearchstring = stringReplace(ssearchString, "~", " ") ssearchstring = stringReplace(ssearchString, chr$(34), "'") sselectStmt = sselectStmt & swhereClause & ssearchstring ' Write select statement to this file TextToSave = "select is " & sselectStmt Open FileName For Append As #1 ret = getData(sselectStmt, Outputs) Function stringReplace(mystr As String, fromchar As String, tochar As String) As String 'Replace all occurrences of fromchar in mystr with tochar If Len(mystr) = 0 Or Len(fromchar) = 0 Then mystr = Left(mystr, i - 1) & tochar & Mid(mystr, i + Len(fromchar)) Function Service_PreInvokeMethod (MethodName As String, Inputs As PropertySet, Outputs As PropertySet) As Integer Service_PreInvokeMethod = ContinueOperation Service_PreInvokeMethod = CancelOperation |
![]() |
![]() ![]() |
Integration Platform Technologies: Siebel Enterprise Application Integration | Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |