Preview & Correct
Let users preview a document before it is generated, and correct the case when generation fails.
User guide navigation
On this page
Preview and correct
Use a preview when users need to check a document before it is generated. When generation fails, let users correct the case and generate again.
Add a preview
The Epistola Document Preview component shows a live render of the document, built from the case and from what the user types in the form. It uses the same mapping as the generate step. The preview is a real render, but it is not stored and creates no generation job.
- Add the Epistola Document Preview component to the form.
- Under Where is this form shown?, choose In a user task or On a start form.
- Under Process Link, choose the Generate Document step whose document the preview should show.
- Keep Use the form’s field keys as overrides on. The preview then reads fields with a key such as
pv:motivationordoc:/applicant/namefrom the form, before the user saves. - Add Input Overrides only for fields whose key does not say where the value is stored, such as a step in a form flow.
- Choose whether the preview refreshes on its own while the user fills in the form. Users can also turn this on or off themselves.
- Test with realistic cases.
Correct the case and generate again
When a document fails, the cause is almost always in the case: a value is missing or has the wrong form. So the user fixes the case, and the process generates the document again.
- Route the failure path to a user task, for example Correct case data.
- Copy the reason to a variable the form can show, for example with an execution listener on the failure flow:
${execution.setVariable('generationError', epistolaResult.errorMessage)}. - Build a normal case form. Show the reason read-only, and add the case fields the document uses, with their case path as key.
- After the task, loop back to the same Generate Document step. It runs its mapping again, on the corrected case.
- If it fails again, route the case to a person for review.
This way the case and the document cannot disagree. Later documents get the correction too.
The retry form is gone
Plugin 1.0 removed the retry form (epistola-retry-form). It changed the document instead of the case, so the next document failed in the same way. A form that still has that component shows nothing in its place. Replace it with a correction form as described above.
Good practice
Preview helps users make a decision. Do not turn it into a full document editor inside Valtimo.
Epistola is open source, not free of cost. The organisations that use it fund its development, through Epistola or an Official Partner. We are steward-owned: fair prices, no profit maximisation. How Epistola is funded →