If you do this you get the next message in AppSource validation message:
"Error AS0080: Field 'Item No.' has changed from 'Code[10]' to 'Code[20]' in table or table extension 'TIP SILICIE Item Pack. Type'. Decreasing the length of a field is not allowed. For fields used in the primary key, the field length cannot change.."
The only alternative is marking as obsolete the table and create a new one. I understand not allowing destructive changes, but this schema change is not destructive.
So, I want Microsoft for to allow increase field length primary key fields and add new fields to primary key in AppSource App tables.
Comments
A post with a better explanation about the subject, alternatives, docs etc.
https://community.dynamics.com/business/b/jesusalmarazblog/posts/primary-keys-changes-in-appsource-not-allowed
Category: Development
I want to describe a real scenario: You make a table "Sales Price" style in your own app with a complex primary key with many fields. This key include all search citeria for your prices: Item No, Variant Code, Sales Code, Unit of Measure Code. If tomorrow there is a new price search criteria, "Drop shipment" for example, I have to do the next steps in my app:
- Mark as obsolete the table.
- Create a new table with the new search critieria in the primay key.
- Make upgrading app code to transfer data from your old table to the new one.
I have to do all this because in Appsource you can not add a new field at the end of your table primary key.
This is the kind of change I mean. Is not a breaking change, the third party old code will work anyway.
Category: Development
As much as I want to vote yes, then the domino effects of changing a table field size is too great. Everywhere that field is assigned to a variable, a table field or used as a parameter will/can break.
Category: Development
If the length of a primary key changes, fields referencing the PK field should be allowed to be extended as well. With that, the AS0086 rule warning (Increasing the length of a field is not allowed as it might break the runtime behavior of dependent extensions referencing it) should be loosened too.
Category: Development
Business Central Team (administrator)
Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future.
Best regards,
Business Central Team