Troubleshooting serial-only PO receiving in Mobile Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
22m ago - last edited 17m ago
I ran into “1 PO line item failed to be received” after scanning only a serial number in Mobile Agent under Procurement → PO Line Item → Receive. The asset was already linked to the PO line, was in transit, and had the correct serial number. The ServiceNow Agent app documentation describes scanning either identifier for a single item.
What we reproduced in DEV
The Receive action item converted an Asset Tag entry to a string before checking whether it was null. With a valid serial and a null tag entry, the receiving handler searched for both the serial and the literal tag "null". It missed the existing asset and fell back to asset creation. With the same serial and a blank tag, the lookup matched the existing record.
We reproduced that behavior in a read-only test. We couldn’t capture the original failing mobile payload, so the exact value sent by the phone remains unconfirmed.
What we changed
In System Mobile → Action Items → Receive action item → Execution Script, in the IT Asset Management Mobile scope, we defaulted a missing or null barcodes.asset_tag array to [] and used its length when calculating the scan count. Inside the loop, we checked each raw tag with gs.nil() before converting it to a string. Blank entries now pass through as an empty string, so the handler can match by serial alone. Populated tags still pass through as before. We saved the original script for rollback.
@@ Before calculating the scan count @@
- var scanCount = Math.max(parm_input["barcodes.asset_tag"].length, parm_input["barcodes.serial_number"].length, parm_input["barcodes.mac_address"].length);
+ var assetTags = parm_input["barcodes.asset_tag"] || [];
+ var scanCount = Math.max(assetTags.length, parm_input["barcodes.serial_number"].length, parm_input["barcodes.mac_address"].length);
@@ Inside the scan loop @@
- var assetTag = parm_input["barcodes.asset_tag"].length > index ? new String(parm_input["barcodes.asset_tag"][index]) : '';
+ var rawAssetTag = assetTags[index];
+ var assetTag = gs.nil(rawAssetTag) ? '' : new String(rawAssetTag);What I verified on the phone
I repeated the serial-only scan on two different pre-created assets on the same DEV PO. Both submits succeeded. We verified that each existing asset moved from In transit to In stock and had a new receiving line for one unit.
If you see the same message, check that the full barcode value is in Serial Number on the review screen, then check how the Receive action handles empty Asset Tag entries before it calls the receiving handler.