/ Search

Search Epistola

Find documentation, integration guides, tour steps, blog posts and pages.

DocsIntegrationsTourBlogPage
↑↓↵esc

Document Generation Action

Add a workflow step that asks Epistola to generate a document, and choose which release and variant it uses.

Document generation action

Use the Generate Document action at the point in the process where the case needs a document. The action sends the case data to Epistola and stores the request in a process variable. The PDF follows later.

Choose what to generate

  1. On a service task, create a process link with the Epistola plugin and choose Generate Document.
  2. Select your plugin configuration.
  3. Choose the Environment, or leave it empty to use the default environment of the configuration.
  4. Choose the Catalog.
  5. Choose the Release, or leave it empty.
  6. Choose the Template.
  7. Choose the variant, or let Epistola use the default variant.

Map the data and save

Then map the data and say where the result goes:

  1. Map case data to the fields of the data contract. See Map case data.
  2. Fill in the Filename. Optionally, fill in a Correlation ID.
  3. Fill in the Result Process Variable, for example epistolaResult. Use only letters and numbers.
  4. Save the process link. Valtimo refuses to save if a required field of the data contract has no mapping, or if an expression is invalid.

Choose the environment and release

Epistola generates every document from a published release of a catalog. These settings decide which release:

  • Environment: Epistola uses the releases deployed to this environment. If you leave it empty, the plugin uses the Default Environment of the configuration.
  • Release: a version such as 1.4.0 uses exactly that release. A range such as ^1.4.0 uses the highest release that fits. If you leave it empty, Epistola uses what the environment serves: the draft it follows, or else the highest release deployed there. Without an environment, Epistola uses the highest release (the highest version number).

If neither the action nor the configuration has an environment, Epistola chooses from all published releases of the catalog. An environment gives you control: a case gets only what you deployed there. So environments are the recommended way to decide what a case process gets.

When you name an environment, that environment must serve the catalog. If no release is deployed there, Epistola refuses the request. A test environment can also follow a draft, with a preview watermark. The action settings mark a catalog that is not deployed to the environment, but you can still choose it.

Fill in the environment, release and variant

These fields are JSONata expressions. How you enter a value depends on the field’s editor:

  • A field with a list opens as a dropdown. Pick a value there.
  • The button next to the field switches to the visual editor. Type a fixed value without quotes, or type @ to pick a value from the case.
  • Click the button again for the Advanced editor. There you type JSONata: put a fixed value in double quotes, such as "production". An expression such as $pv.environment decides per case.

If an expression produces no value, the step fails with an incident. In the Advanced editor, write a fallback into the expression, for example $pv.environment ?: $plugin.defaultEnvironmentId. The empty text "" means: deliberately no environment.

Choose a variant

Epistola selects a variant in three ways:

  1. Omit the variant to use the template’s default variant.
  2. Select a variant when the process knows exactly which layout to use.
  3. Supply attributes (key/value pairs such as language: nl or brand: acme) and let Epistola match them against the variants of the release.

You use a variant or attributes, never both. Required attributes must all match. Preferred attributes only add to the score.

If no variant matches, Epistola falls back to the default variant. If two or more variants share the highest score, that is an error, not a fallback.

If business rules in Valtimo decide which presentation is needed, let those rules compute the variant or the attribute values. Attribute values are JSONata expressions too.

Mark the step Asynchronous before

Mark the generate step Asynchronous before in the modeler. This is the recommended default.

Epistola can refuse a request straight away, for example when the template is not in the release, nothing is deployed, or the key has no access. With Asynchronous before, the refusal becomes an incident that says what is missing. You fix the cause and retry the incident. Without it, the person who completed the previous task sees a general error, and their submit is rolled back.

After the action

After the action, add a wait step with a route for success and for failure. Do not assume the PDF is ready right away. See Wait for documents.

More on this topic

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 →