SWS AddNewContact Method
Adds a rental contact to the specified account and returns a copy of the contact information. Also adds addresses and phone numbers to the new contact.
Parameters
Name | DataType | Is Required |
---|---|---|
AcctID | Long | Required |
Description | The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. | |
Active | Boolean | Optional |
Description | Sets the contact as active (“True”) on the account or inactive (“False”). The default is “True” if left undefined. | |
Cflex01 | String | Optional |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. | |
Cflex02 | String | Optional |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. | |
Cflex03 | String | Optional |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. | |
Cflex04 | String | Optional |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. | |
Cflex05 | String | Optional |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. | |
ContactId | Long | Do Not Use |
Description | The rental contact’s ID number value is ignored as a new contact does not have an ID number at this point. | |
ContactType | String | Optional |
Description | The rental contact type. Available values:
|
|
DLNumber | String | Optional |
Description | The rental contact’s driver’s license number. Max string length of 35. | |
DLState | String | Optional |
Description | The issuing state/province of the rental contact’s driver’s license. Max string length of 20. | |
DOB | String | Optional |
Description | The rental contact’s date of birth. The date format is based on your software coding parameters. Max string length of 20. | |
EcommCode | String | Optional |
Description | Set the rental contact’s alpha-numeric eStore password/eCommerce code. Max string length of 30. | |
String | Optional | |
Description | The rental contact’s email address. This is also used as the username if the site supports eStore. Max string length of 100. | |
Employer | String | Optional |
Description | The rental contact’s employer. Max string length of 75. | |
FirstName | String | Required |
Description | The given name for the rental contact. Max string length of 50. | |
KnownAs | String | Optional |
Description | The alternate or nick name for the rental contact. Max string length of 50. | |
LastName | String | Required |
Description | The family name for the rental contact. Max string length of 50. | |
SSN | String | Optional |
Description | The rental contact’s social security number. This field has limited viewing for privacy but can be defined at any time. Max string length of 20. | |
Addresses | ContactAddress | Optional* |
Description | An array of objects to create a new address for the contact. Create an array for each address for the contact. * This is required for the primary contact on the account. |
|
Phones | ContactPhone | Optional* |
Description | An array of objects to create new phone records for the contact. Create an array for each phone number for the contact. * This is required for the primary contact on the account. |
Returned Parameters
Name | DataType |
---|---|
ACCT_CONTACT_ADDRESSES | ACCT_CONTACT_ADDRESSES |
Description | A collection of address data associated with the rental contact. |
ACCT_CONTACT_PHONES | ACCT_CONTACT_PHONES |
Description | A collection of phone data related to the contact. |
ACCT_ID | Long |
Description | The account’s ID number. |
ACTIVE | Boolean |
Description | Indicates if the contact is active (“True”) or not (“False”). |
CFLEX01 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX02 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX03 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX04 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CFLEX05 | String |
Description | A custom field, set up by the organization, designed to hold additional contact information. This is not displayed in the Store application. |
CONTACT_ID | Long |
Description | The rental contact’s ID number that was created during the process. |
CONTACT_TYPE | Integer |
Description | A numeric value for the contact type. Available values:
|
CREATED | dateTime |
Description | The creation date and time of the record. |
CREATED_BY | Long |
Description | The user’s ID that created the record. |
DL_NUMBER | String |
Description | The rental contact’s driver’s license number. |
DL_STATE | String |
Description | The issuing state/province of the rental contact’s driver’s license. |
DOB | String |
Description | The rental contact’s date of birth . The date format is based on your software coding parameters. |
ECOMM_CODE | String |
Description | No longer returned. |
String | |
Description | The rental contact’s email address. This is also used as the username if the site supports eStore. |
EMPLOYER | String |
Description | The rental contact’s employer . |
FIRST_NAME | String |
Description | The given name for the account/rental contact. |
KNOWN_AS | String |
Description | The alternate or nick name for the rental contact. |
LAST_NAME | String |
Description | The family name for the rental contact. |
SSN | String |
Description | The rental contact’s social security number. This field will be partially obfuscated for privacy. |
UPDATED | DateTime |
Description | The updated date and time . |
UPDATED_BY | Long |
Description | The user’s ID number that 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 AddNewContact request object and an AddNewContact response object. We can define and create those like this:
// Create request, response, address and phone objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.Contact_Request request = new SWS.Contact_Request();
SWS.Contact_Response response;
SWS.ContactAddress address = new SWS.ContactAddress();
SWS.ContactPhone phone = new SWS.ContactPhone();
Create the parameters for the address, phone and contact request objects. Note, no ID’s other than account ID are entered. This method is creating a new address, phone and contact and associating them with a previously established account.
//Create a new address record address.Active = true; address.Addr1 = "123 Main St"; address.City = "My Town"; address.State = "UT"; address.PostalCode = "12345"; address.AddrType = SWS.AddressType.HOME; //Create a new phone record phone.Active = true; phone.Phone = "800-555-1212"; phone.PhoneType = SWS.PhoneType.MOBILE; //Add new contact request object request.AcctID = 123545; request.Active = true; request.Addresses = new SWS.ContactAddress[]{ address }; request.Phones = new SWS.ContactPhone[] { phone }; request.FirstName = "First"; request.LastName = "Last"; request.ContactType = SWS.ContactType.ACCOUNT_MANAGER; request.Email = "first@co.com";
Now we can call the method.
try
{
// Call the method that will load the response object
response = service.AddNewContact(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.
-
July 1, 2013 at 5:24 pmSWS CreateNewAccount and AddNewContact methods now validate string parameters correctly | Centershift Developer eXchange