I am getting stuck. GetNewOHOrderMsc does not seem to be populating a new row in the OrderMsc table for me to use. That NewMiscCharge variable comes back null every time. Is there something I am missing here?
I know that I am getting my OrderInfo to populate as well as the dsSalesOrder. I can write a different query to the OrderDtl table within the dataset and see the information from my order. But it doesn’t seem to be setting up the new row in OrderMsc.
boSalesOrder.GetNewOHOrderMsc(ref dsSalesOrder, OrderNum, 0);
var NewMiscCharge = (from m in dsSalesOrder.OrderMsc
where m.RowMod == "A" && m.Company == callContextClient.CurrentCompany
select m).FirstOrDefault();
I am not getting this row to be retrieved from the query. NewMiscCharge comes back null. Is there a better way to “get a new misc charge”?
Bah. I think I found it. I needed to be using OHOrderMsc in the from statement. Should’ve been:
var NewMiscCharge = (from m in dsSalesOrder.OHOrderMsc
where m.RowMod == "A" && m.Company == callContextClient.CurrentCompany
select m).FirstOrDefault();
Any idea why I would keep getting the “Row has been modified by another user and couldn’t be updated” BLE? It seems to happen anytime I set the DocDspMiscAmount field. If I don’t set that field, the amount does not show up on the misc charge. It just shows 0. Even after I get the BLE, it still adds the charge but it doesn’t save the change I made to the header to initiate the BPM to execute.
I believe it’s related to the fact that when I add the misc charge successfully, it forces an update to the OrderHed table as it changes the OrderAmt. So the OrderHed row gets locked at that time.
Ok. So then my question is: is there a better way to do what I am trying to do other than a pre-processing on the MasterUpdate?
Dan,
Did you ever get this working or find a better way to do this? I’m running into the same issue with the “row modified by another user” error.
Yes, for Orders I moved it to Post-Processing. I used an in-trans data directive for the Quotes (not sure if you’re there yet or already past it but don’t forget about quotes! The Order does not update like you’d want it to when you convert a quote to an order - so you need to have it right on the quote before you convert it to an order).
We added the miscellaneous charge specifically for credit card orders > $1000. To make sure it was a credit card order, we checked the Payment Terms.
If I remember correctly, I had to write a LINQ statement to retrieve the order amount and terms code from the database because it was not populated in the temp-table dataset that you get at post-processing. Pics below for reference.