System Documents
The System Documents feature allows users to upload template files (e.g., Word documents) with predefined placeholders (keys) that will be dynamically replaced with data from SQL queries. These documents are often used for generating dynamic content such as contracts, reports, or summaries where specific fields (like customer name, contract date, etc.) are populated automatically from the system.
The system relies on two queries: one for the header data and one for the body data, with both queries pulling information from the database to replace the placeholders in the document.
How to use System documents?
- Creating a System Document
-
Uploading a Template:
-
Navigate to the System Documents section and click on Add New Document to upload a Word file containing predefined placeholders (e.g., {{CustomerName}}, {{ContractDate}).
-
These placeholders will be replaced with actual data during the document generation process.
-
Linking Document Queries:
- After uploading the template, you need to link it to the Document Queries entity to define the SQL queries that will retrieve the necessary data.
-
The Document Queries entity has a lookup field to associate it with a specific System Document.
-
Document Queries Entity
-
Defining Queries:
-
The Document Queries entity allows administrators to define SQL queries that will be used to replace placeholders in the system document.
-
Each query must specify:
-
Type: Determine whether the query is for the header or the body of the document.
-
SQL Query: The actual SQL command that will retrieve the necessary data from the database.
-
Linking Queries to System Documents:
-
Each query in the Document Queries entity is linked to a specific System Document. This ensures that when a document is generated, the corresponding queries are executed to replace the placeholders in the document.
-
This relationship allows for organized management of all queries associated with a particular document template.
-
Processing a System Document:
-
Creating the Ribbon Button:
-
After setting up the System Document and associated Document Queries , navigate to the Ribbon Button Tool within the application.
-
Create a new ribbon button that will trigger the download process for the system document.
-
Linking to a Web Resource:
-
Associate the newly created ribbon button with a web resource of name ‘System Document Scripts’ that contains the necessary JavaScript functions for executing and downloading the document.