Tutorial: Add a PDF file to the template as cover page

The instructions below are for adding a PDF file as a cover page. However the steps generally can be followed in many other use cases that involve adding a mandatory PDF file to the template.

In the 'Advanced UI' > Home > Main Flow:

1- Add a query for the file to the 'Initialize' step of the logic flow (screenshot below). In the query, specify the 'Id' condition to be the file's Id. In this example, I named the variable that held the query result firstpagePDF.

2- In the 'PDF Preview - Start' step of the logic flow, load the file and merge it in the same final PDF with the main document. 

- load tag: 'var' is the variable name that you give to this loaded file, 'recordId' should be the Id of the queried file.

- mergePDF tag: the 'firstDoc' has to be the PDF file and the 'secondDoc' is the main document. 'var' has to be 'documentPDF'. You set the variable inside 'firstDoc' and 'secondDoc' depending on where you would want to place the PDF file.

If you want the PDF file to be attached based on different conditions, you can add the conditions in this step inside the 'If' command.