Process Automation and Logic (38%) Flashcards

1
Q

Enforcing Object and Field Permissions in Apex

A
  • Sharing rules are not always bypassed just because Apex is run in system context. Use WITH SHARING or WITHOUT SHARING keywords to explicitly enforce or not enforce sharing on Apex classes
  • Enforce field and object permission in SOQL queries using keyword WITH SECURITY_ENFORCED.
  • Use methods Schema.DescribeSObjectResult and Schema.DescribeFieldResult to check user’s access permission levels to objects and fields
  • Use instance methods IsAccessible, IsUpdateable, IsCreatable, IsDeletable with above mentioned to check specific
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

getGlobalDescribe()

A
  • Returns a map of all sObject names (keys) to sObject tokens (values) for the standard and custom objects defined in your organization
  • EX: Map gd = Schema.getGlobalDescribe();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Database.query(string) method

A
  • Use to create a dynamic SOQL query at runtime using input from an end user
  • sObject s = Database.query(string);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DescribeSObjectResult Methods

A
  • fields - follow with a field member variable name or the getMap method
  • fieldSets - follow with a field set name or the getMap method
  • getChildRelationships() returns a list of child relationships
  • getKeyPrefix() Returns the 3-character prefix code for the object
  • getLabel() Returns the object’s label
  • getLabelPlural() Returns the object’s plural label
  • getLocalName() Returns the name of the object with namespace omitted if object is part of current namespace
  • getName() Returns the name of the object
  • getRecordTypeInfos() Returns a list of the record types supported by the object
  • getRecordTypeInfosByDeveloperName() Returns a map that matches developer names to their associated record type
  • getRecordTypeInfosById() Returns a map that matches the record IDs to their associated record type
  • getRecordTypeInfosByName() Returns a map that matches records labels to their associated record type
  • getSObjectDescribeOption() Returns the effective describe options used by the system for the SObject
  • getSObjectType() Returns the Schema.SObjectType object for the sObject. You can use this to create a similar sObject.
  • isAccessible() Returns true if the current user can see this object, false otherwise
  • isCreateable() Returns true if the object can be created by the current user, false otherwise
  • isCustom() Returns true if the object is a custom object, false if it is a standard object
  • isCustomSetting() Returns true if the object is a custom setting, false otherwise
  • isDeletable() Returns true if the object can be deleted by the current user, false otherwise
  • isFeedEnabled() Returns true if Chatter feeds are enabled for the object, false otherwise
  • isMergeable Returns true if the object can be merged with other objects of its type by the current user, false otherwise. True is returned for leads, contacts, and accounts
  • isMruEnabled() Returns true if Most Recently Used list functionality is enabled for the object, false otherwise
  • isQueryable() Returns true if the object can be queried by the current user, false otherwise
  • isSearchable() Returns true if the object can be searched by the current user, false otherwise
  • isUndeletable() Returns true if the object can be undeleted by the current user, false otherwise
  • isUpdateable() Returns true if the object can be updated by the current user, false otherwise
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Cross-object formula fields can pull field values from objects that are up to X relationships away.

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False: Cross-object formula fields can pull data from a record even if the user does not have access to it

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Reasons a roll-up summary field would not be able to calculate the value of a formula field

A
  • The formula field contains cross-object field references
  • The formula field contains functions that derive values dynamically, such as NOW or TODAY
  • The formula field is a type other than Number, Currency, Percent, Date, or Date/Time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Roll-up summary functions and supported field types

A

SUM:

  • Number
  • Currency
  • Percent

MIN or MAX:

  • Number
  • Currency
  • Percent
  • Date
  • Date/Time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Valid ways to declare a String variable

A
  • Correct: String str1;
  • Correct: String str1 = ‘Hello World’;
  • Incorrect: String str1 = new String();
  • Does not need to be instantiated with a new() command because it is a primitive data type. Can be declared with or without an initial value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Valid syntax for declaring collection variables

A
  • Can be sObject, Apex object, List, Set, or Map
  • new Map()
  • new Account[]{}
  • new List()
  • new Set()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Apex Expression

A
  • A construct made up of variables, operators, and method invocations that evaluates to a single value.
  • Can be a literal expression, a new sObject, Apex object, list, set, map, SOQL or SOSL query in square brakcets, or a static or instance method invocation.

