The company is opened and the scheduled task in the table 2000000175 Scheduled Task is validated. When task achieves the ready state and it's scheduled time occurs, a new background session is started. When a task is created, the task is recorded in table 2000000175 Scheduled Task of the database. Here's a general overview of the process: What happens in the exception path depends on whether the exception is retriable. The exception path is used to handle errors and control the retry flow when errors occur in the main path. The main path is used to run the main codeunit and failure codeunits, if any. When a scheduled task is run, there are two possible execution paths that it can follow: the main path and the exception path. This section describes the flow that a scheduled task goes through. The CreateTask method can also specify the earliest date to run the task. Once you have the codeunits, add code to the application that calls the CreateTask method to schedule a task. To set up a task, create codeunits that contain the logic that you want to run at a scheduled time. TaskScheduler.CreateTask(Integer, Integer, Boolean, String, DateTime, RecordId, Duration) Method TaskScheduler.CreateTask(Integer, Integer ) Method MethodĪdds a task to run a codeunit at a specified date and time. In AL code, you create and manage the tasks by using the AL methods that are available for the TaskScheduler data type. This codeunit is referred to as a failure codeunit. Optionally, you can create a second codeunit that contains the logic to handle the task if an error occurs for any reason. If something isn't urgent/time critical (for example, can run at a lower priority), consider running it with a task.Ī scheduled task is basically a codeunit that runs logic in a background session at a specific time.Maybe instead you can schedule a task to run the code in the other company? Sometimes in AL code, you want to change company and run code there.If you want users to be able to change the scheduling, use the job queue. From AL, you can schedule code to run either using the task scheduler or by enqueuing a job queue entry. Here's a few scenarios where you might want to use a scheduled task For more information, see Async processing overview. Business Central supports multiple ways to run asynchronous (async) operations, such as job queues, scheduled tasks, new sessions, and page background tasks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |