If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

About Message Part Examples

The following examples illustrate how message parts can be configured for either HTMLbased or text-based messages. All of these examples are based on the Persons service.

Standard Message Part Examples

In the following examples, the message part is configured to display the person's mailing address within the email message. The information to display in this part comes from the current message source. The field tags, << >>, indicate the fields from which the information is retrieved.

Standard Message_ HTML Only

<<AddressLine1>><BR>
<<AddressLine2>><BR>
<<City>>, <<State>> <<ZipCode>><BR>
<<Country>><BR>

Standard Message_ Text Only

<<AddressLine1>>
<<AddressLine2>>
<<City>>, <<State>> <<ZipCode>>
<<Country>>

Script Based Message Part Examples

In the following examples, the message part is configured to display the person's order history. The Visual Basic scripts provided capture the required information from the Orders service and format the information for inclusion within the message.

Script-Based Message: Text Only
Using oDT As System.Data.DataTable = oDataAction.GetDataTable -(oResponse.MarkupString(System.Convert.ToString("SELECT ID,-OrderDate,Line1_ProductName,GrandTotal,Balance FROM APTIFY.dbo.vwOrders WHERE ShipToID=<%ID%>")))
-If oDT.Rows.Count > 0 Then 
Dim sLineBreakString As New String("-"c, oDT.Columns.Count * 20) 
oResponse.WriteText(System.Convert.ToString(oProperties.GetProperty("This is your order history")))
oResponse.WriteText(System.Environment.NewLine) '' Line break
oResponse.WriteText(System.Environment.NewLine) '' Line break
oResponse.WriteText(sLineBreakString)
oResponse.WriteText(System.Environment.NewLine) '' Line break 
For Each oCol As System.Data.DataColumn In oDT.Columns
oResponse.WriteText(String.Concat(oCol.ColumnName, " "))
Next 
oResponse.WriteText(System.Environment.NewLine) '' Line break
oResponse.WriteText(sLineBreakString)
oResponse.WriteText(System.Environment.NewLine) '' Line break 
For Each oRow As System.Data.DataRow In oDT.Rows
For Each oItem As Object In oRow.ItemArray
oResponse.WriteText(String.Concat(System.Convert.ToString(oItem), " "))
Next
oResponse.WriteText(System.Environment.NewLine)
Next 
oResponse.WriteText(System.Environment.NewLine) '' Line break
oResponse.WriteText(sLineBreakString)
oResponse.WriteText(System.Environment.NewLine) '' Line break
End If
End Using



Script-Based Message: HTML Only
Using oDT As System.Data.DataTable = oDataAction.GetDataTable -(oResponse.MarkupString(System.Convert.ToString("SELECT ID, -OrderDate,Line1_ProductName,GrandTotal,Balance FROM APTIFY.dbo.vwOrders WHERE ShipToID=<%ID%>")))
If oDT.Rows.Count > 0 Then
oResponse.WriteText ("<h2>This is your order history</h2><HR>")
oResponse.WriteText ("<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=3>") 
oResponse.WriteText("<TR>")
For Each oCol As System.Data.DataColumn In oDT.Columns
oResponse.WriteText("<TD>")
oResponse.WriteText(oCol.ColumnName)
oResponse.WriteText("</TD>")
Next
oResponse.WriteText("</TR>") 
For Each oRow As System.Data.DataRow In oDT.Rows
oResponse.WriteText("<TR>")
For Each oItem As Object In oRow.ItemArray
oResponse.WriteText("<TD>")
oResponse.WriteText(System.Convert.ToString(oItem))
oResponse.WriteText("</TD>")
Next
oResponse.WriteText("</TR>")
Next 
oResponse.WriteText("</TABLE>")
End If
End Using

 



Copyright © 2014-2019 Aptify - Confidential and Proprietary