At Deft Flux, we are often asked how users might customize the Epicor MES menu. For example, a company may want to allow all employees who use MES to access the PO Tracker. The empty buttons in the standard MES menu are not created to readily call new programs, so the path to customize the menu buttons is not obvious. We will step through one method of customization:
- Find out the menu identifier of the purchase order tracker using the System >> Security >> Menu Maintenance .
- Prepare to run the MES menu in customizable mode.
– Copy the Epicor <environment> MES menu item and rename it to Epicor <environment> MESC.
– Edit the properties of the new menu item and change the -MES at the end of the command line to -MESC.
- Run the MES menu in customizable mode and open up the customization editor.
- We will not use the existing blank button. Instead, inside the customization editor, create a *new* button that precisely covers the original blank button. Select the button and open the properties page. – Change the name to btnPOTracker.
– Change the text to &PO Tracker.
– Make sure the EpiBinding is blank.
- Switch to the Script Editor and add code to make the script for MES to look like this:
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.btnPOTracker.Click += new System.EventHandler(this.btnPOTracker_Click);
this.MESControl_Column.ColumnChanging += new DataColumnChangeEventHandler(this.MESControl_BeforeFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.btnPOTracker.Click -= new System.EventHandler(this.btnPOTracker_Click);
this.MESControl_Column.ColumnChanging -= new DataColumnChangeEventHandler(this.MESControl_BeforeFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void btnPOTracker_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
ProcessCaller.LaunchForm(oTrans, "PMGO2002");
}
private void MESControl_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "LoggedIn":
btnPOTracker.Enabled = !(bool)args.Row["LoggedIn"];
break;
}
}
private void MESMenu_Load(object sender, EventArgs args)
{
// Add Event Handler Code
btnPOTracker.Enabled = false;
}
}
Now, when you run the custom version of the MES menu, you should have the custom PO tracker button, and it should only be enabled when an employee is logged in to MES. The problem we will have is that running MES in standard mode will still run the standard version. We need to tell Epicor to run our custom version of MES:
- Open Menu Maintenance again, and create a custom menu item with the Menu Id “UDMES”.
– Set the program to Epicor.Mfg.Menu.Mes.dll and set the Customization to the one we have just created (POTracker in our case).
– Set the Parent Menu Id to “PROCESS”. This will remove the new menu item from Main Menu and place it under Processes. This menu is for processes that need to be called by other processes, but should not be on the main menu.
- Edit C:\Program Files (x86)\Epicor Software\Epicor905\Client\config\<environment name>.mfgsys. This can be edited on each workstation that needs to call this customization or edited on the server and deployed to the clients on installation. Find the line that contains the property MESCustomMenuID and set the value to “UDMES”.