The Generate from File activity uses a file from the context of an app or a process as a template to create a document. This is especially useful for cases when you have to choose from various templates when creating a new document.
For example, there is an app that stores different types of contracts with corresponding templates. Each new contract is generated from a template depending on its type. On the task page, the employee enters order details, selects the contract type from the app, and sends the contract for further processing. In the course of the process, the contract file is created at the Generate from File step from a template of the selected type. This contract can be used further in the process.
To learn more about the syntax used in templates, see Template syntax.
начало внимание
Only users included in the Administrators group can set up the Generate from File element.
конец внимание
Set up the Generate from File activity
On the process page, go to the right pane and open the System Elements tab.
Drag the Generate from File activity to the process diagram and place it in the spot where you need the system to create the document.
Double-click on the shape to open its settings.
General tab
- Name*. Specify the name of the operation as it will be shown on the process diagram.
- Input file *. Select the file that will store the document template. Only File variables can be selected. The compatible file formats are .docx и .xlsx.
- Output file*. Select the file that will store the created document. Only File variables сan be selected.
- Generated file name*. Enter a name for the output file. You can use process variables and the
DateTime()
function. To add a variable, click {+} on the right side of the field. To use DateTime, click f(x). You can read more about using the functions in Template syntax. - Convert to PDF. Enable this option if you want the document to be created as PDF.
Error Handling tab
An error may occur during document generation, for example, if the file creation service is unavailable. You can set the further course of the process and the actions to be performed in this case.
- Notification. Enable the option so that in case of an error, responsible users will be notified about it. You can select:
- Current user. The one who performed the task placed before the Generate from File activity in the process diagram.
- Context variable. For example, the initiator.
- Group.
- Org chart item.
- Interrupt. Check the option and select the connector that the process will follow in case of an error.
After having filled out all fields, click Save.
The input template file is stored in the app context. The newly generated file is saved into the variable that you have specified as the output file. Add this variable to the appropriate task form or use it in a script to allow the user to retrieve the document.