Skip to content

Instantly share code, notes, and snippets.

@hasokeric
Created May 25, 2018 23:44
Show Gist options
  • Save hasokeric/68782f10cb1919cc3a48fc77bf263b0e to your computer and use it in GitHub Desktop.
Save hasokeric/68782f10cb1919cc3a48fc77bf263b0e to your computer and use it in GitHub Desktop.
Accept Launch Opts Context Value
//Gist File: Form Load Context Value
private void ReturnMtlForm_Load(object sender, EventArgs args)
{
btnGetLots.Enabled = false;
if (ReturnMtlForm.LaunchFormOptions.ContextValue != null)
{
// Get passed values
List<object> ctxVal = new List<object>();
ctxVal = (List<object>)ReturnMtlForm.LaunchFormOptions.ContextValue;
string jobNum = ctxVal[0].ToString();
string partNum = ctxVal[1].ToString();
string jobSeq = ctxVal[2].ToString();
string lotNum = ctxVal[3].ToString();
// Create new request
oTrans.GetNew();
edvRtnMtl.dataView[edvRtnMtl.Row]["FromJobNum"] = jobNum;
edvRtnMtl.dataView[edvRtnMtl.Row]["FromJobSeq"] = jobSeq;
edvRtnMtl.dataView[edvRtnMtl.Row]["LotNum"] = lotNum;
if(lotNum != "")
{
btnGetLots.Enabled = true;
}
edvRtnMtl.Notify(new EpiNotifyArgs(oTrans, edvRtnMtl.Column, edvRtnMtl.Row));
GetPartTranDetails();
}
}
@hasokeric
Copy link
Author

In E9 & E10 Epicor in its infinite wisdon uses the LFO.ValueIn as the ReportID thus if you call it from custom code and you pass it something in the ValueIn field your report will fail to load.
To pass custom values use the ContextValue field (Object)

@hasokeric
Copy link
Author

hasokeric commented May 25, 2018

// Use thiswith the process caller.

ArrayList al = new ArrayList();
al.Add((int)edvShipHead.dataView[edvShipHead.Row]["PackNum"]);
al.Add(true);
LaunchFormOptions lfo  = new LaunchFormOptions();
//lfo.ValueIn            = al; IGNORE THIS USE AS ABOVE
lfo.IsModal            = true;
lfo.SuppressFormSearch = true;
ProcessCaller.LaunchForm(oTrans, "Epicor.Mfg.UIRpt.PackingSlipPrint", lfo);

// Use this to retrieve
object o = BAQReportForm.LaunchFormOptions.ValueIn;
string[] values = (string[])o;
EpiDataView edvReportParams = (EpiDataView)oTrans.EpiDataViews["ReportParam"];
edvReportParams.dataView[edvReportParams.Row]["field1"] = values[0];
edvReportParams.dataView[edvReportParams.Row]["field2"] = values[1];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment