Accessing Native Epicor ERP Controls Within Your Customization
Working with custom controls you have added to a screen with Epicor is pretty basic - you create a button named ‘myCoolButton’ and you can do whatever you want with it inside of the script editor just by referring to it by name:
But let’s say you want to access one of the standard Epicor screen fields - you may find yourself frustrated to find that they are all inaccessible using this technique. No fear, though, there is a simple way to get to them:
EpiListBox lstMenu = (EpiListBox)csm.GetNativeControlReference("c17d4711-a862-47e5-a5b6-d96d53737a73");
lstMenu.Items.Add(oTrans.MenuItems[0,5,0]);
So breaking down the two lines here, first we are declaring a variable to gain access to the control we want to work with. Here I am referencing an object that is of the type EpiListBox and it has and ID of c17d4711-a862-47e5-a5b6-d96d53737a73. This info can be found by looking at the objects properties:
Then when we have a variable reference to the object we can update any of the properties or attach to events it might kick off. In my example I am adding an item to the list box on the fly. Note that as the types change (EpiButton for example as opposed to EpiListBox) the available properties and methods will also change. For the most part you will find them all documented within object explorer:
Hope this article helped some of you out there. As always, leave us comments if you get stuck or appreciate the assist. Also, keep us in mind if you need help in your Epicor customization adventures!