Apex - Chirag-ahir/SFC-Preparation GitHub Wiki

Apex is a strongly typed object-oriented programming language used to write the code that is executed on the Salesforce.com platform. It is a language developed by salesforce.com, allowing developers to execute flow and transaction control statements on Salesforce servers in conjunction with calls to the API.

What are the different collection variables available in Apex?

  • List
  • Set
  • Map

What are the different conditional statements available in Apex?

  • If Else
  • Switch Statement
  • Ternary Operators

What do you understand by Class? A class is a user-defined datatype and acts as a blueprint for its instances.

What do you understand by Constructor? A constructor is code that is invoked when an object is created from the class blueprint.

What do you understand by Method? A method is a block of code or collection of statements that has a specific purpose and can be reused multiple times in a code.

Apex Salesforce documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm

Apex Hours Playlist: https://www.youtube.com/watch?v=68X85SxAU1g&list=PLaGX-30v1lh1e8roeCUumUEel5ukdPubj&ab_channel=SalesforceApexHours

Apex Palylist Shrey: https://www.youtube.com/watch?v=IFX_lZhbP6A&list=PLWgzSrReOBh4JSM4CC5OGt1O8q26QCpz7&index=5&ab_channel=SalesforceHulk

Run apex code in VS Code and connect with org: https://youtu.be/l_WKCX0hgXE?si=mjkDhgWGFRs3SKIu

Features of Apex: https://www.saasguru.co/features-of-salesforce-apex-programming-language/

Apex Governor Limits:

  • Per-Transaction Limits

SOQL Queries: Total number of SOQL queries in code: 200 Maximum number of records retrieved by SOQL queries: 50,000

SOSL Queries: Total number of SOSL queries: 20 Maximum number of records retrieved by a single SOSL query: 2,000

DML Statements: Total number of DML statements: 150 Maximum number of records processed by a DML statement: 10,000

Callouts: Total number of callouts (HTTP or web services) in a transaction: 100

Heap Size: Maximum heap size: 12 MB

Email: Total number of sendEmail methods: 10

Workflow and Processes: Total number of rules fired: 500

  • Email Limits

Maximum number of recipients per email (single email): 5,000 Maximum number of external email addresses per day for sandbox: 10 Maximum number of external email addresses per day for production: 5,000

  • Batch Apex Limits

Maximum number of batch Apex jobs queued or active: 100 Maximum number of batch Apex job start method concurrent executions: 1 Maximum batch size: 2,000 Maximum number of batch Apex job executions per 24-hour period: 250,000

  • Apex Trigger Limits

Maximum trigger depth: 16 (a single trigger can be called recursively up to 16 times)

  • Custom Settings Limits

Maximum number of custom settings: 300

Apex Optimization Tools:

  1. Salesforce Optimizer: It is a inbuilt tool provided by salesforce to optimize your entire org and provides suggestions for optimizing code including Apex classes and Triggers, as well other configurations like fields, profile and permission set.

Salesforce Optimizer: https://youtu.be/FWDE7I-8vBA?si=fjBUG4oXJChN8Vsy

  1. PMD (Programming Mistake Detector) for Apex:

PMD For Apex: https://youtu.be/SHrNZ65iuMs?si=julCHFEnuU489UjN