Examples:

  • 3+4 (literal)
  • new List()
  • myClass.myMethod()
  • new Account[]{}
  • Account[] aa= [SELECT Id, Name FROM Account WHERE Name = ‘Acme’]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Lists, Sets, and Maps

A
  • List is an ordered collection of elements distinguished by their indices. Can be of any data type.
  • Set is an unordered collection of elements that do not contain any duplicates. Can be of any data type.
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Parameterized Typing

A
  • The concept that Apex is a statically-typed programming language, which means users must specify the data type for a variable before that variable can be used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Characteristics of static, instance, and local

A

STATIC:

  • Associated with a class
  • Allowed only in outer classes
  • Initialized only when a class is loaded
  • Not transmitted as part of the view state for a VF page

INSTANCE:

  • Associated with a particular object
  • No definition modifier
  • Created with every object instantiated from the class in which declared

LOCAL:

  • Associated with the block of code in which used
  • Must be initialized before being used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Enumerations (enums)

A
  • Abstract data type with values that each take on exactly one of a finite set of identifiers that you specify.
  • Define an enum using the enum keyword in declaration and curly braces to demarcate the list of possible values.
  • Ex: public enum Season {WINTER, SPRING, SUMMER, FALL}
  • By creating an enum, you create a data type. Season can now be used as its own data type to define variables.
  • Ex: Season myFavoriteSeason = Season.FALL;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Do-While Loops

A

do {
statement
} while (Boolean_condition);

  • code block/statement must be in curly braces
  • Boolean condition statement is not checked until after the first loop, so the do statement is always executed at least once.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Constructor

A
  • Code that is invoked when an object is created from the class blueprint
  • Has the same name as the class name
  • Should not return a value
  • Ex: (second line is the constructor)
public class sampleClass(){
           public sampleClass(){
                      //logic here
           } public void sampleMethod(){
                      //logic here
           }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Common use cases for Apex

A
  • Web services
  • Email services
  • Complex validation over multiple objects
  • Complex business processes that are not supported by workflow
  • Custom transactional logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Apex sharing settings

A
  • “without sharing” is the default setting for Apex classes.
  • Inner classes do not inherit the sharing setting from their container class.
WITH SHARING
- 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, where it has access to all objects and fields.
- Syntax: public with sharing class sharingClass{
//code here
}
WITHOUT SHARING
- Used to ensure that the sharing rules for the current user are NOT enforced. For example, you can explicitly turn off sharing rule enforcement when a class is called from another class that is declared using WITH SHARING.
- Syntax: public without sharing class noSharing{
//code here
}

INHERITED SHARING
- Helps to avoid ambiguity from an accidentally omitted sharing setting

  • 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
  • Inherited sharing runs as without sharing only when explicitly called from an already established without sharing context.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Apex access modifiers

A
  • It is required to specify an access modifier when declaring a top-level class
  • It is not mandatory when declaring inner classes
  • The default for inner classes is private unless explicitly defined otherwise

PRIVATE:

  • Default
  • Method or variable is accessible only within the Apex class in which it is defined.

PROTECTED:
- Method or variable is visible to any inner classes in the defining Apex class, and to the classes that extend the defining Apex class.

PUBLIC:
- Method or variable can be used by any Apex in this application or namespace.

GLOBAL:
- 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Use cases for Static variable/method

A
  • To store information that is shared across instances of a class
  • To create a utility method in a class
  • To use a method or variable without instantiating its class

Since all instances of the same class share a single copy of a static variable, it can be used to store information within the context of an Apex transaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

PageReference Class

A
  • Reference to an instantiation of a page
  • Consists of a URL and a set of query parameter names and values (among other attributes)

Ways to instantiate a PageReference:
- Page.existingPageName
Refers to a PageReference for a Visualforce page that has already been saved in your organization. By referring to a page in this way, the platform recognizes that this controller or controller extension is dependent on the existence of the specified page and will prevent the page from being deleted while the controller or extension exists.

- PageReference pageRef = new PageReference( 'partialURL' );
Creates a PageReference to any page that is hosted on the Lightning platform. For example, setting 'partialURL' to '/apex/HelloWorld' refers to the Visualforce page located at http://mySalesforceInstance/apex/HelloWorld. Likewise, setting 'partialURL' to '/' + 'recordID' refers to the detail page for the specified record.

This syntax is less preferable for referencing other Visualforce pages than Page.existingPageName because the PageReference is constructed at runtime, rather than referenced at compile time. Runtime references are not available to the referential integrity system. Consequently, the platform doesn’t recognize that this controller or controller extension is dependent on the existence of the specified page and won’t issue an error message to prevent user deletion of the page.

