Call SSRS BAQ Report from Miscellaneous Shipment Print Button

We are using Epicor Version 12.1.1.100.0 (2025.2.10) and have an SSRS BAQ Report MiscShipment , which requires the parameter MscShpDt_JobNum in the BAQ Designer.

We need to call this report from the Print button on the Miscellaneous Shipment form, based on the following conditions:

  • JobNum should not be empty
  • MscShpDtl.Rows.Count > 0

When these conditions are met, the system should:


try this but not working

1 Like

I’ll be honest that I’ve never seen the “ssrs-report-design” action widget in use.

Based on the hover-text, it is reliant on the Edge Agent.
image

I would approach this by adding your BAQ Report to a menu (if you didn’t already) and use an app-open action instead. You should then be able to pass your values using the app-open’s “Value In” expression.

A condition action prior to the app-open could verify JobNum has value, etc.

You would need an event on the BAQ Report’s app to receive the values and parse them into the required columns.

Here’s an example of an event I have set up in Order Entry where my shipping department can print a label:

Value In:

And here’s the event on my Label application to receive the value in:

Row Update

1 Like

@dcamlin approach is what I typically will do if user input is required.

If i want to supply all variables and click button → receive print, I set up as below:

Every SSRS Report has a BO containing SubmitToAgent that handles it’s printing function.
This one, which is a Custom Report + Custom Report Style based on BAQ accepts a DynamicCriteriaReportParam input, which contains the various variables defined for that report. Your report will use a different BO and Tableset. You may use REST Help to check what Tableset it uses.

There are a base set of shared variables every report has like WorkstationID, ReportStyleNum. Then there are report-specific variables overlaid on top in UserCriteria.

Here is a sample of working code to create the set of input variables and submit the ssrs report for preview. You can change the variables to get client print, etc. You can use my SysTasks dashboard to look at the historical variables used in printing that ssrs report to guide you in setting it up.

This particular function prints a custom designed serial label report, you can adapt it to anything. Note that I am manually adding my report-specific columns to the DynamicCriteriaRow, you must do this for your report’s specific parameters, in addition to adding to User Criteria. We are building an XML to send to SubmitToAgent. You must read the trace for your desired report to build the similar file.

    var XL = new Func<string, object[], System.Xml.Linq.XElement>((n, c) => new System.Xml.Linq.XElement(n, c));
    var XDec = new Func<string, string, string, System.Xml.Linq.XDeclaration>((v, e, s) => new System.Xml.Linq.XDeclaration(v, e, s));
    var XD = new Func<System.Xml.Linq.XDeclaration, System.Xml.Linq.XElement, System.Xml.Linq.XDocument>((dec, root) => new System.Xml.Linq.XDocument(dec, root));
    var SO = System.Xml.Linq.SaveOptions.DisableFormatting;
    DynamicCriteriaTableset dcts = new DynamicCriteriaTableset();
    CallService<Ice.Contracts.DynamicCriteriaSvcContract>(dc => {
      dcts = dc.GetNewDynamicCriteriaReportParam(reportID:"SerialLabel");
      DynamicCriteriaParamRow dcp = dcts.DynamicCriteriaParam[0];
      dcp.Table.Columns.Add(IceColumn.CreateExtensionColumn("UserID", typeof(string)));
      dcp.Table.Columns.Add(IceColumn.CreateExtensionColumn("job", typeof(string)));
      dcp.Table.Columns.Add(IceColumn.CreateExtensionColumn("SerialNum", typeof(string)));
      ReportStyleRow rs = dcts.ReportStyle[0];
      dcp.AutoAction = "SSRSPREVIEW";
      dcp.WorkstationID = "web_" + dcp.WorkstationID;
      dcp.ReportStyleNum = 1002;
      dcp.SSRSRenderFormat = "PDF";
      dcp.RowMod = "A";
      dcp["job"] = JobNum;
      dcp["SerialNum"] = SerialNum;
      dcp["UserID"] = Session.UserID;
      dcp.UserCriteria = XD(XDec("1.0", "utf-8", "yes"), XL("UICriteria", new object[] {
          XL("RptCriteriaSet", new object[] {
              XL("Company", new object[] { Session.CompanyID }),
              XL("RptDefID", new object[] { "SerialLabel" }),
              XL("RptCriteriaSetID", new object[] { "default" }),
              XL("Description", new object[] { "default" })
          }),
          XL("RptCriteriaPrompt", new object[] {
              XL("PromptID", new object[] { "1" }),
              XL("PromptValue", new object[] { JobNum }),
              XL("IsToken", new object[] { "false" }),
              XL("PromptName", new object[] { "job" }),
              XL("DataType", new object[] { "nvarchar" }),
              XL("Label", new object[] { "Job Num" })
          }),
          XL("RptCriteriaPrompt", new object[] {
              XL("PromptID", new object[] { "2" }),
              XL("PromptValue", new object[] { SerialNum }),
              XL("IsToken", new object[] { "false" }),
              XL("PromptName", new object[] { "SerialNum" }),
              XL("DataType", new object[] { "nvarchar" }),
              XL("Label", new object[] { "SerialNum" })
          })
      })).ToString(SO);
      dc.SubmitToAgent(agentID: "", agentSchedNum: 0, agentTaskNum: 0, ds: dcts, maintProgram: "Erp.UIDynRpt.SerialLabel");
    });
