Thursday, 4 September 2014

AX 2012 R3 email report not working

One of the common requirement for report is emailing (Eg. nightly batch run and email the report).

Standard AX does provides this feature, but unfortunately AX 2012 R3 RTM seems to have a bug over here.

Given the Print destination settings below, it looks OK on the first look, but it wasn't. The problem with it is the Cc field is empty.

It uses the SrsReportRunMailer class, emailReport method to send the email.
The mailer.quickSend() method call has all the parameters passed in (including the Cc).

Here's where the problem comes from, the SysMailerNet class, quickSend method. is checking the Cc value using prmisDefault() method.

Sequence:
1. Print destination settings doesn't provides value in Cc field
2. Empty string is passed in as parameter value in quickSend method
3. Due to empty string is passed in, the Cc parameter is no longer default value
4. Validating using the prmisDefault method is incorrect due to Cc is no longer default value (it should just check whether the Cc has value or not - Eg. if(cc){...})

The error occur when it reach the line - ccs.add(cc).
If cc is empty, it error and stop there.


There're two quick solutions here:
1. Enter a value in Cc field
2. Modify the code, use if(cc){...} instead of if(!prmisDefault(cc)){...}


1 comment:

  1. Last time I read more about spam in mailbox. Do you know how to solve such a problem and get rid of unnecessary addresses?

    ReplyDelete