Last updated:
Document services
The Document Services feature allows users to configure how documents are retrieved and downloaded within the platform.
A document service acts as an abstraction layer between the application and the source of the document. It determines where the file is retrieved from and how it is delivered to the user.
Document services can be used in the following components:
Fields:
- PDF field
- Download field
Controls:
- PDF control
- Download control
Each collection contains a default document service, which runs on the Any2Info webserver. When this service is used, the document download is executed directly from the Any2Info server.
For advanced use cases, it is possible to run a standalone document service on a separate server. To configure this setup, please contact support@any2info.com.
The default document service can be extended with multiple plugins, allowing different document sources and behaviors.
Configuration options
Section titled “Configuration options”Document services are configured via plugins. Each plugin type has its own configuration parameters.
SQL Server
Section titled “SQL Server”| Setting | Required | Description |
|---|---|---|
| Server name | Yes | Name of the SQL Server (including instance if applicable). |
| Database | Yes | Name of the database. |
| Username | Yes | SQL user name. |
| Password | Yes | SQL user password. |
| Table | No | Table containing the document. Not required when using a custom query. |
| IdHeader | Yes | Column used as unique identifier. |
| ExtensionHeader | Yes | Column containing the file extension. |
| ByteHeader | Yes | Column containing the file data (varbinary). |
| NameHeader | Yes | Column containing the file name. |
| CustomQuery | No | Custom query when data is not in a single table. |
| Setting | Required | Description |
|---|---|---|
| Connectionstring | Yes | ODBC connection string. |
| Table | No | Table containing the document. |
| IdHeader | Yes | Column used as unique identifier. |
| ExtensionHeader | Yes | Column containing the file extension. |
| ByteHeader | Yes | Column containing the file data. |
| NameHeader | Yes | Column containing the file name. |
| CustomQuery | No | Custom query for complex scenarios. |
| Setting | Required | Description |
|---|---|---|
| ConvertToPDF | No | Determines if the document is downloaded as PDF or Word file. |
File System
Section titled “File System”| Setting | Required | Description |
|---|---|---|
| UseUserImpersonator | No | Enables user impersonation. |
| Username | No | Username for impersonation. |
| Password | No | Password for impersonation. |
| Domain | No | Domain for impersonation. |
If impersonation is not used, the identity of the IIS Application Pool (Any2InfoAppsService) is used.
This plugin supports downloading files from:
- Local server file system
- Network shares accessible by the server
Dataflow
Section titled “Dataflow”| Setting | Required | Description |
|---|---|---|
| DatahubId | Yes | The DataHub to use. |
| IdParameter | Yes | Parameter name containing the file identifier. |
| DataflowEvent | Yes | EventReceived trigger name. |
| ExtensionOutputParameter | Yes | Output parameter for file extension. |
| NameOutputParameter | Yes | Output parameter for file name. |
| ByteOutputParameter | Yes | Output parameter for file content. |
This is the most versatile plugin and allows integration with:
- SharePoint
- REST APIs
- External systems via DataHub
Input / output
Section titled “Input / output”| Direction | Type | Description |
|---|---|---|
| Input | Identifier | Unique identifier used to retrieve the file. |
| Output | File | File stream including name, extension, and content. |
Configuration
Section titled “Configuration”Document services can be configured via Tools → Document services.
Steps to configure a plugin:
- Select the ellipsis (
...) next to the default service. - Choose New plugin.
- Provide a name (e.g. Download instruction (file share)).
- Save the plugin.
- Locate the plugin in the tree structure.
- Select the ellipsis (
...) on the plugin. - Choose Configure.
- Select the plugin type.
- Configure the required parameters.
Assigning a document service
Section titled “Assigning a document service”After configuration:
- Select the document service in the Document service property of a field or control.
- Provide a File identifier, either as a static value or mapped dynamically.
Tips & best practices
Section titled “Tips & best practices”- Always ensure a unique identifier is available for the selected plugin.
- When using a PDF field or control, ensure the file is a valid PDF. Otherwise, no pages will be displayed.
- Use the Dataflow plugin for maximum flexibility and external integrations.
- Use custom queries when document metadata is spread across multiple tables.
Errors & troubleshooting
Section titled “Errors & troubleshooting”| Error | Meaning | Solution |
|---|---|---|
| File not found | Identifier does not match any record | Verify identifier value and mapping |
| Invalid PDF | File is not a valid PDF | Ensure correct file type is returned |
| Connection failed | Database or ODBC connection issue | Verify connection settings and credentials |
| Access denied | File system permissions issue | Check impersonation or application pool identity |
| Dataflow failure | Dataflow did not return expected output | Verify event configuration and output parameters |
Example use cases
Section titled “Example use cases”- Displaying employee work instructions based on production data
- Downloading invoices or offers
- Retrieving documents from SharePoint or external APIs