Start batch jobs automatically in Axapta

If somebody is looking for a way to automatically start an existing batch-job, here I will show you the simple way under Windows XP environment. Before we start, it is assumed you have the basic knowledge to set up batch jobs in Axapta.
Okey, here we go:

1. Create a batch group named Test and set up the relating batch jobs for this group.
2. In the class SysStartupCmdBatchRun, modify the method infoRun as below:
   void infoRun()
        batchRun batchRun = new batchRun();

3. Open Axapta Configuration Utility, create a new configuration, in our example it is Test4BatchConf. Copy the active configuration to Test4BatchConf, then type Batch_Test in Startup command field.   Export this Configuration to C:Test4BatchConf.xpo.
4. Create a short-cut for Ax32.exe in your desktop. Right click this short-cut to view its property. In the short cut tab, in our example the location of Ax32.exe is c:MBSClientbinAx32.exe (in this case, no space is allowed in the file path, like Program files, otherwise it will generate errors). Change the string in target field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.
Close the short-cut for Ax32 in your desktop.
5. In Windows XP, click Start->All programs->Accessories->System Tools->Scheduled Tasks. Click the icon Add Scheduled Tasks, then open the wizard which will guide you through the setup of Scheduled Tasks; click next, then you can see a window to allow you specify programs. Click browse, choose the short-cut for Ax32.exe which you created in your desktop. Type in the task’s name and specify the type of scheduled task. In our example, we specify Test4AxBatch as the task’s name and  daily as the type of task. And we need to run this task 5PM every day. Before you close the wizard please select the check box Open advanced properties for this task when I click Finish. In the Task tab, change the string in Run field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.
Here we have it, an automatic daily batch job .

This entry was posted in Axapta Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s