Manually update DropShipHead.ARInvoiced from Custom Code

,

So for context, I have created a UBAQ which shows users a combined view of both Packing Slips and Drop Shipments which are ready to be invoiced. The goal here is to allow invoice creation of Packing Slips and Drop Shipments as one normally would do in AR Invoice Entry via Actions → Get → Shipments, but also allow them to combine Packing Slips and Drop Shipments into the same invoice (following a bunch of criteria that doesn’t matter here).

The logic is such that a Packing Slip invoice and a Drop Shipment Invoice are both created, then using a Buffer Copy of the Drop Shipment Invoice, each line is appended to the end of the Packing Slip Invoice, and then the Drop Shipment Invoice is deleted.

The problem here is that when the Drop Shipment Invoice is deleted it marks the Drop Shipment as not invoiced anymore (proper Epicor functionality no worries there) but then when I go to manually update the value to show that it is indeed invoiced, I get an error:

image

It seems if I try to update the value and run the DropShip.Update BO, it throws an error if the ReceivedShipped flag is set to true (which in this case it should always be true).

Wondering if anyone has any other thoughts on how this could be done.

The DropShip ARInvoiced field is broken in Epicor. If you query your database you will find stuff that is marked as Invoiced but clearly isnt, or stuff that is not invoiced but is marked as Invoiced.

So given that Epicor does not show any love to that field at all. I would just use LINQ to Update the field.

// Pseudo Code
var row = ttDropWhatever....FirstOrDefault();
row.ARInvoiced = true;
txScope.Complete();
Db.Validate(row);

The benefit of having that set properly, is you can use it in a Dashboard or Report accurately. I’ve seen it broken dating back a few years.

4 Likes

This seems to work great. It even reverts to false when the Invoice is deleted which is something I was worried about. Thanks Haso!

1 Like

You put in a case for this?