web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Exception thrown when emailing statements with print management in a batch

(0) ShareShare
ReportReport
Posted on by

Can anyone help me with the below problem, basically at the moment I'm having to run the statements every month and end up doing it in about 20-30 'batches' because of the seemingly random crashes.

I get the following error at seemingly random intervals when attempting to email statements (External->Customer account Statement) using a batch and print management.

For testing purposes, I have set the email address to my own email address in print management but the same thing happens when I use @Business@ as the purpose field for the email when trying to send to customers (I usually add our debtors manager into the CC field as well but leave this out for testing).

By picking up the last customer sent to from the emails, I then 'select' >Customers->Csutomer Account for the next run which then continues from where it seemingly left off until it crashes again.

I cannot see why it crashes when it does but it always has the same error as shown below.

Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.
at Dynamics.Ax.Application.SrsPrintMgmtController.Outputreports() in SrsPrintMgmtController.outputReports.xpp:line 96
at Dynamics.Ax.Application.CustAccountStatementExtController.Outputreports() in CustAccountStatementExtController.outputReports.xpp:line 3
at Dynamics.Ax.Application.CustAccountStatementExtController.Runprintmgmt() in CustAccountStatementExtController.runPrintMgmt.xpp:line 116
at Dynamics.Ax.Application.SrsPrintMgmtController.Run() in SrsPrintMgmtController.run.xpp:line 14
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
at BatchRun::runJobStatic(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at BatchIL.taskThreadEntry(Object threadArg)

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If you can reproduce the problem, can't you simply use the debugger to see what's going on? If not, review code statically, at least - the stack trace gives you exact lines of code. (You might also show the code here.)

    Also, you said it happens in batch - does it mean that running it without batch works, or that you didn't test it without batch? If it's the latter case, give it a try.

  • Community Member Profile Picture
    on at

    I have tried running statements one by one (as a batch, because email behaviour is different in batch than not), never hit a problem. Not using a batch forces one to have to confirm each email (or at least every few seconds) because instead of sending through the smtp server it tries to use outlook, I haven't really looked for a way around this outlook security issue as I'd prefer it not to use outlook for the outgoing emails anyway, and using a batch makes it use the smtp server.

    I have also run the same batch with the same parameters (Customer Account=*) multiple times and it will crash after a different customer each time, sometimes it runs for just a handful (2-10) Sometimes it will do a few hundred I haven't been able to establish a pattern.

    I have also tried running through the debugger but I never hit a problem there either. It works fine.

    I have also done some network monitoring during the process, basically results are the same and I don't see high traffic volumes or disconnects, no errors on SQL server, I have also run directly on AOS server (as opposed to client) same results i.e. it crashes at seemingly random points.

    I have tried sending using the tick for print management, but also with no tick and change the output options to have same settings as print management setup, same results either way, random crashes.

    In desperation (because whilst I can read and understand the flow of x++ but I'm a beginner with AX2012 development) I have tried using some code I found to create our own statement sending job, but somehow end up with the wrong statement in a file of the right name going to the right customer. e.g. ABC003 statement in a file called ABC005.pdf sent to the ABC005 email address (I might be incorrect in the sequence I gave up on that plan).

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If you can't debug it, then use trace messages. Of course, make sure your CIL is up-to-date. And look at the code, as discussed above (I can't don't have access to any AX 2012 environment, so it's up to you).

    There is little you can do without collection more information, because just knowing that there is "an error" isn't enough.

  • Community Member Profile Picture
    on at

    Thanks I will try some of this.

    I was hoping someone else might have come across same problem, but I will do yet another CIL compile, I also read somewhere earlier today that it's a good idea to delete the cil files first. There is no customisation to the statement feature though as far as I know, other than layout customisation of the report.

    By 'trace messages' do you mean inserting messages that display (or are written to console) into the code to try and see at what point the crash occurs, or do you mean something else. (Remember I'm not all that experienced with AX2012 development, I'm an 'advanced' end user with other development experience trying to help myself because our partner is not coming up with a solution)

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Yes, I mean tracing in general (as applicable in any programming language), regardless of which mechanism you use. As we're talking about Windows OS, you can utilize Event Tracing for Windows (ETW), but you can also write messages to infolog, directly to a file or anything you like. It's the last resort if interactive debugging fails for some reason.

    When compiling CIL, don't forget that it depends on results of the X++ compiler (if X++ hasn't been built correctly, CIL won't be correct either) and than forget to check compilation results.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans