Hey, pretty new to this so sorry if the question has a simple answer.
I am trying to tie the customizable button on Epicor’s Mes to a custom BAQ report. The report is a summary of employee times throughout the week. I can get the button to pull up the report just fine. However, I would like for the button to be disabled until someone is logged in. Then pull that employee number or name and populate the report based on that information rather than have them type it in. I have attempted to accomplish this based on these threads but have had no success.
We are currently in Epicor 10.2.400.11 on the cloud.
i noticed you’re not using the epiview notification as was suggested. Try using this instead. If it’s a custom button you’ve created, there’s no need to declare a module level variable, you can simply address it by name.
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.edvEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["EmpBasic"]));
this.edvEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
// End Wizard Added Variable Initialization
// Begin 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.edvEmpBasic = null;
this.edvEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
// End Wizard Added Object Disposal
private void edvEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
EnableDisableCustomControls(true);
}
else
{
EnableDisableCustomControls(false);
}
}
}
private void EnableDisableCustomControls(bool iFlag)
{
<yourbutton>.Enabled = iFlag;
<yourbutton>t.Enabled = iFlag;
}
Error: CS0117 - line 84 (218) - ‘Ice.Lib.Framework.EpiTransaction.NotifyType’ does not contain a definition for ‘Initalize’
Warning: CS0618 - line 99 (233) - ‘Ice.Lib.Framework.EpiButton.Enabled’ is obsolete: ‘EpiControls should use ReadOnly instead of Enabled’
Warning: CS0618 - line 100 (234) - ‘Ice.Lib.Framework.EpiButton.Enabled’ is obsolete: ‘EpiControls should use ReadOnly instead of Enabled’
Process caller has another paramter that can be passed in LFO (LaunchFormOptions) (search this forum) and that can send data in via the ValueIn property.
However, it is not sending the credentials I keyed in for it.
------------------------Begin Code------------------------------------------
// **************************************************
// Custom code for MESMenu
// Created: 11/21/2019 9:46:44 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win;
public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **
private EpiDataView edvEmpBasic;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiButton btnDash;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.edvEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["EmpBasic"]));
this.edvEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
btnDash = (EpiButton)csm.GetNativeControlReference("fe187107-b719-4a3d-96a8-5f8505ea65ae");
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
this.btnDash.Click += new System.EventHandler(this.btnDash_Click);
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.edvEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
this.edvEmpBasic = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
this.btnDash.Click -= new System.EventHandler(this.btnDash_Click);
}
private void MESMenu_Load(object sender, EventArgs args)
{
// Add Event Handler Code
btnDash.ReadOnly = false;
}
private void btnDash_Click(object sender, System.EventArgs args)
{
string yourEMP = "cconn"; //((Session)oTrans.Session).EmployeeID;
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ValueIn = yourEMP;
ProcessCaller.LaunchForm(oTrans, "UDLBRBAQ", lfo);
//ProcessCaller.LaunchForm(this.oTrans, "UDLBRBAQ");
}
private void edvEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
EnableDisableCustomControls(true);
}
else
{
EnableDisableCustomControls(false);
}
}
}
private void EnableDisableCustomControls(bool iFlag)
{
btnDash.Enabled = iFlag;
btnDash.Enabled = iFlag;
}
Just noticed that our Employee ID field on the mes screen is not populating. Could this be why nothing is being passed on? It compiles correctly it launches the report correctly. However, it does not pass anything over to the report.
----------------------------------------------------Code----------------------------------------
// **************************************************
// Custom code for MESMenu
// Created: 11/21/2019 9:46:44 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win;
using Ice.Core;
public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **
private EpiDataView edvEmpBasic;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiButton btnDash;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.edvEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["EmpBasic"]));
this.edvEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
btnDash = (EpiButton)csm.GetNativeControlReference("fe187107-b719-4a3d-96a8-5f8505ea65ae");
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
this.btnDash.Click += new System.EventHandler(this.btnDash_Click);
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.edvEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
this.edvEmpBasic = null;
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
this.btnDash.Click -= new System.EventHandler(this.btnDash_Click);
}
private void MESMenu_Load(object sender, EventArgs args)
{
// Add Event Handler Code
btnDash.ReadOnly = false;
}
private void btnDash_Click(object sender, System.EventArgs args)
{
string yourEMP;
yourEMP = ((Session)oTrans.Session).EmployeeID;
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ValueIn = yourEMP;
ProcessCaller.LaunchForm(oTrans, "UDLBRBAQ", lfo);
//ProcessCaller.LaunchForm(this.oTrans, "UDLBRBAQ");
}
private void edvEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row]["FieldName"]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
EnableDisableCustomControls(true);
}
else
{
EnableDisableCustomControls(false);
}
}
}
private void EnableDisableCustomControls(bool iFlag)
{
btnDash.Enabled = iFlag;
btnDash.Enabled = iFlag;
}