After Epicor version upgrade to 10.2.600.2. Facing error in the customization which was done in the version 10.2.500.12

We created the customization in MES for capturing data from the operators in the Epicor version 10.2.500.12. Recently the version got upgrade to 10.2.600.2. When I ran - verify customization in Customization maintenance. I am getting this error in newer version. Kindly help me.

The Code is

// **************************************************
// Custom code for UD01Form
// Created: 11/4/2019 2:18:45 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.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;

public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **

private EpiBaseAdapter oTrans_adapter;
private EpiDataView edvUD01;
// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

// Instantiate the UD01 view and adapter
UD01Adapter adUD01;
EpiTreeViewPanel treeView;

// Instantiate 
Ice.Lib.Framework.EpiTextBox txt1;
Ice.Lib.Framework.EpiTextBox txt2;

// 1. flags to handle the initialize code execution
bool triggerRowInitialize = false;
bool doRowInitialize = false;

// local variables to hold parameters
string defaultEmployeeNum;
string defaultEmployeeName;
string defaultShift;
string defaultJobNum;

public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	this.oTrans_adapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_adapter"]));
	this.UD01Form.AfterToolClick += new Ice.Lib.Framework.AfterToolClickEventHandler(this.UD01Form_AfterToolClick);
	this.oTrans_adapter.AfterAdapterMethod += new AfterAdapterMethod(this.oTrans_adapter_AfterAdapterMethod);
	this.edvUD01 = ((EpiDataView)(this.oTrans.EpiDataViews["UD01"]));
	this.edvUD01.EpiViewNotification += new EpiViewNotification(this.edvUD01_EpiViewNotification);
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	// End Wizard Added Custom Method Calls

	// initialize UD01 view and adapter
	adUD01 = ((UD01Adapter)(this.csm.TransAdaptersHT["oTrans_adapter"]));
	edvUD01 = (EpiDataView)oTrans.EpiDataViews["UD01"];

	treeView = (EpiTreeViewPanel)csm.GetNativeControlReference("ff47e708-60d7-4586-9708-91a5d57fb7a6");

	// initialize existing textboxes in case you want to handle an existing control property
	txt1 = (Ice.Lib.Framework.EpiTextBox)this.csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838f");
	//txt1.Text = "1";
	//txt1.Focus();	

	// get the parameters sent
	string parameterString = this.UD01Form.LaunchFormOptions.ValueIn.ToString();

	// get parameters from string
	var parameters = parameterString.Split('|');
	if (parameters.Length > 0) 
	{
		defaultEmployeeNum = parameters[0];
		defaultEmployeeName = parameters[1];
		defaultShift = parameters[2];
		defaultJobNum = parameters[3];
	
		// 2. Set the trigger flag
		triggerRowInitialize = true;
	}
}

public void DestroyCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	// Begin Wizard Added Object Disposal

	this.oTrans_adapter = null;
	this.UD01Form.AfterToolClick -= new Ice.Lib.Framework.AfterToolClickEventHandler(this.UD01Form_AfterToolClick);
	this.oTrans_adapter.AfterAdapterMethod -= new AfterAdapterMethod(this.oTrans_adapter_AfterAdapterMethod);
	this.edvUD01.EpiViewNotification -= new EpiViewNotification(this.edvUD01_EpiViewNotification);
	this.edvUD01 = null;
	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

private void UD01Form_Load(object sender, EventArgs args)
{
	// Hide treeview
	(treeView.Parent as Infragistics.Win.UltraWinDock.DockableWindow).Pane.Close();
}

