How can I send parameters to print form?

Lets say I have group ID and invoice number at hand and I want to send those values to print form for a print invoice function. I know how to launch the print form but not sure how to send the parameters into it.

Here is my code snippet:

Erp.Proxy.BO.ARInvoiceImpl bo = WCFServiceSupport.CreateImpl<Erp.Proxy.BO.ARInvoiceImpl>(_session, Epicor.ServiceModel.Channels.ImplBase<Erp.Contracts.ARInvoiceSvcContract>.UriPath);
		
string err = string.Empty;
        bo.PrePrintInvoices(edvInvcHeadList.dataView.Table.Rows[edvInvcHeadList.Row]["GroupID"].ToString(), int.Parse(edvInvcHeadList.dataView.Table.Rows[edvInvcHeadList.Row]["InvoiceNum"].ToString()), out err);
		
		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.IsModal = false;
		ProcessCaller.LaunchForm(oTrans, "ARRP6600", lfo);

“ARRP6600” is menu ID for print form but when print form appears, it does not have the invoice num, group ID parameters.

Here’s a way to do it :

LaunchFormOptions lfo = new LaunchFormOptions();
var invoiceNum = Convert.ToString(yourDataView.CurrentDataRow["InvoiceNum"]);
var groupID = Convert.ToString(yourDataView.CurrentDataRow["GroupID"]);

lfo.ValueIn = new List<string>(){invoiceNum, groupID};
lfo.IsModal = false;
ProcessCaller.LaunchForm(oTrans, "ARRP6600", lfo);

And then you need to handle those values in the print form. Create a customization on it and add something like this (adjust to your case):

private void DynamicCriteriaReportForm_Load(object sender, EventArgs args)
{
	// Add Event Handler Code
	if(DynamicCriteriaReportForm.LaunchFormOptions != null && DynamicCriteriaReportForm.LaunchFormOptions.ValueIn!= null)
	{
        List<string> valueIn = (List<string>)DynamicCriteriaReportForm.LaunchFormOptions.ValueIn;
		string invoiceNum = valueIn[0];
        string groupID = valueIn[1];
	
        // process those values as needed, in our case we had report criterias on a custom RDD
		EpiDataView edvReportCriteria = (EpiDataView)(oTrans.EpiDataViews["ReportCriteria"]);
		edvReportCriteria.CurrentDataRow.BeginEdit();
		edvReportCriteria.CurrentDataRow["InvoiceNum"] = invoiceNum;
        edvReportCriteria.CurrentDataRow["GroupID"] = groupID;
		edvReportCriteria.CurrentDataRow.EndEdit();
	}
}

3 Likes

This looks great! I will give it a try. Thank you!