Asynchronous Processing in Salesforce

An asynchronous process is a process or function that executes a task "in the background" without the user having to wait for the task to finish.

Asynchronous runs in salesforce different four types :-
  1. Future Methods:- Run in their own thread, and do not start until resources are available.
  2. Batch Apex:- Run large jobs that would exceed normal processing limits.
  3. Queueable Apex:- Similar to future methods, but provide additional job chaining and allow more complex data types to be used.
  4. Scheduled Apex:- Schedule Apex to run at a specified time.

Future Methods

  • It's start always @future annotation before create a future method.
  • It's is used for only long-running operation.
  • It's runs always separate thread.
  • It's method must be static and return type void.
  • It's method parameter always should premitive data type like (Id, string, Interer, boolean), because the sObject might be changed in future when method will be execute. In this case future method will get old sObject value and might be overwrit them.

Queueable Apex class

  • Queueable apex clsss is a interface that is control the asynchronous process of apex process.
  • It is a advance version of future method, it enhanced way of running asynchronous apex code compare to the using future method.
  • It always run in background in it's own thread and doesn't delay the execution of your main apex logic.
  • It implementing the queueable interface and adding a job to the apex job queue.
  • Each queue job runs when system resource become available.

Batchable Apex class

  • Batchable Apex is a interface of three method. We must implement "Database.batchable"
    1) Start method
    2) Execute method
    3) Finish method
  • Start method:- Start method is automatically called at the begning of the apex job. this method will collect the record of the object.
  • Execute method:- Execute method performe an operation which we want to perform on the record fetched from start method.
  • Finish Method:- Finish method execute after all batches are processed. Use this method send confirmation email notification.


To know more live demo source code in Salesforce lightning, Trigger, Visualforce & LWC, Use this link..



Asynchronous Processing in Salesforce Asynchronous Processing in Salesforce Reviewed by Admin on 1:31 AM Rating: 5

7 comments:

  1. read your and i really find it helful. Thanks for sharing such amazing articles with us

    ReplyDelete
  2. best news website https://royalkastoori.com

    ReplyDelete
  3. your article is awesome.
    Great Thanks for sharing awesome info. I have a information about fake ID card. Idsbuddy is 𝐛𝐞𝐬𝐭 𝐟𝐚𝐤𝐞 𝐢𝐝 𝐦𝐚𝐤𝐞𝐫 𝐰𝐞𝐛𝐬𝐢𝐭𝐞𝐬. You can learn more information about fake id card from this website.
    you can check best fake id websites

    ReplyDelete
  4. Hello guys nice post this and thanks for sharing this content in this blog..matka

    ReplyDelete

header banner -- www.w3web.net



Powered by Blogger.