getBarcodeValue (Client API reference)
Invokes the device camera to scan the barcode information, such as a product number.
Available for
This method is supported only for the mobile clients.
Syntax
Xrm.Device.getBarcodeValue().then(successCallback, errorCallback)
Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
successCallback |
Function | Yes | A function to call when the barcode value is returned as a String. |
errorCallback |
Function | Yes | A function to call when the operation fails. An error object with the message property (String) will be passed that describes the error details. |
Return Value
On success, returns a string containing the scanned barcode value.
Exceptions
Example
Xrm.Device.getBarcodeValue().then(
function success(result) {
Xrm.Navigation.openAlertDialog({ text: "Barcode value: " + result });
},
function (error) {
Xrm.Navigation.openAlertDialog( {text: error.message} );
}
);
Related articles
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: