Home > API General, Doc Designer, Letters > SWS createLetter Method

SWS createLetter Method


Creates a .pdf letter from an existing letter template in Store.

Parameters

Name DataType Is Required
Request swsLtrParams Required
Description The fields required to create the letter.

Returned Parameters

Name DataType
LtrNum Long
Description Returns the letter number assigned to the specific letter and customer.

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 CreateLetter request object, and a CreateLetter response object. We can define and create those like this:

' Create a request and response objects
 Dim objService As New SWS.WSSoapClient
 Dim objReq As New SWS.CreateLetter_Request
 Dim objRes As New SWS.CreateLetter_Response

As with every method we need to pass in credentials. We do this with the LookupUser request object:

Here is a sample code of the request object:

' CreateLetter Request
 With objReq
 .SiteID = 1000000001
 .AcctID = 1111111111
 .RentalID = 1212121212
 .LtrTypeID = 1000
 .SiteLtrRule = INVOICE
 .IsMailLocal = True
 .IsCOM = False
 .CertifiedType = NONE
 .ContactType = PRIMARY
 .ContactOrAddrID = 2222222222
 End With

 

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.

Try
 ' Call the method that will load the response object
 objRes = objService.CreateLetter(objLogin, objReq)
 Catch ex As Exception
 MessageBox.Show(ex.Message)
 End Try

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.

Categories: API General, Doc Designer, Letters Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s