{"title":"TaskScheduler.TaskExists(Guid) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/taskscheduler/taskscheduler-taskexists-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/taskscheduler/taskscheduler-taskexists-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/taskscheduler/taskscheduler-taskexists-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Checks whether a specific task exists.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"TaskScheduler.TaskExists(Guid) Method","slug":"taskschedulertaskexistsguid-method","at":0,"chars":1706},{"level":2,"title":"Syntax","slug":"syntax","at":139,"chars":69},{"level":2,"title":"Parameters","slug":"parameters","at":208,"chars":166},{"level":2,"title":"Return Value","slug":"return-value","at":374,"chars":58},{"level":2,"title":"Remarks","slug":"remarks","at":432,"chars":696},{"level":2,"title":"Example","slug":"example","at":1128,"chars":383},{"level":2,"title":"Related information","slug":"related-information","at":1511,"chars":195}],"text":"# TaskScheduler.TaskExists(Guid) Method\n> Version: _Available or changed with runtime version 1.0._\nChecks whether a specific task exists.\n## Syntax\n```al\nExists :=   TaskScheduler.TaskExists(Task: Guid)\n```\n## Parameters\nTask\nType: ../guid/guid-data-type\nThe unique identifier of the task. The unique identifier is returned by the CreateTask method when creating the task.\n## Return Value\nExists\nType: ../boolean/boolean-data-type\n## Remarks\nScheduled tasks are shown in the Scheduled Tasks page in the client. The TaskScheduler.TaskExists method looks up if the task exists on the page (the implementation is different for the on-premises version compared to the online version of Business Central).\n> NOTE\n> It's also possible to use ScheduledTask.Get on a record instance of type ScheduledTask to query for existence of a task. This method requires the user to have Read access to the ScheduledTask table, whereas the TaskScheduler.TaskExists method doesn't require the user to have access to the ScheduledTask table.\nFor more information about the task scheduler, see Using the Task Scheduler<../../devenv-task-scheduler>.\n## Example\nThis example shows how to use TaskScheduler.TaskExists to be able to safely later in the code flow run code that assumes that the task exists.\n```al\nprocedure DoSomethingOnATask(ScheduledTaskId: Guid)\nbegin\n    if not TaskScheduler.TaskExists(ScheduledTaskId) then\n    begin\n        // handle error\n    end;\n\n    // code can now assume that tasks exists\n\n    ...\nend;\n```\n## Related information\ntaskscheduler-data-type\nUsing the Task Scheduler<../../devenv-task-scheduler>\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}