LaunchFormOptions Loading wrong form

Hello All,

I’ve created a button to launch “Fixed Fee Invoice Review” from the Project Entry screen
It has the MenuID “PBGO1070”…

When I open it from the Menu tile it opens to the correct form, but when I open it from the button click it opens another form the uses the same base program

I built a BAQ to have a look at the Menu item form Arguments, it looks like the “Fix Fee Invoice Review” Menu item has a form that loads on top of the base program…

Does anybody know how to make lfo launch the correct form…

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

@LBARKER

Do you have custom code for this button?

Hello @Matthew_Morgan

Just the usual LFO

	LaunchFormOptions lfo = new LaunchFormOptions ();
	lfo.IsModal = false;
	lfo.ContextValue  = ""; //ProjNum;
	ProcessCaller.LaunchForm (oTrans, "PBGO1070", lfo);

perhaps you need to pass the argument you found into the ValueIn or ContextValue. I tried looking at the class in Visual Studio, but not seeing anything definitive. Interested to know the answer here.

lfo.ValueIn = "-formName TMReviewForm";
lfo.ContextValue = "-formName TMReviewForm";
1 Like

I found this piece of code over on GingerHelp

I have tried option 3 … works like magic and loads all pending Project FixFee invoices for review (not the intended result, was hoping the filter would work)

image

I also tried the code below - This loads the right form but no records

System.Collections.Hashtable myHash = new System.Collections.Hashtable();
LaunchFormOptions lfo = new LaunchFormOptions ();
	
		myHash.Add("form","FFReviewForm");
		myHash.Add("ProjectID",ProjNum);
		lfo.ValueIn = myHash;
		ProcessCaller.LaunchForm (oTrans, "PBGO1070", lfo);

I’m now trying to work out how to get the second piece of code to load a record…

Was not aware of ILSpy. Reading from the link you shared just opened up my world to understanding how these screens work and “process” behind the scenes.

Likely will have to pass the value in the ContextValue field or in your new fancy hashtable, and in a customization of the subscreen load the record programmatically.

I can get the value to pass to the form that I am launching… (the value is displaying fine in a message box on the load of the form) but I can’t get it to load the record
@hkeric.wci I’ve been looking at some of your work, have you got any pointers for me?

Can you show the code you have tried? What are you calling on the otherside?
Probably need to call

 GetByID()

I think the problem is… to launch the approval form you need 2 variables one is the ProjectID and the other is the Invoice number, when launching from the Project Entry screen you only have the ProjectID to pass in,

I think I’ll have to work more on the search adapter which I sort of have working but it loads all of the results from all projects, I can’t get the PreLoadSearchFilter to work

The gif below is what I’ve got to mimic

This is the code I’ve pulled together but it loads all results (the filter doesn’t work)

	private void LaunchFixFeeApp()
	{
		EpiDataView edvProjNum = (EpiDataView)(oTrans.EpiDataViews["Project"]);
		String ProjNum = edvProjNum.dataView[edvProjNum.Row]["ProjectID"].ToString();
		
		// Define a reference to the transaction (oTrans) for the form you are calling.
		Erp.UI.App.PBGInvcReviewEntry.Transaction  trans = new Erp.UI.App.PBGInvcReviewEntry.Transaction(oTrans);
		
		// Next define a reference to the form itself
		Erp.UI.App.PBGInvcReviewEntry.FFReviewForm form = new Erp.UI.App.PBGInvcReviewEntry.FFReviewForm(trans);
		
		// Define a search that loads up TEST1234 automatically when the form launches
		SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
		//	opts.PreLoadSearchFilter = "ProjectID LIKE 'ProjNum'";
		opts.PreLoadSearchFilter = "ProjectID = '" +ProjNum+ "'";
		opts.DataSetMode = DataSetMode.RowsDataSet;
		
		// Actually execute the search.  This and all other oTrans methods are available
		trans.InvokeSearch(opts);
		 
		// Show time
		form.ShowDialog();
	
	}

As per the gif, I need to do a search within a search, bugged if I know how to get that to work haha

perhaps the PreLoadSearchFilter isn’t working because you aren’t passing both parameters needed to load the screen. Try this.

opts.PreLoadSearchFilter = "ProjectedID = '" + ProjNum + "' and InvoiceNum = '" + InvNum + "'"; 

Yeah, but I don’t have the invoice number to pass in, it’s not available in the Project screen

So if you want the screen to pre load with records, how do you yourself know which invoices you want it to pull up? Is it just all for that project that appear in that adapter?

Yep, I’m just trying to load the ones related to the Project that is open at the time in Project Entry

You could call that via Dynamic Query, the PBG BO, or the adapter. Just depends on how you want to do it. Then pass the invoices to the LFO.