Auto Generated Sales Order Release Default

Hello!

Has anyone been able to successfully set defaults on an order release THAT IS AUTO-GENERATED from saving the line? Specifically on a method directive, not a data dir.

I’d like to set the site/warehouse to be a certain default. Because the auto generated release does not get created via GetNewOrderRel, and is instead created along with MasterUpdate I’m having trouble with this. Is a DD the only way here?

Interestingly I’ve been struggling to get this sort of thing working for PO releases as well, but the requirement is we really want the release to pickup the site and warehouse by looking at the shipname field (which gets changed when you click on the site button) . There must be some similarity to Sales Order and Purchase Order from the release perspective.

1 Like

I bet they are. I crashed my test System trying to invoke BOs in post processing :frowning:

DataDirective is prolly your best bet…

1 Like

I did this a few months ago for someone, it was not easy. The warehouse was updating after I set it.

I will look for the bpm in the morning.

1 Like

It won’t work on a method directive as the release is not available. While you could do it as a data directive, you can’t simply set the field without using the business objects. I’ve tried in (albeit in E9), and the problem was the PartDtl table (which drives demand/time phase) would use the original plant/warehouse, not the updated plant/warehouse.

You’d almost have to do this as a post-processing directive, but then you can run into issues with the GUI not having the same data as what’s on the table. Or, alternatively you could do an update from Order Entry in code AFTER it creates the line/release. The problem here: if you’re already struggling with the performance of Order Entry, adding another update just slows the program down even more.

The best avenue I’ve had on this is with a client who wanted to do a number of things to the order releases once they were “done” processing it, such as firm all releases, update UD fields, set plants, and so on. So, I’ve got a button that “submits” those updates to Service Connect, and that basically runs and does all these updates using Epicor’s business objects.

Hope that helps. There are a lot of traps you have to avoid with this update.

Kevin Simon

3 Likes

Thanks for all the great responses everyone! I’ll have to think of a different way to approach my problem and may just end up using a very focused DD.

Trying to do the same thing and the closest I’ve gotten is calling SO update from a Data directive on OrderRel - at least one added record. The warehouse changes fine but the demand quantities are left on the original warehouse. Doing this via BO rather than just setting the field doesn’t even work. Can’t figure it out.

Erp.Contracts.SalesOrderSvcContract orderSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db);  
Erp.Tablesets.SalesOrderTableset OrderDs = orderSvc.GetByID(OrderRelRow.OrderNum);

(other code)

           var OrderRelUpdateRow =
            OrderDs.OrderRel
            .Where(or => 
                or.OrderNum == OrderRelRow.OrderNum &&
                or.OrderLine == OrderRelRow.OrderLine && 
                or.OrderRelNum == OrderRelRow.OrderRelNum
            ).FirstOrDefault();
            OrderRelUpdateRow.WarehouseCode = Warehouse; // set via BAQ lookup
            OrderRelUpdateRow.DemandReference = DemandRef; // for testing warehouse selection
            OrderRelUpdateRow.RowMod = IceRow.ROWSTATE_UPDATED;
            orderSvc.ChangeORelWarehouse(ref OrderDs);
            
            orderSvc.MasterUpdate(true,true,"OrderRel",OrderHedRow.CustNum,OrderHedRow.OrderNum,false, out IContinue, out cResponseMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg, out CResponseMsgOrdRel,ref OrderDs);

The only way I have found to do this is with a Data Directive. We unfirm all new releases and handles some buggy stuff with Mark For.

Are you doing anything with changing the warehousecode? It seems like we can change other fields but when changing the warehouse code, the PartDtl, PartWhse, etc related quantity records are not updated. When doing it through uBAQ it works fine but calling the BO directly does not.

Hello!
Did you ever find a solution to this not updating the partwhse qty? This seems like a HUGE bug to me. With an in-trans dd using a ubaq it works, but then that breaks orders that come through Demand EDI. When I move to standard dd and use the BO’s or call the uBAQ the part warehouse qtys do not update. What a PITA.

In my case this was for ECC web orders. I ended up moving everything to SalesOrder.ECCUpdateFinal Post-Processing and it worked. Not sure if this helps you at all but doing things on the OrderRel DD never worked out for me.

Thank You Phil. I found a cheeky way to set this. We only care about auto defaulting primary warehouses in each of our sites. The default Epicor way is to take the site one currently is logged into. So what I did is a pre-procesing directive on salesorder.masterupdate with the following code:

var s = CallContext.Current.TemporarySessionCreator;
s.SetPlantID("950"); //This temporarily sets the session of the method call
s.Create();

Thats it. No manually fussing around with the sales order bo. Its fast too, and updates the demand qtys on partwhse. Is this kosher? That’s debatable.