2 Likes

Dear Sir @GabeFranco,

Thank you very much.

In Epicor Classic, the code below is working perfectly. However, I now need to convert this Classic customization into Kinetic, and I am facing some issues in Kinetic.

As per your guidance, I created a function with one parameter and am calling it from the Kinetic customization code, but it is not behaving as expected.
I would really appreciate your guidance on resolving this issue in Kinetic.


without company parameter below exception
//XL(“Company”, new object { Session.CompanyID ?? “” }),

when adding company param below exception
XL(“Company”, new object { Session.CompanyID ?? “” }),

https:url…/api/v2/efx/778899/MiscShip/PrintMiscShipmentReport/ 500 (Internal Server Error)

–Epicor Classic Code working good
private void btnPrint_Click(object sender, System.EventArgs args)
{
Report();
}

private void Report()
{
    EpiDataView edvD = ((EpiDataView)(this.oTrans.EpiDataViews["MscShpHd"]));
    if (edvD != null)
    {       
        // Retrieve the Job number from the data view
        string Job = edvD.dataView[0]["JobNum"].ToString();
		if(Job.Length ==0)
		{
		MessageBox.Show("Job Num Field is Empty.", "Warning");
		return;
		}     
		else {
		EpiDataView edvMscShpDt = ((EpiDataView)(this.oTrans.EpiDataViews["MscShpDt"]));
    	if (edvMscShpDt != null)
    	{
			if (edvMscShpDt.Row < 0)
        	{
		 	MessageBox.Show("Pack lines were not found.\n 1.Import \n 2.Print.", "Warning");				
	     	return;
        	}
		}
		}
		Ice.UI.Rpt.BAQReport.Transaction trans = new Ice.UI.Rpt.BAQReport.Transaction(oTrans);
		// Load the BAQ report data
        trans.LoadBAQReportData("RPTMiscShipment");

        // Set the Job number in the ReportParam data view
        EpiDataView edvData = (EpiDataView)trans.EpiDataViews["ReportParam"];
		if (edvData != null && edvData.Row >= 0)
		{
			edvData.dataView[edvData.Row]["field1"] = Job;
		}
        // Run the report in Preview mode and check if data exists
	    bool hasData = trans.RunDirect("Preview");
	    if (!hasData)
	    {
	        MessageBox.Show("No data found matching the given Job Number: " + Job, "Information");
	    } 

        // Dispose of resources
        edvData.Dispose();
        trans.Dispose();
    }
    else
    {
        MessageBox.Show("No data found matching the given criteria.", "Information");
    }
}

Dear Sir @dcamlin

As per your guidance, I created a function with one parameter and am calling it from the Kinetic customization code, but it is not behaving as expected.

I would really appreciate your guidance on resolving this issue in Kinetic.

Code in Kenitic

this is added into menu MiscShip

added event callafter_clickOnPrint



image

jobnum Values not received