Platform Developer 2 Exam Flashcards
What annotation is needed on an Apex class to make it available to be called from a flow/process builder?
@InvocableMethod
What element do you use in Flow Builder to invoke Apex code?
Apex Action
What tag is used to embed a flow in a Visualforce page?
<flow:interview> component
</flow:interview>
How can you call a flow from Apex?
By using the Start method of the Interview class
What are the Invocable Method requirements?
Method requirements:
- must be static
- public or global
- annotated with @InvocableMethod
How many method parameters can an Invocable Method have?
<= 1
How many methods can be annotated with the @InvocableMethod annotation in an Apex class?
Only one
Can you use multiple annotations on an @InvocableMethod method?
Nope
What data structure & type must the parameter be for an Invocable Method?
List (List of List works as well). Can be a specific or generic sObject type
What data structure & type must the return type be for an Invocable Method?
List (List of List works as well). Can be a specific or generic sObject type
Where can you call an @InvocableMethod from?
Process builder, Flow, REST API
What is an @InvocableVariable?
Annotation in a class with an @InvocableMethod that allows the variables to be accessible in the @InvocableMethod
Who is the running user for the @InvocableMethod?
The running user that triggered the process
What are the 3 advanced options in Apex action flow elements?
- (recommended) Flow decides at run time
- Apex action always runs in a different transaction
- Apex action always runs in the same transaction
Where can you embed a flow?
LWC, Aura, VF page
Can you embed a LWC in a flow?
Yes
How do you embed a LWC in a flow?
In the config file, add a target & targetConfig tag (ex. below)
<targets>
<target>lightning\_\_FlowScreen</target>
</targets>
<targetConfigs>
<targetConfig>
<property></property>
</targetConfig>
</targetConfigs>
___________________________________________________________
In the js file, use the @api decorator to expose the property in the screen flow (ex. below)
@api strName;
For a LWC that is embedded in a flow, how can you customize the property editor?
In the config file, add the configurationEditor tag with the name of the other component to the targetConfig tag (ex. below)
<targetConfigs>
<targetConfig>
<property></property>
</targetConfig>
</targetConfigs>
Javascript question: What does a variable with a prefix of “_” indicate? Ex.
_myVar
anotherVar
The prefix with an underscore is a convention that indicates the variable is private. JS doesn’t actually enforce it, but it helps to indicate author intent
What is the Process.Plugin interface?
Precursor to @InvocableAction. @InvocableAction is preferenced now
What are some declarative tools?
- formula fields, roll-up summary fields, validation rules, approval processes, workflowr ules, Process Builder, Flow Builder, ReportBuilder, etc
What are some benefits of declarative tools?
- Easier to build and edit
- Get automatic upgrades
- Some aren’t subject to governor limits (ex. roll-up summary fields)
When is code needed?
- Custom UI (Lightning components (Aura or LWC))
- Apex needed for web services, email services, complex validation over multiple objects
- REST or SOAP integrations
- Regularly processing a large number of records
Can you share records using flow?
Yes
Can a flow be triggered by a platform event?
Yes
How can you process an email to a case?
- Simple scenario: Email-to-Case configuration
- Complex scenario: Apex Email Handler”
What is Apex Email Service?
Apex class that can receive and process incoming emails to a specific generated email address. Can define parameters around which email senders are allowed
Can you rollback records in a flow?
Yes
How can you set the order of flows that are running on a single obj?
In Flow Trigger Explorer there’s an “Edit Order” button where you can set it appropriately
What’s the max number of scheduled Apex jobs that you can have at one time?
100
When should you use a SOQL for loop?
When there may be a large number of query results (it processes it in batches)
How can you handle trigger recursion?
Use a static boolean to determine if the trigger has run already
When are the Limit methods helpful?
Can be used to check if you’re going to exceed governor limits
How many @future methods can be invoked per method?
50
What is an unhandled exception?
- Code that can’t handle an error that occurs during a transaction
- Code terminates & all changes are rolled back
- Salesforce sends an email notification
- UI notification is shown to user
- Noted in the debug log
What are some options for error handling?
- addError() to an sObject record
- try/catch/finally statements
- Error class methods that can be used: getMessage(), getFields(), and getStatusCode methods
What are some types of exceptions?
- DmlException
- ListException
- NullPointerException
- QueryException (trying to set SOQL results to a single sObj instead of a list)
- SObjectException (trying to access a field that wasn’t retrieved in a SOQL query)
- LimitException (these can’t be caught)
- CustomException
- MixedDML
What is the safe navigation operator?
a=b?.c means
- if b is not null, set a = b.c
- if b is null, set a = null
What is the MixedDmlException
When a single transaction performs DML operations for both a setup object such as a User record and a non-setup object such as an Account record, a Mixed DML error is thrown.
What is the syntax for a CustomException?
if(somethingHappens) throw new CustomException(’Failure!’);
What keyword is used to specify a starting row offset into the result rest returned by a query?
OFFSET