BPM (Method Directive) MiscChg Error

About a week ago I posted about a BPM (Method Directive) that I was trying to create in Epicor 10.1.500 to automatically add a MIsc. Charge to a line item on a Sales Order for a Steel Surcharge. I did receive some help on this which got me working, however I am now running into an issue with an error message popping up when a user changes the Ship By Date on the Order Head and applies this new date to all Detail lines. Attached is my BPM and below is a screen shot of the error I am receiving. I would much rather do this all in code but I am not sure where to start with this, so any help on this would be appreciated. If anyone knows how to fix my issue with the current method directive I am okay with that as well.

I am also still looking for assistance with how to remove the misc charge through this same BPM if the part is changed to a part that doesn’t meet the criteria for receiving the misc charge, but I am not sure what logic to use to remove it.

Thank you again in advance for the assistance!

image

SteelSurcharge.bpm (230.8 KB)

  • Robert

At one point we where adding a misc charge in code to the line for a select number of parts when the order was flagged as entry complete. Hope this helps.

David

The first part is me checking if the charge already exists.

int sequence = 0;
bool chargeAlreadyAdded = false;
foreach (SalesOrderDataSet.OrderMscRow row in ((SalesOrderDataSet.OrderMscDataTable)soDS.Tables[“OrderMsc”]).Rows)
{
if(row.OrderLine == int.Parse(dtlRow[“OrderLine”].ToString()))
{
if (row.MiscCode == “CofC”)
{
chargeAlreadyAdded = true;
}
if (row.SeqNum > sequence)
{
sequence = row.SeqNum;
}
}
}
sequence++;
if (!chargeAlreadyAdded)
{ //add CofC to line
((SalesOrderDataSet.OrderMscDataTable)soDS.Tables[“OrderMsc”]).AddOrderMscRow(“PYI”, int.Parse(edvOrderHed.dataView[edvOrderHed.Row][“OrderNum”].ToString()), int.Parse(dtlRow[“OrderLine”].ToString()), sequence, “CofC”, “Certificate of Compliance”, 0, 0, “E”, “”, false, 0, 0, 0, “”, “”, “”, “”, “”, “”, 0, 0, 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), new DateTime(), new DateTime(), false, false, false, false, false, “”, new DateTime(), 0, 0, 0, 0, “”, 0, 0, 0, 0, 0, 0, 0, 0, “A”, true, “$”, “$”, false, “USD”, 0, 0, 0, 0, 0, “”, “”, “”, “”, “”, “”, “U”, new byte[8]);
soClass.Update(soDS, out returnError);
}

Hi Robert

Did you get this working in the end? This is something I am also struggling with.

Regards
Kirsty