Using the following code to list all tool menu items from the Sales workbench screen (MainController) is the name of the form.
The following code is called during the form load event: This is a very similar code which has worked from the Quote Entry and Case Entry form, Is there a way to disable / hide a menu item? - #7 by Chris_Conn - ERP 10 - Epicor User Help Forum
using Infragistics.Win.UltraWinGrid;
using System.Reflection;
// Examine display main key for all Menus:
var obj= MainController.GetType().InvokeMember("baseToolbarsManager", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, MainController, null);
var tools = (Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)obj;
// Commented out because this only need to explore all the menu key IDs.
string toolnames = "";
foreach(var t in tools.Tools)
{
toolnames += t.Key +" , ";
}
MessageBox.Show(toolnames);
Error Detail
Message: Exception has been thrown by the target of an invocation.
Inner Exception Message: Field ‘Ice.Lib.Framework.UIApp.EpiHostForm.baseToolbarsManager’ not found.
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod
Client Stack Trace
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeScriptMethod(MethodInfo scriptMethod, Object[] parameters)
at Ice.Lib.Customization.CustomScriptMethodInvoker.InvokeCustomFormLoadIfExists(String methodName, Object sender, EventArgs e)
at Ice.Lib.Customization.CustomScriptManager.<>c__DisplayClassa.b__8()
at Ice.Lib.Customization.CustomScriptManager.TryActionShowExceptionBoxOrLogVerificationErrorIfException(Action action, String exceptionBoxTitle)