Quote Form customization: random error on findActivePanel method

I know this is a long shot, but I have been dealing with a minor run-time error for a while now on an otherwise very stable customization build on Quote Entry.
Sometimes and at random, when the form is first loaded, I get the following error:

Application Error

Exception caught in: Erp.UI.QuoteEntry

Error Detail

Message: Object reference not set to an instance of an object.
Program: Erp.UI.QuoteEntry.dll
Method: findActivePanel
Line Number: 2210
Column Number: 29

Client Stack Trace

at Erp.UI.App.QuoteEntry.QuoteForm.findActivePanel() in c:_Releases\ERP\UD10.1.400.11\Source\Client\UIApps\QuoteEntry\forms\QuoteForm.cs:line 2210
at Erp.UI.App.QuoteEntry.QuoteForm.OnClickMiscTool(String ToolKey) in c:_Releases\ERP\UD10.1.400.11\Source\Client\UIApps\QuoteEntry\forms\QuoteForm.cs:line 3268

Interestingly, after this error occurs, the form is focused correctly, but one of the custom sheet’s I’ve added onto the summaryLineSheet1 panel is focused. When the customization does not experience this error, the form is focused to the summaryPanel1, as I’ve told it to do in the QuoteForm_Load method.

private void QuoteForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code	
		try{
			Erp.UI.App.QuoteEntry.SummaryPanel sp = (Erp.UI.App.QuoteEntry.SummaryPanel)csm.GetNativeControlReference("a2f0ba41-ec45-4d3b-9cea-eb59874235f7");
			sp.Focus();
		}
		catch {}
}

The findActivePanel method appears to be a native method, as does the subsequent OnClickMiscTool method, so it’s interesting that the error is around these methods.

Any thoughts would be appreciated!

This can happen if you hide a panel or a tab that Epicor natively assumes will be there… did you do any of this?

Good find, yes it appears that there is a method that is inside of InitializeCustomCode that does in face hide a native panel.
Not sure why this is there though.
It’s interesting because there a bunch of native panels that are explicitly told to be visible in this method, and one that is told to be invisible.

private void ShowSalesPanel()
{
// display any panels that are not currently visible.
Erp.UI.App.QuoteEntry.MainPeopleSheet PeoplePanel = (Erp.UI.App.QuoteEntry.MainPeopleSheet)csm.GetNativeControlReference(“cdcd04d1-36af-4ed9-b2fe-85bbf1125cb5”);
Erp.UI.App.QuoteEntry.SalespersonPanel SalesPanel = (Erp.UI.App.QuoteEntry.SalespersonPanel)csm.GetNativeControlReference(“16feaa5b-fecf-4695-9693-9633844b7d89”);
SalesPanel.Visible = true;

  UltraDockManager udm = PeoplePanel.baseDockManager;
  DockableControlPane dcc = udm.PaneFromControl(SalesPanel);
  //dcc.Visible = true;
  //One Time Ship To Panel
  Erp.UI.App.QuoteEntry.OTSPanel OTSPanel = (Erp.UI.App.QuoteEntry.OTSPanel)csm.GetNativeControlReference("72f7ee02-a978-43c9-a310-bf6543acd948");
  OTSPanel.Visible = true;
  //Bill To Customer Panel
  Erp.UI.App.QuoteEntry.BillToCustomerPanel BTPanel = (Erp.UI.App.QuoteEntry.BillToCustomerPanel)csm.GetNativeControlReference("ec70eec8-038a-4794-99cd-7e873b97f1fd");
  BTPanel.Visible = false;
  //Header Misc Charges Panel
  Erp.UI.App.QuoteEntry.HeaderMiscChrgsPanel HeaderMiscChargePanel = (Erp.UI.App.QuoteEntry.HeaderMiscChrgsPanel)csm.GetNativeControlReference("7e790c9e-99fd-4543-9489-58ee00791f71");
  HeaderMiscChargePanel.Visible = false;
  //Task Sub Sheets 1
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskSubSheets TaskSubPanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskSubSheets)csm.GetNativeControlReference("99f1dd5c-4792-4ef1-8aa3-912c7dcf5431");
  TaskSubPanel.Visible = true;	
  //Task Comment Panel
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskCommentPanel TaskCommentPanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskCommentPanel)csm.GetNativeControlReference("87d5a561-ea6d-454d-b7ca-66015cb4197f");
  TaskCommentPanel.Visible = true; 
  //Task Vendor Panel
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskVendorPanel TaskVendorPanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskVendorPanel)csm.GetNativeControlReference("0f4b044d-5e46-4a1f-a50e-01698da7070b");
  TaskVendorPanel.Visible = true; 
  //Task People Panel
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskPeoplePanel TaskPeoplePanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskPeoplePanel)csm.GetNativeControlReference("3a5fec54-c216-4f71-aa40-cb73068339f5");
  TaskPeoplePanel.Visible = true; 
  //Task Customer Panel 
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskCustomerPanel TaskCustomerPanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskCustomerPanel)csm.GetNativeControlReference("6c058c91-c0ae-4bdd-8c35-04c21e896bab");
  TaskCustomerPanel.Visible = true; 
  //Task General Panel
  Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskGeneralPanel TaskGeneralPanel = (Erp.UI.App.QuoteEntry.Panels.TaskSubPanels.TaskGeneralPanel)csm.GetNativeControlReference("cfc556c3-d88b-45f9-91bd-420ae1860890");
  TaskGeneralPanel.Visible = true; 

}

Do you think that un-hiding it would fix this issue?

Most likely … yeah it should fix it… assuming there isn’t anything else hiding that shouldn’t be … Look in Tools-> XML-> Custom Properties there could be other Hidden Panels there.

Right on, thanks Jose, I’ve been needing to fix this minor issue for like 2 years now! :slight_smile:

Good to know! Nice one @josecgomez