I have created a UD table that is populated with values we want to track after the user saves from Inspection Processing. I have built a dashboard where these values can be viewed. I have been asked to allow a right click on the part field of a row and call Inventory Transfer, passing multiple values from the dashboard to the Inventory Transfer screen to fill in the values that we already have. A context menu is available to call Inventory Transfer, but I am stuck on the proper way to pass the values. I have seen the LaunchFormOptions referenced here, but am at a loss as to hooking it up. Can someone point me to a good reference or possibly provide some sample code to get me started? Or maybe there is a better, more proper way in this case?
Just a heads up, that you can set up inventory transfer in the call context menus so it will open with a right click, and pass in the part number. However, when clicking on a different part number in the grid, it will crash Epicor. I only had it set up for me, because I could work around it (I knew to close the inventory transfer before I changed part numbers) but I was never comfortable setting that up for others.
BTW, the call context should pass the values for you, without needing and C#
just a thought. rather than calling inventory transfer form, modify dashboard to do inventory transfer.
add a tracker panel to the dashboard, add all needed controls and invoke Inventory Transfer BO.
i will play with context menu and let you know.
@Banderson I see the behavior you are referring to. In my case, it doesn’t crash. It just freezes the process for awhile and then returns without changing the part number. When I check the event log on the server, it shows a SQL timeout error. Just FYI if you are trouble-shooting it.
What values will the callContext pass if I don’t save them with something like a pre-process directive? And then how would I pick them up in the Transfer Entry screen? I looked at that and saw that the Inventory Transfer knew the correct calling from value (the Dashboard), but I wasn’t sure how much farther I could go with that.
Btw, thanks for the quick response.
It knows which field you are calling from, in this case part, so it brings in that part number. What else do you want to bring with it?
@prakash That is an interesting thought. I figure since the user is already familiar with the Inventory Transfer that that was the “proper” way to go, but if I can’t get that working, I like the outside-the-box idea.
Programming a dashboard to do inventory transfer is not a trivial task. I’ve done it, with a lot of help, but is a pretty advanced bit of coding to make work.
@Banderson I can pass the quantity, from location/bin and lot, and to/location/bin so that all the user has the to do is verify and click transfer. I don’t mind the coding, actually enjoy it, just need a start in the correct direction.
@prakash @Banderson I am obviously not in a time-crunch to get this done the quickest way, I have been given the time to come up with the best and most beneficial for the end-user. That is the reason for the initial question of direction.
That being said, if you have already done this, would you mind giving me a 10,000 foot overview of how you accomplished it. Obviously, any code samples would be greatly appreciated to help shortcut this, but not a necessity.
Thanks again for the responses.
Unfortunately I don’t have access to that code as I no longer work for an Epicor customer. (hence the traitor badge). But for the most part, it’s follow the trace. The InvTrans BO can be kind of a pain sometimes though.
@Banderson Agreed on the trace. Already done that and was not finding a good way to follow it. But if that is the way you went, and ended up with a good result, I will start down that path until I hear anything or from anyone else. Thanks!
OK, I think I may have figured out a fairly easy way to do this. I noticed that when I am in developer mode and call Inventory Transfer from the context menu on my dashboard, I get a Process calling window that shows the “Calling App” as my dashboard. If I can read this value from a customization on Inventory Transfer, I could fill in the rest. Does anyone have code to read the value of the Calling App in a customization?
I am stretched for time so my response will be brief. In general, the way you use LFO can differ screen to screen. Some screens have built in handling for LFO values, for those that dont (or you are going outside the bounds of whats already implemented) you can perform your own logic. It’s a 2 step process.
Setup and pass the LFO:
// Create new LaunchFormOptions and set the context
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ContextValue = AnyThingYouWant;
ProcessCaller.LaunchForm(oTrans, "UD01", lfo);
Handle the LFO info on the desired form’s OnLoad:
if(MyFormName.LaunchFormOptions.ContextValue != null
{
// Get passed values - note this field is an object - you can store anything, string, int, class,
etc
//Do something, presumably load a record
}
Thank you @Chris_Conn for the quick response. I would use the new LFO if I were launching (as you mention outside the bounds…) from a button or event. In this case I am attempting to use what seems to be the built in LFO. Therein lies the rub: how to set the ContextValue in the already existing LFO (MainController.LaunchFormOptions.ContextValue) of the dashboard? It acts like it needs to be instantiated (I get “Object reference not set to an instance of an object.”)
Code examples that don’t work:
this.MainController.LaunchFormOptions.ContextValue = MyValue
or
private LaunchFormOptions LFO;
this.LFO = new LaunchFormOptions();
private void MainController_Load(object sender, EventArgs args)
{
LFO = this.MainController.LaunchFormOptions;
}
LFO.ContextValue = MyValue;
I am probably just missing the forest for the trees.
Maybe try using LaunchFormOptions.ValueIn instead of ContextValue
@Chris_Conn - Same issue as ContextValue, but I believe the context menu needs ValueIn to open Inventory Transfer to the correct part.
Maybe I should just go back to the original question and ask for a best method here. I thought the easiest (obviously I was wrong) and best method for what I have been requested to accomplish is to let the system do what it already does and just add a layer of code. I have a context menu that calls Inventory Transfer with the correct (selected) part number, no special coding needed. I am looking to pass at least one more value along with the part number to the Inventory Transfer to load values in the form that we already know from my dashboard. I am using the context menu to Launch the form, so I don’t believe the standard LaunchForm answer will work.
@prakash suggested creating my own Inventory Transfer, which though I like the outside-the-box thinking I am hoping for a cleaner option. This seems to me to be like rebuilding the car because the key doesn’t fit.
@Banderson correctly shared insight that there is an issue using the context menu in that if you click on a different part on the already linked part on the dashboard, it crashes the Inventory Transfer form being called. I have found that this only happens when you leave the Inventory Transfer open and change the part number selected on the dashboard. Even though this seems like a bug in Epicor, I can get around that by closing the Inventory Transfer after a successful save (when it is called from the dashboard). As far as the call context values being passed, the actual call to launch the Inventory Transfer goes through several business objects, and I have not been able to maintain the call context variables though them all. Maybe THAT is just a me issue.
Looking for any suggestions especially if someone has actually done this work before.
Thanks!
Eureka! After beating Google up for days now on this I found a very simple solution that seems like it would have so many other applications I am surprised I have not heard of it before. Setting an Environment Variable allows you to pass values from within a user, process, or machine context in an extremely simple way. This seems to me to be so much simpler than using and maintaining nondescript callcontext fields. Big thanks to Adam Ellis for posting this at Ginger Help. Final Code snippets below:
In the launching dashboard customization:
string qtyPassed = edvPutAwayView.dataView[args.Row]["UD105_QtyPassed_c"].ToString();
Environment.SetEnvironmentVariable("QtyPassed", qtyPassed, EnvironmentVariableTarget.Process);
…and in the receiving (Inventory Transfer) customization:
string qtyPassed = Environment.GetEnvironmentVariable("QtyPassed", EnvironmentVariableTarget.Process);
Just repeat for as many variables as you need.