0

Curerntly I'am working on a scanner that inputs data into BC fields. The communication between the device and the software is in javascript.
I can send data from JS to BC with

 Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('BarcodeRead',[BCode] );

but I couldn't figure out how to send data back to JS.
(The reader has a screen, and I need to display warehouse inventory on it based on BC data).
My current best guess would be to send data with STREAMS to a .txt file, and the JS code read from that. But that would be slow and not so reliable in my opinion.

1 Answers1

0

As you know allready that InvokeExtensibilityMethod can trigger events on the BC side, you know that you need a Control Add-In.

On the Microsoft Docs page about Control Add-Ins, there is an example which shows you how to call JS functions from BC:

    // The procedure declarations specify what JavaScript methods could be called from AL.
    // In main.js code, there should be a global function CallJavaScript(i,s,d,c) {Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('CallBack', [i, s, d, c]);}
    procedure CallJavaScript(i: integer; s: text; d: decimal; c: char);

In BC lingo, procedures are kind of the opposite of events.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
binford
  • 1,655
  • 1
  • 18
  • 36