Method Directive Help-Set ShipHead Field Based on OrderHed Field

I am trying to pull a value from OrderHed when creating ShipDtl in Customer Shipment Entry. I then need the result to either set a UD boolean on ShipHead or not.

We are not using demand management. After entering the sales order for the ShipDtl, I need the ShipDtl to report if the EDIOrder field in OrderHed of that order number is true. If it is true, I need my boolean UD field on ShipHead to be checked to trigger processes following.

I attempted a pre method on CustShip.GetNewShipDtl that says if the ShipDtl.OrderNum field has been changed from any to another then enable the post directive.

My post method says that if this was enabled off of the pre method then execute custom code.

My custom code is what I can’t get… it either says “Name does not exist in current context” or it keeps asking if I am “missing an assembly reference”.

Again, I need the code to link the ShipDtl with a OrderHed and For each OrderHed.EDIOrder “true”, I need to flag a UD field on my ShipHead of that shipment.

Any help is appreciated. Thanks!

Welcome Lindsey. Please post your custom code for review.

I want to preface this with the fact that I in no way know coding!! :slight_smile: I was simply taking a stab at this from my findings in online resources…

Summary

var orderhed = Orderhed;

foreach(var Order in orderhed);
{
if(Orderhed.EDIOrder = “true”);
{
string company = OrderHed.Company;
int orderNum = OrderHed.OrderNum;

var EDIShip =(from sd in Db.ShipDtl where sd.Company == company && sd.OrderNum == orderNum select ds).FirstOrDefault(shipheadPackNum); 
{
  using(var order = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db));
  {
    Erp.Tablesets.SalesOrderTableset orderTs = new Erp.Tablesets.SalesOrderTableset();
    SalesOrder.Update(ref orderTs);
    orderTs.SalesOrder[0].EDIOrder == true;
    {
      set ShipDtlUD.EDI_Flag_c = "true";
    }
  }
}

}
}

You are really diving into the deep end here. I consider directives to be a rather advanced ability in Epicor. You really have to know what is going on in the business objects and methods.

For starters, when you post code here at epiusers, precede the code with three tick marks ` (the tilde key next to the 1) and optionally the letters cs, sql, or vb to represent the language your code is in. Usually, I just use cs. After you paste in your code, end the code section with the same three tick marks without any letters. This will keep all your code together in a handy little window.

The code you posted is pretty messy, but I see what you’re getting at. I think someone else here could direct you a bit better than me. I’ll see if I can make a code that works and let you know. I would be curious to hear what others here would suggest for you.