  • PageReference pageRef = new PageReference ( ‘fullURL’ );
    Creates a PageReference for an external URL.
  • PageReference pageref = ApexPages.currentPage();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Location-based SOQL queries

A
  • Append __s to the end of a geolocation or address field name to retrieve the latitude/longitude value in a SOQL query, instead of the normal __c for a custom field.
  • Ex: SELECT Name, Location__latitude__s, Location__longitude__s FROM Warehouse__c
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Quoted string escape sequences

A
  • Escape character is the backslash () and using a backslash in any other context will result in an error
  • \n or \N = new line
  • \r or \R = carriage return
  • \t or \T = tab
  • \b or \B = bell
  • \f or \F = form feed
  • \ “ = one double-quote character
  • \ ‘ = one single-quote character
  • \ = backslash
  • LIKE expression only: _ = matches a single underscore character (_)
  • LIKE expression only: \% = matches a single percent sign character (%)

Examples:
- SELECT Id FROM Account WHERE Name LIKE ‘Ter%’
(Selects all accounts whose name begins with the three character sequence ‘Ter’)

  • SELECT Id from Account WHERE Name LIKE ‘Ter\%’
    (Selects all accounts whose name exactly matches the four character sequence ‘Ter%’)
  • SELECT Id FROM Account WHERE Name LIKE ‘Ter\%%’
    (Selects all accounts whose name begins with the four character sequence ‘Ter%’)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

SOSL query limits

A
  • If a limit is set on the entire query, results are evenly distributed among the objects returned

Ex: Set an overall query limit of 20 and don’t define any limits on individual objects. If 19 of the results are accounts and 35 are contacts, then only 10 accounts and 10 contacts are returned.
- FIND {test} RETURNING Account(id), Contact LIMIT 20

  • Limits can also be set per individual object
    Ex: FIND {test} RETURNING Account(id LIMIT 20), Contact LIMIT 100
  • If unspecified, the maximum is 2,000 results
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Wildcard characters in SOQL and SOSL

A

= % and _ are wildcards supported by the LIKE operator

  • % matches zero or more characters
  • _ matches exactly one character

EXAMPLES:
- SELECT Id, LastName FROM Contact WHERE LastName LIKE ‘Ab%’
(This will retrieve Contact records with a last name that starts with ‘Ab’)

  • SELECT Id, LastName FROM Contact WHERE LastName LIKE ‘_Ab’
    (This will retrieve Contact records with a 3-letter last name ending in ‘Ab’)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Database.insert method

A
  • DML operation with an unnamed Boolean paramater that when set to false, if a record in the insert list fails, the remaining records in the list can still succeed (partial processing).
  • The Boolean paramater is “all or nothing” in the sense that if set to true, it will not allow any inserts if a single insert fails.
  • Use this operation instead of a DML statement in code when you want to specify whether or not to allow for partial record processing if errors are encountered.

EXAMPLE:

