0% found this document useful (0 votes)
258 views

Launching An Epicor 10 Screen With Programming Code - GingerHelp

Uploaded by

Rejeesh M. Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
258 views

Launching An Epicor 10 Screen With Programming Code - GingerHelp

Uploaded by

Rejeesh M. Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

   [email protected]

L AU N C H I N G A N E P I C O R 1 0
SCREEN WITH A SPECIFIC
C U STO M I Z AT I O N F R O M
CODE
ADAM ELLIS · OCTOBER 2, 2019

Epicor gives us a variety of ways to launch forms from other forms via
code. In this article, I spell out some of the more common Epicor
programming scenarios to get this to work. Let’s get started!

L E T ' S C H AT A B O U T YO U R E P I C O R C U STO M I Z AT I O N P R OJ E C T

SCENARIO #1: LOADING VIA


A MENU ENTRY
Loading via a menu entry is the easiest of all scenarios - all you are
looking to do is load up a screen (i.e., Part Maintenance) that you may or
may not have customized. The single line of code you need to do this is
as simple as this:

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 1/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

ProcessCaller.LaunchForm(oTrans, "OMMT1112");

So for this line of code, you have two arguments - the first is the “sender”
(i.e., what object that is calling this new form - conveniently just put oTrans
in here every time) and the second argument is the menu maintenance ID
you are calling.

And that’s it - whenever you run that line of code (whether invoked with a
button or any other way), it launches that menu entry with whatever
customization is defined in menu maintenance for it. No data is
preloaded in this scenario, though - for that keep reading.

SCENARIO #2: LOADING


VIA A MENU ENTRY &
PULLING UP SOME DATA

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 2/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

So let’s say you want to pull up a screen and also load up some data.
Well, that is either going to be easy or a bit more complicated. The
simple scenario is when you have a straightforward single key value to
get you the record you need. Think a part number for part entry, a sales
order number for sales order entry, etc. To accomplish this, all you need
to do is pass a third argument to our LaunchForm line of code with the
data we want to load up:

ProcessCaller.LaunchForm(oTrans, "OMMT1112", "PART1234");

