BPM Method print SSRS report - Record Not Found

Version 2024.2.10 SAAS
I have a simple bpm method on Quote.CreateOrder. It has worked for a couple years, but now it keeps throwing error. The report is printed though.

Error

Record not found.

Exception caught in: Epicor.ServiceModel

Error Detail

============

##!Correlation ID:##! a9c43324-32c1-4ca7-b2b2-bfdae68bd5f9
##!Description:##! Record not found.
##!Program:##! Epicor.Ice.dll
##!Method:##! InnerGetByID
##!Line Number:##! 627
##!Column Number:##! 21
##!Table:##! QuoteHed

Client Stack Trace

==================
at Epicor.ServiceModel.Channels.ImplBase.CallWithCommunicationFailureRetry(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, RestRpcValueSerializer serializer)
at Epicor.ServiceModel.Channels.ImplBase.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Epicor.ServiceModel.Channels.ImplBase.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Erp.Proxy.BO.QuoteImpl.CreateOrder(QuoteDataSet ds, Int32& orderNum, String& warningMessage)
at Erp.Adapters.QuoteAdapter.CreateOrder(Int32& orderNum, String& warningMessage)

I have used debug messages to guess the line of code that is throwing the error. I think it is:

var soForm = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderAckSvcContract>(Db);

Here is my code:

//GET EMAIL

var EMailAddress="";
var tempOrderNum=orderNum;
var email = (from a in Db.OrderHed 
            join b in Db.CustCnt on
              new  { F1=a.CustNum, F2=a.PrcConNum} equals
              new  { F1=b.CustNum, F2=b.ConNum} 
          where (a.OrderNum == orderNum && b.ShipToNum=="")
          select new {b.EMailAddress,
                      a.CustNum
                      }).ToList();
                      



foreach(var em in email) {
     EMailAddress=em.EMailAddress;
} 

          
//PRINT REPORT

var soForm = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderAckSvcContract>(Db);
SalesOrderAckTableset soTS = soForm.GetNewParameters();
SalesOrderAckParamRow r = soTS.SalesOrderAckParam[0];


r.OrderNum = orderNum ;
r.SysRowID = Guid.Parse("00000000-0000-0000-0000-000000000000");
r.AutoAction = "SSRSPrint";
r.AgentSchedNum = 0;
r.AgentID = "SystemTaskAgent";
r.AgentTaskNum = 0;
r.RecurringTask = false;
r.RptPageSettings = "";
r.RptPrinterSettings = "";
r.RptVersion = "";
r.ReportStyleNum = 1002;
r.WorkstationID = "";
r.TaskNote = "";
r.ArchiveCode = 0;
r.DateFormat = "m/d/yyyy";
r.NumericFormat = ",.";
r.AgentCompareString = "";
r.ProcessID = "";
r.ProcessTaskNum = 0;
r.DecimalsGeneral = 0;
r.DecimalsCost = 0;
r.DecimalsPrice = 0;
r.GlbDecimalsGeneral = 0;
r.GlbDecimalsCost = 0;
r.GlbDecimalsPrice = 0;
r.FaxSubject = string.Format("Industries Sales Acknowledgement.. Order #{0}",orderNum ); 
r.FaxTo = "";
r.FaxNumber = "";
//r.EMailTo = EMailAddress;
r.EMailTo = "mark.miller@ind.com";
//r.EMailCC = "eaglesales@ind.com";
r.EMailBody = string.Format("Attached is Sales Order {0}."  ,orderNum ); 
r.AttachmentType = "PDF";
r.ReportCurrencyCode = "USD";
r.ReportCultureCode = "en-US";
r.SSRSRenderFormat = "PDF";
r.RowMod = "A";
soForm.RunDirect(soTS);

this.PublishInfoMessage("Sales  Order Acknowledgement sent to Contact:" + EMailAddress, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");

Any help would be greatly appreciated. Thanks

I see you have hardcoded the email address, I’m assuming for testing.

I just tested your code in the demo system 2024.2.6, and added in the Erp.Contracts.Rpt.SalesOrderAck to the references of the post processing directive of Create Order and it worked after I configured the Email Settings and using the report style of 2 (which is the starndard version)

If you are wanting to add multiple contacts then you may want to use something like to concatenate the emails.

 string EMailAddress = string.Join(";", emailList.Select(em => em.EMailAddress));

Going to point you to this post to improve readability of your posts in future

Tips for asking question on the forum - Experts’ Corner - Epicor User Help Forum

1 Like

Thanks for looking and direction

The error you are getting isn’t coming from this BPM the error is coming from an Inner get By ID on Quote Business Object

This BPM has nothing to do with it.

1 Like

I appreciate your comment but not sure I understand… If I disable the BPM then the order is created and the job wizard appears as expected.

Currently the order is created and the email is sent but the error message is shown and the job wizard does not appear.

Really appreciate your help

Its a Red Herrin

Your error message is just being hidden by the looks of it and this BPM is surfacing it. But unless you have more code in your BPM than what you shared this BPM doesn’t have anything to do with a Get By ID call.

What method is this hanging off off? and is it pre processing or post?

Did you recently upgrade or change Epicor versions in any way? Maybe the report itself is trying to invoke GetById but that doesn’t make a lot of sense.

Post processing… I shared all the code in the bpm.

Method: Erp.BO.Quote.CreateOrder

We are SAAS so we get updated on schedule. The first report of this issue was 3/3 of this year. I opened a ticket with epicor
support but they decided it was not under our support contract.

For giggles can you had code an existing order number into orderNum

So instead of using the orderNumber being generated by the system you are using an existing (other) unrelated Sales Order

right at the top of your code just assign

orderNum=12030; //Existing Unrelated Sales Order

And see if the error goes away? I’m tryingn to establish if the GetByID is happening inside the order ack report.

Also you aren’t using company in any of your linq queries, are you multi company by chance? If you are you could be at an overlap between companies where the Sales Order exists in Company X and and Company B as well and so you are grabbing the wrong order record.

1 Like

Hardcoded an existing order number and the error remained.

If I put in a debug message to display the order number AND comment out the section that generates the email it will display the new order number. The error only occurs when the email section of code is enabled.

We are not multi company.

Thanks for your help

Is the 1002 report style still there? Sometimes folks here delete/add when they revise the document. vs just pointing the report style ot the new report.

1 Like

Thanks for the thought… Yes the email is actually sent correctly. The only issue is the error message and then job wizard not appearing.

Closing the loop. You were right. This BPM was not the issue. It was another BPM on the same method. Note to self: Keep better documentation. Thanks for your attention.

2 Likes