You are on page 1of 2

Function Service_PreInvokeMethod (MethodName As String, Inputs As PropertySet, O utputs As PropertySet) As Integer On Error GoTo ErrorHandler If MethodName = "RunBatch" Then

Dim iFileNum, i As Integer iFileNum = FreeFile() Open "c:\Output_Message.txt" For Output As iFileNum Write #iFileNum, "Business Service Successfully Started." Write #iFileNum, "Date and Time is:" & now() Dim icount As Integer Dim Dim Set Set boCon bcCon boCon bcCon As BusObject As BusComp = TheApplication.GetBusObject("Contact") = boCon.GetBusComp("Contact")

With bcCon .SetViewMode AllView .ActivateField ("Id") .ActivateField ("Industry") .ActivateField ("Assistant") .ActivateField ("Last Name") .ActivateField ("First Name") .ActivateField ("Middle Name") .ActivateField ("Account Id") .ActivateField ("Division") .ActivateField ("Email Address") .ActivateField ("Fax Phone #") .ActivateField ("Home Phone #") .ActivateField ("Job Title") .ActivateField ("M/F") .ActivateField ("Mail Stop") .ActivateField ("Middle Name") .ActivateField ("Region") .ActivateField ("Work Phone #") .ActivateField ("Work State") .ActivateField ("Agenda") .ActivateField ("Personality") .ActivateField ("Comment") .ActivateField ("Alignment") .ActivateField ("Accomplishments") .ActivateField ("Research Plan Id") .ActivateField ("Research Member Id") .ClearToQuery .SetSearchSpec "Research Plan Id", "is NOT NULL" .SetSearchSpec "Research Member Id", "is NULL" .SetSortSpec "Id" .ExecuteQuery ForwardOnly i = .FirstRecord ' Returns 0 If fails, 1 If succeeds If i > 0 Then Write #iFileNum, "FirstRecord:" & i icount = 0 While i = 1 Write #iFileNum, "Loop Count:" & icount icount = icount + 1 .SetFieldValue "Research Member Id", Get MemberInfo(.GetFieldValue("Research Plan Id")) i = .NextRecord ' Returns 1 If successfu l

" Close #iFileNum End If Service_PreInvokeMethod = CancelOperation Exit Function ErrorHandler: SendErrorEmail Err. Error$ Service_PreInvokeMethod = CancelOperation Close #iFileNum End Function .Wend End If End With Write #iFileNum. "Successfully Quiting. "Count:" & icount Write #iFileNum.