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
ForceTechieForceTechie 

Global and Public Scheduler class and Batch class

Can anyone tell me the difference between Global Scheduler & Public Scheduler class and difference between Global Batch class and Public Batch class.

SurekaSureka

Hi,

 

It is the general difference between Global & Public. Global class is accessible across the Salesforce instance irrespective of name spaces whereas public classes are accessible in the corresponding namespances.

 

Thanks

ForceTechieForceTechie

Can't a public scheduler or batch class run from anywhere in the org?

I know the difference between global and public but there should be some specific reason for making these classes global. Public scheduler/batch classes can be run through the methods they are run when being global.

souvik9086souvik9086

Hi,

 

When we create a apex class which extends Database.Batchable Interface,we have to make it global because the salesforce compiler will know through that global keyword, this class incorporates batch jobs.

 

The process gets started when you instantiate the global class and called it using database.executeBatch.

 

If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.

Thanks

 

ForceTechieForceTechie

What i think is that global keyword makes classes available to be exposed through webservice i.e they can be called from outside the org. This is the only reason which looks possible for making those classes global. Otherwise no difference is there between global and public scheduler/batch class.