|
<< Click to Display Table of Contents >> Navigation: Zetadocs SDK Guide > Zetadocs SDK API > OnBeforeCapture |
OnBeforeCapture Event
Runs before attempting to link documents in the Document Queue.
Publisher
[IntegrationEvent(false, false)]
procedure OnBeforeCapture(var onBeforeCaptureHandler: Codeunit "Zetadocs OnBeforeCapture")
begin
end;
Subscriber
To subscribe to this event, you will need to decorate the subscriber method with the correct EventSubscriber attributes:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Zetadocs Customize", 'OnBeforeCapture', '', true, true)]
procedure OnBeforeCapture(var onBeforeCaptureHandler: Codeunit "Zetadocs OnBeforeCapture")
Zetadocs OnBeforeCapture codeunit
This codeunit exposes procedures that allow you to automatically link documents in the Document Queue to Business Central items.
Method name |
Description |
|---|---|
GetDocumentIds(var List of [Text]) |
Will return a list of document id’s for each document in the Document Queue |
GetDocumentBarcodes(Text, var List of [Text]) |
Will return the list of Barcodes referenced in a document. |
GetDocumentQueueSettings(Record "Zetadocs Document Queue") |
Will return the settings of the Document Queue being processed. |
GetShippingAddress(): Text |
Will return the shipping address extracted from the Document in the Document Queue. |
GetRecordId(Text, var RecordId) |
Gets the Business Central record that is currently linked to a document in the Document Queue. Used to verify that auto linking has been successful. Throws an error if the documentId does not exist |
TryGetRecordId(Text, var RecordId): Boolean |
Gets the Business Central record that is currently linked to a document in the Document Queue. Used to verify that auto linking has been successful. Returns the result of getting the recordId. |
GetRecognisedKeyValuePairs(): JsonArray |
Will return a JsonArray of all the recognised Key Value pairs from the document in the Document Queue. |
GetVendor(documentId: Text) vendorName: Text |
Will return the name of the vendor extracted from the Document in the Document Queue. |
This method will propagate any errors raised in the event subscriber back to Zetadocs Capture and Delivery |
|
SetRecordId(Text, RecordId) |
Use this method to associate a document in the Document Queue with a document in Business Central. |
SetVendor(documentId: Text; vendorName: Text) |
Will override the name of the vendor extracted from the Document in the Document Queue. |
SetError(Text) |
This method can be used to send a custom error message to Zetadocs Capture and Delivery. |
Init(Codeunit "Zetadocs Operation Context", var Record "Zetadocs Document Queue", var Record "Zetadocs Doc. Queue Item") |
This method is called internally by the publisher, a call to this method will return an error. |
Will return a list of document id’s for each document in the Document Queue.
Syntax
OnBeforeCaptureHandler. GetDocumentIds(var documentIds: List of [Text]);
Parameters
documentIds
Type: List of [Text]
Returns a List of id’s for each document in the Document Queue, these can be used to retrieve the Barcodes for each document.
Will return the list of Barcodes referenced in a document.
Syntax
OnBeforeCaptureHandler. GetDocumentBarcodes(documentId: Text; var documentBarcodes: List of [Text]);
Parameters
documentId
Type: Text
The document Id used to retrieve barcodes for.
documentBarcodes
Type: List of [Text]
Returns a list of barcodes associated with the document id passed into the function, these can be used to link to a document in Business Central.
GetDocumentQueueSettings Method
Will return the settings of the Document Queue being processed.
Syntax
OnBeforeCaptureHandler. GetDocumentQueueSettings(var documentQueueTemporaryRecord: Record "Zetadocs Document Queue");
Parameters
documentQueueTemporaryRecord
Type: Record "Zetadocs Document Queue"
The record variable that will store a copy of the settings used. This variable is expected to be a temporary table.
Will return the shipping address extracted from the Document in the Document Queue.
Syntax
onBeforeCaptureHandler.GetShippingAddressInput() DeliveryAddress: Text
Parameters
DeliveryAddress
Type: Text
The Shipping address recognized in the document from the Document Queue.
GetRecognisedKeyValuePairs Method
Will return a JsonArray of all the recognised Key Value pairs from the document in the Document Queue.
Syntax
onBeforeCaptureHandler.GetRecognisedKeyValuePairs(documentId: Text) KeyValuePairs : JsonArray
Parameters
DocumentId
Type: Text
The id of the document for wich the information is required.
KeyValuePairs
Type: JsonArray
The JSON array of the Key Value Pairs that have been recognised in the document. The JSON will be in the format:
'[
{"Key": "IBAN:", "Value": "GB23 BOFA 121211 4534333"},
{"Key": "Bank:", "Value": "HSBC Bank PLC."},
{"Key": "Sort code:", "Value": "111111."}
]'
Will return the name of the vendor extracted from the Document specified in the Document Queue.
Syntax
onBeforeCaptureHandler.GetVendorName(DocumentId: Text) VendorName: Text
Parameters
DocumentId
Type: Text
The id of the document for which the information is required.
VendorName
Type: Text
The name of the Vendor recognized in the document from the Document Queue.
Gets the Business Central record that is currently linked to a document in the Document Queue. This function can be used to check that the auto linking has worked. Throws an error if the documentId does not exist.
Syntax
OnBeforeCaptureHandler. GetRecordId(documentId: Text; theRecordId: RecordId);
Parameters
documentId
Type: Text
The document in the Document Queue to link with.
theRecordId
Type: RecordId
The Business Central document that the above document Id will be linked to.
Gets the Business Central record that is currently linked to a document in the Document Queue. This function can be used to check that the auto linking has worked. Returns the result of getting the recordId.
Syntax
result := OnBeforeCaptureHandler. TryGetRecordId(documentId: Text; theRecordId: RecordId);
Parameters
documentId
Type: Text
The document in the Document Queue to link with.
theRecordId
Type: RecordId
The Business Central document that the above document Id will be linked to.
Use this method to associate a document in the Document Queue with a document in Business Central.
Syntax
OnBeforeCaptureHandler. SetRecordId(documentId: Text; theRecordId: RecordId);
Parameters
documentId
Type: Text
The document in the Document Queue to link with.
theRecordId
Type: RecordId
The Business Central document that the above document Id will be linked to.
Use this method to associate a document in the Document Queue with a vendor in Business Central.
Syntax
onBeforeCaptureHandler.SetVendorName(DocumentId: Text; VendorName: Text)
Parameters
DocumentId
Type: Text
The id of the document for which the information is required.
VendorName
Type: Text
The name of the Vendor to associate with the document from the Document Queue.
This method is used to pass any custom errors to Zetadocs.
Syntax
OnBeforeCaptureHandler.SetError(errorText: Text);
Parameters
Type: Text
The error message to pass to Zetadocs.
Initialises the OnBeforeCapture object with the relevant information. This will be done internally and is not for 3rd parties consumption.