Thursday, July 26, 2018

How to Schedule Apex class to Run Instantly or Run After Some Duration from Developer Console

We create apex scheduler job which can be scheduled to run at specific time. If we want to run job instantly to either check the functionality or want to force start scheduled job then below code sample will help you.

Suppose you have scheduled apex class:

global class SK_JobsSchedulerHelper implements Schedulable {
global SK_JobsSchedulerHelper(){

}
       global void execute(SchedulableContext sc) {
//your business logic
}
}

Now if you want to run it instantly from developer console, then use below script:

SR_JobsSchedulerHelper sch = new SR_JobsSchedulerHelper();
sch.execute(null);

Now if you want to run this job after 5 minutes, then you can use below script:

SR_JobsSchedulerHelper sch = new SR_JobsSchedulerHelper();
Datetime dt = Datetime.now().addMinutes(5);  
String schCronExp = dt.format('s m H d M \'?\' yyyy');
Id schedId = System.Schedule(' scheduling this job at'+System.now().format(),schCronExp,sch);

Hope this help!!


11 comments:

  1. Coder Cyber Services is coming with premium solutions for lost crypto recovery on a single dedicated platform. New generation investors now have it easier thanks to cryptocurrency futures trading, but with so many unscrupulous and fraudulent brokers popping up, it's effortless to choose the wrong one when making investments. With the aid of this specialized tool from Coder Cyber Services,you can also gain the recovery of your lost cryptocurrency because their trade indications are so precise, you can utilize their technical signals to recover your lost cryptocurrency. Contact Coder Cyber Services immediately in order to get your stolen money back as soon as possible if you have been a victim of theft.
    Email: Codercyberservices@execs.com
    WhatsApp: +1 (403) 407-3407.

    Thanks.

    ReplyDelete
  2. Please, everyone should tread carefully with all these crypto brokers and crypto mining managers on social networks. I was duped with a whooping sum $ 640,000 of my investment capital by a broker I met via #Telegram. They kept on assuring me of my investment success growth while requesting for extra funds before a withdrawal request could be accepted and processed to access my investment, at the end of all my constant deposit, I lost all my money. All efforts trying to get them to return all I had invested with them was futile because they kept asking me for more money. I found myself in a very confusing state till recently when I was introduced to this group of Ethical Hackers. I wrote an email on ( cybergenie(@)cyberservices .co m) to them detailing my experience with that crypto broker, and they replied to me to provide proof of my investment with the said broker which I did, Lo and behold, before the end of the day, I got a notification from Trust Wallet of an incoming deposit, all that I lost was retrieved successfully..

    ReplyDelete
  3. Most Reliable and Recommended Crypto Recovery Expert, Captain WebGenesis.

    I was 99% Certain that I had been duped by a Crypto Investment company appearing as a Bakkt-based FX broker. I had lost 6.9Btc as a result of the company's website. As soon as possible, I had to hunt for help, and that's how I came across Captain WebGenesis, a certified Bitcoin recovery professional with specific cyber skills to recover lost money from scammers. His assistance and responses are satisfactory and professional. Captain WebGenesis succeeded in recovering 85% of my lost funds. I sincerely appreciate Him for his assistance, To anyone that has happened to be a victim too, you can file an email complaint through; Add (captainwebgenesis@hackermail.com).

    WhatsApp;; +1 (205)336-1020.
    More Info; captainwebgenesis.com

    ReplyDelete
  4. Tracking Down Lost Bitcoins and Other Cryptos:

    My experience of online scamming took seconds and cost me thousands. I was fooled by a YouTube video that convinced me that I could make a killing in Crypto, and the minute I clicked the link and deposited funds, I knew something was up, but it was too late. I worked with Captain WebGenesis, A certified and reliable Crypto Expert, it took a few days, and the Expert ensured I got almost all of the money back. It wouldn’t have been possible for me to meet up economically because I almost invested all my money but all thanks to this trustworthy Expert Captain WebGenesis with his genius effort to help me recover my already stolen currency. Please ensure also to consult Captain WebGenesis if you need such help:

    via email: Captainwebgenesis@hackermail.com or WhatsApp +1 205 3361020.

    ReplyDelete
  5. DO YOU NEED FINANCES? ARE YOU LOOKING FOR FINANCES? ARE YOU LOOKING FOR FINANCING TO ENLARGE YOUR BUSINESS?via email:bullsindia187@gmail.com

    ReplyDelete

  6. Contact Captain WebGenesis to Recover Lost, Scammed or Stolen Bitcoin with Ease.

    CAPTAIN WEBGENESIS helped me in reclaiming my Btc and usdt worth $67,000, that I had lost to an authorized cryptocurrency trading scam website plan. After several trials with several hackers with no success, I came across CAPTAIN WEBGENESIS, who worked tirelessly on my case and retrieved all of my funds within days.. I shall be eternally grateful to CAPTAIN WEBGENESIS. I urge anyone who has fallen victim to these online fraudsters to get in touch with the expert through his email (captainwebgenesis@hackermail.com).

    Visit: Captainwebgenesis.com

    ReplyDelete

  7. HOW CAN I RECOVER LOST FUNDS FROM TRUST WALLET ? CONSULT CAPTAIN WEBGENESIS.

    Crypto Recovery Services - Through Captain WebGenesis / Legitimate Cryptocurrency Recovery Expert.

    Another Successful Bitcoin Recovery, My Spouse and I are another successful client of Captain WebGenesis among many. Numerous good reviews have been written about how the Crypto Recovery Expert has been utilizing his recovery skills to help people regain their happiness by getting their assets and Bitcoin back from dishonest and scammy cryptocurrency trading organizations. We were severely scammed by some scammers online, so I had to get in touch with them after reading about many of the fantastic services they offer. Fortunately, everything worked out well and Captain WebGenesis was able to get back the money we believed the Fraudsters had taken from us. Reach Captain WebGenesis via
    WhatsApp at +1 701) 314-27-29 or email at (Captainwebgenesis@hackermail.com)

    Website; Www.captainwebgenesis.com

    ReplyDelete
  8. Unleash the power of visual communication with our animated video services. Whether for marketing, education, or entertainment, our videos captivate audiences and leave a lasting impression. https://www.toolbox-studio.com/blog/what-is-video-animation/

    ReplyDelete
  9. Cryptocurrency Tracing For Crypto Scam Recovery / Go to Captain WebGenesis.

    Victims of fraud have found it hard to come across legitimate crypto recovery companies to help them secure their lost investments from bogus investment websites. It's hard to take the pain of losing your hard earned money to fraudsters which can leave you in much debt and stress. If you're a victim of a Crypto scam or theft, I recommend Captain WebGenesis recovery team to provide help and get back your funds. Send a complaint to their email ( Captainwebgenesis@ hackermail. com ) and provide all the evidence required and the team will get into deep work and get back your lost crypto.

    SMS/WhatsApp; +1(501)436-9362.

    ReplyDelete

  10. Hire an Ethical Hacker for Stolen Cryptocurrency Recovery.

    Choosing services of a professional crypto recovery agent, Captain WebGenesis can have some key advantages when dealing with issues related to scammed funds recovery. Such services require experts with vast knowledge of blockchain technology and cryptography, which increases the possibility of a successful recovery process.
    Captain WebGenesis firm possesses specialized tools and techniques to navigate complex recovery processes expeditiously. Additionally, knowing that Captain WebGenesis team is highly experienced to manage the retrieval process can bring peace of mind to those victimized with potential loss due to fraudulent investment websites.

    Reach out to Captain WebGenesis through
    Website; https://captainwebgenesis.com.
    SMS-+1(501)436-9362

    ReplyDelete