qbo.Attachment: Templates

posted Aug 1, 2013, 2:13 PM by Dylan Mlcoch   [ updated Feb 13, 2018, 7:15 AM by Unknown user ]


The QBO Attachment Template class is used to orchestrate mail merges to create new documents. QBO contains various plug-ins that enable mail merging (see below). An Attachment Template defines the type of document being mail merged, where to get the merge data, what plug-in to use, the name and type of the file being created, as well as document retention guidance.



This is the template name.

Applies To:

This is the Parent Object


  • One per parent – This creates only one output file per parent, non-repeatable per form.
  • One active attachment per parent – This doesn’t pertain to attachments, only used for decisions.
  • Many attachments per parent – This creates as many attachments as you need per parent.  This is the most used option.


This is the name of a mail merge plug-in to use when generating new Attachments based on a template.

  • AsposeWord - Mail merging all input data into single document, requires Word2007 mime (see below)
  • AsposeWord-SingleDocument – Mail merging all data into separate documents, each data row into its own document, requires word2007 mime (see below)
  • XhtmlGenerator – Generates an HTML webpage
  • DelimitedGenerator – Generates any delimited text file
  • ExcelGenerator – Excel file
  • HtmlToPDF – Takes an HTML document and creates PDF document
  • MapGenerator – Creates Google map
  • PdfMerge – Merges multiple PDFs into single PDF output
  • ServicesPDF – Sends HTML to QDS and receives PDF back.  Deprecated model use HTML to PDF instead
  • UrlToPDF – Screen scraping from any URL to output to PDF
  • ZipGenerator – Creates zip output from any number of input files

Mime Type:

This is used by the plugin to determine the file format of the document produced. For example, the Aspose plugins can produce Word, PDF, or RTF documents. The Crystal Reports plugin can produce Word, Excel, and PDF documents.  Note that not all plugins support all mime types.  Note that the list of mime type is maintained from Design > Configuration > Modules > Attachment Template, on the Mime Types panel.


The "template" file used by a plugin to mail merge.  Examples:

  • Aspose uses Word documents
  • XhtmlGenerator uses XSLT documents
  • DelimitedGenerators uses an XML document that defines how the attachment should be delimited

File Name Format:

This field controls the path and name of the file on disk. By default, /{Object}/{ObjectID}/{FileName} will be used. The curly braces represent data that can be substituted as the path and file name is generated.  Examples include:

  • /Inbound/LoanDocs/MySampleDoc.{ObjectID}.pdf
  • /{Object}/NewDocuments/{Guid}.{Uri.Extension}
The values that may be used in the curly braces include:
  • {Guid}: generates a GUID to guarantee unique naming
  • {DateTimeStamp}: creates a date time stamp in the format 'yyyy-MM-dd-hh-mi-ss'
  • {Year}
  • {Month}
  • {Day}
  • {Uri.FileName}
  • {Uri.LocalPath}
  • {Uri.Host}
  • {Uri.Extension}
  • {any column from the Attachment table}

The statement that is used to generate input data for the attachment.  


This is a power-used defined enumeration of Attachment Template types. This can be maintained from Design > Configuration > Modules > Attachment Templates.


This is a power-used defined enumeration of Attachment Template statuses. This can be maintained from Design > Configuration > Modules > Attachment Templates.

Initial Storage:

Where file resides once created and saved. Leaving this value blank will default to the 'standard' location (recommended). However, one can instead target client or vendor FTP sites, imaging systems, or any other IFileObject configuration on the system.


Defines when to expire attachments of matching this template. Expiring a document means deleting the file on disk, while retaining the Attachment record in the database. This is useful for document retention compliance, and for managing disk storage space costs. This value is used by standard Attachment expiration jobs that may be configured in the system.


Defined when a document is to be move for 'expensive' storage to 'cheap' archival storage. This value is used by standard Attachment archival jobs that may be configured in the system.

Archive Storage:

Where to store the file once it is archived.

Outbound Service:

What is used to handle mailing, only currently used for: USPSCertified

Generating an Attachment based on a Template

Once an Attachment Template has been configured, one may generate a mail-merged attachment as follows:
  • From any Attachment panel, choose Options > Show Templates; click on the Generate link by any template
  • Create a workflow step to call Attachment/Generate
  • Create a data listener to call Attachment/Generate
  • Manually navigate to Attachment.ashx/Generate?{Parameters}
  • Use javascript to call new qbo3.AttachmentObject().invoke('Generate', {parameters});

Font issue with Aspose Generator - Workaround

There is an issue with Aspose and the PMingLiu font when generating Korean characters during Microsoft Word merges.  
If PMingLiu is used, Unicode blank squares are generated instead of Korean words.
The solution, according to Aspose's documentation, is to change the font to Arial Unicode MS.