- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I am creating a custom mobile app that allows the user to scan multiple asset barcodes before submitting. The function that submits the data is a scripted Action Item that uses a WriteBackAction to run a function in a script include.
My problem is the barcode data, it's not sending the type of data I thought it would be. I watched the Mobile App Academy video for QR Code scanning several times, and in it the presenter says the data is just a string, but that's not my experience.
Once I scan multiple barcodes and submit, the script log shows it is "Ljava.lang.string:@xxxx". How do I pass the scanned data to a script include?
My mobile Action item WriteBackAction:
The messages take the "else" path, I do have a sys_id and scanned assets data.
Currently my script include function is simple:
Where did I go wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In case anyone wonders, Google finally found the answer for me. Here is what I ended up with in the script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @gjz ,
Please follow the below suggestion :
Convert the Java array to a standard JavaScript string using String(assets) or "" + assets, then split it into an array:
In your script include : change the below line
updateAssetScanData: function(assets, recordID) {
var scanID = recordID;
// Convert Java object to a JavaScript string and split into an array
var assetList = assets ? String(assets).split(',') : [];
gs.log('@@ record id: ' + scanID);
gs.log('@@ Scanned Assets: ' + assetList.join(', '));
}
Check: verify your syslog after scanning. It may display readable barcode strings .
Please mark helpful & correct answer if it's worthy for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In case anyone wonders, Google finally found the answer for me. Here is what I ended up with in the script include.
