Add a Priority Enum to Items
Purchasing wants to rank items by how urgently they should be restocked. In AL that calls for an enum — a first-class object that other extensions can even extend later.
Requirements
Create an enum named
"Item Priority"with these values (the ordinals are graded; extra values of your own don't hurt):Ordinal Name 0 Low1 Normal2 HighCreate a table extension that extends the
Itemtable and adds a field named"Restock Priority"of typeEnum "Item Priority".A freshly created item must default to
Normal— use the field'sInitValueproperty.
What the tests check
The grading tests look each value up by name in the enum's Names()/Ordinals() lists and check its ordinal (a missing value fails with a message naming it), look "Restock Priority" up on the Item table by name and require it to be an enum field whose values are those of "Item Priority" — declaring it as an Option field fails. They then write High to an item and read its ordinal back, and create a new item to verify it defaults to Normal.
Learn More
enum 50101 "Item Priority" { value(0; Low) { } ... }.field(50102; "Restock Priority"; Enum "Item Priority").InitValue = Normal; on the field makes every new record start at Normal.