Here’s my full code FFR. To add the field to every grid on POEntry is more code than I thought it would be, and if adding multiple fields it could get cumbersome to the point that it might be better to add a UD field to the PODetail table instead. If the grid is used in two places like it is on POEntry, you need duplicate statements for each using the “-1” control reference modifier or the column does not appear in the second grid location. Interestingly, you cannot use the same column key name in the duplicate grids without getting a “duplicate key” error.
// **************************************************
// Custom code for POEntryForm
// Created: 12/14/2018 11:33:02 AM
// **************************************************
extern alias Erp_Contracts_BO_Vendor;
extern alias Erp_Contracts_BO_Company;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_VendorPPSearch;
extern alias Erp_Contracts_BO_VendCntSearch;
extern alias Erp_Contracts_BO_PO;
extern alias Erp_Contracts_BO_MiscShip;
extern alias Erp_Contracts_BO_Receipt;
extern alias Erp_Contracts_BO_Plant;
extern alias Erp_Contracts_BO_JobEntry;
extern alias Erp_Contracts_BO_JobMtlSearch;
extern alias Ice_Contracts_Lib_BOReader;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
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 Ice.Proxy.Lib;
using Ice.Core;
using Erp.BO;
using Ice.BO;
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 **
EpiUltraGrid invGrid;
EpiUltraGrid jobGrid;
EpiUltraGrid otherGrid;
EpiUltraGrid subcGrid;
EpiUltraGrid allGrid;
EpiUltraGrid inv1Grid;
EpiUltraGrid job1Grid;
EpiUltraGrid other1Grid;
EpiUltraGrid subc1Grid;
EpiUltraGrid all1Grid;
BOReaderImpl _boReader;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
invGrid = (EpiUltraGrid)csm.GetNativeControlReference("619b890f-7d96-4dbe-9309-fd59da524a6a");
jobGrid = (EpiUltraGrid)csm.GetNativeControlReference("f50efdf8-0d94-4cf6-94a0-f36ef621a65f");
otherGrid = (EpiUltraGrid)csm.GetNativeControlReference("f9f11205-b912-427d-8a3b-e0611df23bcc");
subcGrid = (EpiUltraGrid)csm.GetNativeControlReference("43480e8c-c34e-43f6-89f7-f9760d615158");
allGrid = (EpiUltraGrid)csm.GetNativeControlReference("b106bc38-b2e2-4a22-ab02-6c3eea9acbf6");
inv1Grid = (EpiUltraGrid)csm.GetNativeControlReference("619b890f-7d96-4dbe-9309-fd59da524a6a-1");
job1Grid = (EpiUltraGrid)csm.GetNativeControlReference("f50efdf8-0d94-4cf6-94a0-f36ef621a65f-1");
other1Grid = (EpiUltraGrid)csm.GetNativeControlReference("f9f11205-b912-427d-8a3b-e0611df23bcc-1");
subc1Grid = (EpiUltraGrid)csm.GetNativeControlReference("43480e8c-c34e-43f6-89f7-f9760d615158-1");
all1Grid = (EpiUltraGrid)csm.GetNativeControlReference("b106bc38-b2e2-4a22-ab02-6c3eea9acbf6-1");
invGrid.DisplayLayout.Bands[0].Columns.Add("SageID_c","Sage ID");
jobGrid.DisplayLayout.Bands[0].Columns.Add("SageID_c","Sage ID");
otherGrid.DisplayLayout.Bands[0].Columns.Add("SageID_c","Sage ID");
subcGrid.DisplayLayout.Bands[0].Columns.Add("SageID_c","Sage ID");
allGrid.DisplayLayout.Bands[0].Columns.Add("SageID_c","Sage ID");
inv1Grid.DisplayLayout.Bands[0].Columns.Add("SageID_c1","Sage ID");
job1Grid.DisplayLayout.Bands[0].Columns.Add("SageID_c1","Sage ID");
other1Grid.DisplayLayout.Bands[0].Columns.Add("SageID_c1","Sage ID");
subc1Grid.DisplayLayout.Bands[0].Columns.Add("SageID_c1","Sage ID");
all1Grid.DisplayLayout.Bands[0].Columns.Add("SageID_c1","Sage ID");
invGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
jobGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
otherGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
subcGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
allGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
inv1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst1_InitializeRow);
job1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst1_InitializeRow);
other1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst1_InitializeRow);
subc1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst1_InitializeRow);
all1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst1_InitializeRow);
_boReader = WCFServiceSupport.CreateImpl<BOReaderImpl>((Ice.Core.Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.BOReaderSvcContract>.UriPath);
}
private void grdMatLst_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if(!String.IsNullOrEmpty(e.Row.Cells["PartNum"].Value.ToString()))
{
DataSet ds = _boReader.GetRows("Erp:BO:Part","PartNum = '" + e.Row.Cells["PartNum"].Value.ToString() + "'","PartNum, SageID_c");
if(ds.Tables[0].Rows.Count > 0 )
{
e.Row.Cells["SageID_c"].Value = ds.Tables[0].Rows[0]["SageID_c"].ToString();
}
}
}
private void grdMatLst1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if(!String.IsNullOrEmpty(e.Row.Cells["PartNum"].Value.ToString()))
{
DataSet ds = _boReader.GetRows("Erp:BO:Part","PartNum = '" + e.Row.Cells["PartNum"].Value.ToString() + "'","PartNum, SageID_c");
if(ds.Tables[0].Rows.Count > 0 )
{
e.Row.Cells["SageID_c1"].Value = ds.Tables[0].Rows[0]["SageID_c"].ToString();
}
}
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
invGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
jobGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
otherGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
subcGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
allGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
inv1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
job1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
other1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
subc1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
all1Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
_boReader = null;
}
}