  • Database.insert(sObjectsToCreate,true) will prevent inserts if a single insert fails
  • Database.insert(sObjectsToCreate,false) will allow inserts even if some failures occur
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

sObjects that don’t support DML operations

A
  • AccountTerritoryAssignmentRule
  • AccountTerritoryAssignmentRuleItem
  • ApexComponent
  • ApexPage
  • BusinessHours
  • BusinessProcess
  • CategoryNode
  • CurrencyType
  • DatedConversionRate
  • NetworkMember (allows update only)
  • ProcessInstance
  • Profile
  • RecordType
  • SelfServiceUser
  • StaticResource
  • Territory2
  • UserAccountTeamMember
  • UserPreference
  • UserTerritory
  • WebLink
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Order of execution

A
  • System validation rules
  • Before triggers
  • All validation rules
  • Duplicate rules
  • After triggers
  • Assignment rules
  • Auto-response rules
  • Workflow rules (if a field is updated, before update and after update triggers will run again only once more)
  • Processes, flows launched by process, flows launched by workflow rules
  • Escalation rules
  • Entitlement rules
  • Record-triggered flows (after save context)
  • Formula/roll-up calculations
  • Commit to database
  • Post-commit logic happens after all DML operations are committed to the database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

isExecuting context variable

A
  • 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.
  • This means that a particular trigger can be tested whether it is executing or not with the help of this variable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Standard Controller Actions

A
  • Quicksave
  • Cancel
  • Delete
  • Edit
  • List
  • creates a button that calls an action
  • creates a link that calls an action
  • periodically calls an action
  • makes an event (such as “onclick”, “onmouseover”, and so on) on another, named component, call an action
  • defines a new JavaScript function that calls an action
  • calls an action when the page is loaded
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Getter & Setter Methods

A
  • The ‘set’ method is used to pass data from Visualforce page to Apex controller.
  • The ‘get’ method is used to pass data from Apex controller to the Visualforce page.
  • The name of the getter method without the ‘get’ prefix should be used to display results from a getter method.
  • Every value that is calculated by a controller and displayed in a page must have a corresponding getter method, including any Boolean variables.
  • Setter methods must always be named in the standard convention of setVariable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Use cases for custom controller in a Visualforce page

A
  • A VF page needs to run in system mode
  • A VF page should replace the functionality of the standard controller
  • Custom controllers run entirely in system mode
  • Custom controllers are not required to override action, a controller extension can be used instead.
34
Q

Use cases for a controller extension in a Visualforce page

A
  • 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
  • You want to add new actions
  • You want to build a Visualforce page that respects user permissions (because a custom controller runs in system mode)
  • Extensions cannot be used standalone; the page must have a controller to start.
35
Q

Custom Exceptions

A
  • Allows you to throw and catch exceptions (you can only catch built-in exceptions, not throw them)
  • Extend the built-in Exception class and make sure the class name ends with the word Exception, ex: “MyException”.
  • Useful if your method is called by another method and you want to delegate the handling of the exception to the caller method.

VALID syntax for throwing a custom exceptions:

  1. With no arguments: new MyException();
  2. With a single String argument that specifies the error message: new MyException(‘This is bad’);
  3. With a single Exception argument that specifies the cause and that displays in any stack trace: new MyException(e);
  4. With both a String error message and a chained exception cause that displays in any stack trace: new MyException(‘This is bad’,e);
36
Q

Bulk triggers

A
  • Data import
  • Lightning Platform Bulk API calls
  • Mass actions, such as record owner changes and deletes
  • Recursive Apex methods and triggers that invoke bulk DML statements
37
Q

Trigger.new vs trigger.old

A
  • Trigger.new returns a list of new versions of the sObject records
  • It is available in insert, update, and undelete triggers
  • Trigger.old returns a list of the old versions of the sObject records
  • It is available only in update and delete triggers
38
Q

newMap vs oldMap

A
  • newMap returns a map of IDs to the new versions of the sObject records
  • It is available in before update, after insert, after update, and after undelete triggers
  • oldMap returns a map of IDs to the old versions of the sObject records
  • It is available in update and delete triggers
39
Q

How can a Standard Controller be used as a Standard List Controller to show and actions on a set of records?

A
  • Add the recordSetVar tag on

Example:

40
Q

@future annotation

A
  • Used to identify methods that are executed asynchronously
  • Can only return a void type
  • Must be static method
  • When you specify future, the method executes when Salesforce has available resources
41
Q

Querying multi-select picklists

A
  • Use comma or semicolon
  • Comma (,) denotes OR operator
  • Semicolon (;) denotes AND operator
  • Values must each be enclosed in single quotes, as a string
42
Q

For loop order of execution:

for (init_stmt; exit_condition; increment_stmt){
code_block
}

A
  1. Execute init_stmt
  2. Perform exit_condition check. If true, the loop continues. If false, it exits.
  3. Execute code_block
  4. Execute increment_stmt, then repeat from step 2.
43
Q

Security vulnerabilities in Apex and Visualforce development

A
  • SOQL Injections: taking user-supplied input and using those values in a dynamic SOQL query. If the input is not validated, it can include SOQL commands that effectively modify the SOQL statement and trick the application into performing unintended commands. Prevent SOQL injections by using the escapeSingleQuotes method.
  • CSRF (Cross-Site Request Forgery): an attacker’s page contains a URL that performs an action on your website. If the user is still logged into your web page when they visit the attacker’s web page, the URL is retrieved and the actions performed.
  • XSS (Cross-Site Scripting): broad range of attacks where malicious HTML or client-side scripting is provided to a web application.
44
Q

Use cases for the transient keyword

A
  • Declare variables that can’t be saved and shouldn’t be transmitted as part of the view state for a Visualforce page
  • Can be used in Apex classes that are serializable, namely in controllers, controller extensions, or classes that implement the Batchable or Schedulable interface.
45
Q

Constant variables

A
  • Variables whose values don’t change after being initialized once.
  • Defined using 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.
46
Q

Custom Settings Visibility

A
  • Visibility settings only available in developer and scratch orgs

PROTECTED:
- If contained in a managed package, not visible through Apex and API (if contained in an unmanaged package, custom settings will behave as if public)

PUBLIC:
- Regardless of the type of package (managed or unmanaged), accessible by Apex, formulas, flows, and API (for users with Customize Application permission)

47
Q

Custom Settings Schema Settings

A

RESTRICT ACCESS TO CUSTOM SETTINGS:

