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)
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 Guvanch Nasyrov 57
2 Hacer Dabanibuyuk 25

Last 7 Days

1 Derya Baskol 10371
2 Solmaz Aliyeva 5950
3 Tugbag Tamer Yilgin 5763
4 Okan Ozcelik 5617
5 Ayse Yilmaz 2508
6 Fatma Ablak Oren 1470
7 Emel Sarli 1451
8 Sercan Kara 1405
9 Ahmet Derdiyok 995
10 Kemal Ozdemir 990
11 Mehmet Akin 815
12 Osman Demirel 776
13 Zeynep SEMİZ 770
14 Bahar Erdagi 693
15 Zeynep Yildiz 665
16 Aysun Bilgic 624
17 Safiyye Arslan 520
18 Engin Basturk 482
19 Nora Arslan 460
20 Efe Kadioglu 450

Last 30 Days

1 Derya Baskol 1270
2 Tugbag Tamer Yilgin 1140
3 Solmaz Aliyeva 585
4 Kemal Ozdemir 295
5 Efe Kadioglu 285
6 Ayse Yilmaz 260
7 Emel Sarli 235
8 Sercan Kara 190
9 Guvanch Nasyrov 187
10 Ahmet Derdiyok 155
11 Bahar Erdagi 145
12 Fatma Ablak Oren 135
13 Zeynep Yildiz 110
14 Ridvan Ay 100
15 Osman Demirel 86
16 Mehmet Akin 70
17 hatice nal 60
18 Aysun Bilgic 60
19 Engin Basturk 55
20 Sarah Aslan 45

All Times

1 Derya Baskol 50145
2 Engin Basturk 26838
3 Fatih 24248
4 Solmaz Aliyeva 23081
5 Zehra Bulut 21583
6 Okan Ozcelik 19675
7 ZY 18016
8 Zeynep Yildiz 17170
9 Alaattin Kokcu 16967
10 Burcu Derdiyok 16611
11 Cavidan 16514
12 Bahar Erdagi 15869
13 Sebahattin Dalgic 15756
14 Ozlem Helva 15623
15 Esra Balci 15343
16 Ada Lozzy 14765
17 Emel Sarli 14335
18 Tugbag Tamer Yilgin 14194
19 Hakan Can 13232
20 Mehmet Y 13024
Go to top