SWS AddNewPhone Method
Adds another phone number to a specified rental contact and returns a copy of the new phone record. Phone numbers are string values to support the organization’s preferred format and international formats.
Parameters
Name | DataType | Is Required |
---|---|---|
Active | Boolean | Required |
Description | Sets the phone number as active (“True”) or inactive (“False”) on the account. Default is “True” if left undefined. | |
ContactId | Long | Required |
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 | Required |
Description | The new phone number. Max string length of 55. | |
PhoneId | Long | Do Not Use |
Description | The phone number’s ID number. This is ignored as the new phone number does not have an ID number yet. | |
PhoneType | String | Required |
Description | The type of phone number. Available values:
|
Returned Parameters
Name | DataType |
---|---|
ACTIVE | Boolean |
Description | Indicates if the new phone number is active (“True”) or not (“False”) on the account. |
CONTACT_ID | Long |
Description | The rental contact’s ID number. |
CREATED | dateTime |
Description | The date the phone number was initially created. |
CREATED_BY | Long |
Description | The user’s ID that created the phone record in the system. |
PHONE | String |
Description | The new phone number. |
PHONE_ID | Long |
Description | The phone number’s ID number. |
PHONE_TYPE | Integer |
Description | The numeric value for the type of phone number. Available values:
|
UPDATED | dateTime |
Description | The date the phone record was last updated. |
UPDATED_BY | Long |
Description | The user’s ID of the person who last updated the record. |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, an AddNewPhone request object and an AddNewPhone response object. We can define and create those like this:
// Create request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.Phone_Request request = new SWS.Phone_Request();
SWS.Phone_Response response;
To add a new phone call the following parameters.
//Add new phone request object
request.Active = true;
request.Phone = "800-555-1212";
request.PhoneType = SWS.PhoneType.MOBILE;
request.ContactId = 123456;
Finally we can call the method and pass across the login object and the request object to add a new phone. It’s a good idea to do this in a Try Catch block.
//Call the method that creates the new phone record
try
{
// Call the method that will load the response object
response = service.AddNewPhone(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.