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:
- Go to the AOT > Menus and create new menu. For example TestMenu.
- Add menu item. For example CustTable menu item.
- 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.
The new modules appears without image (to move module on the top position clicks the Microsoft Dynamics AX >View > Navigate Pane Options…):
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.
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:
- Go to the AOT > Resources. Click right mouse button and select Create form file.
- Specify the file path and click Open.
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.
All the best
Copied from Experts website....... Dynamicsaxtraining.
You can always reach me at axapta4all@gmail.com
Anonymous Axaptian
Đôi mắt là cửa sổ của tâm hồn , chính vì vậy nên việc giữ cho đôi mắt luôn sáng khỏe chính là nhiệm vụ hàng đầu .
ReplyDeletethực phẩm tốt cho mắt
cách chống nắng hiệu quả
giải độc gan trị mụn
cách trị sẹo lồi lâu năm
công thức kem trộn trắng da toàn thân an toàn , giúp da luôn sáng khỏe .