Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Need help accessing barcode data in a mobile app

gjz
Mega Sage

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:

gjz_2-1790117249247.png

 

The messages take the "else" path, I do have a sys_id and scanned assets data.

 

Currently my script include function is simple: 

updateAssetScanData: function(assets, recordID) {
        var scanID = recordID;
        var assetArray = assets;
        var assetObject = assets;

        gs.log('@@ record id: ' + scanID);
        gs.log('@@ assetArray: ' + assetArray);
        gs.log('@@ assetObject: ' + assetObject);

    },
 
What I see in the script log is:
gjz_0-1790116989685.png

 

Where did I go wrong?

0 REPLIES 0