  • Enabled by default
  • Limits access to custom setting values
  • Admins with Customize Application permission can grant Read access to users through profiles and permission sets using Custom Setting Definitions or View All Custom Settings permissions

ENABLE SOSL ON CUSTOM SETTINGS;
- Custom settings values are not returned in SOSL queries. If Apex operations require this functionality, enable this option

48
Q

Custom Settings Permissions

A
  • Read access to custom settings must be explicitly granted
  • Restrict access is the org-wide preference enabled by default
  • Read permission to custom settings can be granted through permission sets and profiles instead of through the Customize Application permission
  • Permission to specific custom settings: use the Custom Setting Definitions permission
  • Permission to all custom settings: use the View All Custom Settings permission
49
Q

Custom Setting Types

A

LIST:

  • Defines application-level data and provides a reusable set of static data that can be accessed across the org
  • Example uses: 2-letter state abbreviations, international dialing prefixes, catalog numbers for products
  • Because the data is cached, no need to use SOQL queries that count against governor limits

HIERARCHY:

  • Uses built-in hierarchical logic that lets you personalize settings for specific profiles or users
  • Checks the organization, profile, and user settings for the current user and returns the most specific, or lowest, value
50
Q

What tools can be used to publish platform events?

A
  • Process
  • Flow
  • Apex
  • API
51
Q

What tools can be used to subscribe to platform events?

A
  • Process
  • Flow
  • Apex
  • Lightning Web Component
  • CometD or EMP connector
52
Q

What format do results from Database.insert() return in?

A

LIST!

  • The result list corresponds index-by-index to the original list of sObject records passed into Database.insert().
53
Q

When is it appropriate to use CometD to subscribe to platform event channels?

A

When Salesforce is the event producer, and an external client is the event subscriber.

54
Q

Virtual and Abstract classes

A
  • Virtual classes cannot have methods that are abstract, but abstract classes can have both abstract and virtual methods.
  • Virtual methods have a body and can’t be overridden by extensions, but abstract methods only have a signature and no body, depending on the extending class to provide the method.
55
Q

What is the difference in using REST vs SOAP to publish an event message?

A
  • REST uses a POST request (HTTP)

- SOAP uses create() call

56
Q

What data is required for a Geolocation field?

A
  • Latitude AND Longitude. Either both must be populated or both must be blank. You can’t have one without the other.
57
Q

Formula functions that can be used with Geolocation fields

A
  • ISBLANK
  • ISCHANGED
  • ISNULL

*You can’t use quality or comparison operators with geolocations.

58
Q

What makes a Visualforce page vulnerable to an XSS attack?

A
  • Using escape=”false”

By default, nearly all Visualforce tags escape the XSS-vulnerable characters. It is possible to disable this behavior by setting the optional attribute escape=”false”

59
Q

What information does Trigger.operationType return?

A
  • The context of the executing DML operation, such as:
  • BEFORE_INSERT
  • BEFORE_UPDATE
  • BEFORE_DELETE
  • AFTER_INSERT
  • AFTER_UPDATE
  • AFTER_DELETE
  • AFTER_UNDELETE
60
Q

What to know about JSON annotation in Apex to control access to serialization/deserialization

A
  • Add the annotation @JsonAccess to determine the context in which it is allowed to be serialized or deserialized.

Example: @JsonAccess(serializable=’never’ deserializable=’always’) never allows serialization but allows everyone to deserialize it.

