Mobile qr code scan

Sarthak
Tera Contributor

I have to scan the QR code on assets, including Asset Tag and Serial Number via the Agent Mobile App.

In OOTB, when I scan assets while purchase order case, it has separate scanning for Asset Tag and Serial.

How can I achieve the Asset Tag and serial number autofill after the QR code scanning?

 

4 REPLIES 4

IAmAbhigyaan12
Giga Guru

1. Asset tag exists on both Asset and CI tables. Scanning it for Asset related workflows will work against the asset tables. Scanning it for other workflows should use the CI. The value is synced ffromt he Asset to CI and vice versa.

2. You can use OOB HAM workflows

3. Here is more info: https://docs.servicenow.com/en-US/bundle/sandiego-mobile/page/administer/tablet-mobile-ui/concept/sg...

If my answer solved your issue, please mark my answer as Correct & hit like Helpful

Thanks
Abi

Hello Abhigyan,

The QR code consists of Asset Tag and Serial Number.

My Requirement is when I scan the QR code the Asset Tag and Serial Number should be fetched in their respective fields.

But when I made the QR code scanning both the number fetched in Asset Tag field only, whereas the serial number was empty.

Can you please comment now, how can I overcome this challenge

 

Hi @Sarthak ,

 

For the above condition you need to write either a client script or before BR.
Where you need to write a split condition to split asset tag and serial number.

 

// Client Script to split asset tag into asset tag and serial number
(function () {
    // Get the asset tag field and its value
    var assetTagField = g_form.getField('asset_tag');
    var assetTagValue = g_form.getValue('asset_tag');

    // Check if the asset tag value contains a hyphen (assuming the format is "AssetTag-SerialNumber")
    if (assetTagValue && assetTagValue.indexOf('-') !== -1) {
        // Split the asset tag value into parts
        var parts = assetTagValue.split('-');

        // Set the asset tag and serial number fields with the split values
        g_form.setValue('asset_tag', parts[0].trim()); // Set the asset tag field
        g_form.setValue('serial_number', parts[1].trim()); // Set the serial number field
    }
})();
If my answer solved your issue, please mark my answer as Correct & hit like Helpful

Thanks
Abi

There will be two fields when you try to create an asset. Both has individual scan icons. You have to use respective fields to input those. If I am not wrong you cannot scan asset + serial in single scan.