The work from home culture is increasing by time. As far as the world of business can see, the culture is going to stay longer even after a pandemic is over. So, automation in the business is going to be an essential need. For example, working from home or anywhere in the world can be unplanned and the person may end up messing up with any of them. Therefore, to get things done on time, you can automate a few of them. It is easy as the task will get completed automatically when certain conditions are met. So, here comes the task scheduler tool in business central.
For example, you need to run a script every night or send a notification when any specific event occurs. The tool will help you in completing these tasks automatically.
How the Task Scheduler Works?
The task in the task scheduler is a codeunit that is scheduled to run a specific date and time. In Al code, you manage the tasks by using its methods available for DATATYPE.
- Set up the codeunits, one is the main unit that contains logic and another is failure codeunit to handle tasks in case of first one fails.
- Then, you will call a CREATE TASK method to schedule to run these code units.
The flow of the Task Scheduler
- First, the task is recorded in a table.
- Second, the task is in a run state. Also, a new background session is started and the task codeunit is run.
- If tasks fail, the failure codeunit runs and if failure codeunit also fails to manage error. Then, retry flow is initiated.
Now, the time is to apply this working in a real-time scenario. So, you may want to set job queues for the scheduled task.
Use Job Queues to schedule task
It enables the user to schedule and runs specific code units or reports. So, you can also set these jobs to run for one time or on repeat. You can schedule a sales report every week or email for the customers regarding their orders. a job queue can have multiple jobs to run. You can also add the parameters to control specific tasks and manage runs.
Finally, you know that your business is running smoothly with the business central tool task scheduler after adding jobs. Set up the job queries, add new entries anytime, view status and manage your sales. Therefore, the overall benefit of the tool is to organize your sales from reporting to the emails, etc. For more details, you can check Microsoft documents or the DFSM team is here for the consultation too.