Default InspectorID for PO Receipt Inspection Processing

I’m having trouble with creating code to default the InspectorID in Inspection Processing.
I can get the InspectorID from the current logged in user fine but assigning it to the InspectorID field on the PO Receipts panel isn’t working properly.
The code currently will set the field value but not show that it did until you click on the drop-down, but only on the first item. On any subsequent items, it doesn’t set it at all. I know that part must be in the condition but I’ve tried every combination I can think of.
Hopefully someone here can point me in the right direction.
Here’s what I’ve got so far:

	private void edvporView_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
		//MessageBox.Show("Row: " + args.Row + "  Col: " + args.Column + "  Sender: " + args.Sender + "  Type: " + args.NotifyType);



		if ((args.Row > -1) & (args.Sender.ToString() == "Erp.UI.App.InspectionProcessingEntry.Transaction")) {
			if (view.dataView[args.Row]["InspectorID"].ToString()=="") {
				string InspID = "";
				bool recSelected = false;
				string whereClause = "Name = '" + ((Ice.Core.Session)oTrans.Session).UserName + "'";
				DataSet dsInspector = SearchFunctions.listLookup(this.oTrans,"InspectrAdapter",out recSelected,false,whereClause);
				if (recSelected) {
					try {
					//Check that PO Receipts panel is active first
					EpiDockManagerPanel pnlMain = (EpiDockManagerPanel)csm.GetNativeControlReference("2d624ab2-5f0a-4848-8bd5-2df2c702a8bc");
					if (pnlMain!=null) {
						string strActiveControlName = pnlMain.ActiveControl.ToString();
						if (strActiveControlName == "Erp.UI.App.InspectionProcessingEntry.porMainPanel") {
							InspID = dsInspector.Tables[0].Rows[0]["InspectorID"].ToString();
							view.dataView[args.Row].BeginEdit();
							view.dataView[args.Row]["InspectorID"] = InspID;
							view.dataView[args.Row].EndEdit();
							EpiCombo cboInspID = (EpiCombo)csm.GetNativeControlReference("fd9fe6a9-c62e-4a1e-86cf-57f55bb73815");
							cboInspID.Update();
							cboInspID.Refresh();
						}
					}
					} catch {}
				}
					//view.EpiDataChanged();
			}
		}
	}

I can see Epicor calls InspProcessing.AssignInspectorNonConf so you may need to call that to set/change the inspectors. I don’t think setting the fields manually like you did there will work.

1 Like

I can try that, but the main problem I have is the condition. I need to be able to set the InspectorID when the inspector selects the next item. Currently it doesn’t.

I believe I’ve found a usable solution by modifying the GetRows method of Inspection Processing. It still doesn’t display the inspector name until you click the InspectorID dropdown the first time, but it’s only one click and isn’t a problem on subsequent items.