private void UD01Form_AfterToolClick(object sender, Ice.Lib.Framework.AfterToolClickEventArgs args)
{
	var tool = args.Tool.Key;
	switch(tool)
	{
		case "NewTool":
			// When user hits new should initialize 
			if (edvUD01.Row >= 0) 
			{
				if (edvUD01.dataView[edvUD01.Row].Row.RowState == DataRowState.Added) 
				{
					edvUD01.dataView[edvUD01.Row].BeginEdit();
					edvUD01.dataView[edvUD01.Row]["Key1"] = defaultEmployeeNum;
					edvUD01.dataView[edvUD01.Row]["Key2"] = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffff");
					edvUD01.dataView[edvUD01.Row]["Character01"] = defaultEmployeeName;
					edvUD01.dataView[edvUD01.Row]["ShortChar01"] = defaultJobNum;	
					edvUD01.dataView[edvUD01.Row]["ShortChar02"] = defaultShift;	
					edvUD01.dataView[edvUD01.Row]["Date01"] = DateTime.Today;

					// hours must be decimal = 7:45 = 7 hours + (45/60) = 7.75 
					// this number equals to the time in seconds 
					// for example 7:30 am = 7.5 * 60 = 450 minutes
					// 450 * 60 = 27000 seconds
					edvUD01.dataView[edvUD01.Row]["Number01"] = 27000;

					var hour = DateTime.Now.Hour;
					var minute = DateTime.Now.Minute;
					decimal decHour = Convert.ToDecimal(hour) + (Convert.ToDecimal(minute) / 60);
					decimal timeInSeconds = decHour * 60 * 60;
					edvUD01.dataView[edvUD01.Row]["Number01"] = timeInSeconds;

					edvUD01.dataView[edvUD01.Row].EndEdit();
				}
			}
			break;
	}
}


private void oTrans_adapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
	// ** Argument Properties and Uses **
	// ** args.MethodName **
	// ** Add Event Handler Code **

	// ** Use MessageBox to find adapter method name
	// EpiMessageBox.Show(args.MethodName)
	switch (args.MethodName)
	{
		case "GetRows":
			// 3. catch the flag to trigger the initialize after the GetRows is tried.
			// When the ValueIn is sent to any form, a GetRows is executed.
			if (triggerRowInitialize == true)	
			{
				triggerRowInitialize = false; 	// Turn off flag
				doRowInitialize = true; 		// set flag to perform the new
			}
			break;
	}

}

private void edvUD01_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.AddRow))
	{
		if ((args.Row > -1))
		{
			
		}
	}

	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize)) 
	{
		// 4. catch the initialize action flag
		if (doRowInitialize == true)
		{
			doRowInitialize = false; // Turn off flag

			// 5. Invoke the new button through a shortcut
			baseToolbarsManager.Tools["NewTool"].SharedProps.Shortcut = (Shortcut)Shortcut.ShiftF9;
	        SendKeys.Send("+{F9}");
		}
	}
}

}

Assuming the issue is with your code I would delete chunks of code and retry the verification, hopefully that will narrow down where the error happens and you can just change that.

If it is an issue with the customization engine you need to contact support.

It’s likely that the control references have changed… double check what they are now in the .600 form, and update the customization accordingly.

1 Like

Aaron, can you please give an example

Aaron, here is the screenshot, but I do not know how to fix this.

image

Aaron, when you find time today, can you please guide me for this object reference issue.

Thanks
Subha

Aaron means the base form control references or Ids, these:
treeView = (EpiTreeViewPanel)csm.GetNativeControlReference(“ff47e708-60d7-4586-9708-91a5d57fb7a6”);
txt1 = (Ice.Lib.Framework.EpiTextBox)this.csm.GetNativeControlReference(“46567b2e-6bc0-4967-be35-a0ec6843838f”);

I can see that “46567b2e-6bc0-4967-be35-a0ec6843838f” is the id for the txtSalesRepCode control, however the MES screen doesn’t have a treeview in either 10.2.500 or 10.2.600.

Is the treeview part of the UD01 Form?
You need to review what you are trying to do with the treeView and “ff47e708-60d7-4586-9708-91a5d57fb7a6” seems to be an invalid value.

Jonathan,

Yes the treeview is a part of the UD01 form

So it is the other way around, “46567b2e-6bc0-4967-be35-a0ec6843838f” is part of the MES form and not the UD01 Form so it shoulnd’t be there.

And also if you look at the code you are not using txt1, I’m guessing it is there from a copied customization.

Jonathan,
Both treeview and txt1 are part of UD01 Form.

I see, I would go back to my original suggestion, remove pieces of code until you find the culprit of the error and then we can troubleshoot that.