Barcode detected
The event 'Barcode detected' is triggered during the 'Detect barcodes' process (see Documents) for each barcode detected in a document.
If 'Barcode Filters' are specified for the detection process, the event is only triggered for barcodes matching at least one of the filters.
Within an event handler triggered by 'Barcode detected' the document object is available as a data context.
►NOTE◄
The event is triggered, before the document is created, so the document ID reads 0.
The detected barcode is available in the 'Reference' (reference) property of the document.
The 'Description' of the document is preset with a list of all detected barcodes, following the headline 'Detected Barcodes.'
The event is triggered before 'reference resolution', so there is no reference status indicated yet.
The event handler may change document properties to influence the 'reference resolution' process.
The reference value itself can also be modified, e.g. to adjust formatting or to extract a sub-string.
If a 'Barcode pattern' is defined to map barcode segments to document properties, it will be applied to the reference after the the 'Barcode detected' event. Therefore the reference may be used to ensure proper formatting for the 'Barcode pattern', e.g. by inserting separators.
Example:
A specific type of document typically features two different types of barcodes:
One alphanumeric barcode of the 'Code-128' type identifies the 'owner' of the document by the ID used in Lobster Data Platform / Orchestration.
One 'EAN 13' type barcode identifies a certain business object by a reference number.
An uploaded document of a certain type should only be accepted if the user identified by the 'Code-128' barcode is the User of session. Otherwise, the process should be aborted with a notification.
The 'Barcode detected' event is triggered for every barcode detected.
The Validating rule identifies whether the document refers to the relevant document type.
An Entity property rule checks if the automatically provided 'description' of the document contains a concatenation of the text 'USER-' with the ID of the currently logged in user.
If the current user ID is not found in the description, an 'Abort action' with a notification is executed (left branch).
If the current user ID is found in the description, the document is further processed (right branch).
►NOTE◄
The 'description' used for user matching is initialized with the same content each time it is called, namely a list of all recognized barcodes (possibly restricted by filters).
Therefore, the order of processing for the detected barcodes is not critical. If no barcode matching the current user ID is found, the detection process is aborted in the first iteration.
Should a document contain multiple USER-barcodes, the validation logic will accept a document, if any of these codes matches the current user ID.