SaveAndSend

Description

Executes the corresponding "Save and Send" function based on the "Selected" value.


Syntax

AL
[ErrorCode:= ] SaveAndSend(var TempECMJnlLine: Record "ECM Document Journal Line"; var ECMDocDef: Record "ECM Document Definition"; MainRecordVariant: Variant; var EmailInfo: Record "ECM E-Mail Info"; var TempMetadataFieldValue: Record "ECM Metadata Field Value"; var TransactionNo: BigInteger; Selected: Integer)


Parameters

Variable: TempECMJnlLine

Type: Record "ECM Document Journal Line" temporary

Used as a data object ("container") to pass data to a function, for all fields that need to be filled in the document items. By default, the document items are filled using the MainRecord and the document definition.

Filename, BLOB and MD5 hash are mandatory fields


Variable: ECMDocDef

Type: Record "ECM Document Definition"

ECM document definition for the record. The correct document definition for the record is searched with the API function FindDocDefByRRef


MainRecordVariant

Type: Variant

MainRecord (record) is entered into the ECM queue and is needed for processing (metadata and PDF creation).

Tip: The MainRecord can be passed as Record, RecordID or RecordRef.


Variable: EmailInfo

Type: Record "ECM E-Mail Info"

Record containing the e-mail information of the recipient to whom the document should be sent, if any.


Variable: TempMetadataFieldValue

Type: Record "ECM Metadata Field Value" temporary

Used as a data object ("container") to pass data to a function, for all fields that will be passed as metadata to the archive (repository). By default, it is sufficient to pass the table empty, since the metadata is prepared using the MainRecord and the document definition. Alternatively, the desired deviating or additional metadata can be prepared here.


Variable: TransactionNo

Type: BigInteger

ECM queue transaction no. that is returned.

With the transaction number and the ReleaseECMRepositoryRequest function the ECM queue entry is released for further processing.


Variable: Selected

Type: Integer

Contains the selected option:

  • [1] a PDF will be created and added to the ECM queue.

  • [2] a PDF will be created and sent as e-mail

  • [3] a PDF is created, added to the ECM queue and sent as an email

  • [4] a PDF is created, added to the ECM queue, sent as email and printed




Return Value:

ErrorCode

Type: Integer

ErrorCode = 0 and TransactionNo <> 0 if the operation was successful.

With the function ShowMessage the ErrorCodes can be displayed and with the function WriteLog they can be logged.



Remarks:



Example: