{"title":"SingleInstance Property","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/properties/devenv-singleinstance-property/","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/properties/devenv-singleinstance-property, 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/properties/devenv-singleinstance-property","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":"Sets whether a single instance of the codeunit and codeunit variables are instantiated.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":148,"chars":24},{"level":2,"title":"Property Values","slug":"property-values","at":172,"chars":148},{"level":2,"title":"Syntax","slug":"syntax","at":320,"chars":43},{"level":2,"title":"Remarks","slug":"remarks","at":363,"chars":823},{"level":2,"title":"Related information","slug":"related-information","at":1186,"chars":40}],"text":"> Version: _Available or changed with runtime version 1.0._\nSets whether a single instance of the codeunit and codeunit variables are instantiated.\n## Applies to\n Codeunit\n## Property Values\nTrue if only one instance of a codeunit that makes it a single instance codeunit is set; otherwise, false. The default is false.\n## Syntax\n```al\nSingleInstance = true;\n```\n## Remarks\nWhen you set this property to true on a codeunit, all codeunit variables that use this codeunit use the same instance. That is, all codeunit variables of this codeunit use the same set of internal variables when the code is running on the same client. The codeunit remains instantiated until you close the company.\nThe following example shows how you can use the SingleInstance property.\nTwo pages can connect to the same codeunit.\nOn Page1:\n`Codeunit1.SetNumber(100);`\nOn Page2:\n`Number := Codeunit1.GetNumber();`\n`Message(Format(Number));`\nThe SingleInstance property in Codeunit1 is set to true. Page1 calls a function on Codeunit1 and sets the parameter to 100. Codeunit1 saves this parameter in a local variable. Page2 is now able to get the parameter value \\(=100\\) from Codeunit1. A message is displayed.\n## Related information\ndevenv-properties"}