Report Qty Customization error

I’m trying to customize the report quantity screen and bring in the JobEntry table. What I’m trying to accomplish is to have a check box on report quanity, if they select it go into Job entry and set job complete to true.

Below is all I have for the code but it errors when I run it thru the debugger on the object not set to an instance of an object on oTrans_endAdapter.BeforeAdapterMethod += new BeforeAdapterMethod(oTrans_endAdapter_BeforeAdapterMethod);.

I’m sure it’s something stupid, what am I missing.

// **************************************************
// Custom code for RQForm
// Created: 9/23/2024 1:24:45 PM
// **************************************************

extern alias Erp_Contracts_BO_JobEntry;
extern alias Erp_Contracts_BO_JobAsmSearch;
extern alias Erp_Contracts_BO_JobMtlSearch;
extern alias Erp_Contracts_BO_JobOperSearch;
extern alias Erp_Adapters_JobEntry;

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 Erp.BO;
using Ice.BO;
using Erp.Proxy.BO;

public class Script
{
	private EpiBaseAdapter oTrans_endAdapter;
	// ** 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 **

	public void InitializeCustomCode()
	{
		oTrans_endAdapter = (EpiBaseAdapter)csm.TransAdaptersHT["oTrans_endAdapter"];
		oTrans_endAdapter.BeforeAdapterMethod += new BeforeAdapterMethod(oTrans_endAdapter_BeforeAdapterMethod);

	}

	public void DestroyCustomCode()
	{
		oTrans_endAdapter.BeforeAdapterMethod -= new BeforeAdapterMethod(oTrans_endAdapter_BeforeAdapterMethod);
		oTrans_endAdapter = null;

	}

	private void oTrans_endAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
	{
		switch (args.MethodName)
		{
			case "Update":
			

			break;


			default:

			break;

		}
	}
}

So I might be mistaken here, but I think “endAdapter” is the adapter for End Activity, not for Job Entry. It’s referencing the wrong adapter, and that one isn’t added in your external aliases.

That said, I would recommend against adding the functionality you’re trying to get in the customization layer. My recommendation would be to use your checkbox to set a callContextBpmData field, and then set up a BPM to close the job, probably a data directive.

2 Likes

To clarify why I recommend against this: I’m working on cleaning up my environments’ dozens of customizations, many of which have several BeforeAdapterMethod and/or AfterAdapterMethod customization changes. Trying to build a BPM to change or add features is damn near impossible until I get these cleaned up.

2 Likes

What is the use case to do this in report quantity vs doing something during end activity?
I think you could end up with issues in report quantity completing the job before end activity has occurred on the labor transaction. I have not tested as we have used method BPMs on Labor EndActivity and recently functions for this.