So here we put the ID for the record we want to load (in this example,
"PART1234”), and the form will not only load, but it also preloads with that
specific record. That third argument can also be a LaunchFormOptions
object which lets you not only define the record you want to load but also
control how the launched screen works:

LaunchFormOptions lfo = new LaunchFormOptions();


lfo.IsModal = true;
lfo.ValueIn = "PART1234";
ProcessCaller.LaunchForm(oTrans, "OMMT1112", lfo);

So here we tell it the part ID to load (PART1234), but we also tell it that the
form is modal - meaning it is the ONLY form that the user can interact with.
So far so good, but what if you need to do something a little more fancy
with the loaded form. Perhaps you want to update some screen controls
(fill in a text box or something like that) that are not as easy as calling via
ValueIn. That brings us to our final scenario, where we want to get
access to the form object itself so we can do all sorts of crazy things:

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 3/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

SCENARIO #3: IT IS TIME


TO GET BANANAS
So if you want to go down this path you are going to need to use
Assembly Reference Manager to provide a reference to the UI DLL of
whatever screen you intend on calling:

Access Assembly Reference Manager from the tools menu.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 4/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Click the button to Add Custom Reference.

You will need to set the filter to show all files.

Pick the DLL you want to call - it should begin with Ice.UI or Erp.UI.

Now that you have the DLL referenced you can add the code:

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 5/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

// Define a reference to the transaction (oTrans) for the


Erp.UI.App.PartEntry.PartTransaction trans = new Erp.UI.Ap

// Next define a reference to the form itself


Erp.UI.App.PartEntry.PartForm form = new Erp.UI.App.PartEn

// Define a search that loads up TEST1234 automatically wh


SearchOptions opts = new SearchOptions(SearchMode.AutoSear
opts.PreLoadSearchFilter = "PartNum = 'TEST1234'";
opts.DataSetMode = DataSetMode.RowsDataSet;

// Actually execute the search. This and all other oTrans


trans.InvokeSearch(opts);

// Tell it the specific customization name you want to loa


form.CustomizationName = "PartEntry_Prod_20191002";

// Show time
form.ShowDialog();

So we are starting here doing pretty much the same thing the prior
scenarios were doing - calling up a form (in this case part entry) with a
specific customization and then loading up “PART1234”. But obviously
with a lot more code! But the cool thing about this scenario is that you
have access now to (1) load up as many records as you like, (2) directly
access objects on the form (i.e., fill in a text box with a default value) and
(3) directly access all methods of the transaction (oTrans) of the launched
form. For the scope of this article we are just going to focus on that first
benefit - say you want to automatically load up all parts that start with
“TEST12” - all you’ve got to do is update the PreLoadSearchFilter like so:

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 6/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

opts.PreLoadSearchFilter = "PartNum LIKE 'TEST12%'";

If none of these options solve your needs also check out our article on
using environmental variables to pass data in between forms. Hope this
article helps somebody out there!

LET'S CHAT ABOUT YOUR EPICOR


CUSTOMIZATION PROJECTS

AUTHOR: Adam
Ellis
Adam Ellis is the owner of GingerHelp.
Adam is a lifelong entrepreneur and has
extensive ERP and mobile software
knowledge through his consulting and
management experience. He has a
passion for exploring innovative ideas
and how they can change the status
quo. Connect with Adam on LinkedIn to
learn more about his involvement in the
ERP space.

FACEBOOK TWI TTER PINTEREST 0 LIKES

COMMENTS (25) Newest First

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 7/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Preview POST COMMENT…

MikeR 6 months ago · 0 Likes

My requirement seems so simple, it just requires me to Refresh the form that a button
is placed on, but with a different key value. For example, on Part Maintenance the use
may click a button that grabs another Part number and refreshes the form with the
new value. The use case is, a Part that is obsoleted by another Part. I would like to
allow the user to simply refresh the form and see the replacement Part details instead
of making the user copy paste a part number and manually perform the refresh.
I tried oTrans.Retrieve(partNum) but it appears that I cannot tell what this is really
supposed to do. If I just do the oTrans.Refresh() well it works as expected of course,
but does not change the Part. Any thoughts?

Adam Ellis 6 months ago · 0 Likes

Mike, there are probably a few different ways you could do it, but one would
be a simple excerpt from scenario #3 above:

SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);


opts.PreLoadSearchFilter = "PartNum = 'YOUR_NEW_PART_NUMBER'";
opts.DataSetMode = DataSetMode.RowsDataSet;
oTrans.InvokeSearch(opts);

The biggest difference being you can just use oTrans directly since you've
already got a reference to it.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 8/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Jeanne Singagliese A year ago · 0 Likes

This is a great article, but I could use a bit of help. I am trying to open one of 3 custom
Requisition Dispatch forms based on the Custom Requisition form I am calling it from. I
am trying your code to set the custom form name like form.CustomizationName =
"MyReqAction" but I can't seem to find the proper methods to do that. I started to add
a new item under the actions menu for it and hide the base, but after reading the
custom code part of the article I have a feeling I can just tell it which one to open if I
can get the methods right. How would I do that?

Adam Ellis 2 years ago · 0 Likes

Glad you are making progress. Perhaps to get that last bit handled you can just make
use of environmental variables. Basically set a variable on the calling form and then
add a customization on PBGInvoiceReviewEntry to look for it and load the appropriate
record(s). Here are some details on that approach:

https://www.gingerhelp.com/knowledgebase-epicor-erp/using-environmental-
variables-to-pass-data-in-between-forms

Lawson BArker 2 years ago · 0 Likes

Thanks Adam,
I got Scenario 2 working with the Hashtable idea, but can't find a way to get it to load
a record
I also got Scenario 3 working but the PreLoadSearchFilter doesn't filter.... it just loads
all FF invoices

Adam Ellis 2 years ago · 0 Likes

Lawson,

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 9/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

I've not tried to automate this one before, but just looking at the DLLs through ILSpy it
would seem that if you "scenario #2" and the type on what you pass for ValueIn is a
Hashtable it will look for a key in that hashtable named 'form'. Then it decides which
one to launch based on the match of that 'form' - allowing for the string values
'TMReviewForm', 'CPReviewForm', 'FFReviewForm', or 'PPReviewForm'.

Hope this helps,


Adam

Lawson Barker 2 years ago · 0 Likes

Hello Adam,
I'm trying to do an LFO on PBGInvoiceReviewEntry, it has 4 different, if you like, "Form
overlays", I can't find a way to pass the correct form option in the LFO

PBGO1070 = Fixed Fee Invoice Review


PBGO1060 = Time and Material Invoice Review
PBGO1080 = Cost Plus Invoice Review
PBGO1090 = Progress Payment Invoice Review

They all use the same base program but when you try and launch any one of them
from an LFO only the “Time and Material Invoice Review” screen open regardless of
which menuID

Adam Ellis 2 years ago · 0 Likes

Thanks Mark - I appreciate that!

mark Miller 2 years ago · 0 Likes

Every time I am given a new project, if its something I have never done before, I start
on your help page. Thanks for sharing all your knowledge.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 10/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Adam Ellis 2 years ago · 0 Likes

David,

I'd expect this code would get dropped in where you have your current button click
event. Give it a shot an let me know how far you make it.

-Adam

David Foster 2 years ago · 0 Likes

Adam,
This does help greatly. It also exposes a bit of my ignorance, as I am not sure where
to add this in the customization I have already created that launches the BAQReport.
This is a bit of 'on the job' learning for me.
Thank you again,
David

Adam Ellis 2 years ago · 0 Likes

David,

I think in your case you might be better off just adding a reference to the BAQReport
assembly and then just directly invoking it like so:

Ice.UI.Rpt.BAQReport.Transaction trans = new Ice.UI.Rpt.BAQRepor


trans.LoadBAQReportData("YourBAQReportName");
EpiDataView edvData = (EpiDataView)trans.EpiDataViews["Repo
edvData.dataView[edvData.Row]["field1"] = "Lot123
trans.RunDirect("Preview");
edvData.Dispose();
trans.Dispose();

Hope this Helps!

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 11/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

David Foster 2 years ago · 0 Likes

Adam, I am looking at your posts here, and I am trying to figure out how to make them
work for what I am trying to do. Basically, I have created a new CofC BAQReport
which has three parameter fields the user can fill out, Lot Number (which actually pulls
data from the underlying BAQ to get all the info filling out the report), Qty (which the
user can put in any number), and Notes (again a dumb field that can have anything
put into it).

I have created a customization button in Customer Shipment Entry that will open this
form up and the user can copy and paste from the Customer Entry line to the form.
Easy enough.

What I would like to have happen is when the user clicks the CofC button, it opens
this form and populates the Lot Number field and Qty Sent field from the Customer
Shipment Entry screen it was launched from. This way we would lessen user error.

I believe what you have shown in your posts haves what I need. I am just not seeing
how and where to enter it. In the customization or to create a BPM. Thank you, David

Adam Ellis 2 years ago · 0 Likes

Good question Lawson - I would probably recommend a bit of a hack to make that
work:
1. Set your BPM up so that it calls a BPM Form on whatever event you want to trigger
that LFO.
2. Customize the BPM form to do the LFO on form load and then immediately send a
click event to the 'OK' button on the BPM form (you will need to use
GetNativeReference to get access to that OK button so you can send a click event).

The end user would probably never know that a BPM form was involved it will happen
so fast. There might be a better way, but off the top of my head this is what I'd try first.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 12/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Lawson Barker 2 years ago · 0 Likes

Hello Adam, can you do LFO's from a BPM??

Adam Ellis 3 years ago · 0 Likes

Mike, if that is a BAQ report I would probably suggest following this article:

https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-
report-from-within-a-customization

And have your button just automatically fill in the parameters to run the report and
pop it up.

MikeR 3 years ago · 0 Likes

How would we go about calling up an configID inspection report form that I created
from a custom button which was placed on the MES / End Activity form? Trying to
save clicks for data we don't need to capture.

Adam Ellis 3 years ago · 0 Likes

So glad you figured out a solution! Glad you like the blog - definitely gives me
motivation to keep putting these out knowing it is helping people out!

3 years ago · 1 Like

Adam, I found a solution!


Thanks for your time and help!
It's the best Epicor blog I've ever seen, Really.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 13/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

3 years ago · 0 Likes

THANKS for your help Adam!


I can create a new entry automatically but my problem is than I can't fill table
automatically when new entry, I mean, I created a new entry but normally Epicor fill
automatically a table with all lines from my transferOrder, then you can select some
line and ship the line.
Sorry about my english.

I have 4 years using Epicor and never I needed do this xD

Adam Ellis 3 years ago · 0 Likes

You can actually access any of the Transaction Methods from the screen you are
calling via the trans object we have access to in method #3. To know the available
methods, go into customization mode for the window you are calling (in my case Part
Maintenance), go to Tools / Object Explorer, and expand out Transaction / Methods.
So, for example, to add a new part automatically we might do something like this
instead of the InvokeSearch I spelled out above:

trans.GetNewPart();
...
trans.Update();

Give that a shot and let me know how you make out.

3 years ago · 0 Likes

Very great tutorial, excellent work!

I can open a customization using method 3 but fields empty, So I need pass some
parameter or something, specifically I need to create a new entry automatically on the
new screen of my customization, then fill the rest of fields.
Do you know how is it?

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 14/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Thanks again!

Juan Palomar 3 years ago · 0 Likes

Hello Adam!

Great tutorial!!

I wonder I can use this technique to launch form "Credit Memo Entry" just after post a
AR Invoice.
I think I should use this DDL Reference:
Erp.UI.App.ApplyCreditMemoEntry.Transaction
but I cannot call the method that generates a new document type CM, could you give
me a clue on how to do it?

Thanks.

Adam Ellis 3 years ago · 1 Like

Melissa, thanks for your comment - I am glad this article was helpful! I would
recommend using an EpiView to get to that data - I just put up a new article that
should hopefully steer you in the right direction:
https://www.gingerhelp.com/knowledgebase-epicor-erp/accessing-updating-fields-
the-right-way-using-epiviews

3 years ago · 1 Like

Hi,
This is the best breakdown of this process I have found. I do have 1 question. What if I
want to use a field from the screen I am launching the button from (and not just
PART1234)?

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 15/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

PREVIOUS

EPICOR CUSTOMIZATIONS: ADDING YOUR OWN ACTIONS MENU


ENTRIES
EPICOR ERP, EPICOR CUSTOMIZATION

NEXT

CREATING AN ENTIRELY "NEW" SCREEN WITHIN EPICOR


EPICOR ERP, EPICOR CUSTOMIZATION

LET’S CHAT!

CONTACT US

GINGERHELP, SERVICES PRODUCTSKNOWLEDGE


LLC BASE
Epicor ERP Epicor ERP
8685 Fox Consulting Extensions Epicor ERP Articles
Lake Road P21 ERP Infor Infor VISUAL Articles
Sterling, OH Consulting VISUAL ERP Dynamics 365
44276 USA Infor Extensions Articles
VISUAL ERP Crystal Reports
 Consulting Articles
 [email protected] Dynamics SSRS Articles
365 Bezlio for Mobile
Consulting ERP Articles
SSRS

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 16/17
4/25/23, 1:09 PM Launching An Epicor 10 Screen With Programming Code — GingerHelp

Developer
Services
Crystal
Reports
Consulting

GingerHelp is an
independent consulting
practice with no direct
© 2019 - 2023 GingerHelp,
affiliation with Epicor® or
LLC
Infor®.

Terms & Conditions |


Epicor®, Vantage®, and Privacy Policy
Prophet 21™ are registered
trademarks of Epicor
Software Corporation®.
Infor® and VIUSAL® are
registered trademarks of
Infor®.
Crystal Reports® is a
registered trademark of SAP
AG.

https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 17/17

You might also like