![]() | |
Client_2018_01Update_Client Method |
1' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01 2' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07 3 4' Constant DATABASE preset to current database name 5' Constant AUTHENTICATION_KEY set to current authentication key 6' Constant USER_CODE set to a valid login user code 7 8Try 9 Dim oService As New EpicSDK_2018_01Client ' Instantiate the Service object 10 Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object 11 12 ' Populate the database and authentication key in the Header object 13 oHeader.DatabaseName = DATABASE 14 oHeader.AuthenticationKey = AUTHENTICATION_KEY 15 'OPTIONAL 16 oHeader.Culture = "en-US" 'In this case we are setting the culture to US English. 17 oHeader.UserCode = USER_CODE 18 oHeader.IntegrationKey = "eaa8b2df-94c0-4bac-a403-1a1b749b8e06" 'In this case we are identifing as the 3rd custom integration 19 20 Dim oFilter As New SDK2009_07._get.ClientFilter 21 oFilter.ClientID = 113168 ' Need to set this to a valid ClientID from your database. 22 23 'In this case, we only want one result so use CLientID as the search criteria 24 'The first name and last name parameters are ignored. 25 Dim lClients As List(Of SDK2009_07._account.Client) = oService.Get_Client(oHeader, oFilter, 0).Clients 26 27 Dim oClient As SDK2009_07._account.Client = lClients(0) 28 29 ' Now you can update whatever fields you wish. 30 'Lets just update the contact comments: 31 32 oClient.AccountValue.Comments = "Updated Comments." 33 Try 34 oService.Update_Client(oHeader, oClient) 35 Catch ex As Exception 36 oService.Abort() 37 Throw 38 End Try 39 40 ' Give user some feedback 41 Console.WriteLine("The Client AccountsValue.Comments property has been updated") 42 43 ' Close the service 44 oService.Close() 45 46Catch ex As Exception 47 If ex.ToString.Contains("AuthenticationFault") Then 48 Console.WriteLine("The authenticationkey entered is invalid.") 49 Console.WriteLine(ex.Detail.Description) 50 ElseIf ex.ToString.Contains("InputValidationFault") Then 51 Console.WriteLine("The data entered did not pass validation.") 52 Console.WriteLine(ex.Detail.Description) 53 ElseIf ex.ToString.Contains("MethodCallFault") Then 54 Console.WriteLine("There has been an error in the method called.") 55 Console.WriteLine(ex.Detail.Description) 56 ElseIf ex.ToString.Contains("ConcurrencyFault") Then 57 Console.WriteLine("There has been a concurrency error.") 58 Console.WriteLine(ex.Detail.Description) 59 Else 60 MessageBox.Show(ex.Detail.Description) 61 End If 62 Console.WriteLine("Press any key to exit...") 63 Console.ReadLine() 64End Try