Source-code based storage of documents
Document Central can be extended with code that allows uploading documents from a BLOB to Document Central via code. This approach makes it possible to automatically generate and add a Document Central barcode when a report is printed or when a document is posted or converted.
The following requirements must be met:
- The Document Central module must be licensed.
- CORE must be available in the extension as a reference.
- Document Central must be present in the extension as a reference.
Adding Inbound Documents
For adding documents into the Inbound list 2 Functions in the "SIM_DI Upload Mgt" can be used AddInboundDocumentFromExternal & AddInboundDocumentFromSilentUpload.
When to use which function
| Scenario | Function to use |
|---|---|
| A document is automatically generated and uploaded during a BC process (e.g. report print, document posting, document conversion) | AddInboundDocumentFromSilentUpload |
| The upload is triggered from an external system or integration (e.g. via API, from another extension, from Document Management) | AddInboundDocumentFromExternal |
| The target record may not yet be committed to the database at upload time (e.g. during OnAfterInsert, during posting) | AddInboundDocumentFromSilentUpload |
| The target record is already fully committed and the RecordId is known | AddInboundDocumentFromExternal |
| Field mapping / assignment metadata needs to be passed as JSON | AddInboundDocumentFromExternal |
| A specific Document Library must be set for the uploaded document | AddInboundDocumentFromExternal |
| The initial status (Open / Pending / Archived) must be controlled explicitly | AddInboundDocumentFromSilentUpload |
| The user or process that triggered the upload should be tracked (Origin) | AddInboundDocumentFromSilentUpload |
Summary: Use
AddInboundDocumentFromSilentUploadfor automated background uploads that originate from within Business Central (e.g. triggered by posting or printing). UseAddInboundDocumentFromExternalwhen integrating from outside BC or when metadata-driven assignment or a Document Library code is required.
AddInboundDocumentFromSilentUpload
| Var | Name | Data Type | Sub Type | Length | Description |
|---|---|---|---|---|---|
| No | Filename | Text | The original file name of the document | ||
| No | Base64File | Text | The file as a base64 string | ||
| No | InboundListCode | Code | 20 | Code of the Inboundlist | |
| No | StatusCheckText | Text | Statuscheck | ||
| No | Recordref | RecordRef | The data record reference to which the document must be uploaded. | ||
| No | ParamContentTypeText | Text | The Text of the Contenttype | ||
| No | InfoTagText | Text | Infotag | ||
| No | EnumSIMDIInboundDocSource | Enum | "SIM_DI Inbound Doc Source" | The Source Status | |
| No | OriginText | Text | OriginText |
Show example code
AddInboundDocumentFromExternal
| Var | Name | Data Type | Sub Type | Length | Description |
|---|---|---|---|---|---|
| No | ParamFileNameText | Text | The original file name of the document | ||
| No | ParamBase64Text | Text | The file as a base64 string | ||
| No | ParamInboundListCode | Code | 20 | Code of the Inbound list to which the Document should be inserted | |
| No | ParamMetadataJsonText | Text | Metadata as a JSON string | ||
| No | ParamRecordId | RecordId | The record ID to which the document must be linked | ||
| No | ParamContentTypeText | Text | The text of the content type | ||
| No | ParamDocumentLibraryCode | Code | 20 | Code of the Document Library | |
| No | ParamInfoTagText | Text | An Info tag | ||
| No | ParamEnumSIMDIInboundDocSource | Enum | "SIM_DI Inbound Doc Source" | The source of the Document |