Assemble Documents to Stream
The Assemble
Documents to Stream method assembles a document from a HotDocs
template and streams the results as a base64-encoded string.
In this Topic ShowHide
Prerequisites
Before you can use Assemble Documents to Stream, you must first:
- Register the Service Type
- Register a Service
Instance
Return Types
HotDocs assemblies can produce single or multiple documents. Depending
on the number of templates produced, the SmartObject streams a different
file:
- Single Document – the document
streams as a base64-encoded string.
- Multiple Documents – streams
a zip file containing all
assembled documents.
Using the Output
In the K2 process, the output content stream is typically passed to
a K2 text field, from where it
can be used by K2 events and controls.
Using Assemble Documents to Stream
SmartObject Tester
To assemble documents to stream using
the SmartObject Tester:
- Open the SmartObjects
Services Tester (typically located at C:\Program
Files (x86)\K2 blackpearl\Bin).
- Navigate to the SmartObject
Explorer node and expand All
SmartObjects.
- Right-click on the appropriate HotDocs SmartObject and select
Execute SmartObject.
- Select Assemble Documents to Stream
from the Method to Execute drop-down menu.
- In the answer fields, enter appropriate answer data.
- Press Execute to
write file to the user's temp folder.
The SmartObject tester currently outputs
a temporary zip file to the user’s temp folder. However, the return property
has the potential to be passed on to additional processes that can unzip
the file and access the documents.
K2 Process
To use Assemble Documents to Stream in a K2 Process:
- Open K2 Studio.
- Create a new project or open an existing project.
- In the Solution Explorer, expand the project and create or
open a process.
- Navigate to the Event Wizards
menu.
- Drag and drop SmartObject Event
onto appropriate location on the canvas.
- In the SmartObject Wizard, click Next
add an Event Name.
- Click the Context Browser
button next to the SmartObject Method field.
- Navigate to SmartObject Server(s)
> SmartObject Server.
- Navigate to the HotDocs
SmartObject created in the K2 SmartObject Tester.
- Expand the Packages
node.
- In the Packages node, expand a Template node. This
is a HotDocs Template you wish to use in the process.
- Expand the Single Method node.
- Select the Assemble Documents
to Stream option.
- Click Add.
- In the SmartObject Event Wizard, click Next.
- Click the right arrow on the right-hand side of the window to display
the context browser. Open the Process/Activity
Data tab and expand Data Fields.
- In Input Mapping, drag
and drop a data field from the Context Browser
into the Value column for
the appropriate Input field. This maps data from the process to a
field used in the SmartObject.
- Click Next.
- In Return Mapping, drag
and drop data fields from the Context Browser
into the Value column for
the appropriate Return field. This field should be a binary-type data
field. This maps the data returned from the SmartObject to business
data within the process. The data can then be passed to other K2 Processes.
- Click Next.
- Click Finish.
The new mapping appears in the process. You can now link the SmartObject
to other stages in the process.