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

Community site session details

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

How to run the job after one minute and print message "Hello world"

(0) ShareShare
ReportReport
Posted on by 65

I am stuck in an issue related to running code unit after every minute using job queue or task scheduler but i don't know how to create settings with time units so that it runs as soon as i deploy it on sandbox.

I have written code unit which will send customer details on the provided email. 

This is the code unit code.

pastedimage1670336092905v1.png

Job Queue Entry Screenshot:

image_5F00_2022_5F00_12_5F00_06T14_5F00_23_5F00_01_5F00_921Z.png

And i have created setting in the job queue to run this background job after every 1 minute as soon as i deploy. While i am creating the job queue entry the time is 19:25 and i set the time let's suppose  Earliest Time: 06-12-2022 19:30 to run. But it doesn't run on the same day and time i defined in the job queue entry.

I am new to business central and trying luck to get this work done. I have also tried this link: https://robertostefanettinavblog.com/2019/04/25/testing-jobs-and-reports-scheduling-with-a-date-formula/ to enter time.
Kindly let me know the steps so that i may know where i am doing wrong.

Help would be appreciated.

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,376 on at
    RE: How to run the job after one minute and print message "Hello world"

    Hi

    you put your tail in ready

    pastedimage1670338459595v1.png

    DAniele

  • Nitin Verma Profile Picture
    21,684 Moderator on at
    RE: How to run the job after one minute and print message "Hello world"

    Hi,

    Go to your job queue entries page and mark your Job queue as Set Status as Ready Click on action button.

    Thanks.

  • Dev-Master Profile Picture
    65 on at
    RE: How to run the job after one minute and print message "Hello world"

    Hi i had already done this but it didn't work that's why i posted question to take help.

    In fact if i choose option "Run Once Foreground" to test my code unit it worked and i got emails. 

    image_5F00_2022_5F00_12_5F00_06T15_5F00_41_5F00_24_5F00_962Z.png

    But when once i created the job queue entry and set it to ready status but it didn't run. What might be the issue?

  • Suggested answer
    DAnny3211 Profile Picture
    11,376 on at
    RE: How to run the job after one minute and print message "Hello world"

    but is the first launch date set to the next day?

    you can change it manually

  • Dev-Master Profile Picture
    65 on at
    RE: How to run the job after one minute and print message "Hello world"

    Actually i want to test it right now as soon as i deploy and create job entry it should run after few minutes? can i do this on the same day?

  • Suggested answer
    DAnny3211 Profile Picture
    11,376 on at
    RE: How to run the job after one minute and print message "Hello world"

    you can set the date to today with a time of 17:10 for example, but set the jon in on hold otherwise it won't let you change it

    pastedimage1670342573320v1.png

    , or force the execution like this:

    pastedimage1670342378553v1.png

    DAniele

  • Dev-Master Profile Picture
    65 on at
    RE: How to run the job after one minute and print message "Hello world"

    I am done with it actually the time the server was using is different from my current time that's why the job was not running. What i did was just run the job and got the email in which there is a time embed in the body text. there i found the time is different and then i recreated the job entry and set the time according to server time and as soon as i deployed it started sending me the emails.

  • Suggested answer
    DAnny3211 Profile Picture
    11,376 on at
    RE: How to run the job after one minute and print message "Hello world"

    check my answer if it helped you, thanks

    DANiele

  • Dev-Master Profile Picture
    65 on at
    RE: How to run the job after one minute and print message "Hello world"

    YEs it helped but the issue was i had to set the job queue time according to the server time to test it while development. so when i set it run accordingly.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,330

#2
Sumit Singh Profile Picture

Sumit Singh 2,738

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,546

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans