BPM : Function : |:

Why is that when I call this function it does update the tables but ignores any other changes made on the Screen, Would someone please explain that …

Action<int, int, string, string > UpdateOrderGroundInfo = (inOrderNumber, inOrderLine, inPlant, inWarehouseCode) =>
{
using (var txScope = IceContext.CreateDefaultTransactionScope())
{

          foreach (var DBOrderHed_iterator in (from DBOrderHed_Row in Db.OrderRel
                    where   
                    (int) DBOrderHed_Row.OrderNum == (int) inOrderNumber  &&
                    (int) DBOrderHed_Row.OrderLine == (int) inOrderLine                     
                      select DBOrderHed_Row))
      {
         OrderRel = DBOrderHed_iterator;
        if (OrderRel != null)
        {
          
           OrderRel.Plant = inPlant;
           OrderRel.WarehouseCode = inWarehouseCode; 
                             
           }
          //Db.OrderRel.Update(OrderRel);
          Db.Validate();
          
          }  /// END if (DBOrderHed != null)
         txScope.Complete();
        }  /// 

using (var SalesOrderSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
{
var SalesOrderDs = SalesOrderSvc.GetByID(inOrderNumber);
this.dsHolder.Attach(SalesOrderDs);
}

};

Double posting is not going to make people answer you question any faster. Also, I see you still havent formatted your code.

3 Likes

Sidebar, is it acceptable to update a native field like that? Or should the bo method be used? Plant/Whse

9 out of 10 times you should always use the BO. If it is a simple field that has no logic or a UD field, you can get away modifying direct.

2 Likes

I added the tag #codeformat to this thread

1 Like

Direct update of DB fields (except UD fields or fields of UDXX table) is extremely dangerous way.
It means that caller bypasses the whole business logic related to the field updates.
So, direct DB update should be used only as the last resort.

1 Like

Sorry, but I can’t realize how provided code relates to the Epicor Functions subsystem.

@SAD I think they referred to it as a function not because of EFx but because they used an Action<>, it’s hard to pick up on because achem they need to format their code please

1 Like

Closed as duplicate of Please Help Me :|: BPM issue - #11 by SAD