How to launch the Sales Order Acknowledgement Report form programmatically?

At the beginning I thought it would be easy to do it, I tried tracing to see what Epicor does and apparently they launch it through menu ID.

Lets say you want to launch this form through a custom form by passing order number and/or any other required info.

Anyone knows how to achieve this?

Thanks a lot in advance :slight_smile:

soar

If you want this screen to come up then you will have to use LaunchFormOptions to pass in the sales order number and populate it into the filter.

If you just want to print the sales order acknowledgement through code, then you can bypass this screen all together.

1 Like

Here’s a good example of printing the SOA using code without opening the form:

2 Likes

Yes I’d like the form to show up but haven’t yet figured out how to use the LaunchFormoptions…

Any further info would greatly be appreciated :slight_smile:

This example opens a BAQ report form, but it should be fairly similar to the SO Ack form. If you need to store multiple pieces of data, you can create a List and store that into the ContextValue property.

Storing the data before opening the new form:

private void btnPrintBOL_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (edvUD101.Row > -1)
		{
			PrintBillOfLading(Convert.ToInt32(edvUD101.dataView[edvUD101.Row]["Key1"]));
		}
	}
	
	private void PrintBillOfLading(int bolNum)
	{
		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.ContextValue = bolNum;
		lfo.IsModal = true;
		ProcessCaller.LaunchCallbackForm(oTrans, "CustBOLP", lfo);
	}

To retrieve the data:

private void BAQReportForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		if (BAQReportForm.LaunchFormOptions != null)
		{
			if (BAQReportForm.LaunchFormOptions.ContextValue != null)
			{
				EpiDataView param = (EpiDataView) oTrans.EpiDataViews["ReportParam"];
				param.dataView[param.Row].BeginEdit();
				param.dataView[param.Row]["Field1"] = BAQReportForm.LaunchFormOptions.ContextValue;
				param.dataView[param.Row].EndEdit();
				oTrans.NotifyAll();
			}
		}
	}
1 Like

This works great and thanks for posting, but I need to display the form to our users.

What dll reference do I have to add in order to use “LaunchFormOptions”?

@Samm, this line of code launches the form. If you leave off the lfo part, it will launch it blank/empty. If you do the rest of the work to get the data, it will launch the form with the variables filled it.

1 Like

You should be able to use it without any extra references.

1 Like

Thanks a lot!! It works perfectly.

I also had to add code in the SalesOrderAck form to read the options context id and copy it into the report data view.

Thanks again everyone :slight_smile:

1 Like