Barcode scanning issue for asset management

Randy Deane
Tera Contributor

Hello SN Community

 

Hopefully someone can shed a little light.

Currently using an android tablet to scan assets BUT it sometimes "misreads" the scan. It either misplaces characters or completely butchers the whole scan and outputs a serial number it made up it looks like. I've tried with a symbol hand held scanner and now with the camera on the tablet....same issue. It's not a consistent problem but more so random. The issue is with many assets, you wouldn't notice the erroneous scan until you've finished the inventory scan. It's tedious needless to say but I'm pretty sure there's a fix and/or a better method. 

 

Anyone have a possible fix or maybe there's an option in SN to let the scanner know that the scan was incorrect perhaps?! 

 

All feedback is welcomed. 

3 REPLIES 3

KKM
Tera Guru

Hi Randy,
Scanner misreads troubleshooting tips:
It sounds like scanning asset barcodes into ServiceNow, here are some ServiceNow specific solutions to help prevent or detect error scans:
1. Enable barcode validation in ServiceNow - 

  • Use Regex Validation: You can configure ServiceNow fields to validate barcode scans using regular expressions.
  • Field Constraints: Set constraints on the Serial Number field in ServiceNow to ensure the scanned value fits expected formats.
  • Validation - Incorrect scans
    Use a Client Script to warn users if a scan doesn’t match the expected serial number format:
    Example: Validate Serial Number Format in ServiceNow UI - Script code

    (function executeRule(current, gForm, gSNC) {
    var sn = current.serial_number;
    var regex = /^[A-Z0-9-]{6,}$/; // Adjust based on expected format

    if (!regex.test(sn)) {
    gForm.addErrorMessage(" Invalid Serial Number detected! Please rescan.");
    current.setAbortAction(true); // Prevents saving incorrect scans
    }
    })(current, gForm, gSNC);

2.  Auto-correcting common errors:

  • If misreads are consistent, use a Business Rule to fix them before saving.

    Example: Fixing Common Errors (Replacing O with 0, trimming spaces)
    (function executeRule(current, previous /*null when async*/) {
    var correctedSN = current.serial_number;
    // Common fixes
    correctedSN = correctedSN.toUpperCase(); // Convert to uppercase
    correctedSN = correctedSN.replace(/O/g, "0"); // Replace letter 'O' with zero '0'
    correctedSN = correctedSN.replace(/\s/g, ""); // Remove spaces

    // Save the corrected serial number
    current.serial_number = correctedSN;
    })(current, previous);

Kindly mark it as correct/helpful, it it resolves your query. Please press like button for the resolution provided.
With Best Regards,

Krishna Kumar M

 

Randy Deane
Tera Contributor

Hi Krishna Kumar M

 

Appreciate your solution. I will try this and let you know if it solves the issues.

 

Thank you!

Thanks Randy, I really appreciate on accepting my solution as provided and it worked for you. 🙂