Open popup when barcode is scanned

I have a perspective app using a zebra android scanner that uses a BarcodeScannerInput component to process input. The component has an onActionPerformed event script that opens one of several possible popups based on the value. This works fine.

I want to create a similar view that uses a phones camera to scan the barcode using the barcode session event. The problem I am running into is that system.perspective.openPopup() doesn’t seem to work from a session barcode event because “there is perspective page attached to this thread”.

Does anyone know a workaround for this?

You need to have a page open to open a popup. A view on the open page could have a custom property bound to a session property that gets filled in by the session barcode event. A change script on the view custom property could open up the popup.

The session barcode event might be able to send a perspective message to a message handler on the open view with the message handler opening the popup.

Try using system.perspective.getSessionInfo(), filtered to your project, then pick your session by ID out of the list. That object will have a pageids attribute that you can explicitly target with the optional arguments to system.perspective.openPopup().