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
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
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..
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.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156