Automations
The Automations module enables users to extend the system with custom workflows. It allows running custom business logic, integrating with external systems, and scheduling automated tasks to improve efficiency and reduce manual work.
Use Cases:
- Run AI-powered data analysis and generate insights.
- Send automated email notifications based on specific triggers.
- Generate and export reports on a scheduled basis.
- Prepare PDF documents and attach them to the system.
- Integrate with third-party services for data synchronization.
- Perform data cleanup and maintenance tasks automatically.
- Run custom scripts to process data and update records in the system.
Examples:
- Pull exchange rates from an external API and update the system.
- Retrieve emails from an external mail server.
- Optimize video files within the system.
- Validate VAT numbers using the VIES service, generate a PDF confirmation, and attach to the system.
Prerequisites
- Python installed in
c:\Python - Python libs
pip install requests pyodbc uuid logging
Configuration
system:automation_appname- name of the app authorized to run automations defaulterpsystem:automation_python- location of python defaultc:\\Python\\python.exe
Basics
- Automations are stored in the
/automationsdirectory of the application. - Automation names must follow the format:
A001-YourAutomationName. - Only a single app instance is authorized to run automations.
Environment Variables
- Automation scripts read environment variables starting with
JETQUERY_.
Warning : environment variables are visible in a scope of the user running the automation process for example IIS/Kestrel. For localsystem you should set them in system environment variables.
| Batchfile | |
|---|---|
Predefined:
JETQUERY_TOKEN– Represents the API token for authentication, reads from Environment variablesJETQUERY_TOKEN_+JETQUERY_HOST(e.g.,JETQUERY_TOKEN_app.platformaerp.com) token must match host/tenant other tokens are ignoredJETQUERY_HOST– Represents the host URL or tenant ID. exampleapp.platformaerp.com!WARNING! without scheme https:// or http://JETQUERY_DSN– Represents the database connection string.- If not provided, it is generated automatically, e.g.:
SERVER=192.1.1.1;DATABASE=ERP;UID=platforma;PWD=password;Trusted_Connection=no; - The driver must be added in the script, for example:
DRIVER={SQL Server};
- If not provided, it is generated automatically, e.g.:
- (future)
JETQUERY_FILES– Path to the local tenant files. - (future)
JETQUERY_ARCHIVE– Path to the local tenant temporary archive, which is cleaned automatically according to the data retention policy.
Configuration automations\automation.json
API
| Text Only | |
|---|---|
Testing in local environment
SETUP ENVIRONMENT VARIABLES
Run cmd as administrator
| Batchfile | |
|---|---|
Basic dotnet template
Build script examples:
| Batchfile | |
|---|---|
(deprecated) Appendix Schedule in Windows Task Scheduler
Previous deprecated version was based on Windows Task Scheduler and was removed. Still can be used in legacy systems directly from Server command line.
Some examples, run cmd as administrator, scripts: