Checking for "Make Direct" Lines on Customer Shipment Entry

Due to some frequently repeated user errors, we have decided to modify the Customer Shipment Entry screen to disable the “From Inventory” form controls when a user adds a line/rel to the pack that has been marked “Make Direct.”
The field that I am looking to check for is OrderRel.Make but I am having issues grabbing a hold of that data in the script editor. I’m fairly new to the more in-depth parts of form customization like Adapters and that stuff so I’m in that “I don’t know what I don’t know” kind of area.

After poking around in the Epicor customization guide and looking in the object explorer for stuff that sounded like it would help I have made a little bit of progress, but am still looking for some guidance.

<c#>	
private void oTrans_orderRelAdapter_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 "InvokeSearch":
/*			
			OrderRelSearchAdapter ORA = new OrderRelSearchAdapter(CustShipForm);
			ORA.BOConnect();

			Data.DataSet dsORA = ORA.GetCurrentDataSet(dsMode);

			ORA.Dispose();
*/		

			break;
	}

}

</c#>


The form controls I am tasked with disabling.

Hmmm…
I seem to remember it being a little tricky to customize the ship detail form… disabling controls.
Have you looked at BPMs yet?
e.g. BPM to alert and/or prevent on certain transactions, might be simpler.

3 Likes

I would recommend that you use a BPM for this. If the user has entered an O/L/R (without the Job) and that release is Make, then error and clear those fields.
That being said, Use the Customization Search Wizard to build simple search code.

1 Like

So I’ve decided to go with Jason’s suggestion and move this solution to one based on a BPM. Currently I have a Pre-Processing Method Directive on CustShip.GetQtyInfo that checks to see if displayInvQty and ourJobShipQty are BOTH greater than zero and then raises an exception. I have also been tasked with changing displayInvQty back to 0 whenever this exception is raised. This last part is the one I’ve been having issues with.
Currently I am Invoking the CustShip.GetQtyInfo method again, and just setting the displayInvQty parameter = 0, and this works on the form, as long as someone clicks refresh. Is there a way to just automatically refresh the form from this BPM or otherwise make the displayInvQty value return to 0 after the exception is raised?

1 Like

Not sure if I will be giving you good advice here as I do not know all that you did and where, but possibly the best “Refresh” you can do is run a GetByID in the BPM when you are done.

In order to avoid this post becoming one of the classic “I have the exact same issue but no solution was ever found” forum posts that we all hate, I will describe what I eventually got to work.

I attempted to go the BPM route, and that got me close to what I was looking for, but the solution wasn’t quite as “idiot-proof” as we wanted.

So I decided to go back to the customization and do some more messing around and finally settled on using the EpiViewNotification form event. Code Below:

<c#>	private void edvShipDtl_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	if ((args.NotifyType == EpiTransaction.NotifyType.AddRow || args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{
		if ((args.Row > -1))
		{
			if (Convert.ToInt32(edvShipDtl.dataView[edvShipDtl.Row]["OurJobShipQty"]) > 0 && Convert.ToInt32(edvShipDtl.dataView[edvShipDtl.Row]["OurInventoryShipQty"]) > 0)
			{
				EpiNumericEditor fromInvQty = (EpiNumericEditor)csm.GetNativeControlReference("4de8266f-c61f-409c-ad94-53727716091b");
				MessageBox.Show("Ship Qty and Job Ship Qty cannot both be greater than zero.");
				
				fromInvQty.Value = 0;
				edvShipDtl.dataView[edvShipDtl.Row]["OurInventoryShipQty"] = 0;
				edvShipDtl.dataView[edvShipDtl.Row]["DisplayInvQty"] = 0;
				MessageBox.Show("Our Ship Qty and Our Job Ship Qty cannot both be greater than zero. Please confirm you are entering the correct data and try again.");
			}
		}
	}
}

Essentially once we found that EpiDataView was the form event we wanted everything was pretty straightforward. This just displays a message and resets the box to zero. Hopefully someone finds this useful in the future and thanks for all the suggestions!