Thursday, 24 December 2015

Logos for new Module added in AX

Create a new module in Dynamics AX and assign image or logo to this module.
Creating Module: Go to the AOT > Menus and create new menu.  For example TestMenu.

1.    Add menu item. For example CustTable menu item.

2.    Then create new menu reference in the MainMenu menu:

o    On the MainMenu menu clicks the right mouse button and select New > Menu reference. TheSelect: Menus windows opens.

o    Drag and drop the TestMenu menu from Select:Menus window to the MainMenu.

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…

 Select the TestMenu menu in the AOT, click right mouse button and selectProperties. There are two properties NoramlImage and NormalResource.

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:
But this resource doesn’t have the resource id or image id property. Even more in the NormalResourceproperty only the resource id of standard image can be specified. Standard image could be review here AOTForms > 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)));

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()

Reopen application.

No comments:

Post a Comment