Module logo

Hi! I have received the following task: Create new module in Dynamics AX and assign image or logo to this module.

Let’s develop this task.

Module is created very easy:

  1. Go to the AOT > Menus and create new menu.  For example TestMenu.
  2. Add menu item. For example CustTable menu item.
  3. Then create new menu reference in the MainMenu menu:
    • On the MainMenu menu clicks the right mouse button and select New > Menu reference. The Select: Menus windows opens.
    • Drag and drop the TestMenu menu from Select:Menus window to the MainMenu.
New menu

New menu

This is all. The new module have been added. Reopen Dynamics AX application.

The new modules appears without image (to move module on the top position clicks the Microsoft Dynamics AX >View > Navigate Pane Options…):

New module without logo

New module without logo

Adding module logo is not so easy. Select the TestMenu menu in the AOT, click right mouse button and select Properties. There are two properties NoramlImage and NormalResource.

Menu properties

Menu properties

In the NormalImage property the file path to the logo could be specified. But if we create product for sell then we can not specify the exact file path because each Customer will have own path.

In the NormalResource property the image id could be specified. It is suitable for our requirements. Let’s add image in Dynamics AX:

  1. Go to the AOT > Resources. Click right mouse button and select Create form file.
  2. Specify the file path and click Open.

The new image resource will be created:

Image resource

Image resource

But this resource doesn’t have the resource id or image id property. Even more in the NormalResource property only the resource id of standard image can be specified. Standard image could be review here AOT > Forms > SysImageResources.

Trick: we will use the NormalImage property and Logo_image_png resource.

Create the following static method:
static client void addImageToModule()
{
TreeNode treeNodeMenu;
;

treeNodeMenu = SysDictMenu::newMenuName(menustr(TestMenu)).parmTreeNode();
if (treeNodeMenu)
{
treeNodeMenu.AOTsetProperty(identifierstr(NormalImage), SysResource::getImagePath(resourcestr(Logo_image_png)));
treeNodeMenu.AOTsave();
}
}

Call this method in the \Classes\Application\startupPost method:

// No SYS code must exist in this method
// If you need the startup command, look in the class SysStartupCmd
void startupPost()
{
;
Class1::addImageToModule();
}

Reopen application.

Module with logo

Module with logo

All the best 😉