In 2015 I shared a sample about this issue which run both of AX 2009 and AX 2012. Seem Microsoft decided to change this too with 365, so that code doesn't run on 365 anymore. Microsoft shared a white page as before-after, I learned from that page. It was run with one method, since 365 two methods.
We declare these constants at class declaration. Of course these are not mandatory but good for writing human readable code:
public const int listJournal = 2;
We put this metod into control which we run popup. This method run popup menu. This sample has two popup bars:
public str getContextMenuOptions()
{
str ret;
ContextMenu menu = new ContextMenu();
List menuOptions = new List(Types::Class);
ContextMenuOption option;
option = ContextMenuOption::Create("Credit number", listCredit);
menuOptions.addEnd(option);
option = ContextMenuOption::Create("Journal number", listJournal);
menuOptions.addEnd(option);
menu.ContextMenuOptions(menuOptions);
return menu.Serialize();
}
This method triggers when select a bar at popup:
public void selectedMenuOption(int selectedOption)
{
switch (selectedOption)
{
case -1:
break;
case listCredit:
info("Bar 1 selected!..");
break;
case listJournal:
info("Bar 2 selected!..");
break;
}
}
Hiç yorum yok:
Yorum Gönder