function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinivas AnnamSrinivas Annam 

difference between report schedular and batch apex?

already report scheduling is there even though why we use batch apex?what are the differences are there between report schedular and batch apex?what is out of box functionanlity?
CloudGeekCloudGeek
Hello Annam,


Report Scheduling is to schedule reports only. What if you need someone to process certain set of records every one hour for serving a specific task ?

Eg. Let say, you have some other system sending/pushing opportunities into Salesforce via Informatica / some ETL tool/process, you need to update those opprtunities with some speciic values for certain fields as part of process. You should implement a batch program and schedule it to run every hour and do all the work for you.

A Batch class allows you to define a single job that can be broken up into manageable chunks that will be processed separately.
One example is if you need to make a field update to every Account in your organization. If you have 10,001 Account records in your org, this is impossible without some way of breaking it up. So in the start() method, you define the query you're going to use in this batch context: 'select Id from Account'. Then the execute() method runs, but only receives a relatively short list of records (default 200). Within the execute(), everything runs in its own transactional context, which means almost all of the governor limits only apply to that block. Thus each time execute() is run, you are allowed 150 queries and 50,000 DML rows and so on. When that execute() is complete, a new one is instantiated with the next group of 200 Accounts, with a brand new set of governor limits. Finally the finish() method wraps up any loose ends as necessary, like sending a status email.
So your batch that runs against 10,000 Accounts will actually be run in 50 separate execute() transactions, each of which only has to deal with 200 Accounts. Governor limits still apply, but only to each transaction, along with a separate set of limits for the batch as a whole.

Disadvantages of batch processing:
It runs asynchronously, which can make it hard to troubleshoot without some coded debugging, logging, and persistent stateful reporting. It also means that it's queued to run, which may cause delays in starting.
There's a limit of 5 batches in play at any time, which makes it tricky to start batches from triggers unless you are checking limits.
If you need access within execute() to some large part of the full dataset being iterated, this is not available. Each execution only has access to whatever is passed to it, although you can persist class variables by implementing Database.stateful.
There is still a (fairly large) limit on total Heap size for the entire batch run, which means that some very complex logic may run over, and need to be broken into separate batches.

What a deep dive into Batch Apex ? Refer (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm) Here. 

What is Out of Box Functionality ?
Salesforce out of the box means the declarative features provided by the Salesforce, where we can develop applications just by using button clicks and without any code e.g. workflow/approval process,reports and dashboards . It mainly has features for linking salesforce with Outlook.

To simplify : No Code, No Programming. Here is a reference (https://success.salesforce.com/answers?id=90630000000gubGAAQ).


Hope that helps!
 
Vamsi KrishVamsi Krish
Hello CloudGeek,
Is it possible to generate a report of what has been modifed after the batch class has been executed and send that report to specified usergroups?