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 Hide

Prerequisites

Return Types

Using the Output

Using Assemble Documents to Stream

SmartObject Tester

K2 Process

Prerequisites

Before you can use Assemble Documents to Stream, you must first:

  1. Register the Service Type
  2. 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:

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:

  1. Open the SmartObjects Services Tester (typically located at C:\Program Files (x86)\K2 blackpearl\Bin).
  2. Navigate to the SmartObject Explorer node and expand All SmartObjects.
  3. Right-click on the appropriate HotDocs SmartObject and select Execute SmartObject.
  4. Select Assemble Documents to Stream from the Method to Execute drop-down menu.
  5. In the answer fields, enter appropriate answer data.
  6. 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:

  1. Open K2 Studio.
  2. Create a new project or open an existing project.
  3. In the Solution Explorer, expand the project and create or open a process.
  4. Navigate to the Event Wizards menu.
  5. Drag and drop SmartObject Event onto appropriate location on the canvas.
  6. In the SmartObject Wizard, click Next add an Event Name.
  7. Click the Context Browser button next to the SmartObject Method field.
  8. Navigate to SmartObject Server(s) > SmartObject Server.
  9. Navigate to the HotDocs SmartObject created in the K2 SmartObject Tester.
  10. Expand the Packages node.
  11. In the Packages node, expand a Template node. This is a HotDocs Template you wish to use in the process.
  12. Expand the Single Method node.
  13. Select the Assemble Documents to Stream option.
  14. Click Add.
  15. In the SmartObject Event Wizard, click Next.
  16. 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.
  17. 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.
  18. Click Next.
  19. 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.
  20. Click Next.
  21. Click Finish. The new mapping appears in the process. You can now link the SmartObject to other stages in the process.