Change-based Email Alerts in Dynamics AX 2012 (Part 2)

Change-based Email Alerts in Dynamics AX 2012 (Part 2)

This post is a continuation of Change-based Email Alert setup & configuration. Refer to Part 1 if you have not yet completed the initial steps, located here:
Change-based Email Alerts

Batch Jobs

There are two batch jobs that must be set up in order for change-based email alerts to function properly. One job generates the alerts based on the criteria you define, the other actually distributes the emails to the recipients specified. As with any batch job, performance considerations should be taken into account to find the right balance between the frequency of alerts, and the processing power required to do so.

The first batch job is located at System Administration > Periodic > Alerts > Change based alerts, shown in figure 1.5. Check the Batch Processing checkbox, and select the batch group we created before from the dropdown. Then click the Recurrence button to specify how and when you would like this job to run (every minute being the most-frequent option available). Finally, click the Alerts button and uncheck all of the boxes within the popup window, as we do not need to receive alerts every time the job runs or fails in this example.

Figure 1.5 - Alerts Batch Job

Figure 1.5: Changed based alerts batch job.

The second batch process that we need to address is the email distribution job. This job can be accessed at System Administration > Periodic > E-mail Processing > Batch. In our case, the setup will be identical to the previous job. If processing power is not an issue, set the recurrence for every minute, to ensure that you receive alerts as close to real-time as possible.

Create Alert Rule

Now that we have our lengthy setup process complete, it is time to create the alert rule itself. AX still needs to know what event will trigger this alert, as well as who is to be notified with an email. Following our Purchasing Manager example, navigate to Accounts Payable > Common > Purchase Orders > All Purchase Orders, right-click on any PO in the list, and select “Create alert rule…” from the popup menu.

This brings up the Create Alert Rule form (figure 1.6). At the top, choose “Record has been deleted” in the Event dropdown. Notice the Field dropdown automatically changes to “<All fields>,” as we do not need a particular field specified for this alert. Select the “All records in Purchase Orders” radio button, since we want to be notified when any PO is deleted. Keep the “No end date” radio button selected, and keep the default text in the subject and message fields as well. These fields are only displayed on the internal ‘notification’ alerts, whereas our subject and message text will be pulled from our email template. Under ‘Alert who,’ choose your user ID from the dropdown, and under ‘Other alerts,’ uncheck the “Show pop-ups” checkbox and check the “Send e-mail” checkbox. Again, the popups would be utilized for internal notification situations. The email address previously entered into your user’s options should default into that checkbox field as well.

Figure 1.6 - Alert Rule

Figure 1.6: Create Alert Rule form.

Once this alert rule has been created, we should be set to begin testing functionality. Keep in mind that a new rule will need to be created for each user that wishes to receive this alert.

Testing

Testing this alert rule should be fairly straightforward. Find a Purchase Order that is no longer needed (or create a dummy one just for this purpose), and delete it from the form. Assuming all of your configuration is correct, you should receive an email within +/- 60 seconds (or whichever frequency you chose) stating that a PO has been deleted. If you do not receive the email, a good place to begin troubleshooting is the batch job history. Navigate to System Administration > Inquiries > Batch Jobs > Batch Jobs, highlight the change-based alert job that we set up first, and click the Batch Job History button above. This will show a list of all the instances that this job has run, which you can sort by date to find the most recent. If any of the entries show a status of “Error”, click the Log button above to view the error log details. Use this method to guide you until emails begin appearing as expected. I may follow up in the future with a second post detailing more advanced change-based alert structure, but for now this should be sufficient to get you familiar with the process.

 

Share on Google+Tweet about this on TwitterShare on LinkedInShare on FacebookEmail this to someone