Select current record into C# variable

Hey Epic Land!

I have a simple noob question. How would one bring in a currently selected item (sales order, part etc) from the UI into a c# customization variable? And then change this variable depending on the sales order record a user selects?

More info is needed on exactly what you want to do. Are you intending to save the variable back to the record?

Hi Chris,

As a simple example, I’d like to bring in the currently selected Sales Order number and just display it in another epiTextBox. I’m just practicing using EpiDataViews.

In simplest terms of your example - you’d just copy the epibinding of the control that holds the data you want, and paste it to the epibinding of the control you want to display that data on.

I’ll give you a brief overview you can probably expand upon to go a little deeper.

1 - Identify the epidataview that has your info/field. You can do this by clicking the control that displays the data and looking at “Field Help”. This will state the epibinding (view/field)

2 - Get a reference to said epidataview.
var myEDView = oTrans.Factory(“your view name”);

3 - Get the current record row ( i am only breaking this into a seperate step so you can see its purpose)
var currentRow = myEDView.dataView[myEDView.Row];

4 - Get a specific field from the row
string str = currentRow[“MyStrFieldName”].ToString();
or
int num = (int)currentRow[“MyIntFieldName”];

I recommend a glorified reading of the epicor customization and ice tool guides both available in epicweb.
Basic stuff like this is certainly covered there

2 Likes

Thanks guys! Yes, I have certainly started digging into those materials as well as taking the education courses. Good stuff.