Invoking Report in BPM: No records selected?

I am invoking the InvWIPRecon report in some BPM code and I am getting “No records selected” when I run it. I copied the same parameters that are being passed in the UI, so I’m not sure why this is happening.

The code is as follows:

using(var inventoryWIPReconRpt = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.InvWIPReconSvcContract>(Db))
{
  //Validate Date Range from inputs. Using "Today" for now
  string opWarningMsg = string.Empty;
  inventoryWIPReconRpt.ValidateDateRange(today, today, "", "", "", out opWarningMsg);  
  
  if(String.IsNullOrEmpty(opWarningMsg))
  {
    //invoke SubmitToAgent with params
    InvWIPReconTableset wipTS = inventoryWIPReconRpt.GetNewParameters();
    InvWIPReconParamRow paramRow = wipTS.InvWIPReconParam[0];
      
    paramRow.StartDt = today;
    paramRow.EndDt = today;
    paramRow.FiscalYear = year;
    paramRow.JournalNum = 0;
    
    paramRow.Account = "";
    paramRow.IncludeOffset = false;
    paramRow.TransactionType = "ADJ-CST~ADJ-CUS~ADJ-DRP~ADJ-MTL~ADJ-PUR~ADJ-QTY~ADJ-SUB~ASM-INS~AST-STK~DMR-ASM~DMR-MTL~DMR-REJ~DMR-STK~DMR-SUB~DRP-CUS~INS-ASM~INS-DMR~INS-MTL~INS-REJ~INS-STK~INS-SUB~KIT-CUS~MFG-CUS~MFG-DMR~MFG-PLT~MFG-STK~MFG-VAR~MFG-VEN~MFG-WIP~MTL-DMR~MTL-INS~PLT-ASM~PLT-MTL~PLT-STK~PUR-DRP~PUR-INS~PUR-MTL~PUR-STK~PUR-SUB~PUR-UKN~RMA-INS~STK-ASM~STK-AST~STK-CUS~STK-DMR~STK-INS~STK-KIT~STK-MTL~STK-PLT~STK-STK~STK-SVR~STK-UKN~SUB-DMR~SUB-INS~SVG-STK~UKN-CUS~Invoice~Labor";
    paramRow.JobNum = "0";    
    paramRow.ActLvlDtl = 1;
    paramRow.PostingStatus = "Unposted";    
    paramRow.CurPlantOnly = false;
    
    paramRow.StartDtToken = "";
    paramRow.EndDtToken = "";        
    paramRow.RptUserID = Session.UserID;
    paramRow.CurrentPlant = "MfgSys";
    paramRow.BookID = "JRFB";
    paramRow.BookDescription = "JRF Main Financial Book";
    paramRow.COACode = "JRFCOA";
    
    paramRow.SegValue1 = "";
    paramRow.SegValue2 = "";
    paramRow.SegValue3 = "";
    paramRow.SegValue4 = "";
    paramRow.SegValue5 = "";
    paramRow.SegValue6 = "";
    paramRow.SegValue7 = "";
    paramRow.SegValue8 = "";
    paramRow.SegValue9 = "";
    paramRow.SegValue10 = "";
    paramRow.SegValue11 = "";
    paramRow.SegValue12 = "";
    paramRow.SegValue13 = "";
    paramRow.SegValue14 = "";
    paramRow.SegValue15 = "";
    paramRow.Segvalue16 = "";
    paramRow.SegValue17 = "";
    paramRow.SegValue18 = "";
    paramRow.SegValue19 = "";
    paramRow.SegValue20 = "";  
    
    paramRow.DispAccount = "";
    paramRow.FiscalYearSuffix = "";
    paramRow.JournalCode = "";   
    paramRow.FiscalCalendarID = "JRF";    
    paramRow.ProjectID = "";
    paramRow.PhaseID = "";   
      
    paramRow.DateType = "SysDate";
    paramRow.SortByOption = "AD";
    paramRow.IncludeFSA = false;
    paramRow.SysRowID = Guid.Empty;
    paramRow.AutoAction = "SSRSPREVIEW";
    paramRow.PrinterName = "";
   
    paramRow.AgentSchedNum = 0;    
    paramRow.AgentID = "SystemTaskAgent";
    paramRow.AgentTaskNum = 0;
    paramRow.RecurringTask = false;
    paramRow.RptPageSettings = "";
    paramRow.RptPrinterSettings = "";
    paramRow.RptVersion = "";
    paramRow.ReportStyleNum = 2;
    
    paramRow.WorkstationID = "JRF-L-0223 1";
    paramRow.TaskNote = "";
    paramRow.ArchiveCode = 0;
    paramRow.DateFormat = "m/d/yyyy"; 
   
    paramRow.NumericFormat= ",.";
    paramRow.ProcessTaskNum = 0;
    paramRow.DecimalsGeneral = 0;
    paramRow.DecimalsCost = 0;
    paramRow.DecimalsPrice = 0;
    paramRow.ReportCurrencyCode = "USD";
    paramRow.ReportCultureCode = "en-US";
    paramRow.SSRSRenderFormat = "PDF";
    paramRow.PrintReportParameters = false;
    paramRow.SSRSEnableRouting = false;
    paramRow.RowMod = "A";
       
    //debug
    /*
    string jsonString = JsonConvert.SerializeObject(paramRow); 
    string debugPath = @"\\dev01\C$\TEMP\DEBUG_InventoryProcess.txt";
    string content = jsonString;
    if(!File.Exists(debugPath))
    {
      string createText = "First Line:" + Environment.NewLine;
      File.WriteAllText(debugPath, createText);
    }
    string appendText = Environment.NewLine + "Response "+DateTime.Now.ToString() + Environment.NewLine + content;
    File.AppendAllText(debugPath, appendText);
    */
   
    //submit to Agent   
    inventoryWIPReconRpt.SubmitToAgent(wipTS, "SystemTaskAgent", 0, 0, "Erp.UIRpt.InvWipRecon");   
  }
}

I have verified that my “today” and “year” variable are populated correctly. Any ideas? Surely it’s something small that I’m overlooking. Thanks

UGH I was including JobNum = 0, when I didn’t need to.

Silly, but that’s what it was.

2 Likes