Updated September 14, 2016

One of our Epicor 9 clients, a Northeast Ohio manufacturing company, wanted to essentially completely re-design the Epicor 9 MES. That task was going to involve creating 156 different buttons and reassigning their function. In addition, they wanted the ability to easily re-assign the buttons to fit their future needs.

SaberLogic reviewed their needs and determined that the Epicor buttons could possibly (1) execute an Epicor menu id, (2) be bound to an EpiBinding, or (3) execute a custom function.

The first two scenarios are relatively easy to accomplish. We created a custom storage class for a button which stores the object, the text for the button, the call (if it’s a menu id), the binding, or the function. We then created a dictionary to store all of the buttons, using the object name as an index so we can quickly find the individual button storage. So we then cycle through each button and bind them all to the same function. When the user clicks on a button it uses the name of the button as an index to find that button’s properties and determine how to execute the button click. If it was bound as an epibinding, we don’t have to worry. If it’s a menu call, we can use ProcessCaller.LaunchForm to execute the call.

The larger problem left to solve was executing a method when all you have is a string. This is where reflection comes into play. By including system.reflection, we used the following code:

Type thisType = this.GetType();

MethodInfo func = thisType.GetMethod(bp.Function);

func.Invoke(this, new object[] { });

bp.Function is a property of my button properties and Function is the name of the function we want to execute. When we call Invoke, we can pass the second parameter an array of objects if we need to pass parameters to the function call that we are invoking.

By using reflection we can gain access to private declared methods and variables, meaning that we don’t need to include the DLLs, making deployment much more flexible. Using a number of Epicor tools, we are able to determine the private methods and properties of their business objects which allow us to better review and understand how Epicor works . With that, we found that the Arg object that you typically pass into launching a screen has its own static method called Start. This takes the same arguments as if you were creating an instance of the object, but you don’t have to create the instance of the Object. In this case our client wanted to call JobAddlInfo, so after including the adapter, all we had to call was:

JobAddlInfoArgs.Start(MESMenu, "00012345", 0, 10, 1, true);

Since it’s a static method we did not need to create an instance of the object.

Example File Download

>> EXAMPLE XML FILE: Blank_MES_9_05_700B.zip

NOTE: This example XML file download is provided "as-is" and with no guarantees.

The Next Step!

Challenge us with your next Epicor 9 ERP customization request! Contact SaberLogic today!