Skip to content

OpenBarcodeScanner

Define action that allow users to open a barcode scanner on a mobile device.

The properties defined in Action are also applicable to this action.

OpenBarcodeScanner Properties

Property Type Required
Path string Optional
_Type const Required

Path

  • type: string

_Type

OpenBarcodeScanner: This action will open the barcode scanner and return result after scanning.

  • type: const

The value of this property must be equal to:

"Action.Type.OpenBarcodeScanner"

Action Result

Refer to the MDK Guide to understand what an action result is.

The success ActionResult of this action is the display value of the scanned bar code. The failure ActionResult is an error message.


Barcode Formats

The MDK barcode scanning relies on interfaces provided by the SAP BTP SDKs. The SDK scanning in turn uses the native device scanning libraries, so MDK should also support any of those supported formats. The following list of barcode formats have been tested correctly in MDK on both iOS and Android. There may also be additional formats supported beyond this list.

  • Numbers
    • EAN-8
    • EAN-13
    • EAN-14
    • UPC-E
    • UPC-A
    • Code 25
  • ISBN
    • ISBN-13
    • ISSN
  • Alphanumeric
    • Code 39
    • Code 39 mod 43
    • Code 93
    • Code 128
    • GS1-128 (UCC/EAN-128)
  • Arbitrary Data
    • PDF417
    • QR
    • Aztec
    • Data Matrix

Examples

{
    "_Type": "Action.Type.OpenBarcodeScanner",
    "OnSuccess": "/MDKApp/Rules/BarcodeScanner/ShowBarcodeScanningResult.js", 
    "OnFailure": "/MDKApp/Actions/BarcodeScanner/OpenBarcodeScannerFailure.action",
    "ActionResult": {
        "_Name": "BarcodeScanner"
    }
}
export default function ShowBarcodeScanningResult(pageProxy) {
  var actionResult = pageProxy.getActionResult('BarcodeScanner');
  if (actionResult) {
    pageProxy.setActionBinding({
      'Result': actionResult.data,
    });
    return pageProxy.executeAction('/MDKDevApp/Actions/Navigation/BarcodeScanner/NavToBarcodeScannerSuccessPage.action');
  }
}