How to programmatically bring up order information in order entry

I created a new tab in order entry UI. The user enters in key information and clicks the custom submit button. The logic in the custom button creates the OrderHed and OrderDtl records using the SalesOrder methods. This is working fine.

How do I then programmatically call this new order number in the sales order entry UI, which I am already in, so the user can then verify some information?

This is for a different screen but is the simplest approach, I think:

It’s a good idea to run a trace on what happens after the user enters an order number into the box and then exits, because that’s what you’ll need to mirror.

1 Like

How to I call the GetByID()?

I’d suggest you don’t.

Put the OrderNum you say you’ve already got from the existing code into the field that a user would put it in, and call the same things that are triggered when a user does that.

1 Like

Below is my code. I get the record, but how do I display the data to the UI, once I get the record.

SalesOrderAdapter soAdapter = new SalesOrderAdapter(oTrans);
soAdapter.BOConnect();

    int iOrderNum = 50185853;

    if (soAdapter.GetByID(iOrderNum) == true)
      {
        MessageBox.Show("found record.");
      }
    soAdapter.Dispose();
    MessageBox.Show("after");

Thanks for your help.

I tried to assign the new order number to the txtKeyField, but the txtKeyField does not exist.

You seem to be copying the code rather than the technique illustrated.

Do a trace on a standard Sales Order Entry screen, and see what happens when you manually enter an order number into the main box on the Summary tab, including which control is being used and what follows from doing it. You shouldn’t need a separate adapter or a GetByID because there’s unlikely to be a better way of populating the form as a whole than what Epicor already does every time a user calls up an order.

1 Like

i do not understand the issue, the data set and the edv view already there, you only need to grip hold of the view for the current row then use it where ever you want

The OP could answer, but I believe (like in the other thread) some custom code in the customsation is raising a new order in the background, which then needs to be returned to the client.

aha, thanks mate


I tried your suggestion of assigning the order number to the txtKeyField and I was unable to compile that logic. Attached is the error.

could you show the full script editor code ?

That’s because it’s an existing control and doesn’t exist in “Script” by that name, unlike any controls you create yourself.

You need to create your own variable using GetNativeControlReference and the GUID shown in the Properties page for that control.

Specifically:

EpiTextBox txtKey = (EpiTextBox)this.csm.GetNativeControlReference("copyControlGuidHere");

Then you can reference it.

1 Like

I put the order number I wanted in the txtKeyField in the code. When I run that code in the program I do not see any number in the txtKeyField. Do I need to do something to display it to the UI?

Just call oTrans.ValidateKeyField(txtKeyField) right after setting the property. It’ll load it and display it.

That worked. Thanks a lot.

Why not use oTrans.GetByID(orderNum);?

2 Likes

Because I like to make my code inscrutable. :slight_smile:

Yes, that does look simpler.