{"title":"Control add-in performance best practices","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-control-addin-bestpractices/","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-bestpractices, 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-bestpractices","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 to provide the best possible experience and performance for control add-ins in Business Central.","date":"2026-06-24","meta":{"topic":"overview"},"outline":[{"level":1,"title":"Control add-in performance best practices","slug":"control-add-in-performance-best-practices","at":0,"chars":2623},{"level":2,"title":"Code examples","slug":"code-examples","at":1239,"chars":1224},{"level":3,"title":"Bad code example","slug":"bad-code-example","at":1256,"chars":566},{"level":3,"title":"Good code example","slug":"good-code-example","at":1822,"chars":641},{"level":2,"title":"Related information","slug":"related-information","at":2463,"chars":160}],"text":"# Control add-in performance best practices\n> APPLIES TO: Business Central 2022 release wave 1 and later\nWhen developing control add-ins, it's important to provide the best possible experience and performance so that users can maintain their productivity without interruption. If the client detects a slow or unhealthy control add-in, it presents the user with a reduced functionality warning, similar to the following examples.\n Busy control add-in\n  ![Shows the message when a busy control add-in is detected.]\n  A user can close the dialog, but it reappears if the control add-in continues to run slowly. Continuous warnings are issued for nonresponsive or low performing control add-ins. If the problem persists, communication is throttled based on the volume of requests to Business Central. If traffic doesn't decrease, the service rejects incoming calls, causing the control add-in to malfunction partially or completely.\n Excessive payload\n  ![Shows the message when the control add-in experiences an excessive payload.]\n  In this instance, the payload is too large and the request is rejected immediately. The solution is to send smaller payload\nSee Control add-in resiliency in Business Central</across-controladdin-resiliency>.\n## Code examples\n### Bad code example\nThe following example illustrates problematic code that might cause performance issues by invoking the trigger repeatedly without waiting for previous calls to complete.\n```javascript\nfunction invokeALTriggerTheWrongWay() {\n    // Invoke the trigger every 10 seconds, ignoring\n    // whether the previous call has completed\n    window.setInterval(() => {\n        Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(\n            \"MyTrigger\",\n            arguments,\n            false);\n\n        invokeALTriggerTheWrongWay();\n    },\n    10000);\n}\n```\n### Good code example\nThe following example illustrates the right implementation where the trigger is invoked only when the previous call is completed.\n```javascript\nfunction invokeALTriggerTheRightWay() {\n    Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(\n        \"MyTrigger\",\n        arguments,\n        false,\n        () => {\n            // Invoking the AL trigger has completed, invoke\n            // the AL trigger again in 10 seconds\n            window.setInterval(() => {\n                invokeALTriggerTheRightWay();\n            },\n            10000);\n        },\n        () => { /* error handling and perhaps retrying */ });\n}\n```\n## Related information\nControl add-in resiliency</across-controladdin-resiliency>\nmethods/devenv-invokeextensibility-method\nmethods/devenv-getenvironment-method"}