AppSourceCop Error AS0071
An enum field replacing an option field should preserve the member ordinal values.
Description
An enum field replacing an option field should preserve the member ordinal values. Modifying the member ordinal values might break the upgrade of existing installations and dependent extensions.
Remarks
This error ensures that when you replace an option field with an enum field, the ordinal values (the numerical values assigned to each member) of the enum members must match those of the original option members. Changing these ordinal values can lead to data inconsistencies and corruption during the upgrade process. Additionally, dependent extensions that rely on specific ordinal values may fail if those values are altered in the new enum field.
How to fix this diagnostic?
To resolve this error, follow these steps:
- Locate the enum field in your code that is replacing an option field.
- Ensure that the ordinal values of the enum members match those of the original option members.
- If the ordinal values don't match, adjust the enum members to preserve the original ordinal values.
Related information
AppSourceCop Analyzer
Get Started with AL
Developing Extensions