SIGN IN SIGN UP

Login to your account

Username or Email *
Password *
Remember Me

Search Quiz

Search for a Quiz

No results found

Streak

Mon Tue Wed Thu Fri Sat Sun
Longest Streak: Current Streak:
Administrator Progress ( Quizzes)
Flow Builder Progress | ( Lessons)
Apex Beginner Progress | ( Lessons)
Apex Intermediate Progress | ( Lessons)
Integration Progress ( Quizzes)
LWC Progress | ( Lessons)
Apex vs Flows Progress | ( Lessons)
Experience Cloud Progress ( Quizzes)
Exercises ( Quizzes)

Governor limits in Salesforce are predefined limits that are set to ensure that the Apex code and Visualforce pages are executed in a secure and efficient manner. Here are 10 examples of governor limits in Salesforce and sample code to illustrate how they work:

  1. Maximum CPU time limit: This limit ensures that a single Apex transaction does not consume too much CPU time.
// Example code that exceeds the maximum CPU time limit
List<Account> accounts = [SELECT Id, Name FROM Account];
for (Account acc : accounts) {
    for (Contact con : acc.Contacts) {
        // Perform some complex operation
    }
}
  1. Maximum heap size limit: This limit ensures that the amount of memory used by Apex code does not exceed a certain limit.
// Example code that exceeds the maximum heap size limit
List<Account> accounts = [SELECT Id, Name FROM Account];
Map<Id, Contact> contactsMap = new Map<Id, Contact>();
for (Account acc : accounts) {
    for (Contact con : acc.Contacts) {
        contactsMap.put(con.Id, con);
    }
}
  1. Maximum number of SOQL queries limit: This limit ensures that a single Apex transaction does not execute too many SOQL queries.
// Example code that exceeds the maximum number of SOQL queries limit
List<Account> accounts = [SELECT Id, Name FROM Account];
for (Account acc : accounts) {
    List<Contact> contacts = [SELECT Id, Name FROM Contact WHERE AccountId = :acc.Id];
    // Perform some operation on the contacts
}
  1. Maximum number of DML statements limit: This limit ensures that a single Apex transaction does not execute too many DML statements.
// Example code that exceeds the maximum number of DML statements limit
List<Account> accounts = [SELECT Id, Name FROM Account];
for (Account acc : accounts) {
    acc.Name = 'New Name';
    update acc;
}
  1. Maximum number of callouts limit: This limit ensures that a single Apex transaction does not execute too many external callouts.
// Example code that exceeds the maximum number of callouts limit
HttpRequest req = new HttpRequest();
req.setEndpoint('https://example.com');
req.setMethod('GET');
Http http = new Http();
for (Integer i = 0; i < 100; i++) {
    http.send(req);
}
  1. Maximum number of future calls limit: This limit ensures that a single Apex transaction does not execute too many future calls.
// Example code that exceeds the maximum number of future calls limit
for (Integer i = 0; i < 101; i++) {
    Test.callout(i);
}
@future(callout=true)
public static void callout(Integer i) {
    // Perform some callout operation
}
  1. Maximum number of batch jobs limit: This limit ensures that a single Apex transaction does not execute too many batch jobs.
// Example code that exceeds the maximum number of batch jobs limit
Database.executeBatch(new MyBatchJob());
Database.executeBatch(new MyBatchJob());
Database.executeBatch(new MyBatchJob());
  1. Maximum number of scheduled Apex jobs limit: This limit ensures that a single Apex transaction does not schedule too many Apex jobs.
// Example code that exceeds the maximum number of scheduled Apex jobs limit
for (Integer i = 0; i < 101; i++) {
    String jobId = System.schedule('Job' + i, '0 0 * * * ?', new MyScheduledJob());
}

TODAY

1 Solmaz Aliyeva 240
2 Sercan Kara 214
3 Eray Dere 200
4 Evren Akcay 120
5 Okan Ozcelik 75
6 Derya Baskol 65
7 EA 50
8 Mira Ince 40
9 Ciro Miguel Gongo 35
10 Osman Demirel 25

Last 7 Days

1 Derya Baskol 2552
2 Solmaz Aliyeva 1355
3 Sercan Kara 1014
4 Nyaradzai Shoko 661
5 Eray Dere 560
6 Okan Ozcelik 460
7 Efe Kadioglu 374
8 Ciro Miguel Gongo 347
9 Ridvan Ay 285
10 Esranur Bozdemir 260
11 Evren Akcay 245
12 Alaattin Kokcu 245
13 Bahar Erdagi 240
14 Osman Demirel 237
15 Nora Arslan 200
16 Aysun Bilgic 160
17 EA 145
18 Mira Ince 140
19 Ahmet Derdiyok 130
20 Sevilay Zencirkiran 90

Last 30 Days

1 Derya Baskol 2232
2 Solmaz Aliyeva 1305
3 Sercan Kara 944
4 Nyaradzai Shoko 661
5 Eray Dere 560
6 Okan Ozcelik 405
7 Ciro Miguel Gongo 347
8 Ridvan Ay 260
9 Evren Akcay 235
10 Alaattin Kokcu 230
11 Esranur Bozdemir 225
12 Osman Demirel 207
13 Nora Arslan 200
14 Bahar Erdagi 195
15 EA 145
16 Mira Ince 140
17 Aysun Bilgic 130
18 Sevilay Zencirkiran 90
19 Yeliz Celiker 80
20 Ahmet Derdiyok 65

All Times

1 Derya Baskol 98076
2 Solmaz Aliyeva 50120
3 Okan Ozcelik 31148
4 Tugbag Tamer Yilgin 28630
5 Engin Basturk 27031
6 Fatih 24338
7 Bahar Erdagi 21617
8 Zehra Bulut 21598
9 Emel Sarli 20845
10 Zeynep Yildiz 19597
11 Alaattin Kokcu 18067
12 ZY 18011
13 Burcu Derdiyok 16651
14 Cavidan 16514
15 Ozlem Helva 16258
16 Sebahattin Dalgic 15751
17 Esra Balci 15333
18 Ada Lozzy 14760
19 Ahmet Derdiyok 14426
20 Hakan Can 13232
Go to top