Automated batch jobs can be created and set up for virtually every Periodic form. Before creating a batch job, verify that the batch server is setup and running. As an example of setting up a batch job, we will create one for the Notification clean-up form in the Administration module.
The event inbox is where alerts are stored. In some instances, this table can be full of unnecessary and old alerts, which can cause issues on the Unified Work list Web part on the Enterprise Portal. This form will delete notifications from alerts based on filters specified in a Dynamics AX query.
The following steps outline the process of setting up a batch job for the Notification clean-up form, which can be adapted to any form capable of running as a batch (a form with a Batch tab):
1. Open the Notification clean-up form found in Administration | Periodic | Notification clean-up.
2. Click on the Select button to create a Dynamics AX query with appropriate filters.
3. If necessary, you can add additional filters by clicking on the Add button. If nothing is specified, every record will be selected since there is no filter. In this example, we will be deleting all Workflow events. Select the Source line and click on the Criteria cell, a lookup button will appear in which you can select Workflow. Click on the OK button to apply the changes.
4. Now we are back in the General tab of the Notification clean-up form. Workflow is now listed as the source. Click on the Batch tab to create an automated batch job to reoccur on a specific date and time.
5. Select a Batch group from the drop-down list. To create a new batch group, simply create one in the Administration | Setup | Batch group form. In the Identification group, if the Private checkbox is marked, that means only the current user can run the batch job. Mark the Batch processing checkbox to enable batch processing. The Recurrence button is where you can specify when the batch job should run automatically and how many times. The Alerts button is where you can specify the method of alerting based on the batch job’s events. Once the settings have been updated, click on the OK button to submit the batch job.