Its been awhile, so hopefully this isn’t a no brainer…
I am trying to update the OrderRel.Make field to false if certain criteria is met. I have tried Method Directives on the SalesOrder.MasterUpdate (which I have read you can’t get there from here) and Data Directives on the OrderRel.
I can Isolate the row I want in the DD OrderRel, but for the life of me I can not get the stupid Make field to update.
The “Make Direct” and “Buy To Order” fields on a Release act like radio buttons, implying that at least one must be checked. Try setting the Buy To Order flag on the release.
?? One or the other can only be checked at a time, but both can be false at the same time. Updating order rels is a giant nightmare in general no doubt about that, but are you trying to default info based on criteria when a release is added or if a release or anything in the order is updated? What is your exact criteria and trigger point it changes how you need to go about it quite a bit.
Sure you can still pull non-qty bearing from stock. We do it all the time for stuff that is over produced. We receive to inventory and wait for next order. One release becomes stock pull another is remaining of new order for make direct. OP didn’t indicate if it was non-qty bearing or not and regardless non-stock is what controls the Make flag
Now point of interest if you are trying to uncheck make for something that is not in part master that i don’t believe will work.
Likewise you can force a stock part to make direct if you really want. We do this when someone orders a metric ton of stock (say over our min + safety and def when over our max)
If it’s the default first release of a line – I am using the data directive but where it is available is my issue. The criteria is ProdCode != “1WG” AND ProdCode Starts with “1”. I have all this done. I move the OrderNum, LineNum and RelNum to callcontext. All which I validate with a popup. BUT
when I run the code to update in-transaction it gives the following error: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.
When I run the code to update standard – it does nothing most of the time. On RARE occasion it will actually change it, but then Epicor makes you refresh and it goes away.
You are effectively trying to open a new scope and update records while you are already in scope (in transaction). Just update the tt directly and you should be good to go.
Brenda, you are correct, updating order release information via BPM’s are very tricky. In addition, Epicor does a lot of other updates based on orders (think PartDtl table for demand, updates of quantity buckets on Part Warehouse records, etc). I’ve found that getting OrderRel udpates to stick are only part of the challenge, ensuring it’s done and keeps all your other data correct is an even bigger issue.
I tend to lean toward an update via BPM’s versus UI where possible, but this is one where I’ve found much more success in the UI. I’d recommend you have code in your UI that recognizes a new order line (via After Adapter triggers), and then when you need to change the Make/Buy Direct flags, you set then via the EpiDataView and trigger an update (oTrans.Update). The “downside” to this is you’re in effect doing an extra update/save instead of trying to have it incorporated in your update of the line. But it basically is automating having the user click save, go to the release tab and clicking boxes there and save. It’s a very safe customization that avoids all the potential issues with BPM’s.