Skip to main content

Generate a document

In a process, you can generate documents with templates created in JSReport by adding a Reporter service task to your process model. The Reporter service task passes process variables to JSReport as report parameters, which allows you to create dynamic documents based on them. To define the Reporter service task, follow these steps:

  1. Add a new service task to the process model.

  2. Define Delegate expression to be ${reporter}.

  3. Add two Class fields as below:

    • Name:reportTemplate, String value: path to the template in JSReport, for example, /Folder/report.

    • Name:fileName, String value: name of the generated file, for example, Document.pdf.

Use data collected with a form

To generate a report using data collected in a form:

  1. Create a template in JSReport. You can refer to the collected data using the property name defined in the form. 

  2. To enable downloading of the generated document, add a user task that links to a download form. When the page detects that there are generated documents, the download link becomes automatically visible.

Use data from FA Back

In a process, you can generate reports based on FA objects (portfolios, transactions, etc.) by passing their IDs to JSReport to be used in a query script.  When a process is launched against FA objects, the IDs are saved in a process variable as a string of comma-separated values. The Reporter service task allows you to convert the string into a JSReport parameter containing the IDs as a list. To do this, adding two additional Class fields:

  • Name:inputIds, Value: name of the parameter containing the IDs string (default value: ids).

  • Name:outputIds, Value: name of the parameter to pass the list of IDs to JSReport (default value: value of inputIds).

The JSReport call now includes a new variable with the name defined in outputIds and the value being the list of IDs.

Note

If the value of outputIds is either param-tradeOrderId or param-transactionId, the IDs string is converted into a list of Long data type values (invalid Longs are ignored). Otherwise, the IDs string is converted into a list of strings.