{"title":"Control implicit with contexts by using a pragma","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/directives/devenv-directive-pragma-implicitwith/","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/directives/devenv-directive-pragma-implicitwith, 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/directives/devenv-directive-pragma-implicitwith","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 the pragma implicitwith directive controls implicit record contexts in AL and supports code migration in Microsoft Dynamics 365 Business Central.","date":"2026-10-05","meta":{"topic":"concept-article"},"outline":[{"level":1,"title":"Control implicit with contexts by using a pragma","slug":"control-implicit-with-contexts-by-using-a-pragma","at":0,"chars":2052},{"level":2,"title":"Syntax","slug":"syntax","at":1260,"chars":325},{"level":2,"title":"Example","slug":"example","at":1585,"chars":153},{"level":2,"title":"Related information","slug":"related-information","at":1738,"chars":314}],"text":"# Control implicit with contexts by using a pragma\n> APPLIES TO: Business Central 2020 release wave 2 and later\nThe `#pragma implicitwith` directive controls whether the compiler creates an implicit with context. Place the directive before an object declaration. By using `#pragma implicitwith disable`, unqualified references that rely on an implicit record no longer resolve and must be qualified, for example with Rec.. The setting applies to following object declarations until another `#pragma implicitwith` directive changes or restores it.\nIn the app.json file, you can set the NoImplicitWith flag to disable implicit with when you rewrite all code. Learn more about configuring compiler features in ../devenv-json-files#appjson-file.\n> NOTE\n> By using Business Central 2022 release wave 2, the AL: Go! template adds NoImplicitWith to the features property in the generated app.json file. This setting disables implicit with contexts and requires affected references to be qualified.\n> IMPORTANT\n> The compiler warns that implicit with will be removed in the future. Treat this directive as a temporary migration aid and qualify affected references. See Deprecating explicit and implicit with statements<../devenv-deprecating-with-statements-overview>.\n## Syntax\n```al\n#pragma implicitwith enable\n```\n```al\n#pragma implicitwith disable\n```\n```al\n#pragma implicitwith restore\n```\nenable enables implicit-with binding, even when NoImplicitWith is set globally. disable disables implicit-with binding. restore returns to the setting specified by the extension's compiler features.\n## Example\nLearn more about updating affected code in Deprecating explicit and implicit with statements<../devenv-deprecating-with-statements-overview>.\n## Related information\nDevelopment in AL<../devenv-dev-overview>\nAL development environment<../devenv-reference-overview>\nPragma directive in AL<devenv-directive-pragma>\ndevenv-directives-in-al#conditional-directives\nDeprecating explicit and implicit with statements<../devenv-deprecating-with-statements-overview>"}