Using Repeat Answers in the SmartObject
Repeat Answers are items of
answer data entered in the repeat
fields of a HotDocs Template. If you want to use a template that includes
a REPEAT instruction in your SmartObject you must follow the additional
steps below before you execute the SmartObject.
You can only use one repeat level in the SmartObject.
In other HotDocs programs, a repeat answer can usually be nested, meaning
you can create sub-lists within your initial repeat list (for example,
in a list of children you can also include sub-lists of grandchildren).
This is not possible in the SmartObject.
In this Topic ShowHide
Prerequisites
For repeat answers to work in the Smart Object, you must first:
- Create a HotDocs template containing a REPEAT
instruction
- Upload the Template to the HotDocs Template
Hub
- Register the HotDocs
Service Type
- Register a new
Service Instance using the template.
Identifying Repeat Answers in a SmartObject
Repeat answer fields in the SmartObject are always prefixed with RPT-. A Repeat field always takes
the name of the corresponding Repeat Dialog in your template. For example,
if your template contains a Repeat Dialog named EmployeesInformationDialog,
the repeat answer field in the Smart Object will be named RPT-EmployeesInformationDialog.
Repeat Answer Data
Repeat Answer Data is a JSON string
containing values for the data.
Example Repeat Answer Data
HDDATA-[{"EmployeesInformationDialog":[{"Name":"Role
description","Value":"Engineer","Type":"Text"}]},{"RepeatHotDocsInputs":[{"Name":"Role
description","Value":"Secretary","Type":"Text"}]}]
Using Repeat Answers in the SmartObject
SmartObject Tester
Create a SmartObject for the REPEAT dialog
- Open the SmartObjects
Services Tester (typically located in
C:\Program Files (x86)\K2 blackpearl\Bin).
- In the ServiceObject
Explorer folder, expand the required Service (e.g. HotDocsServiceBroker).
- Expand the required Service Instance (e.g. Employment
Agreement).
- Expand the Repeat
Variables node.
- Expand the template
node folder (e.g.
EmployeeContract)
where you want to create repeat data.
- Right-click on the dialog node (e.g. EmployeeInformation)
you want to use and select Create
SmartObject.
- Click Publish SmartObject.
Close the Publish SmartObject window.
Execute a SmartObject for the REPEAT dialog
- 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 SmartObject created in the step above
and select Execute SmartObject.
- In the Method to
Execute drop-down menu, select AddItem.
- In the Input Properties
section, enter appropriate data to the repeat variables (excluding
the Serialised List field).
- Click Execute.
The repeat answer data appears in the Serialised
List field.
- To add more repeat data, enter new data into the fields in
the Input Properties
section.
- Click Execute. The
new repeat answer data also appears in the Serialised
List field. It will look something like:
HDDATA-[{"RepeatHotDocsInputs":[{"Name":"Role
description","Value":"Engineer","Type":"Text"}]},{"RepeatHotDocsInputs":[{"Name":"Role
description","Value":"Secretary","Type":"Text"}]}]
- Once all the data is added to the Serialised
List field, select and copy the data. Close the Execute
SmartObject window.
Execute a SmartObject for the template package containing the
REPEAT SmartObject
- Open the SmartObjects
Services Tester (Normally located at C:\Program Files
(x86)\K2 blackpearl\Bin).
- Navigate to the SmartObject Explorer
folder.
- Navigate to the SmartObject for the template you selected
above (e.g. EmployeeContract),
which you created the repeat data for.
- Right-click the SmartObject and select Execute
SmartObject.
- In the Method to Execute
drop-down menu, select an option:
- Enter the input properties:
- Output Format (required)
– the output format for the generated document. Enter either:
- Answer XML (optional)
– HotDocs Answer XML. You can generate this using the Get Answer
XML method in the previous step.
- In the Input Properties
section, identify the field with the same name as the Dialog node
selected above, prefixed by RPT-
(e.g. RPT-EmployeeInformation).
- Paste the repeat answer data into that field.
- Click Execute.