Updating a Sales Order Record

This one is a doosie. Our front office has issues entering data correctly, and attaching documents. I am working on an OCR customization to hopefully help with this. Here is the flow of things I want to have happen:

(1) New sales order button is clicked
(2) File explorer opens for them to select a Customer Purchase order (I have this working).
(3) If it is a valid Purchase order, it enters the header and line information.
(4) Lastly, it saves the purchase order to the sales order.

I can figure out steps 2-4 just fine, but I am running into an issue. When the new sales order button is clicked, it begins to create a new record (sets the sales order value to 0, and waits for customer to be entered). Is there a way for me to write to the current in-process transaction? Really hitting a roadblock here.

Again, I can get this all working if it were from a custom button, but Cannot get this to work from the “New” button on the toolbar. Any suggestions?


Can’t you use some kind of customization using the “Before ToolClick Event”? From there you can run your Custom Code?

And the use the Form Event Wizard to implement your code?


Yeah you can. The issue I was having is that I would run my custom code, and then the Epicor code for that button would run. I would click the “new” button, my code would run, create a new sales order, but then the code for the “new” button would still run and start creating a new record. Is there a way to stop epicor code from firing that doesn’t bring up an exception box? I currently have it setup as an exception box, if they are trying to create a new sales order, it tells them they need to use the custom button I created, and it stops executing that code. Does that make sense?

You can update the current record on the screen by using the EpiDataViews. Not sure where the hang up is? Maybe I’m missing something when you click your custom Button does it not call the standard Epicor functions to Create the New Record? Or are you going outside and instanciating your own adapter and all that?
Either way, to update the current record all you have to do is write to the appropriate EpiDataVIew. Something like

var edvOH = oTrans.Factory("OrderHed");
1 Like

Jose, that is what I want to do, I just have never done that before. My custom button is referencing the sales order adapter , doing the GetNewOrderHed, and so on. In the example above, what is the Factory?

It’s a factory method (https://en.wikipedia.org/wiki/Factory_method_pattern) to get the current EpiDataView with that given name.

Okay! Let me play around with that, and see where I get. I may be back for more questions! Thanks Jose!

1 Like