Launch Report From Button Click

Is there nay discussion on here about launching a report from a button? Thinking of doing this due to dashboard demand that can’t be done easily.

@Will79:

EDIT: here’s the post: Auto Print Report From Customization - #2 by Yoonani

I can’t find the post from which I adapted it, but here are some examples we have which print the Sales Order Acknowledgement and Job Traveler from some EpiButtons on the Sales Order UI. Note that you’d have to place these methods within the appropriate Button_Click event, or nested within another method called by the click event.

Job Traveler:

public void PrintJobTraveler(string jobNumString)
		{
			string jobNumber = jobNumString;
			
			
			Ice.Core.Session otSession = (Ice.Core.Session)this.oTrans.Session;
			string strWorkstationID = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID(otSession);

			// instantiate job traveler variable
			Erp.Proxy.Rpt.JobTravImpl Job_Trav_Report = WCFServiceSupport.CreateImpl<Erp.Proxy.Rpt.JobTravImpl>(otSession, Erp.Proxy.Rpt.JobTravImpl.UriPath);
		
			Erp.Rpt.JobTravDataSet jtds = Job_Trav_Report.GetNewParameters();

			
			jtds.JobTravParam[0].PrntAllMassPrnt = false;
			jtds.JobTravParam[0].Jobs = jobNumber;
			jtds.JobTravParam[0].BarCodes = true;
			jtds.JobTravParam[0].AutoAction = "SSRSPREVIEW";
			jtds.JobTravParam[0].AgentID = "SystemAgent";
			jtds.JobTravParam[0].ReportStyleNum = 1005;
			jtds.JobTravParam[0].WorkstationID = strWorkstationID;
			jtds.JobTravParam[0].SSRSRenderFormat = "PDF";
			jtds.JobTravParam[0].RowMod = "A";
			
			Job_Trav_Report.RunDirect(jtds);

		}

Sales Order Acknowledgement:

public void PrintSalesOrderAck(string orderNumString)
		{	
			//MessageBox.Show("Prepare to print Sales Order Acknolwedgement form.");
					
			Ice.Core.Session otSession = (Ice.Core.Session)this.oTrans.Session;
			string strWorkstationID = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID(otSession);

			Erp.Proxy.Rpt.SalesOrderAckImpl report = WCFServiceSupport.CreateImpl<Erp.Proxy.Rpt.SalesOrderAckImpl>(otSession, Epicor.ServiceModel.Channels.ImplBase<Erp.Contracts.SalesOrderAckSvcContract>.UriPath);
			
			Erp.Rpt.SalesOrderAckDataSet ds = report.GetNewParameters();
			
			int orderNumInt = Convert.ToInt32(orderNumString);
			ds.SalesOrderAckParam[0].OrderNum = orderNumInt;
			ds.SalesOrderAckParam[0].AutoAction = "SSRSPREVIEW";
			ds.SalesOrderAckParam[0].AgentID = "SystemAgent";
			ds.SalesOrderAckParam[0].SSRSRenderFormat = "PDF";
			ds.SalesOrderAckParam[0].WorkstationID = strWorkstationID;
			ds.SalesOrderAckParam[0].RowMod = "A";
			ds.SalesOrderAckParam[0].ReportStyleNum = 1002;

			report.RunDirect(ds);
			
			
		}

Hope this helps!

4 Likes

Thank you! This gives me a place to start! All I am trying to do is launch the baq report for them to put the data ranges in and then run the report.

If you want to launch the form, another option is to use the “ProcessCaller” in a click-event. You can use ProcessCaller to launch anything that’s tied to a menu. Dashboards, reports, trackers, etc.

1 Like

I had to add the OrderList params in version 10.

ds.SalesOrderAckParam[0].OrderList = orderNumInt.ToString();

Hope it debugs someone.

:thinking: