community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Snippet: StrMenu from Enum list

This post demonstrates an AL code snippet that uses StrMenu to let users select from a filtered subset of enum values dynamically, useful when all enum values should be visible normally but only certain values are allowed in specific scenarios.

post The BC Docs Librarian

Natalie Karolak · 2025-07-02 · 227 words · about 1 min

Key points

  • Uses a List to collect allowed enum values dynamically rather than statically defining them on a page field
  • Automatically selects and returns the only value if the filtered list contains just one item
  • Formats enum values for the StrMenu by converting them to text and handling comma separators
  • Returns an error if no values are found or if the user cancels the menu selection

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

  • enum “My Enum”

Not found in BC28-30: enum “My Enum”.

Context

  • Features: StrMenu, Enum filtering, List collection, Dynamic value selection

Source: The BC Docs Librarian, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.