Error in Customization -- InspProcessingAdapter.GetRows E10.2.400

Hey,

I’m trying to get pending inspections in a customized dashboard. I’m getting an error upon execution of GetRows. Here’s part of the trace on Inspection Processing:

<businessObject>Erp.Proxy.BO.InspProcessingImpl</businessObject>
  <methodName>GetRows</methodName>
  <appServerUri>net.tcp://dnp-paepiapp/ERP10V/</appServerUri>
  <returnType>Erp.Tablesets.InspProcessingTableset</returnType>
  <localTime>11/27/2019 10:10:35:2873272 AM</localTime>
  <threadID>1</threadID>
  <executionTime total="2316" roundTrip="2158" channel="113" bpm="5" other="40" />
  <retries>0</retries>
  <parameters>
    <parameter name="plOperation" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="plMaterial" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="plInventory" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="plFirstArt" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="plReceipt" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="plRMA" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="pcInspectorID" type="System.String"><![CDATA[]]></parameter>
    <parameter name="pcCutOffDate" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseNonConf" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseFirstArt" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseRcvDtl" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseRMA" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseSelectedSerialNumbers" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseSNFormat" type="System.String"><![CDATA[]]></parameter>
    <parameter name="whereClauseInspProcList" type="System.String"><![CDATA[]]></parameter>
    <parameter name="sortBy" type="System.String"><![CDATA[PartNum]]></parameter>
    <parameter name="pageSize" type="System.Int32"><![CDATA[100]]></parameter>
    <parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>

Here’s the customization code:

private void btnSaveInspections_Click(object sender, System.EventArgs args)
{
	var inspProcessingAdapter = ((InspProcessingAdapter)(this.csm.TransAdaptersHT["oTrans_inspAdapter"]));

	bool morePages = false;

	SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
	opts.PreLoadSearchFilter = ""; //"InspectionPending='true' ";
	opts.DataSetMode = DataSetMode.ListDataSet;

	opts.NamedSearch.WhereClauses.Add("plOperation","FALSE"); 
	opts.NamedSearch.WhereClauses.Add("plMaterial","FALSE");
	opts.NamedSearch.WhereClauses.Add("plInventory","TRUE");
	opts.NamedSearch.WhereClauses.Add("plFirstArt","FALSE");
	opts.NamedSearch.WhereClauses.Add("plReceipt","FALSE");
	opts.NamedSearch.WhereClauses.Add("plRMA","FALSE");
	opts.NamedSearch.WhereClauses.Add("pcInspectorID","");
	opts.NamedSearch.WhereClauses.Add("pcCutOffDate","");
	opts.NamedSearch.WhereClauses.Add("whereClauseNonConf","");
	opts.NamedSearch.WhereClauses.Add("whereClauseFirstArt","");
	opts.NamedSearch.WhereClauses.Add("whereClauseRcvDtl","");
	opts.NamedSearch.WhereClauses.Add("whereClauseRMA","");
	opts.NamedSearch.WhereClauses.Add("whereClauseSelectedSerialNumbers","");
	opts.NamedSearch.WhereClauses.Add("whereClauseSNFormat","");
	opts.NamedSearch.WhereClauses.Add("whereClauseInspProcList","");
	opts.NamedSearch.WhereClauses.Add("sortBy","PartNum");
	opts.NamedSearch.WhereClauses.Add("pageSize","100");
	opts.NamedSearch.WhereClauses.Add("absolutePage","0");
	opts.NamedSearch.WhereClauses.Add("morePages","FALSE");

	System.Data.DataSet dsInspProcessing = inspProcessingAdapter.GetRows(opts, out morePages); // *error occurs here*

	inspProcessingAdapter.Dispose();

	MessageBox.Show("count " + dsInspProcessing.Tables[0].Rows.Count.ToString());
}

Note all the WhereClause.Adds. I added these in a blind attempt to prevent this error:

Application Error

Exception caught in: App.DNP_NonConfInspProc.MainController.EP.Customization.DNP_NonConfInspProc.CustomCode.26

Error Detail 
============
Message: Object reference not set to an instance of an object.
Program: App.DNP_NonConfInspProc.MainController.EP.Customization.DNP_NonConfInspProc.CustomCode.26.dll
Method: btnSaveInspections_Click

Client Stack Trace 
==================
   at Script.btnSaveInspections_Click(Object sender, EventArgs args)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
   at Ice.Lib.Framework.EpiButton.OnClick(EventArgs e)
   at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs e)
   at Ice.Lib.Framework.EpiButton.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Of course, the InspProcessing adapter is added to the customization.

What, pray tell, might I be missing?

Thanks,

Joe

try not disposing of the Adapter before trying to access its contents in your message box

Edit; read that wrong, nvm

No worries. It’s not making it that far yet, anyway. :frowning:

You’re gonna laugh at this one.

Add your inspProcessingAdapter.BOConnect(); line after you instantiate it. :slight_smile:

Dang, that got me all excited.

I had this in a previous round:

InspProcessingAdapter inspProcessingAdapter  = new InspProcessingAdapter("MainController");
MessageBox.Show("before");
inspProcessingAdapter.BOConnect();
MessageBox.Show("after");

It would never hit the “after” box (Object reference not set to an instance of an object.).

So I changed it to this (which I haven’t used before) thinking I wouldn’t have to connect it:

var inspProcessingAdapter = ((InspProcessingAdapter)(this.csm.TransAdaptersHT["oTrans_inspAdapter"]));
MessageBox.Show("before");
inspProcessingAdapter.BOConnect();
MessageBox.Show("after");

So again, the “after” message box never fires (Object reference not set to an instance of an object.).

Joe.Stumped = true;

Thanks,

Joe

I tried it with a standard adapter, like you did in the first block, and my (well, your) code executed just fine (10.2.500.4)
Also try passing it oTrans instead of main controller.
InspProcessingAdapter inspProcessingAdapter = new InspProcessingAdapter(oTrans);

In the case where you are using the native adapter, it would have to be connected somewhere, but I’m not sure what the rest of the code looks like…

Yippee!

oTrans for “MainController” did it.

Thanks, Aaron!

Joe

1 Like