Adding Custom Menu Items to Epicor Handheld

Update: One of my readers pointed out that this article is no longer applicable for Epicor 10.2 - you will get an error on oTrans.MenuItems. Skip to the bottom for an update for Epicor 10.2 users.

As an Epicor Handheld user, you may assume that the modules that you see are all that can ever be available, and if you want to do something custom you need to “take over” one of the existing modules:

Alright everybody, from now on “Bin Tracker” means our custom UD screen for quality.

Alright everybody, from now on “Bin Tracker” means our custom UD screen for quality.

But there is a better way - you can add whatever custom menus you want to Epicor Handheld! Here are the steps.


First, figure out which menu level you want to put your new entry. If it was the first level, you see immediately after logging in as an employee it is 0. If it is another level deeper, then it is 1. If it is yet another level deeper, it is 2 - you get the idea.

Next, count the number of existing menu entries at the level you want to add to also starting at 0.

Lastly, go to menu maintenance and find the menu ID of the screen you want to add to Epicor Handheld (note this screen should be customized to be super small to fit onto a mobile screen).

Finally, we are ready for our customization - within InitializeCustomCode of Erp.UI.Menu.Handheld.HHMenuForm you want to add these lines noted with comments per the items you just took note of:

// Define the title for the menu ID.  The first 0 after the bracket is the menu level,
// the 5 is the sequence where you want it to present on the menu, and the final 0 tells
// Epicor we are filling in the title property
oTrans.MenuItems[0, 5, 0] = "6-My Cool Menu"; 
// Same jazz as the last one, only the 1 here tells us we are filling in the property for
// which menu ID to load when this entry is selected
oTrans.MenuItems[0, 5, 1] = "DEMN2030"; 
// Get a reference to the menu list object and add this new menu to it.  These two lines
// of code are only necessary if you are updating menu level 0
EpiListBox lstMenu = (EpiListBox)csm.GetNativeControlReference("c17d4711-a862-47e5-a5b6-d96d53737a73");
lstMenu.Items.Add(oTrans.MenuItems[0,5,0]); 
// This is just another example - showing how you can update a child level and you
// don't need to manually add it to the menu control
oTrans.MenuItems[1, 5, 0] = "6-My Cool Sub Menu"; 
oTrans.MenuItems[1, 5, 1] = "DEMN2030";

Now that should do it - in my case here I have a new entry that loads up Employee Maintenance right from the Handheld menu:

Screenshot of Epicor Handheld where a new custom menu item has been added to the interface - GingerHelp

And that should be it! As always, leave us a comment if you get stuck, or this helped you out. Also, keep us in mind if you want to have us help out with any of your mobile/handheld projects. We have modified the heck out of many Epicor screens as well as developed much fancier mobile interfaces using Bezlio. Happy coding!


For Epicor 10.2 Users

Epicor 10.2 seems to have implemented a change that impacts the approach here. This is a MUCH cleaner setup they’ve got going on with this latest release. All you need to do now is the following:

Add the following to your ‘using’ statements:

using System.Reflection;

Add the following to InitializeCustomCode():

    var view = oTrans.Factory("MESMenu");
    var menuItem = view.dataView.AddNew();
    menuItem.BeginEdit();
    menuItem["MESMenuID"] = view.dataView.Count + 1;
    menuItem["MenuID"] = "DEMN2030";
    menuItem["Hidden"] = false;
    menuItem["CurrentEmpAllowed"] = true;
    menuItem["MenuType"] = "H";
    menuItem["ParentMESMenuID"] = 1;
    menuItem["TranslateMenuDesc"] = "My Cool Menu";
    menuItem["Company"] = ((Ice.Core.Session)oTrans.Session).CompanyID;
    menuItem.EndEdit();
    var menuCall = HHMenuForm.GetType().GetMethod("showMenu",  BindingFlags.Instance | BindingFlags.NonPublic,null,CallingConventions.Any,  new Type[]{typeof(int)}, null);
           menuCall.Invoke(HHMenuForm,new object[]{1});

Props to Chris Conn and Michael Mahrle for posting this over at epiusers.help.