  • The methods JSON.serialize() and JSON.deserialize() cannot be overridden.
61
Q

Proper syntax format for declaring a method in Apex

A

access modifier | keywords | return_data_type method_name(input_parameter_data_type_1 input_parameter_name_1, input_parameter_data_type_2, input_parameter_name_2){}

EX: public static boolean method(string param){}
EX: private static void assignVariables(List acts, String varInit ){}

62
Q

What is Flow.Interview and what is it used for?

A
  • Apex class used for accessing flow controllers

- Can be used to start flows

63
Q

What is Process.Plugin and what it is used for?

A
  • Interface that can be implemented by an Apex class, which can then by used by the Flow Builder to add custom logic to a flow
64
Q

What is the “final” keyword used for?

A
  • To create a constant variable

EX: final Integer myVariable = 123;
EX: private final Integer myVariable = 123;
EX: private static final Integer myVariable = 123;

65
Q

What methods can be used to neutralize potential XSS threats?

A

Allows performing additional HTML encoding of input prior to reflection in HTML context
- HTMLENCODE()

Allows performing JavaScript encoding of input prior to reflection in JavaScript context:
- JSENCODE()

These are the same - call this function when including merge-fields in JavaScript event handlers within HTML

  • JSINHTMLENCODE()
  • JSENCODE(HTMLENCODE()) (replaces the former)
66
Q

When to use continue vs break loop when iterating loops in Apex?

A
  • Use CONTINUE when you want to skip to the next iteration of a loop
  • Use BREAK when you want to exit the loop
67
Q

Cascading triggers

A

Occur when the execution of one trigger causes one or more additional triggers to be fired

Cascading triggers are part of the same execution context with respect to governor limits

68
Q

What automation tools can send outbound messages without code?

A
  • Workflow rules

- Approval processes

69
Q

Apex Governor Limits: Total number of DML statements issued

A

150

70
Q

Apex Governor Limits: Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin

A

10,000

71
Q

Apex Governor Limits: Total number of SOQL queries issued

A

100

Asynchronous limit is 200

72
Q

Apex Governor Limits: Total number of records retrieved by SOQL queries

A

50,000

73
Q

Apex Governor Limits: Total number of SOSL queries issued

A

20

74
Q

Apex Governor Limits: Total number of records retrieved by a single SOSL query

A

2,000

75
Q

Apex Governor Limits: Total stack depth for any Apex invocation that recursively fires triggers due to insert, update, or delete statements

A

16

76
Q

Apex Governor Limits: Total number of callouts (HTTP requests or Web services calls) in a transaction

A

100

77
Q

What are the implementation details about ‘with sharing’ and ‘without sharing’ keywords?

A
  • If a method is implemented in another class, it takes on the sharing setting of the class where it is defined, not the class that calls it.

EXAMPLE: If a method is defined in a class declared ‘with sharing’ and is called by a class declared ‘without sharing’, the method executes with sharing rules enforced.

  • The only time the sharing setting of the calling method is enforced is when the defining class has not declared a sharing setting but the calling class has.
  • Inner classes do not inherit the sharing setting from their container class.
78
Q

An Apex class defined with ‘inherited sharing’ will run as ‘with sharing’ in what contexts?

A
  • An Aura component controller
  • A Visualforce controller
  • An Apex REST service
  • Any other entry point to an Apex transaction
79
Q

What data types can switch statement expressions be used with?

A
  • Integer
  • Long
  • sObject
  • String
  • Enum
80
Q

Best practices for using the “super” keyword

A
  • You can only use it in classes that are extending from virtual or abstract classes
  • You can only use it in methods that are designated with the “override” keyword