Displaying a list of custom options
Besides normal lookups, Dynamics AX provides a number of other ways to present the available data for user selection. It doesn't necessarily have to be a record from the database; it could be a list of "hardcoded" options, or some external data. Normally, such lists are much smaller as opposed to those of the data-driven lookups, and are used for very specific tasks.
In this recipe, we will create a lookup of several pre-defined options. We will use a job for this demonstration.
How to do it...
1. In the AOT, create a new job named
PickList
with the following code:static void PickList(Args _args) { Map choices; str ret; choices = new Map( Types::Integer, Types::String); choices.insert(1, "Axapta 3.0"); choices.insert(2, "Dynamics AX 4.0"); choices.insert(3, "Dynamics AX 2009"); choices.insert(4, "Dynamics AX 2012"); ret = pickList(choices, "", "Choose version"); if (ret) { info(strFmt("You've selected option No. %1", ret)); } }
2. Run the job to view the...