How To: Using the AL Programming Basic Keyword STRMENU in Microsoft Dynamics 365 Business Central
This blog provides a step-by-step guide on how to use the STRMENU. The syntax is ”STRMENU(OptionMembers: Text, [DefaultNumber: Integer], [Instruction: Text]): Integer”. It creates a menu window that displays a series of options.
- Figure 1 shows a code unit with the members of the STRMENU keyword marked in red and the default member marked in green. So, when this code unit works, it creates a dialog box with three options to choose from. Those options are: “Create”, Display”, and “Delete.” The number “2”, which is marked in green, is the default action/option that will be marked as soon as the dialog box appears.
Figure 1: Demo Code unit in Microsoft Dynamics 365 Business Central
- Figure 2 shows the Page Extension for the same.
Figure 2. Page Extension in Microsoft Dynamics 365 Business Central
- Figure 3 shows the output in Business Central. Click on the action.
Figure 3: Clicking on the action in Microsoft Dynamics 365 Business Central
- A dialog box will appear with the default action automatically marked (Figure 4).
Figure 4: A dialog box appears with the default action automatically marked in Microsoft Dynamics 365 Business Central
- The options used inside the STRMENU keyword can be used for performing different actions, as shown in Figure 5. This code unit implies that if the user selects the “Create” option from the dialog box, a new customer will be created with No.= ‘Create01’ and Name= ‘Demo1’. If the user selects “Display” option, the system will find and display the name of the customer with no.=’Create01’. If the user selects the “Delete” option, the record with No.=’Create01’ will be deleted.
Figure 5: Using the members of STRMENU dialog box to perform an action in Microsoft Dynamics 365 Business Central
This is just a small demonstration of how STRMENU can be used.If you have any questions about this function or other Dynamics 365 Business Central or NAV, contact ArcherPoint.
Read more "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics Business Central or NAV.
If you are interested in NAV development, check out our collection of NAV Development Blogs.