SWS UpdatePhone Method
Updates a rental contact’s phone number and returns a copy of the updated record.
Parameters
Name | DataType | Is Required |
---|---|---|
Active | Boolean | Optional |
Description | Updates the phone number to be active on the contact (“True”) or inactive on the contact (“False”). | |
ContactId | Long | Optional |
Description | The rental contact’s ID number. This is returned when using the CreateNewAccount or AddNewContact methods or you can search for it using the SearchBy method. | |
Phone | String | Optional |
Description | The rental contact’s phone number. | |
PhoneId | Long | Required |
Description | The phone number’s ID number that you wish to update. | |
PhoneType | PhoneType | Optional |
Description | Updates the phone number type. Available values:
|
Returned Parameters
Name | DataType |
---|---|
ACTIVE | Boolean |
Description | Indicates if the phone number is active for the contact (“True”) or not (“False”). |
CONTACT_ID | Long |
Description | The rental contact’s ID number. |
CREATED | DateTime |
Description | The date and time the phone record was originally created. |
CREATED_BY | Long |
Description | The user’s ID that originally created the phone record. |
PHONE | String |
Description | The phone number of the record that was updated. |
PHONE_ID | Long |
Description | The phone number’s ID number that was updated. |
PHONE_TYPE | Integer |
Description | The numeric value for the type of phone number. Available values:
|
UPDATED | DateTime |
Description | The date and time the phone record was last updated. |
UPDATED_BY | Long |
Description | The user’s ID that last updated the phone record. |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects. We will need the standard service object, a Phone request object, and a Phone response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.Phone_Request request = new SWS.Phone_Request();
SWS.Phone_Response response;
Here is a sample code of the request object (including optional parameters):
// UpdatePhone Request
request.PhoneId = 123456;
request.Phone = "800-555-1212";
Finally we can call the method and pass across the login object and the request object to retrieve our requested information. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.UpdatePhone(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.
For a full list of methods see SWS Methods.