Power Community

Power Community

Dynamics 365 Business Central: scheduling job queue tasks via API

The Dynamics 365 Business Central 2022 Wave 2 version 21.2 update silently introduces a long requested feature: the possibility to schedule job queue tasks via APIs in an integrated session using Service-to-Service (S2S) authentication.

Service-to-Service (S2S) authentication is suited for scenarios where integrations are required to run without any user interaction and prior to this new version with a S2S session you was not able to schedule job queue tasks (if you tryed to do that, you received a permission error on the API call).

With Dynamics 365 Business Central version 21.2 now this is finally possible!

To show this, just create a codeunit and create the following procedure:

This procedure schedules a codeunit (here I’ve used a standard codeunit just for simplicity) as a recurring job queue task.

Now publish this codeunit as an OData endpoint (here called SDApiMgt) and call it via APIs by using S2S authentication:


No error now, but a HTTP 204 No Content success status response code indicates that a request has succeeded:

If you go on Dynamics 365 Business Central and you check the Job Queue Entries page, you can see that a Job Queue Entry record is created:

The User ID field shows that it’s my Azure Active Directory app registration that creates the task.

Please remember that to set up service-to-service authentication, you’ll have to do two things:

  • Register an application in your Azure Active Directory tenant for authenticating API calls against Business Central.
  • Grant access for that application in Business Central.

For more informations, here you have all what you need.

This post was originally published on this site

- Advertisement -spot_img


Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Plugin Error – Security accessibility of the overriding method must match the security accessibility of the method being overridden – Quick Fix

Hi Folks, I recently came across the above error for one of my Dynamics 365 Plugins…this blog talks about applying...

More Articles Like This

- Advertisement -spot_img