{"title":"PerTenantExtensionCop Error PTE0002","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/pertenantextensioncop-pte0002/","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/analyzers/pertenantextensioncop-pte0002, 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/analyzers/pertenantextensioncop-pte0002","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":"Field ID must be in free range.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"PerTenantExtensionCop Error PTE0002","slug":"pertenantextensioncop-error-pte0002","at":0,"chars":1832},{"level":2,"title":"Description","slug":"description","at":70,"chars":47},{"level":2,"title":"Remarks","slug":"remarks","at":117,"chars":354},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":471,"chars":138},{"level":2,"title":"Code examples triggering the rule","slug":"code-examples-triggering-the-rule","at":609,"chars":505},{"level":3,"title":"Example 1 - A table field ID outside the range 50,000-99,999","slug":"example-1---a-table-field-id-outside-the-range-50000-99999","at":646,"chars":272},{"level":3,"title":"Example 2 - A table extension field ID in the ID range 0-49,999","slug":"example-2---a-table-extension-field-id-in-the-id-range-0-49999","at":918,"chars":196},{"level":2,"title":"Code examples not triggering the rule","slug":"code-examples-not-triggering-the-rule","at":1114,"chars":553},{"level":3,"title":"Example 1 - A table field ID within the range 50,000-99,999","slug":"example-1---a-table-field-id-within-the-range-50000-99999","at":1155,"chars":262},{"level":3,"title":"Example 2 - A table field ID within the range 0-49,999","slug":"example-2---a-table-field-id-within-the-range-0-49999","at":1417,"chars":250},{"level":2,"title":"Related information","slug":"related-information","at":1667,"chars":165}],"text":"# PerTenantExtensionCop Error PTE0002\nField ID must be in free range.\n## Description\nField ID must be in free range.\n## Remarks\nThis rule validates that all table field IDs defined in your extension are within range 50,000-99,999 that is allocated for per-tenant extensions. For more information about the ID ranges for extensions, see ../devenv-object-ranges.\n> NOTE\n> When a new AL table, you are also allowed to use the range 0-49,999 for the ID of your table fields.\n## How to fix this diagnostic?\nYou must change the ID of the object or table field validated to use an ID within the range 50,000-99,999.\n## Code examples triggering the rule\n### Example 1 - A table field ID outside the range 50,000-99,999\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(1000000; MyField; Integer) { }\n    }\n}\n```\nThe table field MyField has the ID `1000000` which is not valid because it is outside the allowed range.\n### Example 2 - A table extension field ID in the ID range 0-49,999\n```al\ntableextension 50100 MyTableExt extends MyTable\n{\n    fields\n    {\n        field(10; MyExtField; Integer) { }\n    }\n}\n```\n## Code examples not triggering the rule\n### Example 1 - A table field ID within the range 50,000-99,999\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n}\n```\nThe table field MyField has the ID `50100` which is valid because it is within the allowed range.\n### Example 2 - A table field ID within the range 0-49,999\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(1; MyField; Integer) { }\n    }\n}\n```\nThe table field MyField has the ID `1` which is valid because it is within the range 0-49,999.\n## Related information\nPerTenantExtensionCop Analyzer<pertenantextensioncop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}