Source-code based storage of documents
In this documentation we will create an extension that allows uploading documents from a BLOB to Document Central via Code. Extending a report with Document Central code is used so that when a report is printed or a document is posted/converted, it is possible to automatically generate and add a Document Central Barcode during that process.
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.
Upload a File with User Interaction:
The UploadFileDialog function opens user interactions such as replacing/renaming and selecting the content type before the document is uploaded to the repository.
Overload 1:
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 | RRef | RecordRef | The data record reference to which the document must be uploaded |
The function outputs:
Name | Data Type | Length | Description |
---|---|---|---|
Boolean | The original file name of the document |
Code Example:
Upload a File silently:
The UploadFileSilent function uploads a document with the specified parameters to Document Central without any user interaction. There are various overloads to specify the document.
Overload 1:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | Base64File | Text | The file as a base64 string. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. |
Overload 2:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | Base64File | Text | The file as a base64 string. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ContentType | Text | The content type with which the document is uploaded. |
Overload 3:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | Base64File | Text | The file as a base64 string. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | MetadataTmp | Record | "SIM_DMS Document Metadata" | A temporary record with metadata whiich exists in the Content Type or Standard Content Type. |
Overload 4:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | Base64File | Text | The file as a base64 string. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ContentType | Text | The content type with which the document is uploaded. | ||
No | MetadataTmp | Record | "SIM_DMS Document Metadata" | A temporary record with metadata whiich exists in the Content Type or Standard Content Type. |
The function outputs:
Name | Data Type | Length | Description |
---|---|---|---|
Boolean | Returns true if the action was successful. |
Code Example:
Upload multiple files silently:
The UploadMultiFileSilent function uploads several documents with the specified parameters to Document Central without user interaction. There are various overloads to specify the documents.
Overload 1:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | ParamTitleListOfText | List of texts | 250 | The title or name that the repository should use. | |
No | ParamFilenameListOfText | List of texts | 250 | The original file name of the document. | |
No | ParamBase64FileListOfText | List of texts | The file as a base64 string. | ||
No | ParamRecordRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ParamContentTypeListOfText | List of texts | 100 | The content type with which the document is uploaded. | |
Yes | ParamRecordTempSIMDMSDocumentMetadata | RecordRef | "SIM_DMS Document Metadata" | A temporary data record with metadata that exists in the content type or standard content type. | |
No | ParamBooleanOneGroupID | RecordRef | Specifies whether the files should be added to a single new group or whether each file should be added to a new group. |
Overload 2:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | ParamTitleListOfText | List of texts | 250 | The title or name that the repository should use. | |
No | ParamFilenameListOfText | List of texts | 250 | The original file name of the document. | |
No | ParamBase64FileListOfText | List of texts | The file as a base64 string. | ||
No | ParamRecordRef | RecordRef | The data record reference to which the document must be uploaded. | ||
Yes | ParamRecordTempSIMDMSDocumentMetadata | RecordRef | "SIM_DMS Document Metadata" | A temporary data record with metadata that exists in the content type or standard content type. | |
Yes | ParamBooleanOneGroupID | RecordRef | Specifies whether the files should be added to a single new group or whether each file should be added to a new group. |
Code Example:
Utilize Archive Queue for Document Upload
The ArchiveDocument function loads the specified file with the corresponding parameters and metadata into the archive queue. The job queue processes the document and uploads it to the repository with a delay.
Overload 1:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. |
Overload 2:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ContentType | Text | The content type with which the document is uploaded. |
Overload 3:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | MetadataTmp | Record | "SIM_DMS Document Metadata" | A temporary record with metadata whiich exists in the Content Type or Standard Content Type. |
Overload 4:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | Title | Text | The title or name that the repository should use. | ||
No | Filename | Text | The original file name of the document. | ||
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ContentType | Text | The content type with which the document is uploaded. | ||
No | MetadataTmp | Record | "SIM_DMS Document Metadata" | A temporary record with metadata whiich exists in the Content Type or Standard Content Type. |
The function outputs:
Name | Data Type | Length | Description |
---|---|---|---|
BigInteger | Returns the entry number of the data record SIM_DMS archive queue entry. |
Code Example:
Get Metadata for RecordRef
The GetMetadata function returns all metadata for the specified RecordRef according to the settings.
Overload 1:
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
Yes | MetadataTmp | Record | "SIM_DMS Document Metadata" | The GetMetadata function returns all metadata for the specified RecordRef according to the settings. | |
No | RRef | RecordRef | The data record reference to which the document must be uploaded. |
Archive Report by Printing
The ArchiveReportByPrinting function prints the corresponding report for this table and the primary key of the RRef. In this case, the data record is not filtered to the current data record.
In the report settings, you can see what is set for the report. Here you can also specify whether the report is executed via the job queue.
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | RRef | RecordRef | The data record reference to which the document must be uploaded. |
The function outputs:
Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|
RRef | BigInteger | Returns the entry number of the data record SIM_DMS archive queue entry. |
Code Example:
AL | |
---|---|
Archive Report by Posting
The ArchiveReportByPosting function prints the corresponding report for this table and the primary key of the RRef. In this case, the data record is filtered out of the current data record.
In the report settings, you can see what is set for the report. Here you can also specify whether the report is executed via the job queue.
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | RRef | RecordRef | The data record reference to which the document must be uploaded. |
The function outputs:
Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|
RRef | BigInteger | Returns the entry number of the data record SIM_DMS archive queue entry. |
Code-Example:
AL | |
---|---|
Archive Report by Report ID
The ArchiveReportByReportId function prints the specified report. The report and the data record must match.
In the report settings, you can see what is set for the report. Here you can also specify whether the report is executed via the job queue.
Var | Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|---|
No | RRef | RecordRef | The data record reference to which the document must be uploaded. | ||
No | ReportNo | Integer | The number of the report to be archived. |
The function outputs:
Name | Data Type | Sub Type | Length | Description |
---|---|---|---|---|
RRef | BigInteger | Returns the entry number of the data record SIM_DMS archive |
Code-Example: