SWS scheduledLetter Method
Creates a letter and allows you to choose the date that it will be generated in Store.
Parameters
Name | DataType | Is Required |
---|---|---|
AcctID | Long | Required |
Description | The account’s ID number for which to generate the letter. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. | |
CertificateOfMail | Boolean | Required |
Description | Adds a filter for letters that will be generated with a certificate of mail (“True”) or not (“False”). This does not indicate certified mail. See the USPS website for details. | |
CertifiedType | certifiedVals | Required |
Description | Indicates what type of certified mail is to be used in the mailing of the letter. Available values:
|
|
MailLocal | Boolean | Required |
Description | Adds a filter to retrieve letters that will be printed and mailed by the site (“True”) or letters that will be sent through centralized mailing (“False”). | |
PdfTemplateID | Long | Required |
Description | The ID of the template that will be used to generate the letter. | |
RentalID | Long | Optional |
Description | The rental item’s ID number for which to generate the letter. If the letter is account level letter this is not required. If the letter is a rental level letter it is required. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
ScheduledDate | DateTime | Required |
Description | The date you wish to schedule the letter to be generated. | |
SendTo | LTR_CONTACT_TYPES | Required |
Description | Indicates which contacts will receive the letter. Available values:
|
|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
ScheduledID | Long |
Description | The ID for the newly scheduled letter. |
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 scheduledLetter request object, and a scheduledLetter response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.scheduledLetter_Request request = new SWS.scheduledLetter_Request();
SWS.scheduledLetter_Response response;
Here’s my sample code of the Request object.
// scheduledLetter Request
request.SiteID = 123456;
request.AcctID = 123456;
request.RentalID = 123456;
request.PdfTemplateID = 123465;
request.ScheduledDate = new DateTime(2017, 9, 1);
request.SendTo = SWS.LTR_CONTACT_TYPES.PRIMARY;
request.MailLocal = true;
request.CertificateOfMail = false;
request.CertifiedType = SWS.certifiedVals.NONE;
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.scheduledLetter(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.