SWS AddNewAddress Method
Adds another complete address to a rental contact’s contact information and defines it as the new ‘Active’ address. Also returns the new address information, including the Store user that created it and the date.
Parameters
Name | DataType | Is Required |
---|---|---|
ContactAddress | ContactAddress | Required |
Description | The object containing the collection of data for the address entry. |
Returned Parameters
Name | DataType |
---|---|
ACTIVE | Boolean |
Description | Defines the address as active (“True”) or inactive (“False”). |
ADDR_ID | Long |
Description | The rental contact’s address ID number. |
ADDR_TYPE | Integer |
Description | The numeric value for the address type. Available values:
|
ADDR1 | String |
Description | The first line of the contact’s address. |
ADDR2 | String |
Description | The second line of the contact’s address. |
ADDR3 | String |
Description | The third line of the contact’s address |
CITY | String |
Description | The city for the contact’s address. |
CONTACT_ID | Long |
Description | The rentals contact ID that was updated. |
COUNTRY | String |
Description | The country for the address. |
CREATED | DateTime |
Description | The creation date and time of the address record. |
CREATED_BY | Long |
Description | The ID of the user that created the address. |
POSTAL_CODE | String |
Description | The postal/ZIP code for the address. |
STATE | String |
Description | The state/province for the address. |
UPDATED | DateTime |
Description | The date and time the address record was last updated. |
UPDATED_BY | Long |
Description | The ID of the user that last updated the address. |
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 AddNewAddress request object and an AddNewAddress response object. We can define and create those like this:
// Create a request and response objects SWS.WSSoapClient service = new SWS.WSSoapClient(); SWS.ContactAddress request = new SWS.ContactAddress(); SWS.Address_Response response = new SWS.Address_Response();
Now we set up the parameters for our request.
//Contact Address object request.ContactId = 12345678; request.AddrType = SWS.AddressType.HOME; request.Addr1 = "123 Main St"; request.Addr2 = "Apt 2"; request.City = "MyTown"; request.State = "UT"; request.PostalCode = "12345"; request.Country = "USA"; request.Active = true;
Finally we can call the method and pass across the login object and the request object to add a new address. It’s a good idea to do this in a Try Catch block.
try { // Call the method that will load the response object response = service.AddNewAddress(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.