web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to run a codeunit in the background without scheduling in Business Central?

(0) ShareShare
ReportReport
Posted on by 2,304 Moderator

I have a requirement to run a codeunit in the background every time I click action on a page. I was considering using the job queue, but I am not sure how to configure it to meet my needs. I want the codeunit to run in the background without a set schedule, and I want it to run for each record individually before moving on to the next record. For example, if the code unit takes 15 minutes to run for one record on page and I start the process for another record immediately after, it should be added to the job queue and run only after the first one has completed. How can I set up the job queue to achieve this?
Any help or guidance will be appreciated...
Regards

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    You need to only schedule a job queue in that case, Job queue will not add any records in-between if its running, it will again restart the processing again, when it finish.

    Thanks.

  • Suggested answer
    Bilal Haider Profile Picture
    414 on at

    Hi,

    You can create a table to queue the records you clicked. (Insert as you click)

    Schedule a job queue that will check records in table and run codeunit for that record and delete it after.

  • Govinda Kumar Profile Picture
    2,304 Moderator on at

    Hi Nitin Verma,

    Thank you for your response, however my requirement is to run the codeunit for each record individually in the background, without a set schedule. Currently, I have set the job whenever I want in the background without worrying about scheduling. The only problem is that if my job takes 15 minutes and I want to set it in the queue for another record, it doesn't get added until the previous job completes..

  • Govinda Kumar Profile Picture
    2,304 Moderator on at

    Hi Bilal Haider,

    Thank you for your suggestion. I think creating a table to queue the records to schedule a job queue and run the codeunit for each record and then deleting it from the table can work. I appreciate your help. I will give it a try and let you know how it goes.

    Regards

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans