Example of Accessing the Mobile Web Client Automation Server

The following example includes the code you use in Microsoft Visual Basic 6.0 to access the Mobile Web Client Automation Server:

Private Sub Command1_Click()
'Siebel Application Object
Dim siebWebApp As SiebelWebApplication
Dim siebBusObj As SiebelBusObject
Dim siebBusComp As SiebelBusComp
Dim siebSvcs As SiebelService
Dim siebPropSet As SiebelPropertySet
Dim bool As Boolean
Dim errCode As Integer
Dim errText As String
Dim connStr As String
Dim lng As String
'Create The Siebel WebApplication Object
Set siebWebApp = CreateObject("TWSiebel.SiebelWebApplication.1")

If Not siebWebApp Is Nothing Then


'Create A Business Object
Set siebBusObj = siebWebApp.GetBusObject("Contact")
If Not siebBusObj Is Nothing Then
   'Create a Business Component
   Set siebBusComp = siebBusObj.GetBusComp("Contact")

Else
   errCode = siebWebApp.GetLastErrCode
   errText = siebWebApp.GetLastErrText
   siebWebApp.RaiseErrorText "Business Object Creation failed." & _
      errCode & "::" & errText

End If

'Create A New Property Set
Set siebPropSet = siebWebApp.NewPropertySet
If Not siebPropSet Is Nothing Then
   Set siebPropSet = Nothing

Else
   errCode = siebWebApp.GetLastErrCode
   errText = siebWebApp.GetLastErrText
   siebWebApp.RaiseErrorText "Property Set Creation failed." & _
      errCode & "::" & errText
End If

'Get A Siebel Service
Set siebSvcs = siebWebApp.GetService("Workflow Process Manager")
If Not siebSvcs Is Nothing Then
   Set siebSvcs = Nothing
Else
   errCode = siebWebApp.GetLastErrCode
   errText = siebWebApp.GetLastErrText
   siebWebApp.RaiseErrorText "Could not Get Siebel Service." & _
      errCode & "::" & errText
End If

'Now query the Business Component
Dim ls_name As String
		
If Not siebBusComp Is Nothing
	siebBusComp.ClearToQuery
	siebBusComp.ActivateField "Last Name"	
	siebBusComp.SetSearchSpec "Last Name", "Washington"
	siebBusComp.ExecuteQuery ForwardOnly
	
	If siebBusComp.FirstRecord = True Then
		ls_name = siebBusComp.GetFieldValue("Name")
	End If
End If

If Not siebBusComp Is Nothing Then
   Set siebBusComp = Nothing
End If

If Not siebBusObj Is Nothing Then
   Set siebBusObj = Nothing
End If

   Set siebWebApp = Nothing
End If

End Sub