In Dynamics AX, by default most of the functions available on forms are related to a currently selected single record. It is also possible to process several selected records at once, although some modifications are required.
In this recipe, we will explore how a selection of multiple records can be processed on a form. For this demonstration, we will add a button to the action pane on the Main account list page to show multiple selected accounts in the Infolog.
Carry out the following steps in order to complete this recipe:
1. In the AOT, open the MainAccountListPage form and create a new method with the following code:
public void processSelected() { MainAccount tmpMainAccount; tmpMainAccount = MainAccount_ds.getFirst(1) ? MainAccount_ds.getFirst(1) : MainAccount_ds.cursor(); while (tmpMainAccount) { info(strFmt( "You've selected '%1'", tmpMainAccount.MainAccountId)); tmpMainAccount = MainAccount_ds.getNext(); } }
2. Add a new
Button
control anywhere...