Nice (yet another) way to enable barcode scanner in C4C custom development
If the Reader followed my previous blogs about custom panes and custom controls in C4C and how to use them to utilize barcode scanner, for example, the one may have found it quite complicated and long to read.
Fortunately, SAP recently brought something nice to do the same thing. I personally found it only a few days ago in 1808.
I think (and hope) it came from the idea Automated barcode/number/text reading for an input field from camera of a device. However, it took almost a year to have it voted and implemented. Or I didn’t notice its arrival earlier but I doubt. Actually, the idea is still in “Review and Develop” phase (since April 2018). Nevertheless, the thing is it’s available now and let’s have a look at how it can be easily utilized.
The main point here:
Fields with display type as InputField (and some others types as well but it’s a different story) now have a new section in their properties in UI Designer called “Fiori Client Specific”.
There are few properties currently available:
- Enable Barcode Scanner
- Font Size
I found only “Enable Barcode Scanner” working as of now. Maybe other entries are in preparation for next releases. Let’s see.
Getting back to the topic of this particular blog.
I took the same Embedded Component which I used in my previous blog.
Added new DataField “BarCodeResult” in Data Model and brought it on the screen.
Then set its property “Enable Barcode Scanner” to True.
That is really all. We good to go and test with C4C app.
The field in question now has tiny barcode icon when you’re in edit mode. Once this icon pressed, the barcode scanner is started.
When you scanned the barcode, its value populated straight back to the field.
That’s it! No video today, sorry.
Now we can proceed, assign our own event handler for OnValueChanged event for this field in Data Model and we’re good to go and format the scanning result as we already did previously or do any other cool things.
Hopefully, ForegroundColor and MachineLearningContext (honestly have no idea what this one is about) will work so easily as well.