Update an OrderRel on addition

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.

Someone please save me.


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.

?? for non-qty bearing parts?

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)

You can receive to inventory when the part is not qty bearing?


I can’t even do a Qty Adjust on a non-QB part.


I meant to say non-stock not non-qty bearing you got me all confused with your nonsense lol. But surprisingly yes you can receive it.


This is for a replacement part, so I only want to update when the release is added.


Is it a new line with the default release being added or a new release entirely?

If it’s a new release on an existing line you may be able to use GetNewOrderRel in method directives depending on your criteria.

If it’s the default first release of a line then you will likely need to use a data directive.

However all of the above depends entirely on your criteria and at what point in the process it’s available.

Neither of these fields will update. I have custom code on the DD Standard, but no love. Is there another way to update that I am missing? Or place?

Send a screenshot of your BPM diagram and a copy of the code you are using.

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.

Please post your code.

using (var txscope1 = IceDataContext.CreateDefaultTransactionScope())
var ttOrderRel_Recs = (from ttOrderRel_Row **in** Db.OrderRel
where ttOrderRel_Row.Company == Session.CompanyID
&& ttOrderRel_Row.OrderNum == callContextBpmData.Number01
&& ttOrderRel_Row.OrderLine == callContextBpmData.Number02
&& ttOrderRel_Row.OrderRelNum == callContextBpmData.Number03
select new {ttOrderRel_Row}).FirstOrDefault();
**if** (ttOrderRel_Recs != **null**)
ttOrderRel_Recs.ttOrderRel_Row.Make = **false**;

I’ve got it to where it will do the update, but it throws the error I previously posted. Would a try/catch of some sort fix that?


I just sent the code. This is about as bare-bones as it gets…

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.

Still no Love :frowning:

Sorry not sure what to tell you. I do exactly what you are looking to do in a data directive controlling he make flag based on order head information.

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.

Kevin Simon