Search code examples
batch-processingaxaptadynamics-ax-2012

How do I send an email alert when batch job status changes to executing?


How do I make AX send an alert email every time a batch job executes?

I know how to make it send an email when I change the status to waiting or withheld.

I would like to be able to set up alerts when jobs exe, error, and so on.


Solution

  • As this is not a standard option, the easy way would for the job to send the mail itself.

    There are several ways to send email, SysEmailTable::sendMail comes handy:

    SysEmailTable::sendMail('templateId',
                            'en-us', // Chosen language
                            'WhoYouSendThisTo@example.com', // Who you're sending the email to
                            mappings, // Your variable mappings
                            '', // Location of file attachment (server/client matters) or none
                            '' , // XML if you're using XSLT
                            true, // Traceable or not?
                            'admin', // Sending user
                            true); // Use retries?
    

    See this blog for more information.