Launching An Epicor 10 Screen With Programming Code - GingerHelp
Launching An Epicor 10 Screen With Programming Code - GingerHelp
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
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.
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:
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:
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
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
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
// 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
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!
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.
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
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?
Mike, there are probably a few different ways you could do it, but one would
be a simple excerpt from scenario #3 above:
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
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?
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
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
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'.
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
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
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
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
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
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:
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
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
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
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.
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.
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!
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
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.
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!
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.
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
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
NEXT
LET’S CHAT!
CONTACT US
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®.
https://www.gingerhelp.com/knowledgebase-epicor-erp/launching-a-screen-with-a-specific-customization-from-code 17/17