Setup Email Alerts and X++ Code to Send Mail in DAX 2009.

Following steps illustrates how to setup and activate Email Alerts in DAX 2009.

In Ax we have two types of Alerts.
    1 ) Pop-Up Alerts , shown in AX Forms as pop-up windows.
    2 ) Email Alerts , where alert message will be sent to users by mail.  In other words its extended
         version of Pop-up Alerts.

How it Works :
   a ) For every alert ax creates record in SysOutgoingEmailTable and  
        SysOutgoingEmailData.
   b ) Then Email distributor batch(Class->SysEmailBatch->run method)  job reads the message
         from the above table and after validating execute the mail.

Now we will see what all setups are required for activating second type of alert.

Step1 : Activates the Alerts feature for user in options form .
             Go to  Tool-->Options  , set show email alerts  as


 Step 2 :  Set Email Parameters , Administration->Setup->Email Parameters
                 Define parameters like which SMTP  Server to use for sending mails and credentials
                 by which mail will be sent to users.




Step 3 : Add Email distributor batch to BatchJob Queue. This job will be responsible for sending mails to users. So if you are not receiving any email it means u have not scheduled this batch job to run.
             Administration->Periodic->Email-Processing--->Batch
Set the recurrence as No End date and minutes as 15-30 minutes.

Step 4 : Check the Batch Job queue for Email distributor batch job , you should find new record
               in batch queue as
               Basic-->Inquiries-->Batch Job
               For this record Click on Alerts and select check box "Error" . It means whenever this
               batch job fails you will get alert.

Incase of any failure you can debugg SysEmailBatch Class run method .

Step 5: Set up Email Templates and attach to EventParameters.
              Basic -> Setup -> Alerts -> Alert Parameter.

Step 6 :   Job to test whether u have configured correctly or not.
                  static void Mail_Send(Args _args)
                 {

                       EventParameters eventParameters = EventParameters::find();
                      SysUserInfo             sysUserInfo;
                     UserInfo                userInfo;
                     ;

                    // SysUserInfo has Alert and email info
                    sysUserInfo = SysUserInfo::find(curuserid());

                     // UserInfo has the language info
                    //userInfo = xUserInfo::find(false, eventRule.UserId);
                                         
 SysEmailTable::sendMail(eventParameters.AlertTemplateId,userInfo.Language,sysUserInfo.Email);

              
            

Even workflow framework uses same alert setups for sending mails for approval and task notifications.

Cool !!!!!!

2 comments:

  1. Call us at We24Support E-mail support number at 1-866-978-0799 and Enhance your system functioning and keep it clean with We24Support services.
    E mail Setup and Support
    email support

    ReplyDelete
  2. We resolve every issue arising with your computer operating system, Windows,
    software, internet security, registry settings, sound drivers,etc in one call
    E-mail Setup and Support
    email support

    ReplyDelete

Note: Only a member of this blog may post a comment.