web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Adalhix / How to add favorites forms ...

How to add favorites forms through X++ in Dynamics 365 For Finance and Operations

AdnDalhi Profile Picture AdnDalhi 336

In Dynamics 365 For Finance and Operations, we can add favorites forms via the user interface to provide quick access to the list of forms, by clicking the star icon next to the form or (to the workspace name) in the navigation pane.

In this article i will share how we can add favorites forms by code, but before let’s know.

pastedimage1588460526080v1.png

  • How they are managed ?

Generally all favorites forms in Dynamics 365 For Finance and Operations are represented by their menu items, so our entry point is the Menu item name.

  • Where they are stored ?

All menu navigation favorites forms are stored in ‘SysMenuNavigationFavoriteItemsTable’ which contain all favorite elements with their associated AOT menu item names and path.

  • Quick scenario: Add « All assets Â» form into Favorites menu :

Now let’s add « All assets Â» as a favorite form.

pastedimage1588460567194v2.png

Following code snippet add  « All assets Â» as Favorite form.
First thing to know is the associated AOT menu item name for the form we want to add as a favorite, here we use « EntAssetObjectTableAll Â»  menu item, and the AOT menu item path used (check all yellow marked elements), and finally the labels.
public static void main(Args _args)
{
SysMenuNavigationUserItemsManager sysMenuNavigationDataProvider = SysMenuNavigationUserItemsManager::construct();
MenuItemName menuItemname = "EntAssetObjectTableAll";
MenuItemType menuItemType = 0;
SysMenuNavigationPath menuNavigationPath = "[\"mainmenu\",\"EntAsset\",\"ObjectsMenu\",\"EntAssetObjectTableAll\"]", path = "Asset management,Assets,All assets";
SysMenuNavigationFavoriteItemsTable::AddIfNotExist(menuItemName, menuItemType, menuNavigationPath, path);
}

the code will create new record if not exist in the sys table and add Â« All assets Â» form into the user-defined favorites section.

pastedimage1588460695503v3.png

Comments

*This post is locked for comments