{"title":"Compiler Error AL0922","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/diagnostics/diagnostic-al922/","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/diagnostics/diagnostic-al922, 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/diagnostics/diagnostic-al922","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":"The method '{0}' cannot be used as the implementation for the interface method '{1}' because it has 'OnPrem' scope.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Compiler Error AL0922","slug":"compiler-error-al0922","at":0,"chars":2036},{"level":2,"title":"Description","slug":"description","at":498,"chars":162},{"level":2,"title":"Remarks","slug":"remarks","at":660,"chars":288},{"level":2,"title":"How to fix it","slug":"how-to-fix-it","at":948,"chars":206},{"level":2,"title":"Example of code that triggers AL0922","slug":"example-of-code-that-triggers-al0922","at":1154,"chars":359},{"level":2,"title":"Example of how to fix it","slug":"example-of-how-to-fix-it","at":1513,"chars":381},{"level":2,"title":"Related information","slug":"related-information","at":1894,"chars":142}],"text":"# Compiler Error AL0922\n> NOTE\n> The AL diagnostics topics are in preview. If you have input for this topic, we'd love to hear from you. Use our GitHub repo to create a PR and add content to this topic by going to https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb. To read about contributing, see Contribute to the Help<../../help/contributor-guide#contributing>. Thanks!\nThe method '{0}' cannot be used as the implementation for the interface method '{1}' because it has 'OnPrem' scope.\n## Description\nInterface implementations cannot have OnPrem scope because interfaces can be invoked in cloud environments where OnPrem methods are not available.\n## Remarks\nInterface methods can be called from any environment, including cloud (SaaS). A method marked with `[Scope('OnPrem')]` is only available in on-premises deployments. If such a method implements an interface, calling the interface from a cloud environment would fail at runtime.\n## How to fix it\nRemove the `[Scope('OnPrem')]` attribute from the implementing method. If the method contains on-premises-only logic, refactor it so the interface implementation works in all environments.\n## Example of code that triggers AL0922\n```al\ninterface IDataExporter\n{\n    procedure Export(data: Text);\n}\n\ncodeunit 50100 FileExporter implements IDataExporter\n{\n    // Error: OnPrem method cannot implement an interface method.\n    [Scope('OnPrem')]\n    procedure Export(data: Text);\n    begin\n        // File I/O that only works on-premises\n    end;\n}\n```\n## Example of how to fix it\nRemove the OnPrem scope and use cloud-compatible APIs, or redesign your feature.\n```al\ninterface IDataExporter\n{\n    procedure Export(data: Text);\n}\n\ncodeunit 50100 FileExporter implements IDataExporter\n{\n    procedure Export(data: Text);\n    var\n        TempBlob: Codeunit \"Temp Blob\";\n    begin\n        // Use cloud-compatible approach\n    end;\n}\n```\n## Related information\nGetting started with AL<../devenv-get-started>\nDeveloping extensions<../devenv-dev-overview>\n../devenv-interfaces-in-al"}