{"title":"Asynchronous considerations","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-control-addin-asynchronous-considerations/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-control-addin-asynchronous-considerations, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-control-addin-asynchronous-considerations","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how control add-ins exchange data asynchronously between AL and JavaScript in Business Central without relying on synchronous return values.","date":"2026-10-21","meta":{"topic":"conceptual"},"outline":[{"level":2,"title":"Send results from AL to JavaScript","slug":"send-results-from-al-to-javascript","at":356,"chars":362},{"level":2,"title":"Send results from JavaScript to AL","slug":"send-results-from-javascript-to-al","at":718,"chars":649},{"level":2,"title":"Related information","slug":"related-information","at":1367,"chars":302}],"text":"Communication between AL code on the Business Central server and a control add-in's JavaScript code in the browser is asynchronous. These calls don't provide a synchronous return value across that boundary.\nDeclare procedures in the AL controladdin object without a return value. Exchange results through procedure parameters and event parameters instead.\n## Send results from AL to JavaScript\nTo send a result from AL to JavaScript, declare a procedure in the controladdin object with parameters for the result. Implement the corresponding JavaScript function. Call the procedure from AL to pass the result to JavaScript.\nThe result is sent in a separate procedure call, not returned to the original JavaScript call.\n## Send results from JavaScript to AL\nTo send a result from JavaScript to AL, declare an event in the controladdin object with parameters for the result. In JavaScript, call Microsoft.Dynamics.NAV.InvokeExtensibilityMethod with the event name and an array of result arguments. Handle the event in the corresponding trigger on the page's usercontrol.\nThe optional successCallback for InvokeExtensibilityMethod reports completion of the invocation. It doesn't receive a result from AL. To send result data to JavaScript, use a separate control add-in procedure call.\nLearn more about invoking AL triggers in methods/devenv-invokeextensibility-method.\n## Related information\nControl add-in object<devenv-control-addin-object>\nmethods/devenv-invokeextensibility-method\nmethods/devenv-getimageresource-method\nmethods/devenv-getenvironment-method\nControl add-in performance best practices<devenv-control-addin-bestpractices>\nmethods/devenv-openwindow-method"}