I sound like a broken record but I use a UBAQ. UBAQ UBAQ UBAQ UBAQ why fiddle with all this stuff when you don’t have to. In 10.2.500 change UBAQ to Func but same concept
Simply write a BAQ which takes in a Parameter (Invoice Number?)
Then in the UBAQ Post Processing on GetList() you can do this
foreach(var x in ttResults)
{
using (var ar = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ARInvFormSvcContract>(Db))
{
ARInvFormTableset ARts = null;
ARts =ar.GetNewParameters();
ar.PackNumDefaults(ref ARts);
ARts.ARInvFormParam[0].AgentID = "SystemTaskAgent";
ARts.ARInvFormParam[0].AutoAction = "SSRSGenerate";
ARts.ARInvFormParam[0].CalledFrom = "Erp.UI.ARInvoiceTracker";
ARts.ARInvFormParam[0].DateFormat = "m/d/yyyy";
ARts.ARInvFormParam[0].InvoiceNum = x.InvcHead_InvoiceNum;
ARts.ARInvFormParam[0].NumericFormat = ",.";
ARts.ARInvFormParam[0].ReportCultureCode = "en-US";
ARts.ARInvFormParam[0].ReportCurrencyCode = "USD";
ARts.ARInvFormParam[0].SSRSRenderFormat = "PDF";
ARts.ARInvFormParam[0].TaskNote = taskNote.ToString();
x.Calculated_ReportGUID = taskNote.ToString();
ar.RunDirect(ARts); //This runs the report right away but it hangs until it finishes...
//ar.SubmitToAgent( ARts, "SystemTaskAgent",0,0,"Erp.UIRpt.ARInvForm"); this uses the system agent and returns right away but you'll have to POLL until your Report is Ready
}
}
Note that I put a GUID (my own GUID) in TaskNotes and return that back with my UBAQ Response Data in Calculated_ReportGUID Field
Now the BAQ will return back (VIA REST) the GUID of the Report that I just ran.
Then Simply you can use another UBAQ to get the Report Data out of the table once the Task is Finished.
The ReportBytes (after it has run) are stored in SysRptList (SSRS Only)
So your other BAQ should be pretty simple (see below) is just a query to SysRptList where the Data is Filtered by the TaskNote of my generated GUID (as a Parameter)
So in other words,
You make a simple
GET Request to your first UBAQ with InvoiceNum as a Paramter
It returns a GUID in Calculated_ReportGuid field
Which you then use to make another
GET Request to BAQ #2 which will return the Report Bytes