Filling a textbox field from C# variable

notlistening

A couple questions. Are you passing values into lfo like lfo.ValueIn = “my-values”;
And calling the form passing the lfo like:
ProcessCaller.LaunchForm(this, “Epicor.Mfg.UI.EndActivityEntry”, launchObject);

Have you tested to ensure that your lfo has the values on the receiving form:
object barcodeObj = StartProdForm.LaunchFormOptions.ContextValue;
MessageBox.Show(barcodeObj.ToString());

I assume that “Start” is a valid EpiDataView on that form (in object explorer > data):
var startDV = oTrans.Factory(“Start”);

Yes start is a valid data view the issue is that he is firing this before all the stuff is loaded in the screen.
@fredmeissner you may have to resort to that timer… or just move all the logic to the main MES form.
We just did a project where they wanted to minimize the clicks on MES.
So we had the shortcut launch the custom form and do all the work directly on it.

This is like the holy grail for barcode nerds. No one has been able to figure this out that I have seen so far. I hope you do so I can steal it. Hahaha!

LoL @Banderson I’ve done it however not by launching Start Activity form, just put the code in the MES menu itself. It was a pretty cool customization but it took a lot of code

ok correction, no mortal on the E-10 help forum has figured out how to do it…(I still want to steal it…)

@fredmeissner, @Banderson just did this on Form_Load works great… Give it a shot

private void StartProdForm_Load(object sender, EventArgs args)
  {
  	// Add Event Handler Code
  	
  	var view = ((EpiDataView)(this.oTrans.EpiDataViews["Start"]));
  	if(view.Row>=0)
  	{
  		view.dataView[view.Row].BeginEdit();
  		view.dataView[view.Row]["JobNum"]= "2029";
  		view.dataView[view.Row].EndEdit();
  		
  		view.dataView[view.Row].BeginEdit();
  		view.dataView[view.Row]["AssemblySeq"]=0;
  		view.dataView[view.Row].EndEdit();

  		view.dataView[view.Row].BeginEdit();
  		view.dataView[view.Row]["OprSeq"]=30;
  		view.dataView[view.Row].EndEdit();
  	}
  }

Obviously you’d need to pass in the hard coded values in the LFO. But it works just fine

2 Likes

That was it! Thank you so much guys!

Ok, I’m kinda slow, so I’m might just not know what I’m looking at, but if I understand correctly, from the main MES screen, with the only requirement be the user is logged in, you scan a barcode, and the start activivty screen opens and populates? I see what you are doing to populate the fields, but how do you get the barcode to open start activity? That’s pretty cool!

You use process calling to launch the start activity menu and pass in an LFO (launch form options) object with the barcode values
Then on the receiving form you parse the LFO extract the barcode values and the code above will populate the screen for you

-Jose

So I’m noticing that when I click OK to start the activity, the MES grid view doesn’t populate with the labor activity unless I clear the screen and log back in to MES…why would the MES Menu not refresh?

1 Like

Probably because when you are invoking your Process you are not notifying the adapter of the change. Invoke

this.RefreshLaborData();
1 Like

That goes on a form close event right? (I’m going to need the same thing on an end activity rewrite that I’m working on.)

Well if you make the process calling Modal

lfo.IsModal = true;

Then the Form will hold execution until the other form closes. So you can write the code like

LaunchForm(); //Execution will stop here until the form closes as long as the LFO is modal.
RefreshLaborData()

I used the following line and it worked:

this.RefreshLaborData();

However, my PerformClick() on the OK button is not working. I linked the control to the GUID, is there anything else I need to do?

What are you hitting perform click for? (In the Start Production Screen?)
Just do this instead

 if (oTrans.Update())
    {
        StartProdForm.Close();
    }

That was it! Still lots of learning to do…

I’m resurrecting an old post here, but I’m wondering what the trick is for calling the “Start Production Activity” form might be. I have tried to use the following, but nothing seems to happen - no error, no UI response:

ProcessCaller.LaunchForm(this.oTrans, “Erp.UI.StartProductionActivityEntry”, lfo);

Aside from defining all of the parameters in the LaunchFormOptions object, I am not sure what I might be missing.

Just a quick glance but this looks correct. What kind of event / form are you using to base this call from?

This is where a BPM comes in really well… I bet if you ran a trace, did the function manually, you would find a BO that is triggered, and you could apply setting the values within the BPM as either a pre or post processes, and it would work very easily.

Greetings, @danbedwards / @timshuwy. Thanks for your responses.

This is being called from a customization within the MES Menu form. I’ve placed that specific line within a method that parses a barcode scan and sets that value in a container that gets passed to the LaunchFormOptions context value parameter. Afterward, the process caller is invoked. What’s weird is, I can set a message box in a line just before the process caller in order to validate the context value, but when the process caller is invoked, nothing happens - and there are no errors to reference.

@timshuwy – I think the reason I was avoiding constructing a BPM was because I thought it would be a simple custom code solution (I know… I know… :wink:).

1 Like