PD1 Test - Version 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What's the syntax for a SOQL For Loop?

for (List<Account> var: [SELECT Id,Name FROM Account]) { System.debug(var); }

What is the syntax for a SOQL For Loop that only retrieves one sObject?

for (Merchandise__c tmp : [SELECT Id FROM Merchandise__c]) { // Perform some actions on the single merchandise record. }

What is the syntax for a SOQL For Loop that only retrieves a list of sObjects?

for (Merchandise__c[] tmp : [SELECT Id FROM Merchandise__c]) { // Perform some actions on the single merchandise record. }

What does the following methods do? System.debug(Limits.getDMLStatements() + ',' + Limits.getLimitsDMLStatements());

getDMLStatements() method shows you the number of DML calls that have been used so far. getLimitsDMLStatements() shows you the total number of calls that can be made.

Event-driven Architecture: what is a channel?

the path that a stream follows

In theory, you could use a VF page to generate a PDF document

true

When upserting records with Apex, what is they syntax to include an external id?

upsert leadsToInsertOrUpdate External_Application_Id__c;

Which DML statements are particular to Salesforce?

upsert; merge

How can you convert a data to a string?

valueOf(dateToConvert) Returns a String that represents the specified Date in the standard "yyyy-MM-dd" format. Date myDate = Date.today(); String myString = String.valueOf(myDate);

What can you add to a class to apply the record visibility by the running user?

with sharing

What is anonymous code?

1. Code not stored in the org 2. Data changes are committed 3. Use to quickly run and evaluate code 4. Code is used in user mode with sharing 5. Governor limits cannot be reset 6. Code coverage is not provided

Which items are not counted and do not impact CCP?

1. Comments 2. Class name definition 3. Lines that only contain brackets 4. System.debug statements

Which namespace provides pre-built Aura components that can be used in an app?

'lightning' namespace

What is the formula for Code Coverage Percentage (CCP)?

(Number of Covered Lines) / (Number of Covered Lines + Number of Uncovered Lines)

What wild cards can be used with a SOSL search?

- * - ?

Local variables have these characteristics:

- They're associated with the block of code in which they're declared. - They must be initialized before they're used.

What are unit tests?

1. Code is stored in the org 2. Data changes are not committed 3. Used to verify that code works as expected 4. Code is run in system mode without sharing 5. Code can be run as another user 6. Governor limits can be reset 7. Code coverage is calculated and provided

What actions can a developer perform in a before update trigger?

1. Change field values using the Trigger.New context variable 2. Display a custom error message

The following sections cover the different development models of building or customizing applications in Salesforce:

1. Change set development model 2. Org development model 3. Package development model

Describe content types for LWC

1. Component JS file 2. Component HTML file 3. Component tests 4. Component config file 5. Component CSS file 6. Component SVG icon

Create test data from static resources

1. Create CSV test data file 2. Load it as a static resource

What does this code do? sObject s = new Account(); Account a =s; This will give error so you need to type Cast this Account a=(Account)s;

1. Create a generic sObject s based on Account 2. The second line would give an error 3. Need to cast the s sObject into account before assigning to a

Programmatic Logic Use Cases - 1

1. Create custom web service: Apex 2. Create custom email service: Apex 3. Create custom validation: Apex 4. Create custom user interface: VF 5. Create a report with custom format: VF 6. Define custom navigation patterns: VF

More Steps for REST Apex

1. Create the Apex class that is exposed as a REST service 2. Then you try calling a few methods from a client 3. Write unit tests

What are three ways to evaluate WF?

1. Created 2. Created & Everytime It's Edited 3. Created & Everytime It's Edited To Subsequently Meet Criteria

What happens when you use @isTest syntax with a class definition?

Public test utility classes are annotated with @isTest to exclude it from the org's code size limit and execute in test context

SOSL ? Wildcard

Question marks match only one character in the middle or end of your search term. For example, a search for jo?n finds items with the term john or joan but not jon or johan. You can't use a ? in a lookup search.

VF Custom Controller

Custom controllers and controller extensions can be written to override existing functionality, customize navigation, use callouts and web services, or have finer control over information access.

LWC: Static resources

Archives (such as *.zip and *.jar files), images, style sheets, JavaScript, and other files in Static Resources can be imported into the component using @salesforce/resourceUrl scoped module

A user selects a value from a multi-select picklist. How is this selected value represented in Apex?

As a string.

What can be added to a console to display a VF page?

Custom console component to the sidebar or footer

What platform features are part of the control layer in the MVC model?

Declarative and programmatic (VF controllers or Apex classes)

When do you define a method as private?

Declare methods as private when these methods are only to be called within the defining class and are helper methods.

VF Action Aware Tags: <apex:actionFunction>

Defines a JavaScript function that calls an action

HTTP Method: DELETE

Delete a resource identified by a URL.

What happens with deployed metadata with existing metadata?

Deployed metadata is not merged with existing metadata in the org, but overwrites it. Also, a renamed metadata component will be received as a new component.

Implement Apex Class: Testing Custom Code

Design, build, and perform unit tests.

Which clause is used to specify the word or phrase to search for in SOSL?

FIND

All methods in a test class have to be test methods

False

Cross-object fields can reference child objects.

False

It is mandatory to specify an access modifier when declaring inner classes.

False

User permissions and field-level permissions in the System.runAs method ARE enforced.

False

You can debug a flow as another user in production.

False

You can delete records with PB

False

You can modify unrelated record with PB

False

You cannot create unrelated records with PB

False

You have to use an access modifier in the declaration of an inner class

False

A Lightning Web Component can contain an Aura Component.

False.

Cross-object fields can be referenced in roll-up summary fields.

False.

Parallel blocks do not allow the same variable to be defined.

False.

The data type of a custom field that is referenced by Apex code or a Visualforce page can be changed.

False.

Only certain records in Salesforce is natively represented as an sObject in Apex

False. All records.

The flow test coverage requirement applies to processes and flows, including flows that have screens.

False. Does not include screen flows.

A class can only have one constructor

False. It can have a constructor that takes no values or multiple constructors that take different types of values.

A top level class can have the 'private' access modifier

False. It needs to be 'public' or 'global.'

Where can Lightning Components be made available?

Mobile app, Lighting Experience, and communities

Trigger Context Variables: isInsert

Returns true if this trigger was fired due to an insert operation, from the Salesforce user interface, Apex, or the API.

Types of Exceptions: RequireFeatureMissing

Problem when code requires feature that has not been enabled

Types of Exceptions: NoSuchElementException

Problem when trying to access a list item that is out of bounds

Types of Exceptions: JsonExeception

Problem with JSON serialization and deserialization

Types of Exceptions: SearchException

Problem with SOSL queries using search call(

Types of Exceptions: DmlException

Problem with a DML statement like insert or delete

Types of Exceptions: CalloutExeception

Problem with a web service operation

Types of Exceptions: AsyncException

Problem with asynchronous operation

Types of Exceptions: SerializationException

Problem with data serialization in Visualforce

Types of Exceptions: NullPointerException

Problem with dereferencing a null variable

Types of Exceptions: Email Exception

Problem with email, such as delivery failure

Types of Exceptions: ExternalObject Exception

Problem with external object records

Types of Exceptions: SObjectException

Problem with inserting or updating sObject records

Types of Exceptions: ListException

Problem with lists, such as trying to access an index out of bounds

Types of Exceptions: MathException

Problem with mathematical operations such as division by zero

Types of Exceptions: SecurityException

Problem with static methods in Crypto class

Types of Exceptions: StringExeception

Problem with string usage and operations

Types of Exceptions: XmlException

Problem with the XmlStream classes, such as failure to read XML

Types of Exceptions: TypeException

Problem with type conversion of variable

Types of Exceptions: NoAccessException

Problem with unauthorized access to objects

Types of Exceptions: QueryExeception

Problem with using SOQL query for assignment

What are Apex property definitions?

Property definitions include one or two code blocks, representing a get accessor and a set accessor: 1. The code in a get accessor executes when the property is read. 2. The code in a set accessor executes when the property is assigned a new value.

What is the accurate construction for a custom controller named "MyController"?

Public MyController(){account = new Account();} Custom controllers don't have a parametrized constructor.

How should a developer create a new custom exception class ?

Public class CustomException extends Exception{}

Which class can contain reusable code for test data creation?

Public test utility class, a.k.a., Test Data Factory

Trigger Context Variables: isUpdate

Returns true if this trigger was fired due to an update operation, from the Salesforce user interface, Apex, or the API.

Debugging Flows: Rollback Mode

Rollback mode, which rolls back database changes after the flow finishes, can be enabled for auto-launched flows.

Asynchronous Apex: Future Methods

Run in their own thread, and do not start until resources are available. Common scenario: Web service callout.

Asynchronous Apex: Batch Apex

Run large jobs that would exceed normal processing limits. Common scenario: Data cleansing or archiving of records.

PARENT-TO-CHILD EXAMPLE

SELECT Name, (SELECT LastName FROM Contacts) FROM Account

Which SOQL query successfully returns the Accounts grouped by name?

SELECT Name, Max(CreatedDate) FROM Account GROUP BY Name Name needs to be part of the SELECT Statement

How do you order SOQL query results?

SELECT Name,Phone FROM Account ORDER BY Name ASC

Show a complex SOQL statement

SELECT Name,Phone FROM Account WHERE (Name = 'SFDC Computing' AND NumberOfEmployees>25) ORDER BY Name LIMIT 10

How do you write and advanced SOQL WHERE clause?

SELECT Name,Phone FROM Account WHERE (Name='SFDC Computing' AND NumberOfEmployees>25)

Unit Tests: Annotation and Access

Test classes and methods must be annotated with @isTest and can be either private or public

Test Data Set Up

Test data can be set up using @testSetup annotation, Test Data Factory, or test methods

Unit Tests: Test Data Requirement

Test methods are used to test functionality and data, so test data should be available

Unit Tests: Test Method Definition

Test methods should be static, return no values(void), and accept no parameters

What test options are available for change sets?

Test options available for deployment are 'Default', 'Run Local Tests', 'Run All Tests', and 'Run Specified Tests'

What can be used to create test data once and access it throughout the test class?

Test setup method

What can be used to populate test data without using code to create test records?

Test.loadData method with static resource for the csv file containing test records

What methods can be used to test governor limits?

Test.startTest()and Test.stopTest() methods, which can only be called once in each test method, can be used in conjunction with Limits methods to test governor limits by determining the proximity of Apex code to reaching the governor limit.

In what two modes can tests run using SOAP API calls and object?

Tests can be run synchronously or asynchronously using SOAP API calls and objects.

How are test executed in the Apex Test Execution page run?

Tests that are executed in the Apex Test Execution page are run asynchronously.

Apex Get Method

The "get" method is used to pass data from your Apex code to your Visualforce page.

Apex Set Method

The "set" method is used to pass values from your Visualforce page to the controller.

Flow Test Coverage

The testing coverage percentage requirement for flows is independent from the Apex code coverage requirement and is set manually in Setup.

Explicitly throw an exception

The throw keyword can be used to throw an exception.

Trigger Context Variables: size

The total number of records in a trigger invocation, both old and new.

Total Stack Depth Before Reaching Governor Limits

The total stack depth allowed for recursive Apex triggers that are invoked due to insert, update, or delete statements is 16. - A recursive Apex trigger occurs, for example, when a trigger invokes another trigger. Then, the invoked trigger also invokes the trigger that invoked it, which results in a recursive loop - At the 17th trigger invocation, an exception will be thrown, and any changes made will be rolled back

What does the upsert DML statement do?

The upsert DML operation creates new records and updates sObject records within a single statement, using a specified field to determine the presence of existing objects, or the ID field if no field is specified.

Best Practices for Apex Classes & Triggers: USE QUERIES AND FOR LOOPS EFFICIENTLY

The use of multiple SOQL queries to retrieve the records of a single object should be avoided if a single query with multiple filters can be utilized. Relationships can be utilized to reduce the number of queries required to retrieve the records. Also, the use of multiple for loops to loop through records should be avoided, if a single for loop with if statements can be used instead.

VF: View State Limit

The view state holds the state of the components on the page such as field values and has a limit of 170KB

VF: View State Usage

The view state is automatically created and used to store state across multiple pages such as in a wizard

Virtual definition modifier

The virtual definition modifier declares that this class allows extension and overrides. You cannot override a method with the override keyword unless the class has been defined as virtual.

When do you create a static variable?

There are times when you need to have a member variable whose value is available to all instances, for example, a stock threshold variable whose value is shared with all instances of the class, and any update made by one instance will be visible to all other instances. This is when you need to create a static variable. Static variables are associated with the class and not the instance and you can access them without instantiating the class. You can use the static variable without instantiating the class.

Trigger Context Variables: Trigger.New

Trigger.New contains all the records that were inserted in insert or update triggers

Trigger Context Variables: Trigger.Old

Trigger.Old provides the old version of sObjects before they were updated in update triggers, or a list of deleted sObjects in delete triggers.

Trigger Timing

Trigger.isBefore and Trigger.isAfter can be used to determine if the trigger was fired before any records were saved or after all records were saved.

Trigger.isExecuting

Trigger.isExecuting can be used to determine if the current context of an Apex code that is being executed is a trigger.

Trigger DML Event

Trigger.isInsert, Trigger.isUpdate, Trigger.isDelete, andTrigger.isUndelete can be used to determine the DML event type that fired the trigger.

Trigger Context Variables: Trigger.new

Trigger.new contains a list of the new versions of sObject records that is available in insert, update, and undelete triggers.

Trigger Context Variables: Trigger.newMap

Trigger.newMap contains a map of the updated versions of the sObject records.

Trigger Context Variables: Trigger.old

Trigger.old returns a list of the old versions of the sObject records. This sObject list is only available in update and delete triggers.

Trigger Context Variables: Trigger.oldMap

Trigger.oldMap contains a map of the previous versions of the sObject records.

Break down the following SOSL query: SOSL text searches are case-insensitive. For example, searching for Customer, customer, or CUSTOMER all return the same results.

True

Built-in exceptions cannot be thrown explicitly. They are only caught.

True

By default, a method or variable is private and is visible only to the Apex code within the defining class. You must explicitly specify a method or variable as public in order for it to be available to other classes.

True

By default, the allOrNone parameter is true for database methods, which means that the Database method behaves like its DML statement counterpart and will throw an exception if a failure is encountered.

True

CSRF protection can fail if Visualforce pages include state changing operations.

True

Class and trigger trace flags do not cause debug logs to be generated or saved. They are created to override logging levels that are set by other debug levels such as ones defined by user trace flags

True

Classes with the @InvocableMethod annotation will be available to flows, processes, and the REST API.

True

Custom exceptions can be created and are designed to be thrown explicitly.

True

Custom metadata type records can be referenced from a Process Builder formula so that, if the value needs to be changed, the custom metadata type value can be changed instead of hardcoding a value in a formula.

True

DML statements can be executed in two ways, either standalone or as a Database class method.

True

Data Import Wizard does not support all standard objects but supports all custom objects

True

Database class methods allow for partial processing, e.g., if one record fails, processing continues.

True

Debug logs can be setup for specific users, classes and triggers.

True

Define any method that uses the webservice keyword as static.

True

DescribeFieldResult

True

DescribeTabResult

True

DescribeTabSetResult

True

ETL tools such as Jitterbit can be used for enterprise-scale import jobs

True

Each DML statement accepts either a single sObject or a list (or array) of sObjects.

True

Ensure that the trigger execution context is understood, so that governor limits are not exceeded. For example, cascading triggers will be part of the same execution context.

True

Every VF standard controller includes a getter method that returns the record specified by the id query string parameter in the page URL.

True

Every Visualforce includes an anti-CSRF token as a hidden form field that can prevent a CSRF attack. However, in this particular case, the init() method is called before the Visualforce page is rendered in the user's browser.

True

Every value that is calculated by a controller and displayed in a page must have a corresponding getter method.

True

Exceeding governor limits halts processing of code and causes LimitException which cannot be caught using exception handling.

True

Exceptions thrown due to the failure of assertion statementslike System.assert cannot be caught.

True

Expressions in Visualforce page markup using the general pattern {! expression_name }automatically connect to the getter method to get access to the data

True

External ID fields are indexed, so searching should perform quicker.

True

External IDs are often created with the 'Unique ID' setting enabled so that External ID values are unique to each record inside Salesforce

True

Fields on related records can't be updated with the same call to the DML operation and require a separate DML call

True

Final variables can only be assigned a value once, either when you declare a variable or inside a constructor. You must assign a value to it in one of these two places.

True

he required percentage for flows and processes is independent from the Apex code coverage requirement. Its minimum test coverage percentage can be defined in Process Automation Settings

True

One of the most important considerations related to the use of change sets is that they cannot delete or rename components.

True

Only use Batch Apex if you have more than one batch of records. If you don't have enough records to run more than one batch, you are probably better off using Queueable Apex.

True

Overriding tabs only works when the Visualforce page uses the standard list controller for that tab, a custom controller, or no controller.

True

SOQL For loops can process records one at a time using an sObject variable, or in batches of 200 sObjects at a time using an sObject list.

True

SOQL injection can potentially occur when user-supplied input is used to construct a dynamic SOQL statement.

True

SOSL allows searching text, email, and phone fields across multiple objects simultaneously.

True

SOSL searches performed in a test return empty results. To ensure predictable results, use Test.setFixedSearchResults() to define the records to be returned by the search.

True

Salesforce has implemented filters that screen out harmful characters in most output methods as one of the anti-XSS defences.

True

Single quotes have a special meaning in Apex—they enclose String values— you can't use them inside a String value unless you escape them by prepending a backslash (\) character for each single quote.

True

Standalone DML does not allow partial record processing.

True

Static methods are easier to call than instance methods because they don't need to be called on an instance of the class but are called directly on the class name.

True

Static variables and methods can only be used with outer classes.

True

A user who does not have the "View Encrypted Data" permission will see the field with masked characters.

User will only see masked characters, but can override the information.

You can save up to 6 MB of Apex code in each org. Test classes annotated with @isTest don't count toward this limit.

True

You can't call a future method from a future method. Nor can you invoke a trigger that calls a future method while running a future method.

True

You can't have a long area text field (including rich text area) in a SOQL Where clause.

True

You can't throw built-in Apex exceptions. You can only catch them

True

You cannot use the webservice keyword in a trigger.

True

You cannot use the webservice keyword to define an interface, or to define an interface's methods and variable

True

What are the Apex data types? User-defined Apex classes

User-defined Apex classes

You create an interface the same way that you create a class and then it can be called by different classes

True

You must use one of the access modifiers (such as public or global) in the declaration of a top-level class

True

You need VF page to show radio buttons

True

With standard case assignment rules, to what entities can cases be assigned

Users and queues.

What are some SOQL sorting limitations?

You can sort on most fields, including numeric and text fields. You can't sort on fields like rich text and multi-select picklists.

What is the difference between PUT and PATCH?

You can update records with the PUT or PATCH HTTP methods. The PUT method either updates the entire resource, if it exists, or creates the resource if it doesn't exist. PUT is essentially an upsert method. The PATCH method updates only the specified portions of an existing resource.

What is the hierarchy of conversion?

Integer -> Long -> Double -> Decimal

Which Apex primitive data types do not use decimals?

Integer and Long

How can you typecast a string into a intenger?

Integer countMe = Integer.valueof('10') + 20;

Which data types are supported by switch statement expressions?

Integer, Long, sObject, String, and Enum

Additional points about classes and interfaces

- A class can implement multiple interfaces by separating the names of the interfaces with a comma after the implements keyword - The class that implements an interface must provide the body for all the methods specified in the interface - An interface allows for different implementations of a method based on the specific application

For a Record-Triggered Flow, what are the possible triggers?

- A record is created - A record is updated - A record is created or updated - A record is deleted

What are the requirements for a class definition?

- Access modifier - class keyword - Name of class

When do you use After triggers?

- Additional complex operations need to be performed after a record is saved, such as create, update, or delete records in another object - Field values of newly saved records need to be accessed such as record Id, etc. Events: - After insert - After update - After delete - After undelete

What is an interface?

- An interface is a class that only includes method signatures. The methods are not implemented in the interface. Another class must be created to supply the implementation. - The body of each interface method in an interface is empty. - A class that implements an interface must use the 'implements' keyword.

Interfaces

- An interface is a named set of method signatures (the return and parameter definitions), but without any implementation - They separate the specific implementation of a method from the declaration for that method - This way, you can have different implementations of a method based on your specific application

What is batch Apex important?

- Batch Apex breaks the record set down to smaller batches so governor limits are not reached

Batch Apex Class

- Batch Apex can be used to execute complex, long-running operations over small batches of thousands of records and requires creating a class that implements a built-in interface - The Database.executeBatch method can be used to execute a batch Apex job. It requires two parameters: an instance of the batch Apex class and an optional scope (number of records to pass into the method)

What are the two types of Apex triggers?

- Before triggers are used to update or validate record values before they're saved to the database. - After triggers are used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records. The records that fire the after trigger are read-only.

What is an instance method?

- Belongs to a class and does not use the static keyword - In order to use it, class needs to be instantantiated first

CHILD-TO-PARENT QUERY

- Child-to-parent relationships can be specified directly in the SELECT, FROM, or WHERE clauses using the dot (.) operator

Invoke Apex Using Flows: PROCESS.PLUGIN INTERFACE

- Classes implementing the Process.Plugin interface will be available in flows only - Not recommended by Salesforce - Does not support bulk operations - Blob, Collection, sObject, and Time data types are not supported by Process.Plugin - The interface exposes the Apex class as a service that accepts input values and returns output back to the flow

Invoke Apex Using Flows: Invocable Method

- Classes with @InvocableMethod annotations are available in flows, processes, and Rest API - Recommended by Salesforce - Supports bulk operations - Invocable methods support list of, or list of lists of primitive data types, sObjects types, and generic sObjects as input/output values - Support for sObject data types in invocable methods enable one Apex action to be used for multiple types of objects

Apex class runs in system context by default. What does that mean?

- Code has access to all data in the org - Object permissions, FLS, and sharing rules of the current user are ignored - Code can modify all data -

When do you use Before triggers?

- Complex validation needs to be performed before allowing a record to be saved or deleted - Field values of a record need to be set or modified before it is saved Events: - Before insert - Before update - Before delete

Cross-Site Scripting (XSS)

- Cross-site scripting is when malicious content such as JavaScript / VBScript / HTML is inserted into a web page and executed - The script can take advantage of the user's session and use it to submit transactions, read data, or alter the page using HTML / CSS

What Apex method can you used to clear data storage in a Salesforce org?

- Database.emptyRecycleBin()method can be used to help free up storage in the org - The Database.emptyRecycleBin() method, regardless of how many records are processed in a single call, increments the DML counter by 1 only regarding the number of DML statements issued

Invoke Flows from Apex

- Flows can be started from an Apex method by specifying the flow name either statically or dynamically - The start method of the Flow.Interview class can be used to run autolaunched or user provisioning flows - The getVariableValue method can be used to return the value of the specified flow variable - The start method does not have a return type, while getVariableValue has the return type of Objec - A flow needs to be activatedfirst before it can be invoked from Apex through user interaction

SOQL Queries: Governor Limits

- Governor limits exists that enforce a maximum number of SOQL queries that can be performed in a transaction - All the necessary data should be retrieved in a single query, the results placed in a collection, then the results iterated over

LWC Component Configuration File

- It defines the metadata values for the component including the design configuration - It follows the naming convention <component>.js-meta.xml, such as searchForm.js-meta.xml

What are some considerations for using future methods in Apex?

- Max 10 @future methods can be invoked from a trigger - Do not place an @future method in a for loop within the trigger

Trigger Design Patterns: One Trigger per Object

- One trigger is created on an object for all possible events - A class can store the logic for the trigger, making it logic-less - This allows controlling the order of execution - This helps to avoid exceeding limits due to multiple triggers

Binding Data Based on URL Parameter in VF Page

- Page parameter: data context is provided to controllers by the id parameter of the page. - Retrieve parameters: the getParameters() method can be used to retrieve parameters passed to the URL - Parameter maps: the method getParameters()returns a map of the query string parametersin the page URL The following custom controller binds the page to an opportunity record whose id is captured from the URL in constructor method: opp = [SELECT Id, Name FROM Opportunity WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

What are platform events?

- Platform events can be utilized to connect business processes in Salesforce and external systems and exchange messages in near real-time - They are based on event-driven architecture that revolves around the use of the publisher-subscriber model - A publisher broadcasts a message that is received by one or more subscribers - Event messages can be published from a Salesforce app or an external app. Similarly, both Salesforce and external apps are capable of subscribing to those messages

CHILD-TO-PARENT EXAMPLE

- SELECT Id, Name, Account.Name FROM Contact WHERE Account.Rating = 'Cold'

Trigger Design Patterns: Bulk Triggers

- Sets and maps are used for bulk processing of records - The trigger is designed to process thousands of records at once - One DML statement is used for operations - Trigger minimizes DML calls to not exceed governor limits

A SOSL SearchQuery contains two types of text

- Single Word— single word, such as test or hello. Words in the SearchQuery are delimited by spaces, punctuation, and changes from letters to digits (and vice-versa). Words are always case insensitive. - Phrase— collection of words and spaces surrounded by double quotes such as "john smith". Multiple words can be combined together with logic and grouping operators to form a more complex query.

How can you use a scratch org?

- Start a new project - Start a new feature branch - Test a new feature - Start automated testing - Perform development tasks directly in an org - Start from "scratch" with a fresh new org

SOSL allows you to specify what search criteria?

- Text expression (single word or a phrase) to search for - Scope of fields to search - List of objects and fields to retrieve - Conditions for selecting rows in the source objects

ImagePROXYURL Function

- The IMAGEPROXYURL function can be used to securely retrieve images and protect users from unauthorized requests - The IMAGEPROXYURL function can be included on the 'src' attribute of a <img> tag or the 'value' attribute of an <apex:image> object

What are the three data types associated with dates & times?

- The Time data type stores times (hours, minutes, second and milliseconds). - The Date data type stores dates (year, month and day) - The Datetime data type stores both dates and times

DML: Delete Statement

- The delete statement can be used to delete one or more existing sObject records - The delete keyword followed by the sObject or list of sObjects is used for the delete DML operation

String Class Methods

- The endsWith method returns true because the string ends with the same string as that in the argument. - The length method returns the length of the string. - The substring method produces a new string starting from the character specified in the first index argument, counting from zero, through the second argument. - The replaceAll method replaces each substring that matches a regular expression with the specified replacement. In this case, we match for text within exclamation points, and replace that text with what was matched (the $1).

DML: Insert Statement

- The insert DML operation adds one or moresObject records to the database - The insert keyword followed by the sObject or list of sObjects is used for the insert DML operation.

DML: Merge Statement

- The merge statement can be used to merge up to three records of the same sObject type - The merge keyword followed by the master record and any othe rrecords can be used to perform the merge DML operation

How are custom objects referred to in SOQL?

- The relationship name for a custom object used in a query must be appended with __r instead of __c. For example, Shipments__r and Agreements__r - SELECT Id, Name, Mother__r.Name FROM Child__c WHERE Father__r.Name LIKE 'Bill%'

Every LWC - UI must have an HTML file. A service component does not require this file.

- The root tag of the HTML file is <template> which will contain the component's HTML - The naming convention is <component>.html in as searchForm.html - When a component renders, the <template> tag is replaced with the name of the component where "c" is the default namespace

Best Practices for Apex Classes & Triggers: Safe Navigation Operator

- The safe navigation operator (?.) can be used to avoid null pointer exceptions. When an expression attempts to operate on a null value, null is returned instead of the NullPointerException thrown - The operator can be used in the following syntax: a = b?.c where null will be returned to a if b evaluates to null. Otherwise, b.c will be returned. Using the ternary operator, it can also be interpreted as: a = (b == null) ? null : b.c

DML: Undelete Statement

- The undelete statement can be used to restore one or more existing sObject records - The undelete keyword followed by the sObject or list of sObjects is used for the undelete DML operation - The ALL ROWS keyword is used to query all rows for both top level and aggregate relationships including deleted records and archived activities

DML: Update Statement

- The update statement can be used to modify one or more existing sObject records - The update keyword followed by the sObjector list of sObjects is used to perform update DML operation

Static methods, variables, and initialization code have these characteristics:

- They're associated with a class. - They're allowed only in outer classes. - They're initialized only when a class is loaded. - They aren't transmitted as part of the view state for a Visualforce page.

Instance methods, member variables, and initialization code have these characteristics:

- They're associated with a particular object. - They have no definition modifier. - They're created with every object instantiated from the class in which they're declared.

DML: Upsert Statement

- To determine whether a record already exists, the upsert statement or Database method uses the ID of the record as the key to match records, a custom external ID field, or a standard field with the idLookup attribute set to true - If the key is not matched, a new object record is created. If the key is matched once, the existing object record is updated - If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated

Trigger Design Patterns: Trigger Handler Class

- Trigger delegates logic to a handler class - Handler methods are created based on context - Routing logic using if-else statements can be used - New functionality can be added without modifying the trigger

What are some differences between SOQL and SOSL?

- Unlike SOQL, which can only query one standard or custom object at a time, a single SOSL query can search all objects. - Another difference is that SOSL matches fields based on a word match while SOQL performs an exact match by default (when not using wildcards). - Use SOQL to retrieve records for a single object. - Use SOSL to search fields across multiple objects. SOSL queries can search most text fields on an object.

What are Lightning Web Components?

- Use core web standards such that it enables it to run natively on browsers. It is lightweight and is optimized for increased performance - The types of content they can contain such as HTML, JavaScript, CSS, SVG, configuration and test files.

When do you use a standard controller with VF?

- Use when a Visualforce page requires basic functionality - Use when standard actions do not need to be customized

When do you use a standard set controller with VF?

- Used to create a custom list controller or extend the pre-built Visualforce list controller - Add features not supported by standard list controllers such as custom sorting

When do you use a standard list controller with VF?

- Used to display a list of records - Use list view filters on a Visualforce page - Create a Visualforce page with pagination features

When do you use a controller extension with VF?

- Used to extend or override a standard action - Add a custom button to a page - Build a page that respects user permissions

When do you use a custom controller with VF?

- Used to implement total custom logic - Use if the page needs to use web services or HTTP callouts - Create a page with new actions - Customize user navigation

VF & HTML/CSS

- VF automatically adds required HTML tags to a page to ensure that the output is a valid HTML document. However, this behavior can be overridden - Inline CSS code can be defined for HTML tags like in a regular HTML page

A class with inherited sharing will run as 'with sharing' when used as what?

- VF page or Lighting Component - Apex REST service - Entry point to an Apex transaction

When should you use APIs vs. platform events?

- When you are building a true Web Service - When you are dealing with data instead of a simple notifications - When you want the service/data available across the lifecycle

When should you use platform events vs. APIs?

- When you want to design a Pub/Sub integration model - When you don't want to transfer lot of data - When you only want to "notify" a subscriber with an event or message with minimal information for them to act upon - When you want your notification to be transient in nature

What are some methods that you can use to manage a list?

- add() - get() - remove() - set()

What DML statements are available?

- insert - update - upsert - delete - undelete - merge

Instance methods, member variables, and initialization code have these characteristics:

-They're associated with a particular object. - They have no definition modifier. - They're created with every object instantiated from the class in which they're declared.

Declaring a controller

//1 (correct) ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Id From Account')); //4 (correct) ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.query('SELECT Id From Account')); //5 (correct) ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id From Account]));

What are two testing considerations when deploying code from sandbox to production?

1. 100% of test must execute without failure 2. Need 75% test coverage

What are the HTTP methods that you can use with Apex REST?

1. @HttpGet: read 2. @HttpPost: create 3. @HttpDelete: delete 4. @HttpPut: upsert 5. @HttpPatch: update

When can a VF page be embedded on a Lighting Record Page?

1. A VF page can be embedded on a Lightning Record page using the VF standard Lightning component when the Available for Salesforce mobile apps and Lightning pages settings of the page is enabled 2. Another method of loading a VF page is by adding the page in the page layout of the object. The page layout is displayed through the standard Record Detail component. However, the VF page must only implement the standard controller of the object that is associated with the page layout in order for it to appear as an option in the page layout editor.

How is a flow called from Apex?

1. A flow can be called from Apex code using the Flow.Interview system class 2. The start method of the Flow.Interview class can be used to launch an auto launched flow or user provisioning flow from Apex

Data Import Wizard: Matching Records

1. Accounts: Name and Site 2. Contacts: Name or Email 3. Leads: Name or Email 4. Solutions: Title 5. Campaign Members: no matching options

What data types can be used with a Switch statement?

Integer, Long, sObject, String, or Enum

List some standard Lightning Components

1. Actions & recommendations 2. Dashboard 3. Einstein next best action 4. List view 5. Recent items 6. Record detail 7. Related list - single component 8. VF page

What are use cases for after triggers?

1. Additional complex operations need to be performed after a record is saved, such as create, update, or delete records in another object. 2. Field values of newly saved records need to be accessed, such as record id.

The following lists the different options or modes available when running tests in the Apex Test Execution page:

1. All or individual classes 2. Parallel test execution 3. Skip code coverage 4. Asynchronous execution

What are three characteristics of static methods?

1. Allowed only in outer classes 2. Initialized only when a class is loaded 3. Are not transmitted as part of the view state for a VF page

What are the steps for using check points?

1. An Apex class or trigger is opened in the Developer Console 2. The margin to the left of the line number where the check point must be set should be clicked 3. The code is executed with the Developer Console open 4. Check points and results can be viewed on the Checkpoints tab

What flow elements can be used to call Apex?

1. Apex Plug-In 2. Call Apex

Apex REST supports these data types for parameters and return values:

1. Apex primitives (excluding sObject and Blob). 2. sObjects 3. Lists or maps of Apex primitives or sObjects (only maps with String keys are supported). 4. User-defined types that contain member variables of the types listed above.

The following tools can be used to run unit tests in Salesforce:

1. Apex test execution 2. Aplex class page (run all tests) 3. Developer console 4. Visual Studio Code 5. API

What will automatically obey OWDs and sharing settings for the user who executes the code in a Salesforce org?

1. Apex triggers 2. Anonymous blocks

Which three options allow a developer to use stylesheets?

1. Apex<stylesheet> tag 2. A static resource 3. Inline CSS

When a record-triggered flow is configured to run before the record is saved, which elements will be available to the flow?

1. Assignment 2. Decision 3. Get Records 4. Loop

Change sets created in an org are called outbound change sets and must meet certain requirements in order to be deployed successfully. What are the requirements?

1. At least 75%of Apex code must be covered by unit tests, and all of the tests must pass and complete successfully. 2. The testing coverage requirement for flows that are deployed as active is independent from the Apex code coverage percentage requirement. 3. Outbound change sets are those that are created in the source org and uploaded to the destination org.

In which two trigger types can a developer modify the new sObjects that are obtained by the trigger.new context?

1. Before Update 2. Before Insert

For a Record-Triggered Flow, when can you run the flow?

1. Before the record is saved: If all you need is to update the record that launches the flow, select this option to quickly build a high-performance flow. To update the record, simply use an Assignment element to set fields on the $Record global variable. 2. After the record is saved: To build a richer flow that can access any record and perform actions, select this option. This flow can access most flow elements. The $Record global variable contains the Salesforce record that launches the flow.

How can you prevent SOQL injection attacks?

1. Bind Variables: An input can be enforced to be treated as a variable and not an executable part of the query 2. Typecast Variables: Typecasting is where variables are casted according to their respective data types (e.g., Boolean, Integer) to intentionally throw exceptions when unexpected data types are encountered.

What are the Apex primitive data types?

1. Blob 2. Boolean 3. Date 4. Datetime 5. Decimal 6. Double 7. ID 8. Integer 9. Long 10. Object 11. String 12. Time

What is an accurate statement about the "with sharing" keyword?

1. Both inner and outer classes can be declared as "with sharing" 2. Inner classes do not inherit the sharing setting from the container class

To use Einstein Next Best Action, what steps are performed?

1. Build a flow in Flow Builder that is invoked when a recommendation is accepted or rejected (optional) 2. Create recommendations and choose the flow to run accordingly when a customers accepts or rejects the recommendation 3. Design a strategy in Strategy Builder to provide the appropriate recommendations to users based on records that meet certain criteria 4. Display the recommendations on a Lightning page or App home page using the Einstein Next Best Action component, or on a VF page, or custom app using the lightning:nextBestActioncomponent

Additional facts about custom controllers

1. Built from scratch 2. Run on system mode

How can you start an approval process?

1. Button 2. Link 3. PB 4. Flow 5. Apex

How can a developer avoid exceeding governor limits when using an Apex trigger?

1. By performing DML transactions on lists of sObjects 2. By using maps to hold data from query results

How can a developer refer to, instantiate, a PageReference in Apex?

1. By using the Page object and VF page name 2. By using a PageReference with a partial or full URL

Limit Methods for Testing Governor Limits: determining balance

1. By using the two versions of a certain Limits method, the remaining amount of resource that is still available can be calculated 2. For example, getCallouts method returns the number of callouts already processed, and getLimitCalloutsreturns the total number of callouts available. Subtracting the value of getCallouts from getLimitCallouts returns the balance.

What can you do with process builder?

1. Call Apex Code 2. Invoke a Flow 3. Post to Chatter 4. Invoke another process 5. Submit for Approval 6. Update Related Record 7. Email alerts 8. Custom Notifications 9. Send Survey Information 10. Create Record (including platform event)

What are some application for VF pages?

1. Custom tabs 2. Override home page 3. Buttons and links 4. Lightning experience style sheets 5. Page layouts 6. Dashboard components 7. Custom console components 8. SFDC mobile app menu items 9. Quick actions in mobile apps 10. Community pages

Two data structures and a Schema method are used for accessing sObject and field describe information in Apex. What are they?

1. Data Structures: Token, Describe Results 2. Schema Method: describeSObjects

What type of operations can be handled with bulk triggers?

1. Data import 2. Bulk API calls 3. Mass actions 4. Recursive Apex methods & triggers

When test data is created through a test method or a test data factory class, what should be considered?

1. Data is temporary 2. No data committed 3. Data is rolled back 4. No data persistence 5. No need to delete data

What test options are available when testing change sets?

1. Default 2. Run local test 3. Run all tests 4. Run specific tests

Expose an Apex class as a SOAP Service

1. Define your class as global 2. Add the webservice keyword and the static definition modifier to each method you want to expose. (The webservice keyword provides global access to the method it is added to.) global with sharing class MySOAPWebService { webservice static Account getRecord(String id) { // Add your code } }

Expose an Apex class as a REST Service

1. Define your class as global, and define methods as global static 2. Add annotations to the class and methods 3. For example, this sample Apex REST class uses one method. The getRecord method is a custom REST API call. It's annotated with @HttpGet and is invoked for a GET request. RestResource(urlMapping='/Account/*') global with sharing class MyRestResource { @HttpGet global static Account getRecord() { // Add your code } }

What is required to use change sets in two orgs?

1. Deployment connection 2. Explicit authorization from each org

To calculate the flow test coverage, what steps are performed?

1. Determine active auto-launched flows/processes 2. Run all tests 3. Determine covered flows/processes 4. Calculate test coverage

What are some limits around debug files?

1. Each debug log should not exceed 20 MB size. Older log lines are deleted to reduce the size of larger logs. 2. An org cannot retain more than 1000 MB of debug logs.

Can you you do with workflow?

1. Email alert 2. Field Update 3. Create Task 4. Outbound Message

Key Points About Event Messages

1. Event messages cannot be viewed in the Salesforce UI 2. Event messages cannot be queried using SOQL or SOSL 3. Platform events do not support field-level security

Benefits of Lightning Component Framework

1. Event-driven architecture 2. Pre-defined use cases 3. Increased performance 4. Reduced development times 5. Extensive compatibility

Points about using existing data for testing

1. Existing data can be accessed via SOQL queries, but it is not recommended as the data 2. It is recommended to store data in static resources or create data programmatically.

Using the final Keyword

1. Final variables can only be assigned a value once, either when you declare a variable or inside a constructor. You must assign a value to it in one of these two places. 2. Static final variables can be changed in static initialization code or where defined. 3. Member final variables can be changed in initialization code blocks, constructors, or with other variable declarations. 4. To define a constant, mark a variable as both static and final. 5. Non-final static variables are used to communicate state at the class level (such as state between triggers). However, they are not shared across requests. 6. Methods and classes are final by default. You cannot use the final keyword in the declaration of a class or method. This means they cannot be overridden. Use the virtual keyword if you need to override a method or class.

What type of web content can you use with VF?

1. HTML 2. CSS 3. JavaScript 4. Images, Maps, iFrame (view an external website) These items need to be loaded into Salesforce as static resources.

Points about Apex

1. Hosted—Apex is saved, compiled, and executed on the server—the Lightning Platform. 2. Object oriented—Apex supports classes, interfaces, and inheritance. 2. Strongly typed—Apex validates references to objects at compile time. 3. Multitenant aware—Because Apex runs in a multitenant platform, it guards closely against runaway code by enforcing limits, which prevent code from monopolizing shared resources. 4. Integrated with the database—It is straightforward to access and manipulate records. Apex provides direct access to records and their fields, and provides statements and query languages to manipulate those records. 5. Data focused—Apex provides transactional access to the database, allowing you to roll back operations. 6. Easy to use—Apex is based on familiar Java idioms. 7. Easy to test—Apex provides built-in support for unit test creation, execution, and code coverage. Salesforce ensures that all custom Apex code works as expected by executing all unit tests prior to any platform upgrades. 8. Versioned—Custom Apex code can be saved against different versions of the API.

What Apex Control Statements are avaialable?

1. IF Statement 2. IF-ELSE Statement 3. ELSE-IF Statement 4. Traditional For Loop 5. List/Set Iteration Loop 6. SOQL For Loop 7. While Loop 8. Do-While Loop

What are some considerations when using change sets to deploy metadata?

1. If a deployment is unable to complete for some reason, the entire transaction is rolled back 2. All dependent components should be added as part of a change set to avoid unexpected errors 3. Permission sets are added as a component in the change set, whereas a Profile is added in the Profile Settings for Included Components section 4. Sufficient buffer time ought to be kept in a deployment schedule in order to accommodate for unforeseen delays due to server load

Flow Builder and PB Actions

1. If an action encounters an error in a process or flow, any successful record changes will be saved if the action supports partial save 2. When an action that supports partial save fails, Salesforce attempts to complete the remaining actions in a bulk operation up to three 3 times. 3. For failed actions that do not support partial save, or follows the all or nothing rule, the entire transaction will be rolled back

In a record-triggered flow, two options are available for executing the outcome in a Decision element. What are they?

1. If the condition requirements are met 2. Only if the record that triggered the flow to run is updated to meet the condition requirements

When does workflow run?

1. Immediately 2. Delayed (time-based)

When does flow run?

1. Immediately 2. Scheduled 3. Resumed (when paused)

What are some possible database CPU consumption failure scenarios?

1. Inefficient SOQL queries 2. Incorrect API choice 3. Insufficiently configured reports, dashboards, and list views

What is true about "with sharing"?

1. Inner classes do not inherit the sharing setting from the container class 2. Both inner and outer classes can be declared as with sharing

What are two ways to populate integers from strings?

1. Integer i = myList[0]; 2. Integer j = myList.get(0);

What is the capability of the StandardSetController?

1. It allows pages to perform pagination with large record sets 2. It allows pages to perform mass updates of records

Apex REST supports two formats for representations of resources. What are they?

1. JSON 2. XML

What are the Apex non-primitive data types?

1. List 2. Set 3. Map 4. Enum 5. SObject 6. Class Object

What are the key milestones in application lifecycle when a sandbox is involved?

1. Manage requirements 2. Develop changes in sandbox 3. Test changes 4. Deploy changes to production 5. Notify end users of changes

What attributes are required when declaring an Apex method?

1. Name of the method 2. Data type of the value returned by the method 3. Method parameters, or arguments passed by the method 4. Body of the method enclosed in braces

Restrictions of change sets

1. Need 75% test coverage 2. Not all metada types are supported 3. Cannot control order of components 4. Cannot rename or delete components

Which standard buttons can be overridden with VF?

1. New 2. Edit 3. View 4. Delete 5. Clone 6. Tab & List

What are some ways to create custom exceptions?

1. No arguments 2. With a single String argument that specifies the error message 3. With a single Exception argument that specifies the cause and that displays in any stack trace 4. With both a String error message and a chained exception cause that displays in any stack trace

VF: Custom Controllers

1. No-argument constructor 2. Getter methods 3. Setter methods 4. Action methods

Which three declarative fields are mapped to variable types in Apex?

1. Number maps to integer 2. Date/Time to DateTime 3. Checkbox to Boolean

What type of data can you show on a VF page?

1. Object data 2. Related data 3. Global data 4. User data 5. Static dat

What can SOQL For Loops process?

1. One sObject at at time 2. A list containing up to 200 sObjects

How you render a VF page?

1. Open a Visualforce Page from the App Launcher 2. Add a Visualforce Page to the Navigation Bar 3. Display a Visualforce Page within a Standard Page Layout 4. Add a Visualforce Page as a Component in the Lightning App Builder 5. Launch a Visualforce Page as a Quick Action 6. Display a Visualforce Page by Overriding Standard Buttons or Links 7. Display a Visualforce Page Using Custom Buttons or Links

What are some best practices for bulkifying Apex code in triggers?

1. Operating on all records in the trigger 2. Performing SOQL and DML on collections of sObjects instead of single sObjects at a time

Order of Events - Part 1

1. Original record is loaded or new record is initialized 2. Field values are loaded into sObjects; system validation rules are run if executed from standard UI 3. Before-save auto-launched flows are executed 4. All before triggers are executed 5. System validation rules are run again and custom validation rules run 6. Duplicate rules are executed 7. Record is saved to databased, but not committed 8. All after triggers are executed 9. Assignment rules are executed

How you instantiate a page in Apex?

1. PageReference pageRef = new PageReference('partialURL'); for VF pages in Lightning 1. PageReference pageRef = new PageReference('fullURL'); for external URLs 2.PageReference pageRef = ApexPages.currentPage();

Accurate statements about variable scope

1. Parallel blocks can use the same variable name 2. A variable ca be defined at any point in a block 3. Sub-blocks cannot use the variable name of a parent block

What are two reasons for using a controller extension instead of custom controller?

1. Re-use functionality: When a necessary functionality already exists in the standard or custom controller used in the page. Using a controller extension avoids the need to recreate that functionality 2. Require standard features: Declarative features that depend on a standard controller such as using custom buttons or if the Visualforce page needs to be embedded in the page layout

How do you start workflow?

1. Record Create 2. Record Update

How can you start process builder?

1. Record Create 2. Record Update 3. Another process 4. Platform event

How can you start a flow?

1. Record Create 2. Record Update 3. Record Delete 4. Platform event 5. Schedule 6. Button 7. Link 8. PB 9. Another flow 10. Login flow: user logs into application 11. Apex 12. Utility Bar 13. VF Page 14. Community Page 15. Lightning Page 16. Custom Tab

What are the implications of using a package development model?

1. Release artifact 2. Package contents 3. Code versioning 4. Code repository 5. Scratch orgs 6. Salesforce DX project 7. Process automation 8. Unlocked packages

What are the three testing options in Visual Studio Code?

1. Run a single test method 2. Run all test methods in a class 3. Run all test in all classes

What are some common vulnerabilities in Apex and VF?

1. SOQL injection 2. Cross Site Scripting (XSS) 3. Cross Site Request Forgery 4. Data Access Control Issues 5. Third-Party Content Issue

What are the implications of using the org development model?

1. Salesforce DX project 2. Salesforce CLI 3. Multiple environments 4. Manual tracking

What is Error 'Apex heap size too large'?

1. Salesforce enforces an Apex Heap Size Limit of 6MB for synchronous transactions and 12MB for asynchronous transactions. 2. The "Apex heap size too large" error occurs when too much data is being stored in memory during processing. The limit depends on the type of execution (E.g. synchronous vs asynchronous calls).

What are some points to know about scheduling Apex?

1. Scheduled Job: An Apex class can be scheduled to run at specific times or regular intervals. 2. Required Interface: to schedule an Apex class, it must implement the Schedulable interface. 3. Scheduling Apex: the Schedule Apex page in Setup or the System.schedule method can be used to specify the schedule.

What types of flows can you create?

1. Screen Flow 2. Schedule-Triggered Flow 3. Auto Launched Flow (no trigger) 4. Record Triggered Flow 5. Platform Even Triggered Flow 6. Login Flow

What are examples of post-commit actions?

1. Sending emails 2. Async Apex 3. Outbound messages

What are three ways for a developer to execute tests in an org?

1. Set Up menu 2. Developer Console 3. Tooling API

Using Debug Log for Debugging

1. Set up debug level and user trace flag 2. Add debug statements to code if required 3. Execute the transaction as the traced user 4. Identify the issue by analyzing the debug log 5. If the issue is not found, use the rule of elimination

Key points about bulk triggers

1. Sets and maps are used for bulk processing of records 2. The trigger is designed to process thousands of records at at time 3. One DML statement is used for operations 4. Trigger minimizes DML calls to not exceed governor limits

What is the need of "Custom Controller" in Visualforce as everything can be done by the combination of Standard Controller + Extension class in salesforce?

1. Sharing setting is applied on standard object or extension by default, In case we don't want to apply sharing setting in our code then Custom controller is only option. 2. A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your VF page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.

Create a record from email

1. Simple: Email-to-Case 2. Email handler (Apex)

Generate a Report

1. Simple: VF w/ custom controller 2. Custom Lightning Component

How can you invoke an external web service?

1. Simple: WF outbound message 2. Complex: REST or SOAP callout in Apex

How can you schedule a job?

1. Simple: flow 2. Complex: Apex Scheduler

Salesforce allows which groupings of unit tests to be run?

1. Single class: Some or all methods in a specific class 2. Multiple classes: Some or all methods in a set of classes 3. Test suite: A predefined suite of classes can be run 4. All tests: All unit tests in an org can be run

Which three data types can be returned from an SOQL statement?

1. Single sObject 2. List of sObjects 3. Integer Maps can only be supported

Which three data types can be returned from a SOQL statement?

1. Single sObject 2. List of sObjects 3. Integer What cannot be returned: 1. Boolean 2. String

What are the different type of Lightning Components

1. Standard 2. AppExchange 3. Custom

What are the three types of controllers that can be used with VF pages?

1. Standard 2. Custom 3. Extension

MVC: Controller Examples

1. Standard controllers 2. Custom controllers (Apex) 3. Extensions (Apex) 4. Declarative rules & tools (Apex triggers, validation rules, processes, etc.)

MVC: View Examples

1. Standard pages 2. VF pages 3. VF components 4. Custom tabs 5. Page layouts

MVC: Model Examples

1. Standard/custom objects 2. Object fields 3. Object relationships 4. Apex classes (data)

A LWC has access to what type of resources?

1. Static resources 2. Content asset files 3. SVG resources 4. Label

What are two ways to declare lists in Apex?

1. String[] myString2 = new List<String>(); 2. List<String> myStrings = new List<String>();

What can you do with flow?

1. Support User Interaction 2. Send Email 3. Post to Chatter 4. Custom Notifications 5. Call Apex Code 6. Create/Delete Records 7. Update Any Record 8. Submit for Approval 9. Query records 10. Loop records 11. Allow uploading files 12. Insert images in flow screens 13. Quick Action 14. Multiple decisions 15. Allow users to look up records

What are LWC component tests?

1. Tests are run using Jest, which is a third-party testing framework used to test JavaScript code 2. A folder titled __tests__ needs to be created on the component folder to contain all test files 3. Test files are created in JavaScript where the recommended naming convention is <component>.test.js such as searchForm.test.js 4. Jest tests are created locally and run independently of Salesforce 5. A single test file can be created to include all component tests, or multiple test files & subfolders can be used to managed tests in an organized manner

Property definitions include one or two code blocks, representing a get accessor and a set accessor. Explain what they are.

1. The code in a get accessor executes when the property is read 2. The code in a set accessor executes when the property is assigned a new value.

Which of the following is not possible to view in the Debug Logs?

1. Workflow formula evaluation rules 2. Formula field calculations 3. Resources used by Apex script

What do you need to do to a custom LC to make it work in Lighting?

1. The component and its component bundle must be configured so that they're compatible with the Lightning App Builder and Lightning pages 2. My Domain must deployed in the org. When deployed, references and links to Lightning resources will be in the format https://mydomain.lightning.force.com.

What happens when governor limits are exceeded?

1. The current transaction is immediately terminated and is unrecoverable 2. The System.LimitException is thrown which is an exception that cannot be handled. 3. Entire transaction is rolled back and no data is committed to the database

Invoking Apex From Flow Using Process.Plugin

1. The interface exposes the Apex class as a service that accepts input values and returns output back to the flow. 2. Blob, Collection, sObject, and Time data types are notsupported by Process.Plugin 3. An Apex class that implements the interface needs to be created to make it available in the palette of Flow Builder

Limit on DML Statements

1. The system enforces a DML limit of 150 statements per Apex transaction 2. If there are more than 150 insert statements, the 151st statement causes the limit exception to be thrown 3. Transaction is terminated and no records are inserted

What is true about encrypted custom fields?

1. They can be included in search results 2. They can be included in report results 3. They are not available in filters for list views, reports, and roll-up summary fields

Instance methods, member variables, and initialization code have what characteristics?

1. They're associated with a particular object. 2. They have no definition modifier. 3. They're created with every object instantiated from the class in which they're declared.

Local variables have what characteristics?

1. They're associated with the block of code in which they're declared. 2. They must be initialized before they're used.

Salesforce implements built-in anti-CSRF tokens in all its standard controllers and methods

1. Token Check: It will automatically check this hidden token before executing a command. 2. Custom Controllers: Custom controllers can become vulnerable to CSRF attacks

When can a standard controller not be used with VF

1. Two levels down: it is not possible to display the list of opportunity line items related to the opportunities of the account on the same Visualforce page (using a standard controller)

What are the two types of LWCs?

1. UI component: This type of LWC is a custom component that users can interact with via a user interface such as clicking on a button, filling out a field on a form, etc. This type of component will require an HTML file, a JavaScript file, and a metadata configuration file. 2. Service component (library): This type of LWC serves as a helper library and is called a service component. It is created to have variables or functions that can be shared between components. This type of component only requires a JavaScript file and a metadata configuration file.

What features are not supported in unit tests?

1. Unit tests cannot send outbound emails. When a unit test includes Apex code that sends an email message, it may run successfully, but no email is actually sent out from the org 2. Unit tests cannot perform HTTP callouts. In order to test Apex code that perform callouts, mock responses are created using the HttpCalloutMock interface

What are some key tools to deploy metadata?

1. Unmanaged packages 2. Visual Studio Code 3. ANT Migration Tool 4. Metadata API 5. Tooling API 6. Change Set What about 3rd-party tools?

What can you do with approval process?

1. Update record fields 2. Update parent fields 3. Create task 4. Send an email 5. Send outbound message

Which two conditions cause cause workflow to fire?

1. Updating records using the bulk API 2. An Apex batch process that changes field values

A developer needs to display all the available field for an object. In which two ways can the developer retrieve the available fields if the variable myObject represents name of the object?

1. Use SObjectType.myObject.fields.getMap() to return a map of fields 2. Use getGlobalDescribe().get(myObject).getDescribe().fields.getMap() to return a map of fields

What are the steps for writing flow unit tests?

1. Use a map 2. Start the flow 3. Retrieve the output 4. Verify the output 5. Increase coverage

Which two practices should be used for processing records in a trigger?

1. Use a map to reduce the number of SOQL calls 2. Use a set to ensure unique values in a query filter

What is the 'transient' ketyword?

1. Use the transient keyword to declare instance variables that can't be saved, and shouldn't be transmitted as part of the view state for a Visualforce page. For example: 2.

Standard tabs can be overridden with what?

1. VF page 2. Lightning Component 3. Use the Salesforce Classic override (overrides Lightning Experience)

Lightning Message Service is a service that enables the following technologies to communicate with each other within a single Lightning page or between multiple Lightning pages:

1. VF pages 2. Aura components 3. LWC 4. Utility bar components

How does MVC apply to VF?

1. View (VF Page) 2. Controller (Controller) 3. Model (SF Database) In MVC, the view (the VF page) interacts with a controller, and the controller provides functionality to the page. For example, the controller can contain the logic to be executed when a button is clicked. A controller also typically interacts with the model (the database)—making available data that the view might want to display, or pushing changes back to the database.

Apex callouts come in two flavors. What are they?

1. Web service callouts to SOAP web services use XML, and typically require a WSDL document for code generation. 2. HTTP callouts to services typically use REST with JSON.

When would a developer use a custom controller instead of a controller extension?

1. When a VF page needs to replace the functionality of a standard controller 2. When a VF page does not reference a single primary object

Apex Class: Syntax

Access modifier, class key word and name of class are required in class definition

The Crypto Apex class contains the following encryption and decryption methods:

1. encrypt() and decrypt(): These methods are used when encrypting and decrypting data using a custom initialization vector 2. encryptWithManagedIV() and decryptWithManagedIV(): These methods are used for encrypting and decrypting data using an initialization vector (IV) generated by Salesforce

What are two ways of setting values on a list that is of type integer?

1. myList[0] = 15; 2. myList.set(1,20);

In the Batch Apex class, three methods must be implemented. What are they?

1. start 2. execute 3. finish

How many records can be processed in a single Apex transaction?

10,000 records can be processed in a single Apex transaction.

Order of Events - Part 2

10. Auto-response rules are executed 11. WF rules are executed 12. Escalation rules are executed 13. WF field update actions may update record again 14. Before triggers, system validation rules, and after triggers may run due to WF field update 15. Processes (PB) are executed, including flows called by processes 16. Entitlement runs are executed 17. After-save record-triggered flows are executed 18. Parent record is updated if record contains roll up summary field or has a cross-object WF field update

What is the limit number of SOQL statements that can run in one Apex transaction?

100

Order of Events - Part 3

19. The grandparent record may also be updated for the same reasons parent was updated 20. Criteria-based sharing rules evaluation is executed 21. All DML operations are committed to the database 22. Post-commit logic is executed

How many records can be processed by a SOQL For loop at a time?

200

Apex Primitive: Double

64-bit number that includes a decimal point. Doubles have a minimum value of -263 and a maximum value of 2^63-1. For example: Double d=3.14159;

Programmatic Logic Use Cases - 2

7. Create custom UI for Lightning: LC 8. Extend SF app with custom functionality: LC 9. Build apps with sophisticated UI using CSS: LC 10. Add client-side functionality in Lightning: LC 11. Override standard actions in Lightning: LC 12. Build sophisticated UI for Lightning: LC

How you put a button a VF page?

<apex:commandButton> adds a button to the page's user interface. This button fires an action when it's clicked. In this case, the action is the save() action method in the standard controller Example: <apex:commandButton action="{! save }" value="Save" />

Which coarse grained component can be used to display the detail page of an object on a VF page?

<apex:detail>

How do you display an image in VF?

<apex:image>

What's one way to embed one VF page in another?

<apex:include pageName="MainPage"/>

What's the best way to include JavaScript in a VF page?

<apex:includeScript value="{!$Resource.MyJavascriptFile}"/>

Dotted notation for VF expressions

<apex:inputFieldvalue="{! Opportunity.Account.Name }"/> - Up to five (5) levels of child-to-parent relationships can be traversed up - However, only 1 level of parent-to-child relationship can be traversed down

Which component can be used to display individual fields on a record in a VF page?

<apex:outputFIeld>

On a Contacts Related list, how do you put a link so that you can edit each contact?

<apex:outputLink value="{! URLFOR($Action.Contact.Edit, contact.Id) }"> Edit </apex:outputLink>

How do you display an external hyperlink in a VF page?

<apex:outputLink value="http://developer.salesforce.com/">Click me!</apex:outputLink>

How do you display a hyperlink to another VF page in a VF page?

<apex:outputLink value="{! $Page.AccountDisplay}">I am me!</apex:outputLink>

What's an example for incorporating a standard controller into a VF page?

<apex:page standardController="Contact">

Which iteration component can be used to generate a table of data with platform styling?

<apex:pageBlockTable>

What component can you use to show a standard related list when using a standard component?

<apex:relatedList list="Cases" />

Which component can be used to allow users to filter records on a VF page?

<apex:selectlist>

Which tag is used to add CSS to a VF page?

<apex:stylesheet>

Which tag can be utilized in an Aura component to handle an event?

<aura:handler>

Which tag can be used in an Aura component to register an event?

<aura:registerEvent>

Which tag can be used to reference a JavaScript library uploaded a static resource in .cmp markup?

<ltng:require>

Safe Navigation Operator

?. can be used to avoid null pointer exceptions. When an expression attempts to operate on a null value, null is returned instead of the NullException thrown. Example: a = b?.c

What can a developer do to determine if the core Apex exceeds any governor limits in a test class during bulk execution?

@Test.getDMLStatements

What are two ways to define test methods?

@isTest static void testName() { // code_block } static testMethod void testName() { // code_block }

What is the default access modifier for an inner class? A. Private B. Global C. Public D. Virtual

A

Apex Primitive: Integer

A 32-bit number that does not include a decimal point. Integers have a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647

Types of Exceptions: InvalidParameterValueException

Invalid method parameter problem

Apex Primitive: Long

A 64-bit number that does not include a decimal point. Longs have a minimum value of -263 and a maximum value of 2^63-1. Use this data type when you need a range of values wider than the range provided by Integer.

What does the ReadOnly attribute do in a VF page?

A Boolean value that enables read-only mode for a Visualforce page. In read-only mode, a page may not execute any DML operations, but the limit on the number of records retrieved is relaxed from 50,000 to 1 million rows.

How do you reference CSS in a VF page?

A CSS file can be stored as a static resource,and then referenced in a <apex:stylesheet> tag using the $Resourceglobal variable.

SOQL For Loop

A SOQL For Loop processes the results of a SOQL query that is defined in the loop. Points: 1. Data type of the variable should be the same sObject type of the records returned by the SOQL query. 2. Query results are processed in batches of 200 records or one at a time depending on the variable type used Example: for (Contact result: [SELECT LastName from Contact LIMIT 3]) { System.debug('single record: ' + result.LastName); }

Implications of Governor Limits: Query Inside a Loop

A SOQL query inside a for loop can result in exceeding the governor limit.

BEFORE DELETE FLOW

A before-delete record-triggered flow can be used to perform updates on any record before the record is deleted.

BEFORE SAVE FLOW

A before-save record-triggered flow can update fields on the record that triggered the flow

How you debug JavaScript for a LC?

A browser's web developer tools can be used to debug JavaScript client-side code for Lightning components. For example, Chrome Developer Tool scan be used for client-side debugging of Lightning components.

Testing code with different users: DML limit

A call to runAs counts against the total number of DML statements

Checkpoint inspector

A checkpoint can be double-clicked to view the results in the Checkpoint Inspector. It has two tabs, namely, Heap and Symbols. The Heap tab displays all objects in memory at the time the line of code at the checkpoint was executed. The Symbols tab displays a tree view of all symbols in memory at the checkpoint.

Handling Events with Client-Side Controllers in LCs

A client-side controller handles events within a component. It's a JavaScript resource that defines the functions for all of the component's actions. A client-side controller is a JavaScript object in object-literal notation containing a map of name-value pairs. Each name corresponds to a client-side action. Its value is the function code associated with the action. Client-side controllers are surrounded by parentheses and curly braces. Separate action handlers with commas (as you would with any JavaScript map)

In debug log, what is a code unit?

A code unit is a discrete unit of work within a transaction, such as a trigger, web Service method or validation rule.

Apex Primitive: Blob

A collection of binary data stored as a single object. You can convert this data type to String or from String using the toString and valueOf methods, respectively. Blobs can be accepted as Web service arguments, stored in a document (the body of a document is a Blob), or sent as attachments.

What are the Apex data types? Collection

A collection, including: - A list (or array) of primitives, sObjects, user defined objects, objects created from Apex classes, or collections - A set of primitives - A map from a primitive to a primitive, sObject, or collection

What can you include in a Lightning Component bundle?

A component can contain other components, as well as HTML, CSS, JavaScript, or any other Web-enabled code. Each Lightning Component is made up of a Mark-ups, JavaScript controller, a Helper, a Renderer and more (Component Bundle).

Aura Framework: Component Bundles & Resources

A component or app can contain various resources which are part of a component bundle. The markup (a .cmp or .app file) is the only required resource. Other resources can be controller, helper, CSS styles, design, documentation, renderer, and SVG file.

Aura Components: hiearchy

A containment hierarchy refers to a tree of components that has a top-level container as its root component. When an event is triggered, all components within the containment hierarchy are notified.

What is a controller extension?

A controller extension is an Apex class that extends the functionality of a standard or custom controller. Controller extensions can be used to override one or more actions: 1. Edit 2. View 3. Save 4. Delete 5. Add New

What is a an Extension Controller?

A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when: 1. You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete 2. You want to add new actions. 3. You want to build a VF page that respects user permissions

What is an Apex controller extension?

A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend.

What is a VF controller?

A controller is an Apex class used by a Visualforce page for setting and displaying data as well as performing other functionality or server-side processes

Class Variables: Access Modifiers

Access modifiers such as public/private/protected/global can be used to define the accessibility. By default, variables are private if not specified

How you declare a specific sObject for an Account?

Account a = new Account();

What is an Apex custom controller?

A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user. A custom controller uses the default, no-argument constructor for the outer, top-level class. You cannot create a custom controller constructor that includes parameters.

What can a debug log contain?

A debug log can contain information such as database changes, HTTP callouts, Apex errors, resources used by Apex, and automated workflow processes (workflow rules, assignment rules, approval processes, validation rules).

What is available in debug logs?

A debug log can record database operations, system processes, and errors that occur when executing a transaction or running unit tests. Debug logs can contain information about: 1. Database changes 2. HTTP callouts to external systems 3. Apex errors 4. Resources used by Apex 4. Automated workflow processes, such as: workflow rules, assignment rules, approval processes, validation rules Transactions can be generated from the following: - Salesforce user interface - API - Execute anonymous calls - Web services - Email services

What happens if a constructor is not explictly defined?

A default, no argument, public constructor is used.

Debugging Flows As Other Users

A flow can be run as another user while debugging in a sandbox org. To enable this feature, one can select the 'Let admins debug flows as other users' checkbox in 'Process Automation Settings'. When debugging the flow, 'Run flow as another user' can be selected in the Debug options, and a user can be selected.

Best Practices for Apex Classes & Triggers: USE A BULKIFIED HELPER CLASS

A helper class that is designed to process records in bulk should contain the logic of the required operations. Methods of the helper class can be invoked to perform specific operations in the trigger. The helper methods should be written to handle collections of records, such as an array, list or set, instead of individual records

What is the purpose of apex:stylesheet?

A link to a stylesheet that can be used to style components on the Visualforce page. When specified, this component injects the stylesheet reference into the head element of the generated HTML page. Example: <apex:stylesheet value="/resources/htdocs/css/basic.css"/>

Which data structure is returned to a developer when performing a SOSL search?

A list of a list of sObjects

Apex Non-Primitive: Map

A map is a collection of key-value pairs where each unique key maps to a single value. Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.

Trigger Context Variables: newMap

A map of IDs to the new versions of the sObject records. This map is only available in before update, after insert, after update, and after undelete triggers.

Salesforce Triggers: Trigger.newMap

A map of IDs to the new versions of the sObject records. Note that this map is only available in before update, after insert, and after update triggers.

What is Trigger.old?

A map of IDs to the old versions of the records.

Trigger Context Variables: oldMap

A map of IDs to the old versions of the sObject records. This map is only available in update and delete triggers.

Salesforce Triggers: Trigger.oldMap

A map of IDs to the old versions of the sObject records. Note that this map is only available in update and delete triggers.

What is a static method?

A method that can be used by not instantiating a class and can be used by all instances of a class.

What is a negative test case?

A negative test case uses one or more invalid inputs or exceeds governor limits to verify that the code doesn't allow normal processing in such conditions. Trying to break code.

Apex Primitive: Decimal

A number that includes a decimal point. Decimal is an arbitrary precision number. Currency fields are automatically assigned the type Decimal. If you do not explicitly set the number of decimal places for a Decimal, the item from which the Decimal is created determines the Decimal's scale. Scale is a count of decimal places. Use the setScale method to set a Decimal's scale.

What is a phase?

A phase can be specified for an event. A component event is typically used when an event needs to be handled by a component within the containment hierarchy. If components that need to communicate with each other are not in the containment hierarchy, then an application event can be utilized.

Event Publishing: Use Case 6 - Solution

A platform event can be defined for any replies from customers related to special requests. In this case, the booking management system can act as the event producer and Salesforce can act as the event consumer. The booking management system can use one of the Salesforce APIs, such as REST API, to publish an event message when a customer sends a reply with a special request. The flow in Salesforce can subscribe to the platform event by using a 'pause' element that resumes the flow interview when a new event message is received. When it resumes, the related Salesforce record can be updated automatically.

Apex Non-Primitive: Set

An unordered collection of unique elements and CANNOT contain duplicate values.

Event Publishing: Use Case 2 - Solution

A platform event can be defined for events related to case creation and update. In this case, Salesforce can act as the event producer and the event consumer. An Apex trigger, process, or flow can be used to publish a platform event message automatically when a new case is created or an existing case is updated. The Lightning web component used by the support managers can subscribe to the platform event channel and receive event messages. The empApi methods should be imported from the lightning/empApi module in the component. The imported methods should be called from the JavaScript code. The callback function can display a toast message.

Event Publishing: Use Case 5 - Solution

A platform event can be defined for events related to initiation and completion of performance review processes. In this case, Salesforce can act as the event producer and the event consumer. When a new performance review process is initiated or an existing process is completed, the Apex controller used by the 'performanceReviewProcess' component can publish a platform event message using the EventBus.publish() method. The 'performanceReviews' component can subscribe to the platform event channel, receive event messages, and update the data. The lightning:empApi component can be added to the component. The client-side controller can call its methods.

Event Publishing: Use Case 4 - Solution

A platform event can be defined for events related to out of stock products. In this case, Salesforce can act as the event producer and the external application can act as the event consumer. The flow used by the sales agents can be utilized to publish an event message when a product is out of stock. The external application used by the partner company can use CometD to subscribe to the platform event and receive event messages. It can initiate a new delivery process automatically based on the content of the event message.

Event Publishing: Use Case 3 - Solution

A platform event can be defined for events related to the creation of new sales orders. In this case, the custom web application (which is external) can act as the event producer and Salesforce can act as the event consumer. The web application can publish event messages for new sales orders by using one of the Salesforce APIs, such as SOAP API, REST API, or Bulk API. In Salesforce, an Apex trigger can be created on the platform event to process any incoming event messages. Other options include using a process, or a flow, that is triggered when a platform event message is received. These tools can be used to send an email to the users and create a record of the custom object automatically.

Platform event definition

A platform event can be defined in Salesforce Classic or Lightning Experience by navigating to 'Platform Events' in Setup. The platform event definition is created by giving a name and adding custom fields.

Event Publishing: Use Case 1 - Solution

A platform event can be defined with custom fields for this use case. Salesforce can publish the platform event message and the external application can act as the subscriber. An Apex trigger, process, or flow can be used to publish a platform event message automatically when the stage of an opportunity changes to 'Closed Won'. The external application can subscribe to the event channel using a custom CometD client or EMP Connector and receive event messages. When a message is received, the external application can create an order automatically based on the field values in the message.

Platform Event: Publish Behavior

A platform event message can be published immediately by choosing' Publish Immediately' or only after a transaction commits successfully by choosing 'Publish After Commit'

Defining platform events

A platform event needs to be defined before event messages can be published. A custom platform event is an sObject and defined like a custom object.

What is a positive test case?

A positive test case uses valid inputs within the governor limits to verify that the code behaves as expected.

What are the Apex data types? Primitive

A primitive, such as an Integer, Double, Long, Date, Datetime, String, ID, Boolean, among others

Which operation can be performed on external objects from a process?

A process can be created to to look up, create, or update external objects.

Test Data Factory

A public test utility class can be used to set up test data used by test methods

Dynamic SOQL Query

A query string can be constructed dynamically and executed at run time using the Database class query method. String whereFilter = 'WHERE Email != NULL'; String query = 'SELECT ' + selectFields + ' FROM Contact ' + whereFilter; List<Contact> contacts = Database.query(query);

What is a recursive trigger?

A recursive trigger is one that performs an action, such as an update or insert, which invokes itself owing to, say something like an update it performs.

In what situation does a setter method not need to pass a value to a controller?

A setter method may not be always required to pass values into a controller. If a VF component is bound to an sObject that is stored in a controller, the sObject's fields are automatically set if changed by the user, as long as the sObject is saved by a corresponding action method. For example, <apex:inputField value="{!lead.company}" />.

Package Development Model: code repository

A source control repository is used to store the source code for the packages and maintain the source of truth.

VF Standard Controller

A standard controller exists for every standard and custom object which can be queried using the Force.com API. Standard controllers contain the functionality and logic that are used for standard Salesforce pages.

Standard List Controller

A standard list controller is used by setting the standard Controller attribute on the <apex:page> component and the recordSetVar attribute on the same component.

A user selects a multiple values from a multi-select picklist. How are they represented in Apex?

A string each value separated by a semi-colon.

VF Scenario: A developer is working on a VF page that uses the Account standard controller. The page should display the name and title of all the contacts related to a particular account in a table

A table of data can be displayed using an iteration component such as the <apex:pageBlockTable>. The value attribute can be used to set the list of records. The var attribute can be used to assign each record in the list to a variable. The component can be used to retrieve the name and title of each contact

What is a test suite?

A test suite is a collection of Apex test classes that is grouped and run together. This enables to conveniently run the same subset of tests whenever required.

What is a token?

A token is a lightweight reference to an sObject or field which makes code faster and more efficient. Both sObjects and fields can be described using tokens

What does a trace flag consist of?

A trace flag consists of a debug level, start time, end time, and log type.

Bulk Triggers: Using DML Statements

A trigger designed to handle records in bulk should only use one DML statement.

Apex Primitive: Boolean

A value that can only be assigned true, false, or null.

Apex Primitive: Datetime

A value that indicates a particular day and time, such as a timestamp. Always create datetime values with a system static method.

Apex Primitive: Date

A value that indicates a particular day. Unlike Datetime values, Date values contain no information about time. Always create date values with a system static method. You can add or subtract an Integer value from a Date value, returning a Date value.

Apex Primitive: Time

A value that indicates a particular time. Always create time values with a system static method.

Class Variables: Null as Default

A variable can be assigned a value when declaring. If not assigned a value, its default value will be null

An after trigger on the Account object performs a DML update operation on all of the child Opportunities of an Account. There are no active triggers on the Opportunity object, yet a "maximum trigger depth exceeded" error occurs in certain situations. Which two reasons possibly explain the Account trigger firing recursively?

A) Changes to Opportunities are causing cross-object workflow field updates to be made on the Account B) Changes to Opportunities are causing roll-up summary fields to update on the Account

A developer can use the debug log to see which three types of information?

A) Resource usage and limits B) Database changes D) HTTP callouts to external systems

Which two statements are true about Apex code executed in Anonymous Blocks?

A) The code runs with the permissions of the logged-in user B) Successful DML operations are automatically committed

In the Lighting Component framework, which resource can be used to fire events?

A) Third-party web service code B) JavaScript controller actions

What are three techniques that a developer can use to invoke an anonymous block of code?

A) Type code into the Developer Console and execute it directly B) Type code into the Execute Anonymous tab in the Force.com IDE and click Execute C) Use the SOAP API to make a call to execute anonymous code

A developer is asked to create a custom Visualforce page that will be used as a dashboard component. Which three are valid controller options for this page? A. Use a custom controller B. Use a custom controller with extensions C. Use a standard controller with extensions D. Do not specify a controller E. Use a standard controller.

A, B, D VF pages that use the Standard Controller can't be used in dashboards. To be included in a dashboard, a VF page must have either no controller, use a custom controller, or reference a page bound to the StandardSetController Class.

If a developer needs to update a related object in a trigger, when should it be done? A. After Insert B. Before Insert C. Before Update D. After Update

A,D

In the Lightning Component Framework, which resources can be used to fire events?

A. 3rd-party JavaScript code B. JavaScript controller actions

Which three options allow a developer to use custom styling in a Visualforce page?

A. <apex:stylesheet> tag B. Inline CSS C. A static resource

What is a capability of the <ltng:require> tag that is used for loading external Javascript libraries in Lightning Component?

A. One-time loading for duplicate scripts B. Specifying loading order D. Loading scripts in parallel

If a custom object has OWD = Private with Grant Access Using Hierarchies turned off, who can select the Sharing button?

A. Record Owner B. Sys Admin C. A user shared to the record

A developer wants to display all of the available record types for the Case object. The developer also wants to display the picklist values for the Case.Status field. What action can the developer perform to get the record types and picklist values in the controller?

A. Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues() B. Use Schema.RecordTypeInfo returned by Case.SObjectType.GetDescribe().getRecordTypeInfos()

On a VF page with a custom controller, by using an ID parameter that is passed in the URL, how should a developer retrieve a record?

A. Use the constructor method for the controller B. Create a new PageReference object with the Id We can use an Apex method to obtain the ID from the page URL. Usually, we use a constructor to call it because every time the page loads, the constructor is called first.

A developer encounters APEX heap limit errors in a trigger.Which two methods should the developer use to avoid this error?

A. Use the transient keyword when declaring variables B. Use SOQL for loops instead of assigning large queries results to a single collection and looping through the collection.

How do you cast a generic sObject into a specific object?

Account acct = (Account)myGenericSObject; // Now, you can use the dot notation to access fields on Account String name = acct.Name; String phone = acct.Phone;

How you populate additional fields for an sObject variable? Method 2

Account acct = new Account(); acct.Name = 'Acme'; acct.Phone = '(415)555-1212'; acct.NumberOfEmployees = 100;

How do you declare an sObject variable?

Account acct = new Account(Name='Acme');

How you populate additional fields for an sObject variable? Method 1

Account acct = new Account(Name='Acme', Phone='(415)555-1212', NumberOfEmployees=100);

Within a trigger, how can you return the old version of the record?

Account oldAccount = Trigger.oldmap.get(newAccount.Id);

Provide sample syntax for SOQL query in Apex

Account[] accts = [SELECT Name,Phone FROM Account];

Which method can be used in a custom controller to respond to user input on a VF page?

Action method

Action Methods and VF

Action methods can be used in a custom controller to respond to user input on a Visualforce page such as the clicking of a button or link.

VF Action Methods

Action methods perform logic or navigation when a page event occurs, such as when a user clicks a button, or hovers over an area of the page. Action methods can be called from page markup by using {! } notation in the action parameter of one of the following tags

What is needed to deploy a process or auto-launched flow as active?

Active processes and auto-launched flows are deployed as inactive by default. To deploy a process or auto-launched flow as active, the org must meet flow test coverage requirements, which is independent from the required Apex code coverage and defined separately in Setup

What does the following class and method do: Database.insert(recordToInsert, allOrNone)?

Adds an sObject, such as an individual account or contact, to your organization's data. The optional allOrNone parameter specifies whether the operation allows partial success. If you specify false for this parameter and a record fails, the remainder of the DML operation can still succeed. This method returns a result object that can be used to verify which records succeeded, which failed, and why. If the parameter is not set or is set true, an exception is thrown if the method is not successful.

What are after triggers?

After triggers are used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records. The records that fire the after trigger are read-only.

All Apex REST methods must be what?

All Apex REST methods must be global static.

Apex Initial Value

All Apex variables are set to the value of 'null' if they are not assigned a value during initialization.

How are global variables referred to in VF?

All global variables are referenced with a $ symbol. Examples: <apex:outputTextvalue="{!$Profile.Name}" /><apex:outputTextvalue="{!$UserRole.Name}"/>

Which tests are run by default for deployment to production?

All local test

What is the structure of unit tests?

All unit tests follow the same structure, which is to create test data, call the test method, and then verify results. Data is not committed so it does not need to be deleted.

Techniques to Prevent SOQL Injection: Sanitize Input

Also known as restricted list, this approach involves removing potential bad characters from user input.

Controller Extensions: Running Mode

Although custom controllers and controller extension classes execute in system mode and thereby ignore user permissions and field-level security, it is possible to choose whether they respect a user's organization-wide defaults, role hierarchy, and sharing rules by using the 'with sharing' keywords in the class definition.

What can be used to delete components from production?

An ANT migration tool deployment with a DestructiveChanges XML file and the components to delete in the package.xml file.

How do you use Apex email services? Example

An Apex Class can be built that extends the Messaging.InboundEmailHandle rinterface. This enables the class to handle inbound mail messages and store the contents and attachments of an email message in an object called InboundEmail. Attachments can be automatically uploaded and attached to corresponding records.

What is an Apex property?

An Apex property is similar to a variable; however, you can do additional things in your code to a property value before it is accessed or returned. Properties can be used to 1. Validate data before a change is made 2. To prompt an action when data is changed (such as altering the value of other member variables) 3. To expose data that is retrieved from some other source (such as another class).

VF: Custom Controllers

Invoked using the controller attribute of the <apex:page> component

Apex Propery

An Apex property is similar to a variable; however, you can do additional things in your code to a property value before it is accessed or returned. Properties can be used to validate data before a change is made, to prompt an action when data is changed (such as altering the value of other member variables), or to expose data that is retrieved from some other source (such as another class).

What are entry points for Apex transactions?

An Apex transaction may be initiated from an Apex trigger, class method, anonymous code, web service, Visualforce page, custom Lightning component, and others.

Apex Infinite Loop

An Apex trigger that has a DML statement which triggers itself will result in an infinite loop and will eventually fail.

What can prevent a VF page from using anti-CSRF token?

An action handler in apex:page

What is a benefit of using an after insert trigger over using a before insert trigger?

An after insert trigger allows a developer to insert other objects that reference new records.

AFTER SAVE FLOW

An after-save record-triggered flow can access other objects' records and perform actions like sending an email

Apex Anonymous Blocks

An anonymous block is Apex code that doesn't get stored in the metadata, but that can be compiled and executed.

Application Event Propagation

An application event has three types of phases, namely, Bubble, Capture, and Default. The order of the event propagation for the bubble and capture phases in an application event is the same as the component event. When using the default phase, the event handlers are invoked in a non-deterministic order. It does not follow the same propagation rules related to the component hierarchy as the capture and bubble phases. Instead, the event is broadcast to all components in the application.

Platform event triggered flows

An auto-launched flow can be configured to automatically run upon receiving event messages from a platform event that the flow is subscribed to. 1. Record access: Platform event-triggered flows can access all available records and do not need to be associated with an object. 2. Global variable: The $Record global variable contains the field values from the platform event message which can be used throughout the flow

Apex Non-Primitive: Enum

An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Enums are typically used to define a set of possible values that don't otherwise have a numerical order. Typical examples include the suit of a card, or a particular season of the year.

What are the Apex data types? Enum

An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Enums are typically used to define a set of possible values that don't otherwise have a numerical order. Typical examples include the suit of a card, or a particular season of the year.

What happens if the following query runs and no contacts are returned? Contact contacObj = [SELECT Id,FirstName FROM Contact WHERE LastName='Smith'];

An error that records are found

Techniques to Prevent SOQL Injection: Escape Single Quotes

An escape character can be added to all single quotation characters using String.escapeSingleQuotes() to ensure that the strings are not treated as commands.

Event-driven Architecture: what is the event consumer?

An event consumer or subscriber subscribes to the channel and receives the event message.

Event-driven Architecture: what is an event?

An event is any meaningful change in a business process. For example, a user changes the stage of an opportunity to 'Closed Won'.

A platform event instance is called what?

An event message

Event-driven Architecture: what is an event message?

An event message is a notification that contains data about the event. It is published when an event occurs.

Within the context of log files, what is an event type?

An event type is a combination of log category and log level and specifies which events are logged

In a debug log, what is an execution unit?

An execution unit is equivalent to a transaction and contains everything that occurred within the transaction. EXECUTION_STARTED and EXECUTION_FINISHED delimit an execution unit.

Publishing Platform Events in External Apps

An external app can use any Salesforce API to publish event messages, such as: SOAP API,REST API, or Bulk API. For example, in order to publish a platform event message for a platform event named Opportunity_Event__e using REST API, a POST request can be sent to the following endpoint:/services/data/v48.0/sobjects/Opportunity_Event__e/

What is an initialization vector?

An initialization vector in cryptography is an arbitrary number that is used in combination with a secret key to prevent generating a sequence of text that is identical to a previous sequence.

What's an inner Apex class?

An inner class can be defined inside a top-level class, which will be referred to as the outer class. If unspecified, an inner class defaults to 'private' and is accessible only to the outer class.

What is an object?

An instance of a class

What is an Apex interface?

An interface is similar to a class but uses the 'interface' keyword and contains only method signatures.

Apex Non-Primitive: List

An ordered, indexed (zero-based) collection of primitives and non-primitives.

What are the Apex data types? sObject

An sObject, either as a generic sObject or as a specific sObject, such as an Account, Contact, or MyCustomObject__c

Metadata deployment: unmanaged package

An unmanaged package can be used to distribute a bundle of components across Salesforce orgs.

How can a developer test the following situation: A developer needs to check and examine the responses of certain endpoints made available by a web service.

Anonymous blocks can be used to send data to an external web service by initiating HTTP callouts Won't the changes be committed in the external system?

What happens with regards to sharing when running an anonymous block?

Anonymous code is always executed using the full permissions of the current user.

Thou shalt use relationships to reduce queries

Another key technique in making SOQL queries more efficient is to utilize relationships. In the example of utilizing relationships to keep SOQL outside a for loop, we utilized the children Contacts relationship of the standard Account object.

Subscribing to Platform Events: Flow Pause Element

Another method for subscribing to a platform event in Flow Builder is through the Pause element. The Pause element can be configured to resume a paused flow when it receives a platform event message.

How can a developer get all of the available record types for the current user on the Case object? A. Use SOQL to get all Cases. B. Use DescribeSObjectResult of the Case object. C. Use Case.getRecordTypes(). D. Use DescribeFieldResult of the Case.RecordType field.

Answer: B Schema.DescribeSObjectResult R = case.SObjectType.getDescribe(); List<Schema.RecordTypeInfo> RT = R.getRecordTypeInfos();

SOQL Antijoin

Anti joins can be used to return data from the first object that does not have related data in the second object.

Apex Primitive: Object

Any data type that is supported in Apex. Apex supports primitive data types (such as Integer), user-defined custom classes, the sObject generic type, or an sObject specific type (such as Account). All Apex data types inherit from Object.

The extension MyExtension has a public save() method. Which save methods (extension or standard controller) will be used by a Salesforce page?

Any extension methods take precedence over controller methods with the same name.

Built-In Exception: QueryException

Any problem with SOQL queries, such as assigning a query that returns no records or more than one record to a single sObject variable.

Built-In Exception: DmlException

Any problem with a DML statement, such as an insert statement missing a required field on a record.

Built-In Exception: ListException

Any problem with a list, such as attempting to access an index that is out of bounds.

Built-In Exception: NullPointerException

Any problem with dereferencing a null variable

Built-In Exception: SObjectException

Any problem with sObject records, such as attempting to change a field in an update statement that can only be changed during insert.

Apex Primitive: String

Any set of characters surrounded by single quotes.

When you make a callout to an external site, what do you need to do regarding that site?

Any time you make a call out to an external site, it needs to be authorized. . Before you start working with callouts, update the list of approved sites for your org on the Remote Site Settings page.

What is the requirement for a class to be used as a custom VF controller?

Any top-level class that has a default, no argument controller.

Apex Primitive: ID

Any valid 18-character Lightning Platform record identifier.

Which page on the Salesforce user interface allows unit class testing?

Apex Test Execution

Locking statements

Apex allows you to lock an sObject record to prevent other code from making changes to it. Use the FOR UPDATE SOQL statement to lock a record.

A sales director has requested an automation process that automatically converts a lead into an account and contact when the rating of the lead is updated to a certain value.

Apex can be used to convert leads by using the LeadConvertclass. A lead conversion method can be defined using this class to converta lead when the rating of the lead is updatedto a certain value. By adding the @InvocableMethod annotation to the Apex method, it can be made available to a process in the Process Builder. A process can then be created to invoke the Apex method for lead conversion.

Apex Class: Use Cases

Apex classes can be used for: - Web services - Email services - Complex validation - Business processes - Custom logic - Batch operations

What are custom controllers?

Apex classes which expose their methods and/or variables to a VF page. In order to do this, these classes must have a constructor method and all methods and variables must be publicly exposed (using the public access modifier).

Access to @AuraEnabled Methods

Apex methods annotated with @AuraEnabled are only accessible to an authenticated user if the user profile or an assigned permission set is explicitly enabled to have access to the containing Apex class. This requirement also applies to guest, portal, and community users.

Subclasse

Apex supports subclasses, allowing you to create a class that extends another class. The subclass inherits all the functionality of that parent class. It can also have additional methods and member variables, and can override the behavior of existing parent class methods.

Why should you use bulk design patterns with Apex

Apex triggers are optimized to operate in bulk. We recommend using bulk design patterns for processing records in triggers. When you use bulk design patterns, your triggers have better performance, consume less server resources, and are less likely to exceed platform limits.

In flow, what data type do you need to use to define an Apex variable?

Apex-Defined

How do you return the ListView of an Account object using the following debug statement: system.debug(controller.getListViewOptions());

ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.getQueryLocator(SELECT Id FROM Account LIMIT 10));

Thou shalt utilize maps for queries

As demonstrated in the example above, utilizing maps for queries, is a fundamental technique and trick to use in order to make SOQL queries, DML transactions, and Apex triggers more efficient. Sometimes, you'll be refactoring some code and come across a query as a List.

Best Practices for Apex Classes & Triggers: KEEP LOGIC OUT OF TRIGGERS

As one of the trigger design patterns, it is a best practice to delegate trigger logic in an Apex handler class. This allows the trigger code to focus on managing the order of when and how logic should be executed. If the logic needs to be modified, then the handler class can be updated without touching the trigger. One other benefit is that the class can potentially be reused in a Visualforce page, custom Lighting components, etc.

What is the base endpoint for Apex REST?

As you can see, the class is annotated with @RestResource(urlMapping='/Account/*'). The base endpoint for Apex REST is https://yourInstance.salesforce.com/services/apexrest/.

Aside from the Salesforce web interface, what can you used to clone a sandbox?

Aside from the Salesforce web interface, the Tooling API can also be used to clone a sandbox.

Apex system method: assertEquals(expected, actual, msg)

Asserts that the first two arguments are the same. If they are not, a fatal error is returned that causes code execution to halt.

SOSL * Wildcard

Asterisks match zero or more characters at the middle or end of your search term. For example, a search for john* finds items that start with john, such as, john, johnson, or johnny. A search for mi* meyers finds items with mike meyers or michael meyers.

What types of flows can be used with external objects?

Auto-launched and screen flows

AggregateResult[] groupedResults = [SELECT AVG(Amount)aver FROM Opportunity]; Object avgAmount = groupedResults[0].get('aver'); What is aver?

Aver is a variable that stores the result from AVG(amount). Aver can be called using the get function.

A developer wants to override a button using VF on an object. What is the requirement? A.The object record must be instantiated in a controller or extension B.The standardController attribute must be set to the object C.The controller or extension must have a PagerReference Method D.The Action attribute must be set to a controller method

B

When do you use Batch Apex?

Batch Apex is used to run large jobs (think thousands or millions of records!) that would exceed normal processing limits. Using Batch Apex, you can process records asynchronously in batches (hence the name, "Batch Apex") to stay within platform limits. If you have a lot of records to process, for example, data cleansing or archiving, Batch Apex is probably your best solution.

Implications of Governor Limits: Batch Apex

Batch Apex processes smaller batches of records to avoid exceeding governor limits.

Which statement can be used to exit an entire for or while loop?

Break

Implement Apex Class: Controller Class

Build a server-side controller for a Visualforce page or Lightning component (always needs an underlying class for VF page or Lighting Component).

Bulk Triggers: Bulk Operations

Bulk triggers can handle bulk operations like data import, bulk API calls, mass actions, and recursive Apex methods and triggers.

How can CSS be added to a LC bundle?

By clicking on the STYLE button in the developer console sidebar

How can triggers be tested?

By including DML operations in test methods

A VF page has a standard controller for an object that has a lookup relationship to a parent object. How can a developer display data from the parent record on the page?

By using merge field syntax to retrieve data form the parent record. The relative fields are prepended to __r

How can flow hide unnecessary fields on a screen?

By using the component visibility settings on a screen component

Cross-Site Request Forgery

CSRF performs an action via a URL that takes advantage of the active session of an authenticated user. 1. Redirect users: An attacker includes a URL on their site that performs an action on a second site 2. Perform actions: If the user is still authenticated to the second site, the action may be successful, if there is no protection

How can CSS styles be shared among LWCs?

CSS styles can be shared among Lightning Web Components through a CSS module. To import a CSS module in a Lightning Web component, an @import statement is defined in the CSS file of the target component.

What happens when you use addError() in a trigger?

Calling addError() in a trigger causes the entire set of operations to roll back, except when bulk DML is called with partial success. If a DML statement in Apex spawned the trigger, any error rolls back the entire operation. However, the runtime engine still processes every record in the operation to compile a comprehensive list of errors. If a bulk DML call in the Lightning Platform API spawned the trigger, the runtime engine sets the bad records aside. The runtime engine then attempts a partial save of the records that did not generate errors

Future methods: case 1

Callouts to external Web services. If you are making callouts from a trigger or after performing a DML operation, you must use a future or queueable method. A callout in a trigger would hold the database connection open for the lifetime of the callout and that is a "no-no" in a multitenant environment.

Break Statement

Can be used conditionally within a loop to exit the entire loop. Any remaining loop iterations will not be executed.

Continue Statement

Can be used conditionally within a procedural loop to skip the current iteration and jump to the next iteration.

Switch Statement

Can be used to determine if an expression matches one of several values and branches.

Trigger.IsExecuting

Can be used to determine if the current context of an Apex code that is being executed is a trigger.

What type of actions can you take with Data Import Wizard?

Can insert, update, and upsert records

Cascading Apex triggers

Cascading triggers are considered to be part of the same Apex transaction for governor limits.

VF Action Aware Tags: <apex:actionSupport>

Causes a JavaScript event on another component to call an action

To throw an exception, it must be constructed first. There are four ways to construct a custom exception, and then it can be thrown. What are they? #3

Chained Exception: An exception from a previous exception is passed:MyException me = newMyException(e);throw me;

What field types are supported for the the Platform Event sObject?

Checkbox, Date, Date/Time, Number, Text, and Text Area (Long)

What can be used to investigate objects in memory at a specific checkpoint and see the other objects with references to them?

Checkpoint inspector

Using Checkpoint Inspector for Debugging

Checkpoints can be used to see snapshots of what's happening in the Apex code at particular points during execution. The Types panel of the Heap tab can be used to view how many objects were instantiated and the memory they consumed in bytes. The Symbols tab can be used to review the states of various objects at a checkpoint. It shows a tree view of all the symbols that reference particular objects. If the Checkpoints tab doesn't show any checkpoints, it means that the execution of the code didn't reach the line number where the checkpoint has been set.

What are checkpoints?

Checkpoints preserve a snapshot of the state of objects in memory at the time the checkpoint was reached. The Checkpoints tab can be used to access a list of saved checkpoints. Each checkpoint provides the following information: namespace, name of the Apex class, line number, and iteration.

What are classic apps?

Classic apps contain standard and custom tabs, which can include standard and custom object tabs, Visualforce tabs, Lightning component tabs, Canvas apps, and web tabs

How can you deploy code with VSC?

Code can be deployed to any authorized org by selecting SFDX: Deploy Source to Org(force:source:deploy) or force:mdapi:deploy

Visual Studio Code git support

Code can be pulled from a git repository through VS Code to update code base in local machine.

How can you retrieve source code in VSC?

Code can be retrieved from any authorized org by selecting SFDX: Retrieve Source from Org(force:source:retrieve) or force:mdapi:retrieve

What is code coverage?

Code coverage indicates how many executable lines of code in your classes and triggers have been exercised by test methods

Finally Block

Code in the finally block is run whether an exception has been thrown or not, and is used for cleanup

Input parameters must be separated by what?

Commas

What are common test utility classes?

Common test utility classes are public test classes that contain reusable code for test data creation. Test utility class is also commonly known as a Test Data Factory. They can only be called by test methods, and not by non-test code.

LCF: Event-drive architecture

Components can "listen" to events and responding.

Where can Lightning Components be added to the SF mobile app?

Components can be accessed from the navigation menu in the Salesforce Mobile App.

Limits Class

Contains methods that return limit information for specific resources. getDMLRows(): Returns the number of records that have been processed with any statement that counts against DML limits, such as DML statements, the Database.emptyRecycleBin method, and other methods. getDMLStatements(): Returns the number of DML statements (such as insert, update or the database.EmptyRecycleBin method) that have been called.

In MVC Architecture, what does Controller represent?

Controller represents the business logic, either declarative or programmatic. Custom controllers and controller extensions are written as Apex classes.

Event Publishing: Use Case 1 - Problem

Cosmic Electronics uses Salesforce to manage opportunities. The company also uses an external order management application to manage orders. Sales users use the application to create orders manually after winning sales deals. But the sales director would like to automate the process. When an opportunity is won, the external application should receive a notification and create the associated order record automatically based on the details specified on the opportunity.

Event Publishing: Use Case 6 - Problem

Cosmic Grande is a hotel in Paris that started using Salesforce recently. When a new booking is created online, a new record is created automatically in Salesforce and the proprietary booking management system used by the company. Before each stay that is longer than a week, a customer service associate of the hotel uses a flow in Salesforce to send an email to inquire if the customer has any special request. If the customer sends a reply, it is stored in the booking management system, and the associate has to update the Salesforce record manually. If the customer has a special request, the Salesforce record should be updated automatically.

Event Publishing: Use Case 4 - Problem

Cosmic Grocery sells various kinds of household items through its official online store. It uses Salesforce to manage the products. When a product is out of stock, one of the sales agents uses a flow in Salesforce to record certain details and send an email to a partner company with information like the required quantity of the product. A sales user of the partner company checks the email and initiates a new delivery process in an external application. The delivery process should be initiated automatically in the external application. Although it has automation tools, there is no mechanism to check for incoming emails.

Event Publishing: Use Case 5 - Problem

Cosmic Innovation has a custom Aura component named 'performanceReviewProcess' in Salesforce that allows HR managers to start and manage the performance review process for the company's employees. It uses an Apex controller named 'PerformanceReviewProcessController'. There is another Aura component named 'performanceReviews' that shows all the ongoing and completed performance reviews. When a new performance review process has been initiated or an existing process has been completed using the 'performanceReviewProcess' component, the 'performanceReviews' component should be updated automatically and any user who is viewing the component should see a notification.

Event Publishing: Use Case 3 - Problem

Cosmic Luxio is a company that manufactures and sells luxury watches. Customers can purchase items from the company's website or by visiting an authorized retail store. Each retail store uses a custom web application for managing sales orders. Salesforce is used by the employees who work at the company's headquarters. When a new sales order is created by a retail store, certain users in Salesforce should be notified and a record of a custom object should be created automatically.

Implement Apex Class: Models and Actions

Create a data model and/or perform custom actions in general.

HTTP Method: POST

Create a resource or post data to the server.

Implement Apex Class: Test Data Factory

Create a reusable component for test data generation.

Apex Interface: Functionality

Create different implementations of methods based on specific application. The implementation class provides method definition.

HTTP Method: DELETE

Create or replace the resource sent in the request body.

Cross Site Request Forgery (CSRF); Definition

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing.

What browser technology is supported with Lightning Components?

Cross-browser compatible and supports latest browser technology such as HTML5, CSS3, and touch events

Custom controller system mode

Custom controllers run entirely in system mode, which does not enforce the permissions and field-level security of the current user. However, it is possible to use the with sharing keyword in the class definition of the custom controller to ensure that it respects a user's organization-wide defaults, role hierarchy, and sharing rules.

EXTENDS EXCEPTION CLASS

Custom exceptions are created by extending the built-in Exception class.

Interrupt Program Flow

Custom exceptions can be used to interrupt the program flow even when a system exception does not occur.

LWC: Labels

Custom labels used for implementing multilingual features can be imported using the @salesforce/label scoped module

What items can be displayed with a custom tab?

Custom object, website, Visualforce, Lightning component, or Lightning page.

How you access custom settings?

Custom settings can be accessed via custom setting methods or using $Setup variable

How are customizations and code retrieved/deployed?

Customizations and code are retrieved or deployed using the Metadata API as XML files, which also includes the version of the Apex runtime engine.

What is the minimum log level needed to see user-generated debug statements?

DEBUG

Implications of Governor Limits: DML Statements

DML statements in an Apex transaction are rolled back if a governor limit is exceeded.

Salesforce Data Export Services

Data Export Service is available in Setup to export data manually once every 7 days or29 days

Dat Import Wizard Limits

Data Import Wizard supports import up to 50,000 records. Accounts, contacts, leads, solutions, campaign members, and records of custom objects can be imported.

Data Loader Limits

Data Loader supports import or export up to 5,000,000 records. One can insert, update, upsert, delete, or export Salesforce records.

How can sensitive data be protected with programmatic options?

Data can be programmatically secured through encryption and decryption using methods provided by the Crypto Apex class.

What's a use case for batch Apex?

Data clean up. Based on different criteria, schedule a batch job to delete certain data periodically.

What's an alternative way to execute DML methods?

Database class: Database.DMLOperation. The Database DML methods take a single sObject or a list of sObjects as their first argument. They also take a second optional Boolean argument called opt_allOrNone that specifies whether the operation allows for partial success

Name the Database methods that are static and are called on the class name.

Database.insert() Database.update() Database.upsert() Database.delete() Database.undelete() Database.merge()

What is Database.setSavepoint() for?

Database.setSavepoint() is used to define a point at which DML operations can be rolled back. If any error occurs during DML Operations, which contains many statements, the application will be rolled back to the most recent save point and the entire transaction will not be aborted.

How can you create dates and times from the current clock?

Datetime myDateTime = Datetime.now(); Date today = Date.today();

What are the different debug levels?

Debug level consists of one of the following log levels (listed from lowest to highest) for each log category: NONE,ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST

How can debug levels be overridden for an Apex class or trigger?

Debug levels can be overridden for an Apex class or trigger by using Apex class or trigger trace flags.

When are debug logs generated?

Debug logs are generated when there are active user-based trace flags, when running Apex tests, and when executed code or API requests include debugging parameters or headers. A debug log is generated every time a transaction in the defined filter criteria is executed. The filter criteria (debug level) can be set for the user, the Developer Console, or the API header.

When are debug logs generated?

Debug logs are generated when there is an active user trace flag, when Apex tests are run, and when executed code or API requests include debugging parameters or headers.

What is a trace flag?

Debug logs can be set up for specific users, classes, and triggers. Trace flags can be created for them by navigating to 'Debug Logs' in Setup. A trace flag consists of a debug level, start time, end time, and log type. Generated debug logs can be viewed and downloaded on the same page. It is also possible to add or remove trace flags by navigating to Debug | Change Log Levels in the Developer Console.

What is a best practice for using log file to troubleshoot processes?

Debug logs can be used to find detailed information about processes after they finish running. They appear as flows and workflow rules in debug logs. The log level should be set to FINER for the WORKFLOW log category.

What can debug logs contain?

Debug logs can contain information about database changes, HTTP callouts, Apex errors, resources used by Apex, and automated workflow processes (Workflow rules, Assignment rules, Approval processes, Validation rules)

Which Apex primitive data types use decimals?

Decimal and Double

Which variables can be declared as a numerical value with a decimal point?

Decimal and Double

Where should a developer build a managed package?

Developer edition

Cross-Site Forgery Request: Avoid State Changes

Developers can ensure built-in protection is used by avoiding state changing operations.

What is the org development model?

Developing using the org development model involves working with orgs that don't have source tracking, or retrieving and deploying code directly to a target org.

CALCULATE TEST COVERAGE

Divide the number of active auto-launched flows that have test coverage by the total number of active auto-launched flows and processes

Which type of loop should be used if the code needs to be executed at least once?

Do-While Loop

What are some limitations of scheduled flows?

Does not support: 1. User interaction 2. Screens 3. Local actions 4. Choice sets

What is a dynamic form?

Dynamic Forms can be used to break up record details by migrating page layout field sand sections as individual page components into Lightning App Builder. Each component becomes configurable like any other component on a Lightning record page Key: only available on custom objects.

Each Apex trigger needs to have how many lines of code covered?

Each Apex trigger must at least have one (1) line of code covered in the test.

What are the different categories for log levels?

Each debug level consists of a log level for the following log categories: Database, Workflow, NBA, Validation, Callout, Apex Code, Profiling, Visualforce, and System.

What methods in a controller extension are available to be used by an associated VF page? How can they be called?

Each public and global method in a controller extension is available to be used by an associated Visualforce page. To call the method the page can reference it in an expression, or it can call the method directly using JavaScript remoting..

What happens every time you invoke a Batch Apex class?

Each time you invoke a batch class, the job is placed on the Apex job queue and is executed as a discrete transaction. This functionality has two awesome advantages: - Every transaction starts with a new set of governor limits, making it easier to ensure that your code stays within the governor execution limits. - If one batch fails to process successfully, all other successful batch transactions aren't rolled back.

If you're using a standard controller and what to include a form in it for field inputs, in what mode do you need to put the pageBlock?

Edit

How can you obtain an instance of an sObject, such as Account?

Either by creating the sObject or by retrieving a persistent record from Salesforce using SOQL.

Which governor limit applies to all code in an Apex transaction?

Elapsed CPU time

Which is one of the governor limits that applies to all code in an Apex transaction?

Elapsed CPU time. Salesforce limits CPU usage to 10 seconds for synchronous transactions and 60 seconds for asynchronous transactions.

Temp Variable

Elements can be added to a temporary list, set, or map and then added or removed to or from the original after the loop execution is over.

What does enabling Debug Mode for LCs do?

Enabling Debug Mode helps debug JavaScript code contained in Lightning components. When the debug mode is enabled, framework JavaScript code is not minified and is easier to read and debug. However, Salesforce is slower for any user who has debug mode enabled.

Store Error Messages

Error details can be stored in a custom object using a future method

Email Error Messages

Error messages can be sent to a developer via email using the Messaging class

While Loop

Evaluate first: if the loop condition returns false, code block is not executed

Publishing Platform Events in Salesforce

Event messages can be published from Salesforce using: processes, flows or Apex. For example, processes can publish event messages as part of an automated process, flows can publish them as part of a user interaction, and Apex code can publish them as part of custom business logic in an app.

Component Events: Stopping Event Propagation

Event propagation can be terminated any time the stopPropagation method is executed in an event handler.

What communication model is used by the Lightning Component Framework?

Event-driven model

Events configuration

Events can be configured to relay data within the containment hierarchy or to all components in the application. Events are fired from JavaScript controller actions. Components with registered event handlers can respond to the events.

There is a ternary conditional operation, which acts as short hand for an if-then-else statement

Example: x ? y : z Meaning: if x, a Boolean, is true, then the result is y; otherwise it is z

Which attribute of the <apex:page> component can be used to associate a controller extension with a VF page?

Extensions attribute

If a test method is annotated with isTest(SeeAllData=false) and the containing class is annotated with isTest(SeeAllData=true), org data access is restricted for that method.

False. Method can still access org data.

Apex variables can only be binded with SOQL and not SOSL

False. SOQL and SOSL statements in Apex can reference Apex code variables and expressions if they're preceded by a colon (:).

The Lightning Component Framework is strictly based on MVC architecture.

False. The Lightning Component Framework is not strictly based on the MVC architecture. Aura and Lightning web components follow the MVCC (Model-View-Controller-Controller) pattern. There are two controllers: a) The JavaScript controller on the client side is used to perform client-side operations and also acts as the intermediary between the server and the UI b) The Apex controller on the server side is used to perform database operations. The JavaScript controller is used to call methods in the Apex controller

You can use * in a SOQL statement.

False. The following is not allowed: Contact con = [SELECT * FROM Contact LIMIT 1]

For SOQL For Loop, records are only processed one at a time.

False. They can be processed one at at time or in batches of 200 records.

In Apex and SOQL, you can retrieve all sObject fields using the * wildcard.

False. You need to explicitly declare which field you want returned.

What does the word 'final' do to a variable?

Final variables can only be assigned a value once, either when you declare a variable or inside a constructor. You must assign a value to it in one of these two places.

How do you use a standard list controller in VF to show a list of records?

First you set the standardController attribute on the <apex:page> component, then you set the recordSetVar attribute on the same component. The recordSetVar sets the name of the variable to be created with the collection of records.

What does Einstein Next Best Action rely on?

Flow, recommendations, strategies, and components

@isTest(SeeAllData=true) Annotation

For Apex code saved using Salesforce API version 24.0 and later, use the @isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization 1. If a test class is defined with the @isTest(SeeAllData=true) annotation, the annotation applies to all its test methods. The annotation applies if the test methods are defined with the @isTest annotation or with the (deprecated) testMethod keyword.

What happens when you generate Apex classes from a WSDL file?

For each generated class, a second class is created with the same name and the prefix Async. The first class is for synchronous callouts. The second class class is for asynchronous callouts.

SOSL In Example

For example, the following SOSL query searches for the text 'Marcus' in only Name fields: FIND {Marcus} IN NAME FIELDS

What happens when you add instances of an Apex class to maps?

For maps, instances of your Apex classes can be added either as keys or values. If you add them as keys, there are some special rules that your class must implement for the map to function correctly; that is, for the key to fetch the right value. Similarly, if set elements are instances of your custom class, your class must follow those same rules.

How can you move metadata in a scripted manner between orgs?

Force.com migration tool

Which method can utilize a SOQL query to retrieve data for display on a VF page?

Getter method

VF Page Data: User Data

Global variables can also be used to retrieve general information about the current user in Visualforce

VF Page Data: Global Data

Global variables can be used to retrieve general information about the system and organization in Visualforce

Reference global variable in VF

Global variables must be referenced using VF expression syntax to be evaluated. For example, {!$User.FirstName},{!$Organization.Country}, or{!$Page.someVisualforcePageName}

Methods to be called by JavaScript remoting, called Remote Actions, must be declared using what keywords?

Global: The scope of the method. Methods to be called by JavaScript remoting, called Remote Actions, must be either global or public. Static: This is a class method, as opposed to an instance method. This means you can call the method without instantiating an object of this class. Remote Action methods must be static

Screen Flow

Guides users through a business process that's launched from Lightning pages, Experience Cloud sites, quick actions, and more.

Which clause can be used to filter the results returned by an aggregate function in an SOQL query?

HAVING clause

Best Practices for Apex Classes & Triggers: AVOID HARDCODING IDs

Hardcoding record Ids is discouraged as there is no guarantee that the Ids will be the same in another environment. If an application with hardcoded record type Ids, for example, is deployed to another org, the application will fail to function properly. The developer name instead can be used when referring to the record type as this is a user-defined field value and not generated by the system.

What is heap size?

Heap size is the amount of memory allocated to an object during a transaction.

A developer has JavaScript code that needs to be called by controller functions in multiple components by extending a new abstract component. Which resources in the abstract component bundle allows the developer to achieve this?

Helper.js

Component Event Propagation

How an event is propagated in the containment hierarchy depends on the phase that is configured in the event handler. There are two types of phases available for component events, namely, Bubble and Capture

Which statement would a developer use when creating test data for products and pricebooks?

Id pricebookId = Test.getStandardPricebookId();

Best Practices for Apex Classes & Triggers: USE RELATIONSHIPS TO AVOID QUERIES

If Apex code needs to process child records of a parent record, a subquery can be added to an original query that is used for retrieving the parent records. This avoids the need to perform another query when processing parent records and reduces the number of queries that are called in a single transaction.

How many records at a time can be returned by a SOQL query?

If Apex runs a SOQL query that potentially returns more than 50,000 records, a governor limit is encountered as SOQL is only allowed to retrieve a maximum of 50,000 records at a time.

What happens if a DML statement fails?

If a DML operation fails, it returns an exception of type DmlException. You can catch exceptions in your code to handle error conditions.

Void Keyword

If a method does not return a value, the 'void' keyword should be used instead of a return type.

Best Practices for Apex Classes & Triggers: USE A SOQL FOR LOOP

If a query returns a large volume of data and cause the transaction to exceed the heap limit, a SOQL for loop should be used to process multiple batches of the resulting records through the use of internal calls to query and queryMore. When a SOQL query is defined in a for loop definition, the query results are chunked into batches of 200records, and the for loop logic can be designed to handle those individual batches.

Bulk Triggers: Avoid Limit Exceptions

If a trigger is not designed to process thousands of records at once, it may reach the DML statement limit per transaction.

What happens when WF updates a field?

If a workflow field update updates a record, before and after triggers are fired one more time. This applies to all types of DML operations. For example, if a workflow field update updates a record on record insert, before and after insert triggers on the record's object are fired one more time.

What happens if an Apex trigger has a DML statement that triggers itself?

If an Apex trigger has a DML statement that triggers itself, it will result in an infinite loop and eventually fail.

Techniques to Prevent SOQL Injection: AllowList Variables

If possible user input values are known, the input value should be checked against that defined list, or an allowlist. Also, a NOT NULL check should be avoided.

Data Loader: Record Owner

If the owner is not specified, it defaults to the person importing the data.

SOQL In Clause

If the value equals any one of the values in a WHERE clause. For example: SELECT Name FROM Account WHERE BillingState IN ('California', 'New York')

What does the <apex:detail/> component do?

If you are using a standard controller with a VF page, it shows the standard page layout for that object. It includes related lists.

With the upsert DML statement, which fields can be used to match records?

If you don't specify a field when calling this statement, the upsert statement uses the sObject's ID to match the sObject with existing records in Salesforce. Alternatively, you can specify a field to use for matching. For custom objects, specify a custom field marked as external ID. For standard objects, you can specify any field that has the idLookup property set to true. For example, the Email field of Contact or User has the idLookup property set.

SOQL Injection Defenses: Dyanimic SQL; escapeSingleQuotes method

If you must use dynamic SOQL, use the escapeSingleQuotes method to sanitize user-supplied input. This method adds the escape character (\) to all single quotation marks in a string that is passed in from a user. The method ensures that all single quotation marks are treated as enclosing strings, instead of database commands.

What VF component can you used to selectively show fields when using the standard controller?

If you want to selectively determine a record's fields for display, use the <apex:outputField> component.

Apex Interface: Use Cases

Implement different logic for different types of functionality. Allow developers to be abstract when utilizing objects.

Implement Apex Class: Extending Classes

Implement inheritance by extending a virtual class.

Implement Apex Class: Implementing Interfaces

Implement inheritance using an interface.

Which keyword is used by a class to use an interface?

Implements

Testing code with different users: Mixed DML

Mixed DML operations can be performed by enclosing them within the runAs block

How can imported Apex method be invoked from a LWC?

Imported Apex methods can be invoked from a Lightning web component either via @wire or imperatively. To invoke an Apex method, it must be annotated with @AuraEnabledand be static and either global or public.

Private variables

In Private Modifiers, you modified the variables to be private, ensuring that they can only be accessed through a method.

Subscribing to Platform Events in Salesforce

In Salesforce, it is possible to subscribe to and receive platform events using: processes, flows, Apex triggers, and Lightning components. Processes, flows and triggers provide an auto-subscription mechanism. In a Lightning component, the empApi component can be used for subscription and receiving event messages.

VF Expressions

In Visualforce pages, all content that is encapsulated in {! and } characters is evaluated as an expression. Dot notation is used to access fields or traverse related objects

In a single Apex transaction, how many DML statement can be executed?

In a single Apex transaction, DML statements can only be executed up to 150 times only.

True

In addition to the HTTP method, each request sets a URI, which is the endpoint address at which the service is located.

Explicit Conversion

In general, Apex requires explicit conversion of one data type to another. For example, using String.format, Sting.valueOf, or casting a variable to a string before assigning it to a String data type variable.

Flows: System Context with Sharing

In system context with sharing, object-level and field-level security is ignored, but record-level access is enforced.

Flows: System Context without Sharing

In system context without sharing, object-level and field-level security is ignored including record-level access.

Trigger.newMap.KeySet()

In trigger if you try to call trigger.newMap.keySet() on update event or after insert it will return Id of records which is going to process. In trigger if you try to call trigger.newMap.keySet() on before insert then it will return null.

Log categories: Apex Profiling

Includes cumulative profiling information such as namespace limits, emails sent, etc.

Log categories: Visualforce

Includes events generated from Visualforce such as the view state, etc

Log categories: Apex Code

Includes information about Apex code such as trigger, methods, queries, etc

Log categories: Database

Includes information about activities related to the database such DML, SOQL, SOSL calls.

Log categories: System

Includes information about executed system methods such as System.debug()

Log categories: Callout

Includes information about requests and responses from a web service

Log categories: Validation

Includes information about validation rules that fired and their results

Log categories: Workflow

Includes information about workflow rules, flows, and processes.

How can a developer apply the look and field of Lightning Experience to a number of applications built using custom third-party JavaScript framework an rendered in VF pages?

Incorporate Salesforce Lightning Design System CSS stylesheets into the JavaScript application?

How many inner classes can be created

Infinite; however, nesting is not allowed. Only one-level deep. Nesting another class in an inner class is not allowed - code will not compile.

Which code can be defined for HTML tags like in a regular HTML page?

Inline CSS code

SOQL Inner Join

Inner joins can be used to return data from the first object that has related data in the second object

Debugging Flows: Input Variables

Input variables that are not collections or Apex variables can be populated using a Lookup screen component.

USE DML STATEMENT OUTSIDE THE FOR LOOP

Instead of placing a DML statement inside a for loop to perform operations such as insert, update, delete, and undelete, the records that need to be inserted or modified should be added to a list, and a single DML statement should be invoked on that list after the execution of the for loop.

USE SOQL QUERY OUTSIDE THE FOR LOOP

Instead of placing a SOQL query inside a for loop to retrieve the data, a single query should be used outside the for loop to retrieve all the necessary data, and then the for loop logic should iterate over the results. This is to ensure that the Apex code does not reach the governor limit for the maximum number of SOQL queries that can be executed in an Apex transaction.

Use Maps for SOQL Queries

Instead of using a For Loop, a map can be used to obtain records from a SOQL query. Map<Id,sObject> = new Map<Id,sObject>(SOQL Query);

USE MAPS FOR SOQL QUERIES

Instead of using a for loop, a map can be used to obtain records from a SOQL query, which is a more efficient approach. The following technique can be used: Map<Id, sObject> m = new Map<Id,sObject>(SOQL Query);

How do yo use the LIKE operator in SOQL?

Instead of using the equal operator (=) for comparison, you can perform fuzzy matches by using the LIKE operator. For example, you can retrieve all accounts whose names start with SFDC by using this condition: WHERE Name LIKE 'SFDC%'.

Future methods: case 3

Isolating DML operations on different sObject types to prevent the mixed DML error. This is somewhat of an edge-case but you may occasionally run across this issue.

What does the following code do? // Get standard price book ID. // This is available irrespective of the state of SeeAllData. Id pricebookId = Test.getStandardPricebookId(); // Insert a price book entry for the standard price book. // Standard price book entries require the standard price book ID we got earlier. PricebookEntry standardPrice = new PricebookEntry( Pricebook2Id = pricebookId, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true); insert standardPrice;

It allows you to create an entry for the standard pricebook.

What is an access modifier?

It helps determine how accessible a method or variable is to code outside the container class. List them: - Private - Protected - Public - Global

Why is @RemoteAction used in Apex?

It is called JavaScript remoting - a tool that front-end developers can use to make an AJAX request from a Visualforce page directly to an Apex controller.

Dynamic Lightning Pages

It is possible to configure when a component appears on a Lightning page by adding filter conditions and logic to its properties in the Lightning App Builder. For example, a Lightning component can be set to display exclusively when its page is viewed on a phone.

Apex error 'List has no rows for assignment to SObject'

It means that SOQL query does not bring back any results

What does the VF RenderAs attribute do?

It renders a VF page as a PDF document

Lightning Framework: STATEFUL AND STATELESS

It utilizes a stateful client (using JavaScript) and a stateless server(Apex). The client calls the server only when absolutely necessary, which results in fewer calls to the server and more responsive and efficient apps.

Lightning Framework: EVENTS Subscription

It utilizes event-driven architecture. Components are capable of listening to application and component events and responding accordingly.

What's important to remember about an after update trigger?

It's fired once all records have been updated; at this state, Trigger.New records are read-only and cannot be altered.

What is the purpose of the isCreateable() method?

It's used to check if a user has access to create records for an object.

Which function extends text and merge field values by inserting escape characters before unsafe JavaScript characters?

JSENCODE

With Lightning Components, what is used to exchange data between client and server?

JSON (JavaScript Object Notation) format is used to exchange data between client and server.

VF components are similar to which type of tag library containing name tag namespaces prefixes?

JSP tag library that carry metadata information.

What JavaScript remoting?

JavaScript remoting is a tool that front-end developers can use to make an AJAX request from a Visualforce page directly to an Apex controller. JavaScript remoting allows you to run asynchronous actions by decoupling the page from the controller and to perform tasks on the page without having to reload the entire page.

Scheduled-Triggered Flow

Launches at a specified time and frequency for each record in a batch. This auto-launched flow runs in the background.

Platform-Event Triggered Flow

Launches when a platform event message is received. This auto-launched flow runs in the background.

Record-Triggered Flow

Launches when a record is created, updated, or deleted. This auto-launched flow runs in the background.

Auto-launched Flow (no trigger)

Launches when invoked by Apex, processes, REST API, and more. This auto-launched flow runs in the background.

What are Lightning Apps?

Lightning apps contain everything from the Classic apps list, plus they can contain Lightning Page tabs and utilities like Lightning Dialer.

Lightning Framework: APEX AND JAVASCRIPT

Lightning components built using the Lightning Component framework use HTML, CSS, and JavaScript on the client side and Apex on the server side.

What are Lightning Web Components?

Lightning components can also be created using the Lightning Web Components (LWC) model, which uses the core Web Components standards. HTML and modern JavaScript can be used to build Lightning web components.

How do you add Lightning Components to a VF page?

Lightning components can be added to Visualforce pages using the <apex:includeLightning /> component.

Implications of Governor Limits: Limits Methods

Limits methods allow returning the specific limit for a particular governor.

Limit Methods for Testing Governor Limits

Limits methods is used to return the amount of resource consumed in a transaction and the general total amount of resource available pertaining to governor limit.

What does the Limits.getDMLStatements() method do?

Limits.getDMLStatements() method returns the number of DML statements that were executed.

Indirect Lookup Relationships

Link a child external object to a parent standard or custom object through a custom unique, External ID field

External Lookup Relationships

Link a child standard, custom, or external object to a parent external object using the standard External ID field.

How do you declare a list of Accounts?

List<Account> acc = new List<Account>();

How can you query a list of account with child opportunities? How can you access the opps?

List<Account> accounts = [SELECT Id, Name, (SELECT Id, StageName FROM Opportunities) FROM Account WHERE Id IN: accountIds]; for( Account a: accounts){ for(Opportunity o: a.Opportunities){ //do something } }

What is the data type returned by the following SOSL search?

List<List<sObject>> SOSL searches return a list of of a list of sObjects.

How do you add elements to an Apex list?

List<String> colors = new List<String> { 'red', 'green', 'blue' }; // Add elements to a list after it has been created List<String> moreColors = new List<String>(); moreColors.add('orange'); moreColors.add('purple');

What are two ways to define a string in Apex?

List<String> colors = new List<String>(); String[] colors = new List<String>(); Generally, it's easier to create a list rather than an array because lists don't require you to determine ahead of time how many elements you need to allocate.

What is the syntax to create a list of child object for a parent object?

List<sObjectTypeName> children = objectA.ChildRelationshipName;

Log categories: NBA

Logs activities generated by Einstein Next Best Action and Strategy Builder

Variable to store 64-bit without a decimal point

Long

Implicit Conversion

Lower numeric types can be assigned to higher numeric types without explicit conversion. Example: Integer to a Double; doing the opposite will throw an error.

What are the SOQL Apex limits?

Making fewer database queries helps you avoid hitting query limits, which are 100 SOQL queries for synchronous Apex or 200 for asynchronous Apex.

What are the SOQL limits in Apex?

Making fewer database queries helps you avoid hitting query limits, which are 100 SOQL queries for synchronous Apex or 200 for asynchronous Apex.

How do you expose an Apex class as a REST service?

Making your Apex class available as a REST web service is straightforward. Define your class as global, and define methods as global static. Add annotations to the class and methods.

Maps of sObjects

Map keys and values can be of any data type, including sObject types, such as Account. Maps can hold sObjects both in their keys and values. A map key represents a unique value that maps to a map value. For example, a common key would be an ID that maps to an account (a specific sObject type). This example shows how to define a map whose keys are of type ID and whose values are of type Account. Map<ID, Account> m = new Map<ID, Account>();

How do you declare and populate a map in one line?

Map<String,String> countryCurrencyMap = new Map<String,String>{'US'=>'USD','France'=>'EUR','Australia'=>'AUD'};

How can you declare a map of two string and place values directly in the map?

Map<String,String> myStrings = new Map<String,String>{'a'=>'apple','b'=>'bee'};

Master-Detail Relationship

Master-detail relationship can be used between two custom objects, or a standard & custom object where the standard object is the master

Apex Transaction Limits for Flows: Maximum CPU time on the Salesforce servers

Maximum CPU time on the Salesforce servers: 10K milliseconds

Maximum Trigger Depth Exceeded Error Salesforce

Maximum Trigger Depth Exceeded Error Salesforce occurs mainly due to recursion in the trigger. Recursion can occur because of many reasons. Recursion occurs when the same code is executed again and again. It can lead to an infinite loop and which can result in governor limit sometime. Sometimes it can also result in unexpected output.

VF Page Data: Related Data

Merge field syntax is used to display related object records that are up to five levels of child-parent and 1 level of parent-child relationships away

Metadata deployment: Metadata API

Metadata API can be used to retrieve, deploy, create, update, or delete customizations from any org.

Public access modifier

Method or variable can be used by any Apex code in the application or namespace.

Global access modifier

Method or variable can be used by any Apex code that has access to the class, not just the Apex code in the same application or namespace.

TestSetup Annotation

Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class.

TestSetup Annotation

Methods defined with the @testSetup annotation are used for creating common test records that are available for all test methods in the class. Test setup methods are defined in a test class, take no arguments, and return no value. The following is the syntax of a test setup method. Example: @testSetup static void methodName() { }

Best Practices for Apex Classes & Triggers: USE THE LIMITS APEX METHODS

Methods of the System class called 'Limits' should be used to output debug messages for governor limits to determine if or when the code is about to exceed any governor limits. For example, Limits.getQueries() can be used to retrieve the number of SOQL queries that have been used so far in the code, and Limits.getLimitQueries() can be used to retrieve the total number of SOQL queries allowed.

When setting up HTTP web services, what are mock callouts?

Mock callouts allow you to specify the response to return in the test instead of actually calling the web service. You are essentially telling the runtime, "I know what this web service will return, so instead of calling it during testing, just return this data." Using mock callouts in your tests helps ensure that you attain adequate code coverage and that no lines of code are skipped due to callouts. Again, when using a mock callout, the request isn't sent to the endpoint. Instead, the Apex runtime knows to look up the response specified in the static resource and return it instead. The Test.setMock method informs the runtime that mock callouts are used in the test method.

In MVC Architecture, what does Model represent?

Model represents the structure of the data through sObjects, fields, and Apex classes

Multiple Apex classes have been created that will be invoked in flows. Each class contains an invocable method which is designed to work with a specific type of sObject such as Account, Contact, etc. Although the sObject type handled in each invocable method is different, the business logic is the same. This resulted to repeated code contained in the different classes

Multiple Apex classes have been created that will be invoked in flows. Each class contains an invocable method which is designed to work with a specific type of sObject such as Account, Contact, etc. Although the sObject type handled in each invocable method is different, the business logic is the same. This resulted to repeated code contained in the different classes

When troubleshooting a process, what is the significance of MyVariable_current vs. MyVariable_old?

MyVariable_current refers to to the field value when the process was executed. MyVariable_old refers to the most recent previous value.

Which type of information is provided by the Checkpoints tab in the Developer Console?

Namespace and Time

Where should a VF page be added to make it available in the mobile app?

Navigation menu

What is Einstein Next Best Action?

Next Best Action is used to create and display actions for users that are tailored to meet unique criteria. It relies on flows, recommendations, strategies, and components, and has standard objects for reporting.

Can you access fields for a generic sObject using dot notation?

No

What are some test execution limits?

No greater than 500, or 10 multiplied by the number of test classes, can be executed every 24 hours. For sandboxes and Developer edition orgs, the limit is 20 multiplied by the number of test classes.

Debugging Flows: Non-DML Statements

Non-DML statements (such as HTTP requests), asynchronous DML statements or actions cannot be rolled back

What are some of the benefits of queueable apex?

Non-primitive types: Your Queueable class can contain member variables of non-primitive data types, such as sObjects or custom Apex types. Those objects can be accessed when the job executes. Monitoring: When you submit your job by invoking the System.enqueueJob method, the method returns the ID of the AsyncApexJob record. You can use this ID to identify your job and monitor its progress, either through the Salesforce user interface in the Apex Jobs page, or programmatically by querying your record from AsyncApexJob. Chaining jobs: You can chain one job to another job by starting a second job from a running job. Chaining jobs is useful if you need to do some sequential processing.

What happens if you perform a callout after a DML transaction?

Not allowed - system throws "You have uncommitted work pending..." exception. Flow has a Transaction control setting to allow the flow to decide at run time whether it's necessary to perform the action in a separate transaction in order to execute successfully. A callout=true attribute should be added to the invocable method annotation to inform the flow that Apex method will perform callout

How are nulls incorporated when ordering a SOQL statement?

Null records can be ordered at the beginning or end of the query results. Example: SELECT Id, Name FROM Account ORDER BY Name ASC NULLS FIRST

VF Page Data: Object Data

Object data can be displayed using expression syntax and components such as <apex:outputField> and <apex:detail>

SOQL: Return Related Objects

Objects of one type can be returned based on criteria that applies to objects of another type.

What is ObjectsAndFields ina SOSL search?

ObjectsAndFields is optional. It is the information to return in the search result—a list of one or more sObjects and, within each sObject, list of one or more fields, with optional values to filter against. If not specified, the search results contain the IDs of all objects found.

If you choose or create themes in Lightning, how you ensure a VF page renders the theme?

Once a theme has been selected, it can be used with any VF page by setting the lightningStylesheets attribute to true in the <apex:page> tag. The API version of the page must be updated to 43.0 or later in order to use custom theming.

How often can scheduled flows run?

Once, daily, or weekly.

What's a major benefit of Asynchronous Apex?

One of the main benefits of running asynchronous Apex is higher governor and execution limits. For example, the number of SOQL queries is doubled from 100 to 200 queries when using asynchronous calls. The total heap size and maximum CPU time are similarly larger for asynchronous calls.

When should application level events be used?

One should only use an application event for events that should be handled at the application level or when a component needs to communicate with another component that does not belong to the source component's containment hierarchy.

Thou shalt not put queries in loops

One way Salesforce enforces that its tenant's applications or your applications must run in a performant manner. One way Salesforce does this is by enforcing governor limits. One of the most stringent governor limits is a SOQL query limit of 100 queries in a transaction. If you ever query inside a loop, you will run into this limitation. Hence, thou shalt not put queries in for loops.

What type of relationships are allowed for external objects?

Only lookup, external lookup, and indirect lookup relationships are available for external objects.

Future methods: case 2

Operations you want to run in their own thread, when time permits such as some sort of resource-intensive calculation or processing of records.

Class Variables: Optional Keywords

Optionally, use Final or Static

What other Apex increment the DML counter by 1?

Other methods that increment the DML counter by 1 are: - Approval.process() - Database.convertLead() - Database.rollback() - Database.setSavePoint() - EventBus.publish() - System.runAs()

Other Methods

Other than common methods, DMLExceptionsand EmailExceptions have additional methods such as getDmlFieldNames and getDmlMessage.

SOQL Outer Join

Outer joins can be used to return all data from the first object and the matching data from the second object

PageReference Class

PageReference is a reference to an instantiation of a page. Among other attributes, PageReferences consist of a URL and a set of query parameter names and values.

PARENT-TO-CHILD QUERY

Parent-to-child relationships can be specified using a sub-query enclosed in parentheses

What can you monitor on the 'Paused Flows Interviews' page in Setup?

Paused flow interviews and scheduled actions from processes can be monitored on the 'Paused Flows Interviews' page in Setup

What can be monitored in the system?

Paused flow interviews, scheduled actions from processes, and asynchronous Apex jobs can be monitored in Salesforce

Why is bulk DML recommended?

Performing bulk DML operations is the recommended way because it helps avoid hitting governor limits, such as the DML limit of 150 statements per Apex transaction.

What is the batch apex execute method?

Performs the actual processing for each chunk or "batch" of data passed to the method. The default batch size is 200 records. Batches of records are not guaranteed to execute in the order they are received from the start method. This method takes the following: - A reference to the Database.BatchableContext object. - A list of sObjects, such as List<sObject>, or a list of parameterized types. If you are using a Database.QueryLocator, use the returned list.

Which type of user can be traced using a debug log to track data that is synchronized using the Salesforce integration cloud?

Platform Integration User

Publishing Event Messages Using Apex

Platform event messages can be published using Apex by creating an instance of the event and passing it to the EventBus.publish()method. More than one event can be published by adding the events to a list and passing the list to the method.

What is event-driven architecture?

Platform events make use of event-driven architecture that consists of: - event producer - event consumer - channel (or also known as event bus)

Polyglot pers

Polyglot Persistence is a fancy term to mean that when storing data, it is best to use multiple data storage technologies, chosen based upon the way data is being used by individual applications or components of a single application. Different kinds of data are best dealt with different data stores. In short, it means picking the right tool for the right use case.

Units tests should include both ______ and ______ test cases to verify positive and negative behavior of code.

Positive, negative

How syntax is required in a test class to access pre-existing data?

Pre-existing data can be accessed by annotating the test class or method with @isTest(SeeAllData=true). The isTest(SeeAllData=true) annotation applies to all test methods in a test class.

How can private or protected members be exposed to test classes?

Private or protected members can be exposed to test classes by using an annotation. The @TestVisible annotation allows private or protected members (methods, variables, inner classes) to be visible to a test class.

Types of Exceptions: VFException

Problem related to a Visualforce page or controller

Types of Exceptions: NoDataFoundException

Problem that occurs when data does not exist

SOSL RETURNING

RETURNING is an optional clause that can be added to a SOSL query to specify the information to be returned in the text search result. If unspecified, then the default behavior is to return the IDs of all objects that are searchable in advanced search as well as custom objects (even if they don't have a custom tab), up to the maximum specified in the LIMIT n clause or 2,000 (API version 28.0 and later), whichever is smaller.

Where can you embedded recommendations?

Recommendations can be embedded into any digital touchpoint: chatbots, community portals, web pages, backend systems, Salesforce objects and records, and mobile devices.

SOQL Relationship Queries

Relationship queries, based on lookup and master-detail relationships enable retrieving of data from related records.

What does the following do? lightningStylesheets="true"

Renders VF page in Lightning

What does <apex:detail />

Replicates the standard view for an object

Which design supported by the Lighting Framework ensures compatibility with different devices?

Responsive design

Additional Use Cases for SOQL: 3

Retrieve data for a particular division in an organization using the divisions feature.

Additional Use Cases for SOQL: 1

Retrieve data for a specific term that you know exists within a field. Because SOSL can tokenize multiple terms within a field and build a search index from this, SOSL searches are faster and can return more relevant results.

HTTP Method: GET

Retrieve data identified by a URL.

Additional Use Cases for SOQL: 4

Retrieve data that's in Chinese, Japanese, Korean, or Thai. Morphological tokenization for CJKT terms helps ensure accurate results.

Additional Use Cases for SOQL: 2

Retrieve multiple objects and fields efficiently where the objects might or might not be related to one another.

Trigger Context Variables: new

Returns a list of the new versions of the sObject records. This sObject list is only available in insert, update, and undelete triggers, and the records can only be modified in before triggers.

Trigger Context Variables: old

Returns a list of the old versions of the sObject records. This sObject list is only available in update and delete triggers.

The following map is defined: Map<ID, Account> accountMap What does accountMap.values() return?

Returns a list that contains all the values in the map (sObjects of accounts).

What is the return data type when ApexPages.currentPage().getParameters() is used to retrieve URL parameters from a VF controller?

Returns a map of the query string parameters for the PageReference; both POST and GET parameters are included. The key string contains the name of the parameter, while the value string contains the value of the parameter.

The following map is defined: Map<ID, Account> accountMap What does accountMap.keySet() return?

Returns a set that contains all of the keys in the map (id of accounts)

Trigger Context Variables: operationType

Returns an enum of type System.TriggerOperation corresponding to the current operation. Possible values of the System.TriggerOperation enum are: BEFORE_INSERT, BEFORE_UPDATE, BEFORE_DELETE,AFTER_INSERT, AFTER_UPDATE, AFTER_DELETE, and AFTER_UNDELETE. If you vary your programming logic based on different trigger types, consider using the switch statement with different permutations of unique trigger execution enum states.

What does the getDMLStatements() method do?

Returns the number of DML statements (such as insert, update or the database.EmptyRecycleBin method) that have been called.

The following map is defined: Map<ID, Account> accountMap What does accountMap.size() return?

Returns the number of key-value pairs in the map.

What does the getDMLRows() method do?

Returns the number of records that have been processed with any statement that counts against DML limits, such as DML statements, the Database.emptyRecycleBin method, and other methods.

What does getSObjectType() do?

Returns the token for this SObject. This method is primarily used with describe information.

Trigger Context Variables: isExecuting

Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an executeanonymous() API call.

Trigger Context Variables: isUndelete

Returns true if this trigger was fired after a record is recovered from the Recycle Bin. This recovery can occur after an undelete operation from the Salesforce user interface, Apex, or the API.

Trigger Context Variables: isAfter

Returns true if this trigger was fired after all records were saved.

Trigger Context Variables: isBefore

Returns true if this trigger was fired before any record was saved.

Trigger Context Variables: isDelete

Returns true if this trigger was fired due to a delete operation, from the Salesforce user interface, Apex, or the API.

What SOQL query can you run to determine number of active flows and processes?

SELECT count_distinct (DefinitionId) FROM Flow WHERE Status = 'Active' AND (ProcessType = 'Autolaunched Flow' OR ProcessType = 'Workflow' OR Process Type = 'CustomEvent' OR ProcessType = 'InvocableProcess')

What SOQL query can you run to determine active flows with test coverage?

SELECT count_distinct (FlowVersionId) FROM FlowTestCoverage

What is SOQL Injection?

SOQL injection occurs when an attacker modifies the structure of the query. The user input can modify the intended SOQL statement and result in unintended or harmful results.

SOQL Traverse Relationships

SOQL relationship queries traverse parent-to-child and child-to-parent relationships between objects to filter and return results.

Accessing Variables in SOQL Queries

SOQL statements in Apex can reference Apex code variables and expressions if they are preceded by a colon (:). The use of a local variable within a SOQL statement is called a bind.

What allows developers to run commands for executing SOQL queries and anonymous Apex code in VSC?

Salesforce CLI

Event-driven Architecture: example

Salesforce can publish a custom platform event message over a channel when the stage of an opportunity changes to 'Closed Won'. An order management system can subscribe to the channel and receive the message to create an order.

Have you ever received the message "Apex CPU time limit exceeded" after writing and testing some code? The first time I received this message I wondered what a CPU has to do with my code in the cloud?!

Salesforce platform imposes a CPU usage governor limit to any given execution context, which is approximately 10 seconds. It means that Apex Code, declarative tools or a combination in a transaction, must not exceed a ~10-second limit.

Standard Platform Events

Salesforce provides certain predefined platform events called standard platform events, such as AssetTokenEvent and BatchApexErrorEvent.

Per-Transaction Flow Limits

Salesforce strictly enforces limits to ensure that any runaway flows don't monopolize shared resources in the multitenant environment. Per-transaction limits, which Apex enforces, govern flows. If an element causes the transaction to exceed governor limits, the system rolls back the entire transaction. The transaction rolls back even if the element has a defined fault connector path.

With a partial sandbox, what are used to select which objects and data to copy?

Sandbox templates are used to select specific objects and data to copy to a Partial Copy (or Full Copy) sandbox in order to control its size and content.

What does the VF method do? quicksave

Save a new record without navigating away from the screen.

Asynchronous Apex: Scheduled Apex

Schedule Apex to run at a specified time. Common scenario: Daily or weekly tasks.

Dashboard refreshes can be monitored using what?

Scheduled jobs

In a SOSL search, what is SearchGroup?

SearchGroup is optional. It is the scope of the fields to search. If not specified, the default search scope is all fields. SearchGroup can take one of the following values: - ALL FIELDS - NAME FIELDS - EMAIL FIELDS - PHONE FIELDS - SIDEBAR FIELDS

How is SearchGroup used in SOSL?

SearchGroup is optional. It is the scope of the fields to search. If not specified, the default search scope is all fields. SearchGroup can take one of the following values: ALL FIELDS NAME FIELDS EMAIL FIELDS PHONE FIELDS SIDEBAR FIELDS

A developer created an Apex Trigger using the Developer Console and now wants to debug the code. How can the developer accomplish this in the Developer Console?

Select the Override Log Triggers checkbox for the Trigger to get the debug logs out.

How can sensitive data be protected with declarative options?

Sensitive data can be stored using the declarative features: 1. protected custom metadata types 2. protected custom settings 3. encrypted custom fields 4. named credentials.

Implement Apex Class: Trigger Handler

Separate business logic invoked by an Apex trigger.

Which complex data type supports unique elements?

Set

How can a developer set up a debug log on a specific user?

Set up a trace flag for the user, and define a logging level and time period for the trace.

How can you set a set in SOQL to limit the records that are returned?

Set<String> names = new Set<String>(); names.add('Test'); names.add('Test2'); System.debug([SELECT Name FROM Account WHERE Name IN: names]);

Bulk Triggers: Use Collections

Sets and maps can be used to reduce the number of data operations and act on multiple records at onetime.

Setter methods with VF

Setter methods can be used to submit values from the Visualforce page back to the controller. In a Visualforce controller, they are executed automatically before action methods.

Testing code with different users: Setup Objects

Setup objects can be inserted or updated together with other sObjects using the runAs block.

Asynchronous Apex: Queueable Apex

Similar to future methods, but provide additional job chaining and allow more complex data types to be used. Common scenario: Performing sequential processing operations with external Web services.

Thou shalt not put DML in loops

Similar to the 2nd commandment, thou shalt not put DML in loops either. As a quick recap, DML means any insert, update, delete, undelete, merge, convertLead transaction. Not only is DML in a loop poorly performant, but you will run into governor limits as well.

How can you use isEmpty()?

Since a subquery also returns results in a list format, the isEmpty() method can be used to determine if a subquery returned any results

In a Switch statement, the 'when' value can be what?

Single value, multiple values, or sObject types

Which approach should a developer take to add pagination to a VF page?

StandardSetController

What does the word 'static' do to a variable?

Static methods, variables, or initialization code are associated with a class, and are only allowed in outer classes.

What should be used instead of dynamic SOQL to prevent SOQL injection?

Static query with a bind variable

Within the context of VF, what are static resources?

Static resources allow you to upload content that you can reference in a Visualforce page. Resources can be archives (such as .zip and .jar files), images, stylesheets, JavaScript, and other files. Static resources are managed and distributed by Lightning Platform, which acts as a content distribution network (CDN) for the files. Caching and distribution are handled automatically.

What can you use to populate data in test methods by diminish the amount of code needed?

Static resources and Test.loadData method can be used to populate data in test methods without writing several lines of code.

Static Variables

Static variables declared in an Apex class can be directly accessed without instantiating using the following syntax: ClassName.StaticVariableName.

What's a good use for Apex Map?

Storing IDs and Names for Account records

To throw an exception, it must be constructed first. There are four ways to construct a custom exception, and then it can be thrown. What are they? #2

String Error Message: A string argument can be passed to its constructor which will be used as the error message:MyException me = newMyException('oops!');throw me;

To throw an exception, it must be constructed first. There are four ways to construct a custom exception, and then it can be thrown. What are they? #4

String and Exception: A string error message and a chained exception is passed:MyException me = newMyException('oops!', e);throw me

SOQL Injection Defenses: Use Static SOQL

String queryName = '%' + name + '%'; queryResult = [SELECT Id FROM Contact WHERE (IsDeleted = false and Name like :queryName)];

When rendering Apex from declarative functionality, think about what action the user is taking (i.e., delete data) and how the Apex class is defined.

Study

When the server processes the request, it sends a status code in the response. The status code indicates whether the request was processed successfully or whether errors were encountered. If the request is successful, the server sends a status code of 200. You've probably seen some other status codes, such as 404 for file not found or 500 for an internal server error.

Study

What can be used to create or delete tests that can run together?

Suite Manager in Developer Console

What happens if you try to add or remove elements while iterating through a collection that includes them?

System causes an error

What are the Apex data types? System-supplied Apex classes

System-supplied Apex classes

What method should be used to verify whether test expected results are met?

System.assert() methods should be used to verify whether the expected results are met or not.

What can be used in catch block to log errors?

System.debug statements can be used in catch blocks to log the errors. Detailed information about the error, such as what caused the error, can be logged. Debug logs can be used to view the caught errors.

How do you identify Apex methods that run asynchronously?

Technically, you use the @future annotation to identify methods that run asynchronously.

Unit Tests: Data Setup Method

Test class methods annotated with @testSetup can be used to set up test data

Reference standalone file

The $Resource global variable and dot notation is used to reference static resources that are uploaded as standalone files. For example, {!$Resource.<resourcename>}.

SOQL Wildcards: Zero or More

The % wildcard matches zero or more characters.

What can you find in the 'Scheduled Jobs' page in Setup?

The 'Scheduled Jobs' page in Setup can be used to view all reporting snapshots, scheduled Apex jobs, and dashboards scheduled to refresh

Override keyword

The 'override' keyword can be used to override a method in a class that is defined as virtual or abstract.

Transient Variables

The 'transient' keyword is used to declare variables that cannot be saved. One common usage is a field on a VF page that is utilized only during the page request.

Apex class sharing modes: with sharing

The 'with sharing' keyword allows you to specify that the sharing rules for the current user are considered for the class. You have to explicitly set this keyword for the class because Apex code runs in system context.

How are the wildcards * and ? used in SOSL?

The * wildcard matches zero or more characters at the middle or end of the search term. The ? wildcard matches only one character at the middle or end of the search term.

What is the purpose of the <apex:column> VF component?

The <apex:column> component creates a new column within the table.

In VF, what is the purpose of the <apex:form> component?

The <apex:form> component enables your page to send user-submitted data back to its controller.

How do you reference JavaScript in a VF page?

The <apex:includeScript>tag and $Resource global variable are used to reference JavaScript files in static resources.

VF: Displaying Fields

The <apex:outputField> component can be used to display individual fields from a record.

VF: Standardized Appearance

The <apex:pageBlock> and <apex:pageBlockSection> components are used to enable the platform look and feel

<apex:pageMessages/>; what does this VF component do?

The <apex:pageMessages> component displays all information, warning or error messages that were generated for all components on the current page.

List Views in VF Pages

The <apex:selectlist> component can be used to include list views to filter records displayed on a page. The expression {! listViewOptions} can be used to get a list of list view filters available for an object

Which method annotation can be used to make Apex available to a flow or process?

The @InvocableMethod annotation can be used to make an Apex method available to a flow or process. Invocable methods must be static and either public or global. Only a single method in an Apex class can have the @InvocableMethod annotation, and other annotations cannot be used with it. An invocable method can have at most one input parameter, and the @InvocableVariable annotation can be used to identify class variables used as input or output parameter.

Custom sObject for platform event ends in what?

The API name ends with "__e"

What can you find under the Apex Jobs page in Setup?

The Apex Jobs page in Setup can be used to monitor the status of all asynchronous Apex jobs in Salesforce. Apex Flex Queue in Setup can be used to monitor and reorder the jobs.

Scheduled Apex

The Apex Scheduler lets you delay execution so that you can run Apex classes at a specified time. This is ideal for daily or weekly maintenance tasks using Batch Apex. To take advantage of the scheduler, write an Apex class that implements the Schedulable interface, and then schedule it for execution on a specific schedule.

Total Heap Size

The Apex heap size limit for synchronous and asynchronous transactions is 6MB and 12MBrespectively.

When does an Apex transaction end?

The Apex transaction ends after changes are committed to the database at the end of the original process

Display Error Message

The ApexPages.message class can be used to show errors related to exceptions caused by a custom controller or controller extension for a Visualforce page

What object can be used to add test to an Apex job queue?

The ApexTestQueueItem object can be used to add tests to an Apex job queue and run them asynchronously. This is an API object.

Lightning Data Service

The Aura framework supports the Lightning Data Service (LDS), which serves as the data layer and can be used to read, create, update, and delete records. Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you. In addition to simplifying access to Salesforce data, Lightning Data Service improves performance and user interface consistency. At the simplest level, you can think of Lightning Data Service as the Lightning components version of the Visualforce standard controller. While this statement is an over-simplification, it serves to illustrate a point. Whenever possible, use Lightning Data Service to read and modify Salesforce data in your components.

Aura Framework: Events

The Aura framework supports two types of events, namely component events and application events. Component events are used for handling events in the containment hierarchy while application events allow handling events at the application-level.

What can you find under the the Batch Jobs page?

The Batch Jobs page can be used to view only batch jobs. It is useful when there are many batch jobs. A slider can be used to select a specific date range and narrow down the list of batch jobs.

Subscribing to Platform Events in External Apps

The Bayeux protocol (websocket & HTTP) is required in order to subscribe to platform events in an external app. CometD is a library that implements this protocol and can be used to subscribe to platform events in an external client. CometD is an event and message routing bus. A custom CometD client can be implemented or EMP Connector can be utilized. Platform events are sent by Salesforce to CometD clients sequentially in the order they are received.

Pre-Built Flows: Create Case

The Create a Case flow walks agents through the case creation process and helps eliminate user errors

Apex DISTANCE() function

The DISTANCE() function calculates the distance between two geolocations.

Bulk DML Statement

The DML statement 'insert ListName' is used to insert multiple records with one operation.

Database class methods

The Database class provides an alternative way for making record changes in the database as well as other methods

Publishing Results

The Database.SaveResultobject is returned by the EventBus.publish()method. It contains the result of the publishing. When theisSuccess()method of an instance of the object returns true, then it means that the event message was published successfully in the Salesforce event bus. Errors are returned in theDatabase.Errorobject.

How can you debug server-side issues with LCs?

The Developer Console can be used for server-side debugging of Lightning components. A debugger can look for logs that have contain "/aura" in their Operation column

Apex GEOLOCATION() function

The GEOLOCATION() function creates a geolocation from a latitude and longitude. A geolocation represents a specific physical location. Here the function is used to combine the latitude and longitude parameters to create a value that represents the location of the user.

SOQL Group By

The GROUP BY clause can be used to specify a group of records to avoid iterating through individual query results.

SOQL HAVING

The HAVING clause can be used to filter the results returned by an aggregate function in a SOQL query

<li> HTML tag

The HTML <li> element is used to represent an item in a list. It must be contained in a parent element: an ordered list ( <ol> ), an unordered list ( <ul> ), or a menu ( <menu> ).

SOQL IN

The IN or NOT IN operator can be used in a WHERE clause to filter on a set of value. - It can be used with lists of any type, such as a list of IDs, Integers or Strings. - Using a bind expression as a value allows filtering on a dynamic set of values in Apex. - Example: SELECT Id FROM Account WHERE AccountNumber IN : integerList

How does the Lightning Component Framework allow Aura components to communicate with each other?

The Lightning Component Framework allows Aura components to communicate with each other using component and application events

What is the MVC Architecture?

The MVC architecture consists of three components, namely, Model, View, and Controller. Each represents a different layer of the MVC pattern and specific aspects pertaining to application development. The Lightning Component Framework is used for developing Lightning components. The Aura Framework can be used for building Lightning Aura components.

How can you check which metadata types are supported in the Metadata API?

The Metadata Coverage report shows which metadata types are supported in the Metadata API and other metadata channels

In Apex, what is the QueryResult object?

The QueryResult object has a records field that is an array of sObject records matching your query. For example, the following query returns an array of Contact records in the records field. SELECT Id, LastName FROM Contact WHERE FirstName = 'Bob'

Pre-Built Flows: Reset Password

The Reset Password flow walks agents through the customer password reset experience.

What is the Salesforce Lightning Inspector?

The Salesforce Lightning Inspector is a Google Chrome Developer Tools extension that can be installed for navigating the component tree, inspecting component attributes, and profiling component performance

Method Return Value

The data type of the returned value must be explicitly specified for a method which returns a value.

In the log inspector, what is the stack tree?

The Stack Tree has two tree views, namely, Execution Tree and Performance Tree. They show information in a top-down manner from the initiating calls to the next level down. The Execution Tree displays each operation while the Performance Tree aggregates operations to provide a better look at the performance of an operation as a whole.

When scheduling Apex, what arguments are used for the System.Schedule method?

The System.Schedule method takes three arguments: 1. A name for the job 2. An expression used to represent the time and date the System.schedule job is scheduled to run 3. The name of the class. The method uses the user's timezone for the basis of all schedules.

Since Apex code runs in system mode by default, how can you test user context?

The System.runAs method allows test methods to run in the context of an existing user or a new user. Record sharing of the user specified in the System.runAs method is enforced

What method do you use to the call the static resource that has has test data nd define the sObject type?

The Test.loadData method is called inside the test methodt hat requires it. Example: Test.LoadData (Account.sObjectType, 'TestAccounts');

Reference file in archive

The URLFORfunction in conjunction with the $Resource global variable is used to reference a static resource that is contained in an archive. For example, URLFOR($Resource.<resourcename>, 'images/icons/white.png') returns the URL to a specific image in the zip file

What is required to override a tab home page with a VF page?

The VF page must use the standard list controller for that tab, a custom controller, or no controller

Inline VF

The VF page should use the standard controller of the standard or custom object associated with the page layout in order for the page to be available in the page layout editor.

Pre-Built Flows: Verify Identity

The Verify Identity flow helps agents resolve cases of missing credentials

View State Tab

The View State tab in the Developer Console allows you to examine the view state for a Visualforce page request. 1. Show components contributing to view state 2. Must be enabled on a user profile 3. Is displayed only when using

SOSL WHERE

The WHERE clause is used to search and only return records that match a specified criteria.

How you apply current user security to a SOQL statement?

The WITH SECURITY_ENFORCED clause, which enforces field and object level security permissions, can be added to a SOQL statement which will cause the query to throw a System.QueryException if the current user does not have access to a field or object that is referenced in the SOQL statement

SOQL WITH

The WITH clause can be used to filter records based on field values. Unlike the WHERE clause which only supports fields from the object specified in the FROM clause, WITH allows you to filter by other related criteria.

SOQL Wildcards: One Character

The _ wildcard matches exactly one character.

Abstract definition modifier

The abstract definition modifier declares that this class contains abstract methods, that is, methods that only have their signature declared and no body defined.

VF Action Aware Tags: <apex:actionPoller>

The action is called periodically without user input.

VF Action Aware Tags: <apex:commandButton>

The action is called when a user clicks the button

VF Action Aware Tags: <apex:commandLink>

The action is called when a user clicks the link

VF Action Aware Tags: <apex:page>

The action is called when the page is loaded.

Prevent DML Operation

The addError()method can be called on a record or field to prevent DML operations from committing

What's another benefit of bulkifying code?

The benefit of bulkifying your code is that bulkified code can process large numbers of records efficiently and run within governor limits on the Lightning Platform. These governor limits are in place to ensure that runaway code doesn't monopolize resources on the multitenant platform.

SOQL PLURAL FORM

The child relationship name in a parent-to-child traversal is the plural form of the child object name. For example, Contacts and OpportunityLineItems.

What is Apex inherited sharing?

The class inherits settings of the calling class or depends on how the Apex class is used.

How can a custom type be identified as unique when added to a set?

The class must implement the equals and hashcode methods

BULKIFY TRIGGER CODE

The code defined in an Apex trigger should be able to process a batch of records instead of one record at a time. For example, if a trigger is invoked by a SOAP API call that inserts a batch of 200 records, all those records should be processed as a bulk in the trigger to ensure scalability and avoid hitting governor limits.

What is the output of the following code? Integer index = 1; Integer counter = 2; Do{ System.debug(index); Index ++; Counter ++; }While(index == 20 && counter == 21);

The debug statement will output 1. Loop only runs one time.

Component Events: Bubble Phase

The default phase used by a component event is the bubble phase, which behaves in a bottom-up manner. When an event is fired, the source component gets to handle the event first. Next is its parent component, followed by the grandparent, and then each component all the way up until the root component.

Event-driven Architecture: what is an event producer?

The event producer publishes an event message over a channel when an event occurs.

How you call/render an Apex extension in a VF page?

The extension is associated with the page using the extensions attribute of the <apex:page> component. Because an extension is used in conjunction with a standard controller or custom controller, methods from the "extended" controller will also be available on the page. Multiple controller extensions can be defined for a single page through a comma-separated list. Example: <apex:page standardController="Action" extensions="MyControllerExtension">

What type of fields can be external IDs?

The field type must be number, text or email.

Apex Final Keyword

The final keyword means that the variable can be assigned at most once, either in the declaration itself, or with a static initializer method if the constant is defined in a class.

What does this code do? Fridge f = new Fridge('MX', 200); Toaster t = new Toaster(); KitchenUtility [] utilities = new KitchenUtility[] { f, t }; String model = utilities[0].getModelNumber(); System.debug(model);

The following example creates an instance of a Fridge and Toaster. It then creates an array of KitchenUtility objects using these two objects and treating them as KitchenUtility instances.

Lightning Component Framework: Performance

The framework utilizes a stateful client (using JavaScript) and a stateless server (Apex). The client calls the server only when absolutely necessary, which results in fewer calls to the server and more responsive and efficient apps.

How can the functionality of the Metadata API be accessed?

The functionality in Metadata API can be accessed with the help of two tools, namely, Salesforce Extensions for Visual Studio Code and Ant Migration Tool. 1. Allows metadata customization and building tools for metadata management 2. Used to retrieve, deploy, create, update, or delete customization information 3. Primarily used for deployment of customization information 4. Performance is slower due to the larger complexity of metadata types 5. Metadata API supports XML data format Tooling API supports XML, JSON, and custom data format

Error Cause

The getCause method returns the cause of the exception as an exception object

Line Number

The getLineNumber method returns the line number of the exception

What method do you use to create pricebook entries in tests?

The getStandardPricebookId method is used to get the standard price book ID so that price book entries can be created in tests.

Error Type

The getTypeName method returns the type of exception.

Classes: Global Access Modifier

The global access modifier declares that this class is known by all Apex code everywhere.

What is the global access modifier?

The global access modifier, which is more permissive than the public modifier and allows access across namespaces and applications.

VF Page Data: Static Data

The global variable $Resource can be used to display previously uploaded static resources in a Visualforce page

What is an iFrame component?

The iframe component can be used to display an external website in a VF page. The <apex:iframe>component is used to create an inline frame within a VF page.

What does the merge DML statement do?

The merge statement merges up to three records of the same sObject type into one of the records, deleting the others, and re-parenting any related records.

How can the metadata of an SObject be accessed?

The metadata of an sObject, which is a representation of any Salesforce record, can be accessed using tokens or the describeSObjects Schema method

What is the global access modifier?

The method or variable can be used by any Apex code that has access to the class and not just the Apex code in the same application.

What is the public access modifier?

The method or variable can be used by any Apex in the application or namespace.

What is the private access modifier?

The method or variable can only be accessed within the Apex class in which it is defined.

Protected access modifier

The method or variable is visible to any inner class in the defining Apex class and to the classes that extend the defining Apex class.

What is the protected access modifier?

The method or variable is visible to any inner classes in the defining Apex class, and to the classes that extend the defining Apex class.

What should you do to so that a public utility class is visible to other test classes?

The methods in a public utility class should be declared as public or global to be visible to other test classes

SOSL LIMIT

The optional LIMIT clause can be added to a query to specify the maximum number of rows that arere turned in a search result.

Component Events: Capture Phase

The order of the event propagation in the capture phase behaves in a top-down manner. When the source component fires the event, the root component gets to handle the event first and the propagation traverses down the containment hierarchy until it reaches the source component.

What is the package development model?

The package development model involves creating a package of customizations that is deployed to the production environment

Lookup Relationships: Delete options

The parent can be prevented from being deleted if children exist. Children can also be deleted when parent is deleted (requires Salesforce support).

SOQL Wildcards: Match Similar

The percent (%) and underscore (_) wildcards are supported for the LIKE operator.

Classes: Private Access Modifier

The private access modifier declares that this class is only known locally, that is, only by this section of code. This is the default access for inner classes—that is, if you don't specify an access modifier for an inner class, it is considered private. This keyword can only be used with inner classes (or with top level test classes marked with the @isTest annotation)

Classes: Public Access Modifier

The public access modifier declares that this class is visible in your application or namespace

What is the result of the following expression? Boolean isIt = true; String x = 'You are ' + (isIt ? 'great' : 'small'); System.debug(x);

The resulting string has the value 'You are great'.

What is the result of the following expression? Boolean isIt = false; String x = 'You are ' + (isIt ? 'great' : 'small'); System.debug(x);

The resulting string has the value 'You are small'.

Testing code with different users: Nested Methods

The runAs methods can be nested, or another runAs method can be contained in a runAs method

What is a scratch org?

The scratch org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences. You can share the scratch org configuration file with other team members, so you all have the same basic org in which to do your development.

Displaying Detail From Detail Page

The standard detail page for a particular object record can be displayed using the <apex:detail> component. The <apex:detail> component includes attributes for including or excluding the associated related lists, related list hover links, and title bar that appear in the standard Salesforce application interface.

VF: Using a Standard Controller

The standardController attribute is added to the <apex:page> tag and assigned the name of the standard or custom object.

Static keyword

The static keyword can be used to define a static method, which does not require an instance of a class in order to run.

Event Publishing: Use Case 2 - Problem

The support agents of Cosmic Service Solutions regularly create and update cases in Salesforce. They use Lightning Experience to work on cases. A Lightning web component has been created for support managers, which provides an overview of all the cases assigned to the support agents. While they are viewing the component, the support managers would like to be notified immediately when a case is created or updated by a support agent.

Event types

There are two types of events, namely, component events and application events. Both types of events are fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy. On the other hand, an application event can be handled by any component tha thas a handler for the event.

How many test setup methods can you add per test class?

There is a limit of one test setup method only per test class

What is System.LimitException: Too many query rows: 50001 in Apex and Triggers? what does it mean and how to resolve it?

There is a limit to the number of records that that can be retrieved by the SOQL Query which is 50000 records. Attempting to query the records having the number more than this will give the error which you are getting. To query the records more than its limit, you need to use a Batch Class which provides a fresh limit of 50k records by resetting the limits

When do you need to think about order of execution?

These events are executed when an insert, update or upsert operation occurs

Metadata deployment: ANT Migration Tool

This command-like tool can be used to move metadata between related or unrelated environments

Users may observe that the Platform Integration User appears in the Created By, Last Modified By, or Owner fields on certain records in their organization. What does that mean?

This is a normal and expected part of how Salesforce maintains an organization. Many internal Salesforce applications automatically run their business processes as the Platform Integration User. Some records may show as being created, last modified, or owned by this user.

What does this SOSL query return? List<List<SObject>> searchList = [FIND 'SFDC' IN ALL FIELDS RETURNING Account(Name), Contact(FirstName,LastName)];

This is an example of a SOSL query that searches for accounts and contacts that have any fields with the word 'SFDC'.

Private access modifier

This is the default; method or variable is accessible only within the Apex class in which it is defined.

What is the purpose of the escapeSingleQuotes method?

This method adds the escape character (\) to all single quotation marks in a string that is passed in from a user.

sObject.hasErrors()

This method can be used to determine if an object instance contains any errors.

sObject.addError()

This method can be used to dynamically add errors to specific fields.

sObject.getErrors()

This method can be used to retrieve a list of errors for a specific object instance.

In Apex, what is the AggregateResult object?

This object contains the results returned by a query() if the query contains an aggregate function, such as MAX(). AggregateResult is an sObject, but unlike other sObject objects such as Contact, it is read-only and it is only used for query results.

Where can a developer identify the time taken by each process in a transaction using Developer Console log inspector?

Timeline tab under Execution Overview panel

What syntax do you need so that a test method can access or org data?

To access org data, annotate the test method with @isTest(SeeAllData=true).

How do you access records that cause an Apex trigger to fire?

To access the records that caused the trigger to fire, use context variables. For example, Trigger.New contains all the records that were inserted in insert or update triggers. Trigger.Old provides the old version of sObjects before they were updated in update triggers, or a list of deleted sObjects in delete triggers.

What tag do you use in a VF page to associate a standard controller?

To associate a standard controller with a Visualforce page, the standardController attribute on the <apex:page> tag is used and assigned to the name of any Salesforce object that can be queried using the Force.com API.

Best practices for running within the Apex heap size

To avoid exceeding the heap size, SOQL for-loops should be used to process records in batches especially when handling large data sets. 1. Using transient variables for Visualforce pages, 2. Remove items in a collection after use 3. Use the Limits.getHeapSize() and Limits.getLimitHeapSize() methods are helpful. 4. Don't use class-level variables to store a large amount of data 5. Utilize SOQL For Loops to iterate and process data from large queries 6. Construct methods and loops that allow variables to go out of scope as soon as they are no longer needed

How to avoid Recursive Trigger

To avoid recursive triggers, you can create a class with a static Boolean variable with default value true. In the trigger, before executing your code keep a check that the variable is true or not. Once you check make the variable false.

To declare a batch class, what do you need to include in the declaration syntax?

To create a batch class, the Batchable interface can be used by implementing Database.Batchable<sObject>. Example: public class LeadBatchClass implements Database.Batchable<sObject>{}

How do you create your own custom exception class?

To create your custom exception class, extend the built-in Exception class and make sure your class name ends with the word Exception, such as "MyException" or "PurchaseException".

How do you create a custom exceptions?

To create your custom exception class, extend the built-in Exception class and make sure your class name ends with the word Exception. Append extends Exception after your class declaration as follows: public class MyException extends Exception{}

Apex Transaction Limits for Flows: Total number of records retrieved by SOQL queries

Total number of records retrieved by SOQL queries: 50K (All executions of Get Records elements, and executions of Update Records or Delete Records elements that use filter conditions)

Setting up Apex checkpoints

To debug Apex classes and triggers, up to five checkpoints can be set by opening the class or trigger in a source code editor and clicking in the margin to the left of the line number. After executing the code with the Developer Console open, the Checkpoints tab can be used to view the checkpoints and results. The View All Data user permission is required in order to set checkpoints.

If you want to define a constant variable, which two keywords do you need?

To define a constant, mark a variable as both static and final.

When implementing queueable Apex, what's important about the class declaration syntax?

To define a queueable class, the Queueable interface is needed. Example: public class MyOpportunityQueueableClass implements Queueable{}

To deploy a process or flow as active, your org must have what percentage flow test coverage?

To deploy a process or flow as active, your org must have 75% flow test coverage. To calculate your org's flow test coverage, Salesforce divides the number of covered flows and processes by the sum of the number of active processes and active auto-launched flows. Note: screen flows or workflow not evaluated.

LWC: SVG resources

To display an SVG (e.g., custom icon, illustration, et.c) it can be embedded in the component HTML file or can it uploaded to Static Resources and then imported.

How can you ensure an Apex triggers is only called once?

To ensure a trigger is called only once, before the trigger code is executed, a class with a static method / variable can be called to check and set if the code has already been run as part of the transaction.

In Apex, how do you get child records related to a parent record?

To get child records related to a parent record, add an inner query for the child records. The FROM clause of the inner query runs against the relationship name, rather than a Salesforce object name. This example contains an inner query to get all contacts that are associated with each returned account. The FROM clause specifies the Contacts relationship, which is a default relationship on Account that links accounts and contacts.

Why would a developer use a custom controller instead of a controller extension?

To implement all of the logic for a page and bypass default Salesforce functionality

VF and static resources

To load a static resource in a Visualforce page, the $Resource global variable, which is always accessible, can be used. To access files contained in an archive, the URLFOR function is used.

Loading images on a VF page

To load images on a page, the <apex:image> tag can be used. Images can be referenced from a static resource or it can be referenced from an external URL.

How do you make a web services callout from an Apex trigger?

To make a callout from a trigger, call a class method that executes asynchronously. Such a method is called a future method and is annotated with @future(callout=true).

How can you prevent saving records in a trigger?

To prevent saving records in a trigger, call the addError() method on the sObject in question. The addError() method throws a fatal error inside a trigger. The error message is displayed in the user interface and is logged.

How can you prevent a transaction roll back when executing Apex DML statements?

To prevent the roll back, the limit exception must not be invoked. To prevent the exception from getting invoked, Limit methods such as Limits.getDMLStatements() and Limits.getLimitDMLStatements(), for example, can be used to determine the remaining number of DML statements allowed before actually executing the DML method. If there is no more quota left, Apex can skip executing further DML statements.

How do you securely reference an external image in a VF page?

To reference an image from an external website, the IMAGEPROXYURL function is used.

When do you use sObject?

To store a record (standard or custom object).

What are some key points for batch apex syntax?

To write a Batch Apex class, your class must implement the Database.Batchable interface and include the following three methods: - start - execute

What do you need in Apex to write a batch class?

To write a batch Apex class, your class must implement the Database.Batchable interface. Example: global class CleanUpRecords implements Database.Batchable<sObject>

Metadata deployment: Tooling API

Tooling API allows fine-grained access to an org's metadata and can be used for integrating it with other systems

Within the context of metadata, what is the Tooling API used for?

Tooling API is used for fine-grained access to an org's metadata. 1. Used to retrieve smaller pieces of metadata, such as an object's field or properties 2. REST or SOAP API is used to access objects exposed by Tooling API 3. Suitable for developing interactive applications due to better performance 4. Performance is faster because it retrieves smaller pieces of metadata 5. Tooling API supports XML, JSON, and custom data format

Apex Transaction Limits for Flows: Total number of DML statements issued

Total number of DML statements issued: 150 (Create Records, Update Records, and Delete Records executions)

Apex Transaction Limits for Flows: Total number of SOQL queries issued

Total number of SOQL queries issued: 100 (All executions of Get Records elements, and executions of Update Records or Delete Records elements that use filter conditions)

Apex Transaction Limits for Flows: Total number of records processed as a result of DML statements

Total number of records processed as a result of DML statements: 10K

Trigger Context Variables: Trigger.operationType

Trigger.operationType gets context about the current DML operation. It returns an enum of type System.TriggerOperation that corresponds to the current operation. Possible values: BEFORE_INSERT AFTER_INSERT BEFORE_UPDATE AFTER_UPDATE BEFORE_DELETE AFTER_DELETE AFTER_UNDELETE Switch syntax: switch on trigger.operationType{ when BEFORE_INSERT{ }}

Trigger Context Variables: Trigger.size

Trigger.size is used to determine the number of records processed in a trigger. Note that triggers execute on batches of 200 records at a time.

Trigger Best Practice # 1

Triggers for all possible events on an object can be combined into one trigger. These are: before insert, before update, before delete, after insert, after update, after delete, and after undelete.

A JavaScript file is required in any type of Lightning Web Component. The JavaScript file defines and creates the HTML element if the component renders UI.

True

A MIME type of text/csv is assigned to the static resource once it is uploaded, and is used to determine the default action when the resource is fetched

True

A Visualforce page accessed in Salesforce Classic uses the eclassic styling even with lightningStylesheetsset to true.

True

A Visualforce page can be embedded on a Lightning page using the standard Visualforce Lightning component available in Lightning App Builder.

True

A class is allowed to extend another class and/or implement one or more interfaces.

True

A class is required to a have an access modifier (e.g., public, global), except for inner classes

True

A class is required to have an access modifier (e.g., public or global) except for inner classes.

True

A class or interface (custom type) defined in an anonymous block is considered virtual by default

True

A constructor can be overloaded, meaning multiple constructors with different parameters can be created

True

A custom controller is an Apex class that uses the default, no-argument constructor for the outer, top-level class. You cannot create a custom controller constructor that includes parameters.

True

A custom icon can be defined for the custom LW component by including an SVG file.

True

A flow can be called from Apex dynamically. Meaning, the flow is not fixed or hardcoded in Apex, which allows the flow to invoke to be determined only at run-time.

True

A new Visualforce tab needs to be created for a Visualforce page before it can be added as a menu item

True

A sandbox environment can be cloned instead of using the production org as the source.

True

A setter method has one input parameter and does not return anything.

True

A sharing setting can be defined on the outer class and also in the inner class.

True

A static method or variable does not require a class to be instantiated in order to be accessed

True

A variable declared in a sub-block will not be available to its parent block.

True

All classes that contain methods defined with the webservice keyword must be declared as global. If a method or inner class is declared as global, the outer, top-level class must also be defined as global.

True

All standard Visualforce components, which start with <apex> have anti-XSS filters in place.

True

An Aura component can be configured to register to an event using the <aura:registerEvent> tag and respond to an event using the <aura:handler> tag. A method can be called when an event is received. The type of phase can also be specified.

True

An object of the DescribeSObjectResult class can be used to store the results of the obtained describe information.

True

Any Apex class you want to expose as a REST API must be global and annotated with the @RestResource annotation

True

Any action method in a custom controller or controller extension can return a PageReference object as the result of the method.

True

Apex REST supports OAuth 2.0 and session authentication mechanisms.

True

Apex classes containing code are called directly by test methods for testing

True

Apex is an on-demand, object-oriented language

True

Apex provides the generic Exception class plus 24differenttypesof built-in exceptions in the System namespace

True

Apex test methods don't support callouts, and tests that perform callouts fail. The good news is that the testing runtime allows you to "mock" the callout.

True

As with all controller methods, controller extension methods can be referenced with {! } notation in page markup. In the example above, the {!greeting} expression at the top of the page references the controller extension's getGreeting method.

True

Aura or Lightning Web components can execute Apex methods that have @AuraEnabled annotations.

True

Autolaunched flows are part of the larger transaction that they were launched through and share that transaction's limits. For example, flows launched from Apex or a process are executed with the Apex or process actions as part of the larger transaction.

True

Before you start working with callouts, update the list of approved sites for your org on the Remote Site Settings page.

True

Which default sharing mode is used for anonymous block execution?

User mode with sharing

Firing events can only be wired up by the Lightning lifecycle. That means anything outside the context of the actual lightning DOM cannot fire those events, so no third-party web service code. The third-party javascript code is a different story. The lightning documentation says that you can only register/fire events from built-in resources such as components or related controllers/helpers. It appears you probably want to write a wrapper function in your component which will call the third party code and fire the event when done

True

Flows can be called from an Apex method dynamically by using the createInterview method

True

Flows with Screen elements can span multiple transactions. A new transaction begins each time the user clicks Next in a screen. Flows with Pause elements span multiple transactions. A transaction ends when a flow interview pauses for an event. When the flow interview resumes, a new transaction begins.

True

For future methods, the specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types; future methods can't take objects as arguments.

True

Force.com Metadata API and Force.com IDE provide access through metadata components.

True

Formula fields can expose data the user does not have access to in a record.

True

Full sandboxes can have an optional template

True

Future methods can't be used in Visualforce controllers in getMethodName(), setMethodName(), nor in the constructor.

True

Future methods must be static methods, and can only return a void type.

True

Governor limits cannot be reset in an anonymous code, but a new set of governor limits can be used forunit tests by using Test.startTest() and Test.stopTest() methods

True

HTML static resources can be isolated on a separate domain using iframes to protect Visualforce content from untrusted sources. A static HTML file can be referenced on a separate domain by using $IFrameResource.<resource_name> as a merge field, where 'resource_name' is the name of the uploaded static resource.

True

HTTP callouts can be used with any HTTP service, either SOAP or REST.

True

If a method does not return a value, the keyword 'void' should be used in the method definition

True

If no sharing mode is declared in a class, it will not enforce sharing rules unless it is called from a class that enforces sharing rules.

True

If the sharing setting is 'Read Only' on the two master records, then a user must have 'Read Only' access to both master records to get 'Read' access to the junction object records.

True

If you need to send data back to Salesforce, most of the time you'll do it inside an <apex:form>.

True

If you set SeeAllData = false, then Pricebooks are accessible via getStandardPricebookID but you cannot retrieve product or pricebook using query.

True

Instance methods and member variables are used by an instance of a class, that is, by an object. Instance member variables are declared inside a class, but not within a method. Instance methods usually use instance member variables to affect the behavior of the method.

True

Interface methods do not have access modifiers and only contain their signature

True

Invocable methods and invocable variables support generic sObjectand List data types.

True

It is mandatory to specify one of the access modifiers when declaring an outer class, also know as top-level class.

True

It is possible for a getter method to contain a SOQL query that retrieves data to display on the Visualforce page. For example, it can execute a SOQL query to get a list of account records, and then return the list to the Visualforce page that calls the method

True

JavaScript-based maps can be displayed using Visualforce.

True

Jobs are processed first-in first-out—in the order in which they're submitted. You can look at the current queue order and shuffle the queue, so that you could move an important job to the front, or less important ones to the back.

True

Knowledge articles can be imported into Salesforce knowledge from the 'Import Articles' page of the 'Data Management' section in Setup

True

Limit methods such as Limits.getDMLRows() and Limits.getLimitDMLRows() can be used to obtain informationregarding governor limits.

True

Log levels are cumulative. For example, if DEBUG is set as the log level, the debug log will also include events logged at the INFO, WARN, and ERROR levels.

True

Maps and location services need to be enabled in Setup before a map can be displayed in a Visualforce page.

True

Method parameters, which are enclosed in parentheses, should be separated by commas where each parameter is preceded by its data type.

True

Methods defined in the anonymous block can include the static keyword.

True

Methods defined with the webservice keyword are inherently global. Any Apex code that has access to the class can use these methods. You can consider the webservice keyword as a type of access modifier that enables more access than global

True

Methods defined within an interface have no access modifiers and contain just their signature.

True

Most standard and all custom objects have standard controllers that can be used to interact with the data associated with the object, so you don't need to write the code for the controller yourself.

True

Multiple triggers running on the same object can result in exceeding governor limits.

True

Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this method from scheduled Apex. However, if your scheduled Apex executes a batch job, callouts are supported from the batch class.

True

Test results can be verified with the use of System.assert() methods.

True

Test setup methods are supported only with the default data isolation mode for a test class. If the test class or a test method has access to organization data by using the @isTest(SeeAllData=true) annotation, test setup methods aren't supported in this class.

True

Test setup methods have no arguments and no return value

True

Test setup methods will not be supported if the test class or test method has access to existing data in the org using the @isTest (SeeAllData=true) annotation

True

The <apex:slds /> tag with custom Salesforce Lightning Design System (SLDS) code can be used to include SLDS components that are not part of the Visualforce component library.

True

The Apex Flex queue enables you to submit up to 100 batch jobs for execution. Any jobs that are submitted for execution are in holding status and are placed in the Apex Flex queue. Up to 100 batch jobs can be in the holding status.

True

The CSS scoping class, slds-vf-scope, is automatically applied to the Visualforce page's <body> element when lightningStyleSheets is set to true. If the applyBodyTag or applyHtmlTag is set to false, the scoping class must be manually added to the <body> tag.

True

The Data Import Wizard can be used to import Accounts, Contacts, Leads, Solutions, Campaign Members, Person accounts, and Custom Objects.

True

The DescribeFieldResult class has instance methods for describing sObject fields.

True

The DescribeSObjectResult class also has instance methods for checking the current user's object permissions.

True

The DescribeTabResult class has instance methods for obtaining metadata information for a tab in a standard or custom app in Salesforce.

True

The DescribeTabSetResult class has instance methods for obtaining metadata information about a standard or custom app in Salesforce.

True

The JSENCODE function encodes text and merge field values by inserting escape characters before unsafe JavaScript characters like the double quotation mark (").

True

The LIKE operator in SOQL and SOSL is similar to the LIKE operator in SQL; it provides a mechanism for matching partial text strings and includes support for wildcards.

True

The Lightning Component Framework uses event-driven programming. Lightning Aura components can communicate with each other using events. An event may or may not be triggered by user interaction.

True

The RecordTypeInfo class has instance methods for accessing record type information for an sObject with associated record types.

True

The SObjectField class has instance methods to return the describe field result for a field

True

The SObjectType class has instance methods to return the describe sObject result for a field and construct a new sObject

True

The Schema class has certain static methods for obtaining schema describe information.

True

The Security.stripInaccessible Apex method can be used to remove fields from SOQL query results that the current user does not have access to and avoid exceptions when a DML operation is performed.

True

The StandardSetController stores data sets on the server, which reduces page state and increases performance.

True

The System.Schedule method uses the user's timezone for the basis of all schedules, but runs in system mode—all classes are executed, whether or not the user has permission to execute the class.

True

The System.runAs method can only be used in test methods

True

The Visualforce custom action can be added to the page layout of the object in order to enable it for the Salesforce mobile app

True

The code contained in an Apex class, trigger, or Visualforce component that's part of a managed package is obfuscated and can't be viewed in an installing org. The only exceptions are methods declared as global. You can view global method signatures in an installing org

True

The delete operation supports cascading deletions. If you delete a parent object, you delete its children automatically, as long as each child record can be deleted.

True

The describeSObjects Schema method can be used to describe sObjects

True

The maximum number of records that can be returned in the Database.QueryLocator object is 50 million.

True

The name of a custom exception class must end with Exception such as UserException, AuthException, etc. Otherwise, code cannot be compiled.

True

The only required tag in a Visualforce page required is the <apex:page> tag

True

The original unmodified state of the records are always accessed by the next executing test method

True

The security context under which Apex web service methods run differs from the security context of Salesforce APIs. Unlike Salesforce APIs, Apex web service methods run with system privileges and don't respect the user's object and field permissions. However, Apex web service methods enforce sharing rules when declared with the with sharing keyword. Resources

True

The sharing mode of a class can be defined to determine how it should handle data access restrictions

True

The system saves the records that fired the before trigger after the trigger finishes execution. You can modify the records in the trigger without explicitly calling a DML insert or update operation. If you perform DML statements on those records, you get an error.

True

The test setup method, or the method annotated with @testSetup is used to create test data, which become available to test methods in the test class.

True

The token for a sObject or field can be retrieved by accessing the static member variablename or using a method

True

The types of text fields to search for using SOSL can be specified through the optional INSearchGroup clause.

True

There can be up to 25 External ID fields on an object

True

To activate debug logging for users, Apex classes, and Apex triggers, trace flags and debug levels are configured in Setup or Developer Console

True

To prevent tests from failing and to increase code coverage, Apex provides a built-in WebServiceMock interface and the Test.setMock method.

True

To run SOQL queries for flows, including test coverage, you have to use the tooling API

True

Triggers can fire when one record is inserted, or when many records are inserted in bulk via the API or Apex.

True

Triggers execute on batches of 200 records at a time. So if 400 records cause a trigger to fire, the trigger fires twice, once for each 200 records.

True

Two standard report types are provided by many-to-many relationships which join the master objects and the junction object.

True

Unlike Database class methods, standalone DML statements do not allow partial record processing when errors are encountered.

True

Unlike SQL, SOQL only supports using the SELECT keyword, and does not support other commands such as UPDATE or DELETE, and allows SOQL to be protected from most attacks

True

Unlike specific sObjects types, generic sObjects can be created only through the newSObject() method. Also, the fields of a generic sObject can be accessed only through the put() and get() methods.

True

Up to five levels of child-to-parent relationships can be accessed. For example, {!contact.Account.Owner.FirstName}

True

Use definition modifiers such as virtual or abstract are not required in a class definition

True

Use extreme care if you are planning to invoke a batch job from a trigger. You must be able to guarantee that the trigger won't add more batch jobs than the limit.

True

Use extreme care if you're planning to schedule a class from a trigger. You must be able to guarantee that the trigger won't add more scheduled jobs than the limit.

True

Use the webservice keyword to define top-level methods and outer class methods. You can't use the webservice keyword to define a class or an inner class method.

True

VF: Controller Extensions: One-argument constructor

True

Values can be passed into Apex-defined variables when a flow is launched from a Subflow element, a VF page, or as an action.

True

Visual Force: Standard Controllers: Pre-Defined Apex Classes.

True

We use seeAllData = true to get real-time data in the test class, but without using this also you can get the data from the following objects: User, profile, organization, AsyncApexjob, Corntrigger, RecordType, ApexClass, ApexComponent, ApexPage and custom metadata types.

True

When a constructor is not explicitly defined, a default, no-argument, public constructor is used.

True

When using SOSL, the search query in the Query Editor and the API must be enclosed within curly brackets ({Wingo}). In contrast, in Apex the search query is enclosed within single quotes ('Wingo').

True

When using a custom type (your Apex class) for the map key or set elements, provide equals and hashCode methods in your class

True

When you use <apex:outputField> within a <apex:pageBlockSection> it adopts the two column layout, adds field labels, aligns and styles fields and labels nicely, and so on.

True

With Einstein Next Best Action, you can integrate Salesforce and non-Salesforce data, business rules, action strategies, tactics, predictive models, and more of your business insights in one place.

True

With SOSL, the optional RETURNING clause can be used to specify the information to be returned.

True

With custom exceptions, you can throw and catch them in your methods. Custom exceptions enable you to specify detailed error messages and have more custom error handling in your catch blocks.

True

You can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.

True

You can choose whether a controller extension respects a user's organization-wide defaults, role hierarchy, and sharing rules by using the with sharing keywords in the class definition. For information, see "Using the with sharing, without sharing, and inherited sharing Keywords"

True

You can have only one test setup method per test class.

True

You can launch a flow from Apex.

True

You can only have 100 scheduled Apex jobs at one time and there are maximum number of scheduled Apex executions per a 24-hour period.

True

You can return up to 5 levels of parent objects though relationship query. for exampl [SELECT ParetnId, Parent.ParentId, Parent.Parent.ParentId], etc

True

@AuraEnabled Apex classes used by Aura components or Lightning web components that do not specify "with sharing" or "without sharing" will default to "with sharing" to ensure that Lightning components are secure by default.

True Key point about Aura or Lightning Web Components; the default is "with sharing"

Classes that implement the Process.Plugin interface will only be available to flows

True Salesforce: We recommend using the @InvocableMethod annotation instead of the Process.Plugin interface.

A Visualforce page can be created and made available as a custom action for the action bar of the Salesforce mobile app

True.

A child record once linked to a master record using a m-d relationship cannot be re-parented unless "re-parenting allowed" checkbox is checked on the field level definition

True.

A custom object that is referenced in Apex code or Visualforce page cannot be deleted

True.

A flow can be created that is invoked when a recommendation is accepted or rejected. The flow can be configured to run an automated process, perform a callout, send email and more.

True.

A process can be created to look up, create, or update external objects. External objects are supported by event processes and invocable processes.

True.

A variable ID can be assigned to a string

True.

An application event follows a publish-subscribe model where the event is fired from a source component and all components in the application are notified.

True.

Best practice is to define one trigger per object and handle multiple events within the trigger.

True.

Declaring the same Apex variable in a sub-block is not allowed.

True.

Each setSavePoint() and rollback statement counts against the total DML statements

True.

Exception e is used as a generic exception or you can specify specific ones.

True.

Flows can run in system or user context

True.

Getter methods should have at least public access level so that the Visualforce framework can access them.

True.

Heroku officially supports a broad range of languages and frameworks: Ruby, Python, Node.js, PHP, Go, Java, Scala, and Clojure.

True.

If using validation with a trigger, you use a Before Insert trigger

True.

It is advisable to upload all images, style sheets, and JVScript files as static resources that enables files to load faster (to be used with VF pages).

True.

Like other Apex classes, controller extensions run in system mode. Consequently, the current user's credentials are not used to execute controller logic, and the user's permissions and field-level security do not apply. However, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which the permissions, field-level security, and sharing rules of the current user apply.

True.

Maximum number of records that can be retrieved by SOQL command: 50,000.

True.

One of the best practices for triggers is to bulkify code. Set and map data structures are critical for successful coding of bulk triggers.

True.

Records that are created in a test setup method become available to all test methods in the test class.

True.

Since you can't throw built-in Apex exceptions but can only catch them, you can create custom exceptions to throw in your methods.

True.

The Apex class that uses the 'inherited sharing' keyword runs as 'with sharing' when used as a Visualforce page controller, Apex REST service, or an entry point to an Apex transaction

True.

The Suite Manager is used to create, edit, delete or rename test suites.

True.

The sObject class contains error methods that can be used in Apex testing to track and obtain errors without performing any DML operation.

True.

To subscribe an Apex trigger to a platform event, an after insert trigger is created on the event object type, which in this example, is Order_Event__e. Note that platform events only support after insert events.

True.

When a Visualforce page loads a third-party image outside the org's server, it can initiate a malicious authentication request meant to steal Salesforce usernames and passwords.

True.

SOQL statements can use the ALL ROWS keywords to query all records in an organization

True. ALL ROWS includes records in the recycling bin.

You can make a web service callout directly from a trigger.

True. Apex allows you to make calls to and integrate your Apex code with external Web services. Apex calls to external Web services are referred to as callouts. To make a callout from a trigger, call a class method that executes asynchronously. Such a method is called a future method and is annotated with @future(callout=true). This example class contains the future method that makes the callout. Key point: you have to call a class.

If multiple triggers are developed for a single object, there is no way of controlling the order of execution

True. Figure out: so what happens if you write multiple flows to mimic triggers? How do you control the flow execution?

In Before triggers, the records are not committed to the database so we can skip the DML as whatever value we give to records will naturally assigned to database.

True. For Trigger.New, you can assign values without needing to explicitly commit it to the database.

What is the abstract definition modifier?

Used to declare that a class contains abstract methods which only have signature and no body definition.

When working with VF page, multiple controller extensions can be defined for a single page through a comma-separated list. This allows for overrides of methods with the same name.

True. For example, if the following page exists: <apex:page standardController="Account" extensions="ExtOne,ExtTwo" showHeader="false"> <apex:outputText value="{!foo}" /> </apex:page>

When a class with no specified sharing mode is used as the entry point to an Apex transaction, it will run as without sharing. However, if a class with inherited sharing was used, it will run as with sharing.

True. Study.

In VF, use {! listViewOptions } to get a list of list view filters available for an object

True. Use {! filterId } to set the list view filter to use for a standard list controller's results.

Variables that are declared with the generic sObject data type can reference any Salesforce record, whether it is a standard or custom object record.

True. sObject sobj1 = new Account(Name='Trailhead'); sObject sobj2 = new Book__c(Name='Workbook 1');

Test classes can be either private or public.

True. If you're using a test class for unit testing only, declare it as private.

VLOOKUPs are only available in validation rules.

True. Not available in formula fields.

Any class that implements an interface must define all the methods contained in the interface.

Tue

Triggers working with bulk data (bulk DML or API)

Typically, triggers operate on one record if the action that fired the trigger originates from the user interface. But if the origin of the action was bulk DML or the API, the trigger operates on a record set rather than one record. For example, when you import many records via the API, triggers operate on the full record set. Therefore, a good programming practice is to always assume that the trigger operates on a collection of records so that it works in all circumstances.

When to Use DML Statements and Database DML Statements

Typically, you will want to use Database methods instead of DML statements if you want to allow partial success of a bulk DML operation by setting the opt_allOrNone argument to false. In this way, you avoid exceptions being thrown in your code and you can inspect the rejected records in the returned results to possibly retry the operation. Use the DML statements if you want any error during bulk DML processing to be thrown as an Apex exception that immediately interrupts control flow and can be handled using try/catch blocks

Types of Exceptions: LimitException

Uncatchable exception when a governor limit has been exceeded

What does not affect actual data after successful code execution?

Unit tests

Best Practices for Apex Classes & Triggers: DESIGN TESTS TO VERIFY BULK OPERATIONS

Unit tests should be designed to verify that Apex triggers can handle large datasets and not just single records. Test.startTestand Test.stopTest should be used to utilize a separate set of governor limits wherever necessary.

Unit tests should test which types of scenarios?

Unit tests should set up conditions for all testing scenarios, such as normal, unexpected, boundary, and bad input values. Unit tests should take into consideration positive, negative, and user-restricted code behavior.

What is a big difference between DML statement and database methods?

Unlike DML statements, Database methods have an optional allOrNone parameter that allows you to specify whether the operation should partially succeed. When this parameter is set to false, if errors occur on a partial set of records, the successful records will be committed and errors will be returned for the failed records. Also, no exceptions are thrown with the partial success option.

With Salesforce SOQL, can you use the * wildcard?

Unlike other SQL languages, you can't specify * for all fields. You must specify every field you want to get explicitly. You don't need to specify the Id field in the query as it is always returned in Apex queries, whether it is specified in the query or not. The only time you may want to specify the Id field if it is the only field you're retrieving because you have to list at least one field.

What option do you have to move code between unrelated orgs?

Unmanaged packages

What is the per object limit for copying records into a partial sandbox?

Up to 10,000 records per object can be copied. In addition to standard and custom object records, it can also copy documents and attachments.

How many checkpoints can be set up to debug Apex?

Up to five checkpoints can be set to debug Apex classes and triggers. The Checkpoints tab can be used to access the saved checkpoints.

Describe dml upsert sequence

Upsert uses the sObject record's primary key (the ID), an idLookup field, or an external ID field to determine whether it should create a new record or update an existing one: - If the key is not matched, a new object record is created. - If the key is matched once, the existing object record is updated. - If the key is matched multiple times, an error is generated and the object record is neither inserted or updated

Apex Interface: Syntax

Use 'interface' keyword to create interface definition. Use 'implements' keyword with a class implement.

How do you create a basic input form with VF?

Use <apex:form> and <apex:inputField> to create a page to edit data. Combine <apex:commandButton> with the save action built into the standard controller to create a new record, or save changes to an existing one.

How do you add a table in VF?

Use <apex:pageBlockTable> to add a table of data to a page. <apex:pageBlockTable> is an iteration component that generates a table of data, complete with platform styling. Note: this creates a table in Classic interface

How you display error messages in VF?

Use <apex:pageMessages> to display any form handling errors or messages.

When should you use DML statements vs. database methods?

Use DML statements if you want any error that occurs during bulk DML processing to be thrown as an Apex exception that immediately interrupts control flow (by using try. . .catch blocks). This behavior is similar to the way exceptions are handled in most database procedural languages.

When should you use database methods vs. DML statements?

Use Database class methods if you want to allow partial success of a bulk DML operation—if a record fails, the remainder of the DML operation can still succeed. Your application can then inspect the rejected records and possibly retry the operation. When using this form, you can write code that never throws DML exception errors. Instead, your code can use the appropriate results array to judge success or failure. Note that Database methods also include a syntax that supports thrown exceptions, similar to DML statements.

Lightning Message Service

Use Lightning message service to communicate across the DOM between Visualforce pages, Aura components, and Lightning web components, including components in a pop-out utility bar. Use the Lightning message service functions to communicate over a Lightning message channel. Lightning message service can also be used to communicate with softphones via Open CTI.

Why is it a good idea to use SOQL For Loops?

Use SOQL for loops to operate on records in batches of 200. This helps avoid the heap size limit of 6 MB. The SOQL results can have more than 200 records; however, they are processed in batches of 200.

How to avoid hitting governor limits in test methods?

Use Test.startTest() to reset governor limits?

What is the purpose of a PageReference object?

Use a PageReference object: 1. To view or set query string parameters and values for a page 2. To navigate the user to a different page as the result of an action method

If you want to override the standard buttons such as New or Edit or view for an object or if you plan to use embed a VF page into an object's page layout, what do you need to do?

Use a standard controller.

How should a developer prevent a recursive trigger?

Use a static Boolean variable.

SOQL Aggregate Functions

Use aggregate functions in a GROUP BY clause in SOQL queries to generate reports for analysis. Aggregate functions include AVG(), COUNT(), MIN(), MAX(), SUM(), and more. The following SOQL statement calculates the average amount of all opportunities: SELECT AVG(Amount) FROM Opportunity

Apex Class: Functionality

Use constructors, access modifiers, definition modifiers, and data access keywords. Create static and non-static methods.

Do-While Loop

Use it when the loop needs to be executed at least once. The loop evaluates the conditional expression after the first loop is executed.

What is the purpose of the 'Final' keyword?

Use the 'Final' keyword for a variable whose value should not be altered.

Apex class sharing modes: without sharing

Use the 'without sharing' keywords when declaring a class to ensure that the sharing rules for the current user are not enforced.

isTest Annotation

Use the @isTest annotation to define classes and methods that only contain code used for testing your application. The @isTest annotation can take multiple modifiers within parentheses and separated by blanks. Classes and methods defined as @isTest can be either private or public. Classes defined as @isTest must be top-level classes.

TestVisible Annotation

Use the TestVisible annotation to allow test methods to access private or protected members of another class outside the test class. These members include methods, member variables, and inner classes. This annotation enables a more permissive access level for running tests only. This annotation doesn't change the visibility of members if accessed by non-test classes.

@future (callout=true). What does this mean regarding an Apex method?

Use the future annotation to identify methods that are executed asynchronously. When you specify future, the method executes when Salesforce has available resources.

A method is passed a list of generic sObjects as a parameter. What should the developer do to determine which object type (e.g., Account, Contact), to cast each sObject?

Use the getsObjectType method on each generic sObject to retrieve the sObject token.

What is the batch apex start method?

Used to collect the records or objects to be passed to the interface method execute for processing. This method is called once at the beginning of a Batch Apex job and returns either a Database.QueryLocator object or an Iterable that contains the records or objects passed to the job. Most of the time a QueryLocator does the trick with a simple SOQL query to generate the scope of objects in the batch job. But if you need to do something crazy like loop through the results of an API call or pre-process records before being passed to the execute method, you might want to check out the Custom Iterators link in the Resources section. With the QueryLocator object, the governor limit for the total number of records retrieved by SOQL queries is bypassed and you can query up to 50 million records. However, with an Iterable, the governor limit for the total number of records retrieved by SOQL queries is still enforced.

What is the virtual definition modifier?

Used to declare that a class allows extensions and overrides.

What interface do you use to schedule Apex and what method does it contain?

Uses the Schedulable interface. global void execute(SchedulableContext sc){} After a class has been scheduled, a CronTrigger object is created that represents the scheduled job.

How you populate Apex Maps directly from Apex?

Using a SOQL query. In this method, the map key should be with an ID or String data type and the map value should be declared as an sObject data type.

Apex class sharing modes: without sharing

Using inherited sharing enables you to pass AppExchange Security Review and ensure that your privileged Apex code is not used in unexpected or insecure ways. An Apex class with inherited sharing runs as with sharing when used as: - An Aura component controller - A Visualforce controller - An Apex REST service - Any other entry point to an Apex transaction

LWC: Content asset files

Using the @salesforce/contentAssetUrl scoped module, content asset files can be imported into the component

Implications of Governor Limits: Count() Function

Using the Count() function in a SOQL query counts as one query row toward the limit.

SOSL IN

Using the IN clause enables specifying the types of fields to search for across single or multiple objects

Which VF overrides are available for Lightning console apps?

VF overrides supported for new, edit, view, tab, list, and clone in Lightning console apps.

In Salesforce DX, what is the source of truth?

Version Control System

Package Development Model: code versioning

Versioning is used to facilitate change management. A Version Control System plays an integral role in the package development lifecycle

In MVC Architecture, what does View represent?

View represents the presentation layer which consists of pages and components.

What types of tests can you run in Visual Studio Code?

Visual Studio Code allows running a single method only, or all test methods in a test class. It is also possible to execute all tests that are available

What tools are available to to access functionality provided by the Metadata API?

Visual Studio Code and ANT migration tool

What are some web technologies that can be used in conjunction with VF?

Visualforce markup can be freely mixed with HTML markup, CSS styles, and JavaScript libraries, giving you considerable flexibility in how you implement your app's user interface.

In which Salesforce communities can VF pages be used?

Visualforce pages can also be used in Salesforce Tabs + Visualforce template-based communities.

What declarative tools can send outbound messages

WF and Approval Processes

How you describe queueable Apex?

We took the simplicity of future methods and the power of Batch Apex and mixed them together to form Queueable Apex.

What is SQL referred to when embedded in Apex?

When SOQL is embedded in Apex, it is referred to as inline SOQL.

What happens when a constructor is not explicitly defined?

When a constructor is not explicitly defined, a default, no-argument, public constructor is used

Parent and Grandparent Records

When a parent/grandparent is updated due to its roll-up summary fields or cross-object field updates, an entire order of execution will be performed for each record, but excluding the database commit.

Note about triggers

When a triggers is on an object, updates to records of that object can only be done with Before Insert and Before Update triggers.

Invocable Variables

When an Apex class is used as an input or output parameter for an invocable method, the class member variables that need to be available to the method should be annotated with @invocableVariable.

What's a good use case to use Blob?

When an attachment in Salesforce needs to be stored as a variable. It can be used to convert the attachment into a single object.

What happen with anonymous code if an exception is encountered?

When an exception is encountered, any database changes are rolled back

When do you use the Class object?

When an object of a class needs to be instantiated in order to access non-static methods and variables of the class.

Best Practices for Apex Classes & Triggers: USE ASYNCHRONOUS APEX METHODS EFFICIENTLY

When designing triggers to utilize asynchronous Apex methods, it is necessary to consider the governor limits specific to methods with the @futureannotation. One of the most important considerations is that no more than 10 @futuremethods can be invoked from an Apex trigger. When using an @future method in an Apex trigger, it is important to ensure that it is not placed in a 'for' loop and is invoked only once for all the records it needs to process.

What's a good use for Apex Double?

When large 64-bit numbers with decimals are required.

What's a good use for Apex Long?

When large 64-bit numbers without decimals are required.

What happens when you launch a flow from a quick action?

When launching a flow from a quick action, the record is automatically passed to the flow. When a flow is invoked from a Lightning page, a checkbox in Lightning App Builder can be used to let the page pass the record to the flow automatically.

How do you limit the number of records returned in SOQL query?

You can limit the number of records returned to an arbitrary number by adding the LIMIT n

Performing DML calls in a trigger

When performing DML calls in a trigger or in a class, perform DML calls on a collection of sObjects when possible. Performing DML on each sObject individually uses resources inefficiently. The Apex runtime allows up to 150 DML calls in one transaction.

When do you the final keyword with a variable?

When the value will stay the same.

What's an implication of using future methods?

When using future methods, it's also possible that two future methods could run concurrently, which could result in record locking and a nasty runtime error if the two methods were updating the same record.

When do you create a constructor in Apex?

When want to provide specific initial values for member variables. it's often useful to have a constructor that takes parameters so you can initialize the member variables from the passed in argument values.

Auto-Populating Map Entries from a SOQL Query

When working with SOQL queries, maps can be populated from the results returned by the SOQL query. The map key should be declared with an ID or String data type, and the map value should be declared as an sObject data type. This example shows how to populate a new map from a query. In the example, the SOQL query returns a list of accounts with their Id and Name fields. The new operator uses the returned list of accounts to create a map. // Populate map from SOQL query Map<ID, Account> m = new Map<ID, Account>([SELECT Id, Name FROM Account LIMIT 10]); // After populating the map, iterate through the map entries for (ID idKey : m.keyset()) { Account a = m.get(idKey); System.debug(a); }

What is the difference between variables declared for a class and variables declared for a method?

Whereas class member variables define the attributes of an object, such as name or height, local variables in methods are used only by the method and don't describe the class.

Querying Record in Batches By Using SOQL For Loops

With a SOQL for loop, you can include a SOQL query within a for loop. The results of a SOQL query can be iterated over within the loop. SOQL for loops use a different method for retrieving records—records are retrieved using efficient chunking with calls to the query and queryMore methods of the SOAP API. By using SOQL for loops, you can avoid hitting the heap size limit.

To throw an exception, it must be constructed first. There are four ways to construct a custom exception, and then it can be thrown. What are they? #1

Without Arguments: A custom exception can be instantiated without arguments such as:MyException me = newMyException();throw me

What's the default data access setting of Apex classes?

Without sharing

What happens if a VF page does not use the standard controller associated with the page layout?

Won't appear as an option in the page layout editor.

Which tool allows a developer to send requests to the Salesforce REST API and view the responses?

Workbench REST explorer

WF Recursive Loops

Workflow rules can create recursive loops. For example, if a field update for Rule1 triggers Rule2, and a field update for Rule2 triggers Rule1, it will cause recursion and may cause the organization to exceed its limit for workflow time triggers per hour.

Can you include managed package code coverage when deploying?

Yes - unlike the overall code coverage calculation in Developer Console, an organization's code coverage computed in a deployment can cover managed package code throughtheRunAllTestsInOrg test level.

Is the following constructor declaration legal? public Leads (String email, Boolean call) {} public Leads (Boolean call, String email) {}

Yes. Though 2nd constructor has the same arguments as the 1st, they are in a different order, so this is legal.

Can you override the functionality of standard buttons?

Yes. Standard buttons, such as New, can be overridden using the action override screen. All experiences (SFDC Classic, Lightning, and Mobile) can be overridden on this screen.

Can you use a flow to call a web service?

Yes. A flow can be used to call a web service and process the returned JSON data.

Can you add Lightning Components to screen flows?

Yes. Aura or Lightning Web components can be added to flow screens to utilize features such as intuitive navigation options, custom styling, dynamic screens with filtered fields, and uploading files from a flow screen.

How can you create test data?

You can create test data either in your test method or you can write utility test classes containing methods for test data creation that can be called by other tests.

What happens if you use the delete DML statement?

You can delete persisted records using the delete statement. Deleted records aren't deleted permanently from Lightning Platform, but they're placed in the Recycle Bin for 15 days from where they can be restored.

Describe the two types of Apex web services

You can expose your Apex class methods as a REST or SOAP web service operation.

How do you limit the records returned from SOSL queries?

You can filter, reorder, and limit the returned results of a SOSL query. Because SOSL queries can return multiple sObjects, those filters are applied within each sObject inside the RETURNING clause. You can filter SOSL results by adding conditions in the WHERE clause for an object. For example, this results in only accounts whose industry is Apparel to be returned: RETURNING Account(Name, Industry WHERE Industry='Apparel')

Apex Email Services

You can use email services to process the contents, headers, and attachments of inbound email. For example, you can create an email service that automatically creates contact records based on contact information in messages. It's basically an email parsing tool to create/modify records and upload email attachments.

Using the 'this' Keyword

You can use the this keyword in dot notation, without parenthesis, to represent the current instance of the class in which it appears. Use this form of the this keyword to access instance variables and methods. For example: public class myTestThis { string s; { this.s = 'TestString'; } }

What happens if you try to update Trigger.New records?

You get a Final Exception at run-time.

In a VF page, you can use a standard controller to view data for a custom object, but what is needed to retrieve data for grandchild records?

You need a controller extension with a SOQL query.

What are use cases for using Asynchronous Apex?

You'll typically use Asynchronous Apex for callouts to external systems, operations that require higher limits, and code that needs to run at a certain time.

Static resource example

apex:imageurl="{!URLFOR($Resource.staticResource, 'images/icons/white.png')}"/>

What Apex trigger events can you use?

before insert before update before delete after insert after update after delete after undelete

What is cURL?

cURL is a command-line tool for getting or sending files using URL syntax. It comes in quite handy when working with REST endpoints. Instead of using Workbench for your Apex REST service, you use cURL to invoke the GET HTTP method. Each time you "cURL" your REST endpoint, you pass along the session ID for authorization. You were spoiled when working in Workbench because it passes the session ID for you, under the covers, after you log in.

If caseKeys is a Map defined as Map<Id,case>, what does the method caseKeys.keySet() return?

caseKeys.keySet(): returns a set that contains all of the keys in the map.

Why would the following code fail? Decimal d; d.addDays(2);

d is null and had no value.

Which file must be created to delete metadata components?

destructiveChanges.xml

If a block only contains a single statement, the curly braces can be optionally omitted

if (4 > 2) System.debug ('Yep, 4 is greater than 2');

What can you use to test if a string is a valid ID?

instanceOf

What is the purpose of the ltng:require tag?

ltng:require enables you to load external CSS and JavaScript libraries after you upload them as static resources. Use the styles attribute to specify a resource name and CSS file. Use the scripts attribute to specify a resource name and JavaScript file.

Main point is not to do SOQL statements inside Apex loops; run the SQL statement first and then execute the loop

point to remember

To use Queueable Apex, simply implement the Queueable interface.

public class SomeClass implements Queueable { public void execute(QueueableContext context) { // awesome code here } }

Enum example

public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } The create a "regular" class public class EnumTest { Day day; public EnumTest(Day day) { this.day = day; } public void tellItLikeItIs() { switch (day) { case MONDAY: System.out.println("Mondays are bad."); break; case FRIDAY: System.out.println("Fridays are better."); break; case SATURDAY: case SUNDAY: System.out.println("Weekends are best."); break; default: System.out.println("Midweek days are so-so."); break; } } public static void main(String[] args) { EnumTest firstDay = new EnumTest(Day.MONDAY); firstDay.tellItLikeItIs(); EnumTest thirdDay = new EnumTest(Day.WEDNESDAY); thirdDay.tellItLikeItIs(); EnumTest fifthDay = new EnumTest(Day.FRIDAY); fifthDay.tellItLikeItIs(); EnumTest sixthDay = new EnumTest(Day.SATURDAY); sixthDay.tellItLikeItIs(); EnumTest seventhDay = new EnumTest(Day.SUNDAY); seventhDay.tellItLikeItIs(); } }

How you declare a generic sObject for an Account?

sObject s = new Account();

What is the syntax to create a parent object based on a child object?

sObjectTypeName parentObject = objectA.RelationshipName;

Which two static methods are used to assign a new set of governor limits?

startTest() and stopTest()

Give an example of declaring a constant.

static final Integer INT_COST = 200;

What property do you use in VF to dictate tab order?

tabOrderHint="#"


Ensembles d'études connexes

Congenital Heart Disease in Children

View Set

Google Analytics study questions

View Set

Unit 2 Music History Study Multiple Choice Questions

View Set

Steroid Hormones and Adrenal Glands

View Set

5.02: Constitutional versus Absolute Monarchies

View Set

A+PII: The Autonomic Nervous System and Visceral Reflexes

View Set