So, I just tried what you've suggested: I created another local storage variable (outpan_success_count). So, for the rest service that sends the barcode to outpan and then retrieves the item name, here's what I did:
For Before Send, I set the storage variable outpan_success_count to 0. Then, after the success event, I set the variable to 1. After a fail event, I sent it to 2. Then, after the complete event, I run javascript, and all it does is alert the value of the outpan_success_count variable: alert(localStorage.getItem('outpan_success_count'));
So, when running this, if i use a barcode that outpan finds, it alerts me with a 1
However, if I scan a barcode that outpan does NOT find, nothing happens. There's absolutely no alert.
But, here's the thing, if I place that javascript code to alert the outpan_success_count in the success event BEFORE the mapping, it works and outputs a 1 for a barcode that outpan does not find. But if I move the javascript to AFTER the mapping, it does not work. So, apparently the api call is succeeding, however mapping a blank name onto the local variable is breaking any further coding. Does this make sense?