Here's what I thought I knew about using literal option values in placeholders (%1, %2 etc.) in Microsoft Dynamics NAV: you need to assign the option value to a variable or a field in order to use it in e.g. a MESSAGE statement.

To demonstrate, let's create a simple table whose only field is of type option:


In a new codeunit, we create a local record variable with our newly created table as its subtype. In the OnRun trigger, we call MESSAGE with a format string (%1) and a reference to one of the field's options.


In NAV 2009R2, the result is, as any experienced C/SIDE developer has come to expect, this:


We need to assign our option value to a variable or field and call MESSAGE with that variable/field in order to see the string representation of our option, like so:

Improved Codeunit

Running our improved codeunit will render the result we were after:

Improved Message

In the work of a colleague of mine, who is relatively new to Microsoft Dynamics NAV, I noticed he used an literal option value in a message box. Eager to point out his rookie mistake ;), I ran his code and, much to my surprise, the message that was displayed looked just fine! Apparently, Microsoft has made some changes in the platform code that deals with this situation, since this is what our **original** demo codeunit produces in NAV 2016:


Looks like this old dog will need to un-learn some of its old tricks. 😉