{"title":"AppSourceCop Error AS0004","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0004/","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/appsourcecop-as0004, 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/appsourcecop-as0004","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":"Fields must not change type.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0004","slug":"appsourcecop-error-as0004","at":0,"chars":1358},{"level":2,"title":"Description","slug":"description","at":94,"chars":233},{"level":2,"title":"Remarks","slug":"remarks","at":327,"chars":308},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":635,"chars":198},{"level":2,"title":"Example","slug":"example","at":833,"chars":378},{"level":2,"title":"Related information","slug":"related-information","at":1211,"chars":147}],"text":"# AppSourceCop Error AS0004\nFields must not change type, since dependent extensions may break\n## Description\nFields must not change type.\n> NOTE\n> This rule validates all fields independently of their Accessibility or ObsoleteState, because they are used when synchronizing the schema defined in the extension to the database.\n## Remarks\nThe validation of the length of table fields was previously done with appsourcecop-as0004 and has now been split into two different rules:\n appsourcecop-as0080 - which validates against decreasing the length of fields\n appsourcecop-as0086 - which validates against increasing the length of fields\n## How to fix this diagnostic?\nTo fix this diagnostic, you must obsolete the field by mark the field as Obsolete Pending<../properties/devenv-obsoletestate-property> and then introduce a new field.\n## Example\nVersion 1.0 of the app:\n```al\ntable 50 MyTable\n{\n    fields\n    {\n        field(1; Identifier; Integer) { }\n    }\n}\n```\nVersion 2.0 of the app:\n```al\ntable 50 MyTable\n{\n    fields\n    {\n        field(1; Identifier; Text[30]) { }\n    }\n}\n```\nThe data type of the field Identifier was changed from Integer to `Text[30]`, which isn't allowed and will trigger this rule.\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}