You are on page 1of 29

Platform Developer I Certification Prep: Logic and Process Automation

Unit 1: Review Basic Constructs in Apex, Formulas, and


Rollup Summary Fields
Learning Objectives
After completing this unit, you'll be able to:

• Describe how to use and apply Apex control flow statements.


• Describe the primitive and complex Apex data types and when to use them.
• Describe when to use declarative automation features versus Apex classes and triggers.

Key Topics
This module prepares you for the logic and process automation section of the Platform Developer I exam. The
logic and process automation section, which makes up 46% of the overall exam, tests these topics.

• Formulas and rollup summary fields


• Salesforce Object Query Language (SOQL)
• Salesforce Object Search Language ( SOSL)
• Data Manipulation Language (DML)
• Exceptions and governor limits
• Basic constructs in Apex
• Apex classes
• Apex triggers
• Save order of execution

This module includes a number of interactive, real-world, scenario-based questions that are a lot like the ones
you can encounter as a Salesforce developer. Looking at these scenarios helps prepare you to take the logic
and process automation section of the Platform Developer I exam. As you tackle the practice questions, you
get immediate feedback on your answers, along with detailed information on why your answers are correct (or
incorrect).

This module includes three units on logic and process automation. This unit focuses on the basic constructs in
Apex, formulas, and rollup summary fields.

Exam Practice Questions


Ready to jump in? The sample tool below is not scored—it’s just an easy way to quiz yourself. To use it, read
the scenario on the left side, then click on the answer you think is correct. Some questions may have more
than one correct answer. Click submit, and you get a pop-up telling you whether the answer you chose is
correct or incorrect, and why. When you reach the end, you can review the answers or retake the questions.

1
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 1

Which three statements are true regarding cross-object formula fields? (Select three answers.)

ANSWER FEEDBACK

A. FORMULA FIELDS CAN REFERENCE Correct. A cross-object formula can reference merge
FIELDS FROM MASTER-DETAIL OR fields from a master (“parent”) object if an object is on
LOOKUP PARENT RELATIONSHIPS. the detail side of a master-detail relationship. A cross-
object formula also works with lookup relationships.

B. FORMULA FIELDS CAN REFERENCE Incorrect. Formula fields cannot access a collection of
FIELDS IN A COLLECTION OF RECORDS records. You can perform actions on a collection of child
FROM A CHILD RELATIONSHIP. records using roll-up summary fields.

C. FORMULA FIELDS CAN EXPOSE DATA Correct. Formula fields can expose data that the user
THE USER DOES NOT HAVE ACCESS TO does not have access to. For example, if you create a
IN A RECORD. formula field on the Case object that references an
account field and display that formula field in the Case
page layout, users can see this field even if they don’t
have access to the account record.

D. FORMULA FIELDS CAN REFERENCE Correct. A cross-object formula is available anywhere


FIELDS FROM OBJECTS THAT ARE UP TO formulas are used except when creating default
10 RELATIONSHIPS AWAY. values.

D. FORMULA FIELDS CAN BE USED IN Incorrect. The only formulas you can use in roll-up
THREE ROLL-UP SUMMARIES PER summary fields are COUNT, SUM, MIN, MAX.
OBJECT.

2
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 2

In an organization that has enabled multiple currencies, a developer needs to aggregate the sum of the
Estimated_Value__c currency field from the CampaignMember object using a roll-up summary field called
Total_Estimated_Value__c on Campaign. How is the currency of the Total_Estimated_Value__c roll-up
summary field determined?

ANSWER FEEDBACK

A. THE VALUES IN Incorrect. The currency of the master record


CAMPAIGNMEMBER.ESTIMATED_VALUE__C ARE determines the currency of the roll-up summary
CONVERTED INTO THE CURRENCY ON THE field.
MAJORITY OF THE CAMPAIGNMEMBER
RECORDS AND THE SUM IS DISPLAYED USING
THAT CURRENCY.

B. THE VALUES IN Incorrect. The currency of the master record


CAMPAIGNMEMBER.ESTIMATED_VALUE__C ARE determines the currency of the roll-up summary
CONVERTED INTO THE CURRENCY OF THE field.
CURRENT USER, AND THE SUM IS DISPLAYED
USING THE CURRENCY ON THE CAMPAIGN
RECORD.

C. THE VALUES IN Correct. If your organization uses multiple


CAMPAIGNMEMBER.ESTIMATED_VALUE__C ARE currencies, the currency of the master record
CONVERTED INTO THE CURRENCY OF THE determines the currency of the roll-up summary
CAMPAIGN RECORD, AND THE SUM IS field. For example, if the master and detail
DISPLAYED USING THE CURRENCY ON THE records are in different currencies, the detail
CAMPAIGN RECORD. record value is converted into the currency of
the master record.

D. THE VALUES IN Incorrect. The values in


CAMPAIGNMEMBER.ESTIMATED_VALUE__C ARE CampaignMember.Estimated_Value__c
SUMMED UP AND THE RESULTING should be converted and not summed.
TOTAL_ESTIMATED_VALUE__C FIELD IS
DISPLAYED AS A NUMERIC FIELD ON THE
CAMPAIGN RECORD.

3
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 3

In which three locations can you create custom roll-up summary fields using Standard Object relationships?
(Select three answers.)

ANSWER FEEDBACK

A. ON ACCOUNT USING OPPORTUNITY RECORDS Correct. You can create roll-up summaries on
Accounts using the values of related
opportunities.

B. ON QUOTE USING ORDER RECORDS Incorrect. You can create roll-up summary fields
on any custom object that is on the master side of
a master-detail relationship or any standard object
that is on the master side of a master-detail
relationship with a custom object.

C. ON ACCOUNT USING CASE RECORDS Incorrect. You can create roll-up summary fields
on any custom object that is on the master side of
a master-detail relationship or any standard object
that is on the master side of a master-detail
relationship with a custom object.

D. ON CAMPAIGN USING CAMPAIGN MEMBER Correct. You can create roll-up summaries on
RECORDS Campaigns using campaign member status or
the values of campaign member custom fields.

D. ON OPPORTUNITY USING OPPORTUNITY Correct. You can create roll-up summaries on


PRODUCT RECORDS opportunities using the values of opportunity
products related to the opportunity.

4
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 4

An sObject named Application__c has a lookup relationship to another sObject named Position__c. Both
Application__c and Position__c have a picklist field named Status__c. When the Status__c field on
Position__c is updated, the Status__c field on Application__c needs to be populated automatically with the
same value, and execute a workflow rule on Application__c.

How can a developer accomplish this?

ANSWER FEEDBACK

A. BY USING AN APEX TRIGGER WITH A DML Correct. By using a trigger, you can easily
OPERATION update the picklist value on the parent by
doing an update on the parent record (hence
the DML operation).

B. BY CONFIGURING A CROSS-OBJECT FIELD Incorrect. Here, the status change is on the child
UPDATE WITH A WORKFLOW and it will be reflected on the parent. Instead, the
change should be made on the parent and
reflected on the child.

C. BY CHANGING APPLICATION__C.STATUS__C Incorrect. Here, the status change is on the child


INTO A FORMULA FIELD and it will be reflected on the parent. Instead, the
change should be made on the parent and
reflected on the child.

D. BY CHANGING APPLICATION__C.STATUS__C Incorrect. A rollup summary field can not be used


INTO A ROLL-UP SUMMARY FIELD here because the relationship is a lookup and not
a master-detail relationship.

5
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 5

What should a developer do to update a picklist field on related opportunity records when a modification to the
associated account record is detected?

ANSWER FEEDBACK

A. CREATE A WORKFLOW RULE WITH A FIELD Incorrect. When using workflow rules, you can
UPDATE. only update the record or its parent.

B. CREATE A VISUALFORCE PAGE. Incorrect. Creating a Visualforce page for this


scenario is additional work, and it will only work if
the update is made through the Visualforce page.
This can be accomplished better in a trigger.

C. CREATE A LIGHTNING COMPONENT. Incorrect. Creating a Lightning component for this


scenario is additional overhead, and it will only
work if the update is made through the Lightning
component. This can be accomplished better in a
trigger.

D. CREATE A PROCESS WITH PROCESS BUILDER. Correct. Creating the process using Process
Builder helps the developer control the
schedule of the process. It also allows the
process to run as planned instead of doing
things manually.

6
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 6

When the number of records in a recordset is unknown, which control statement should a developer use to
implement a set of code that executes for every record in the recordset, without performing a .size() or
.length() method call?

ANSWER FEEDBACK

A. DO { … } WHILE (CONDITION) Incorrect. For do while, while, and traditional for


loops, the developer must set the size value for
the exit condition to eventually be met.

B. WHILE (CONDITION) {...} Incorrect. For do while, while, and traditional for
loops, the developer must set the size value for
the exit condition to eventually be met.

C. FOR (INIT_STMT; EXIT_CONDITION; Incorrect. For do while, while, and traditional for
INCREMENT_STMT) { … } loops, the developer must set the size value for
the exit condition to eventually be met.

D. FOR (VARIABLE : LIST_OR_SET) { … }


Correct. List or set iteration for loops do not
need the size of the collection to run.

7
Platform Developer I Certification Prep: Logic and Process Automation

Exam Topic Flashcards


The following flashcards cover UI features, company information, and org-wide settings. Use these interactive
flashcards to brush up on some of the key topics you'll find on this part of the exam.

Read the question or term on each card, then click on the card to reveal the correct answer. Click the right-
facing arrow to move to the next card, and the left facing arrow to return to the previous card.

Question/Term Answer/Definition

Which two users can edit a record An administrator and a user who is assigned
after it has been locked for approval? as the current approver

Name three declarative methods that


Validation rules, lookup filters, page layouts
help ensure quality data.

Name the type that the Boolean will


Object
inherit from? Boolean b = true;

Name three data types or collection


An integer, a single sObject, or a list of
of data types that SOQL statements
sObjects
populate or evaluate.

8
Platform Developer I Certification Prep: Logic and Process Automation

What is the value of x after the code


segment executes?

String x = 'A';

Integer i = 10;

if ( i < 15 ){

i = 15;

x = 'B';
‘B’
} else

if ( i < 20 ){

x = 'C';

} else {

x = 'D';

What happens to changes in the


result when a Visualforce page calls
an Apex controller, which calls Any changes up to the error are rolled back.
another Apex class, and then hits a
governor limit?

9
Platform Developer I Certification Prep: Logic and Process Automation

Related Badges
Looking for more information? Explore these related badges.

Badge Content Type

Module

Formulas & Validations

Project

Visualforce Basics

Module

Apex Basics & Database

Module

Build a Conference Management App

10
Platform Developer I Certification Prep: Logic and Process Automation

You’ve reviewed the Salesforce fundamentals. Next, let’s take a look at data modeling and management.

Unit 2: Get a Refresh on SOQL, SOSL, and DML


Learning Objectives
After completing this unit, you'll be able to:
• Describe how to programmatically access and utilize the object schema.
• Describe how to use basic SOSL, SOQL, and DML statements in Apex.
• Describe the implications of governor limits on Apex transactions.
• Describe how to implement exception handling in Apex.

Key Topics
This unit prepares you for these topics in the logic and process automation section of the Platform Developer I
exam.

• SOQL
• SOSL
• DML
• Exceptions and governor limits

Exam Practice Questions


Ready to jump in? The sample tool below is not scored—it’s just an easy way to quiz yourself. To use it, read
the scenario on the left side, then click on the answer you think is correct. Some questions may have more
than one correct answer. Click submit, and you get a pop-up telling you whether the answer you chose is
correct or incorrect, and why. When you reach the end, you can review the answers or retake the questions.

11
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 1
A developer needs to create records for the object Property__c. The developer creates the following code
block.

01 List<Property__c> propertiesToCreate = helperClass.createProperties();


02 try {
03
04 } catch (Exception exp) {
05 //Exception handling
06 }

Which line of code should the developer insert at line 03 to ensure that at least some records are created, even
if a few records have errors and fail to be created?

ANSWER FEEDBACK

A. INSERT PROPERTIESTOCREATE; Incorrect. If there are errors while


inserting any of the records, the
insert will fail.

B. DATABASE.INSERT(PROPERTIESTOCREATE,FALSE); Correct. This stems from the


method
Database.insert(recordToIns
ert, allOrNone) where
'allOrNone' is a Boolean value.
If the Boolean value is set to
false and a record fails, the
remainder of the DML operation
will succeed. If it’s set to true an
exception is thrown if the method
is not completely successful.

C. Incorrect. System.ALLOW_PARTIAL
DATABASE.INSERT(PROPERTIESTOCREATE,SYSTEM.ALLOW_PA is not a valid parameter inside this
RTIAL); method.

D. DATABASE.INSERT(PROPERTIESTOCREATE); Incorrect. If there are errors while


inserting any of the records the insert
will fail.

12
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 2
A developer in a Salesforce org with 100 accounts executes the following code using the Developer Console .
Account myAccount = new Account(Name='MyAccount');
insert myAccount;

for (Integer x = 0; x < 150; x++){


Account newAccount = new Account(Name='MyAccount' + x);
try{
insert newAccount;
}catch (Exception ex){
System.Debug(ex);
}
}

insert new Account(Name='MyAccount');

How many accounts are in the org after this code is run?

ANSWER FEEDBACK

A. 100 Correct. Salesforce has a governor limit of 150 DML


statements per transaction. The Salesforce org
originally starts with 100 accounts. The first DML
statement inserts the first account leaving 149 DML
statements available. Inside the for loop it tries to
make 150 DML statements. But the limit is reached
when x = 149. When this happens the transaction
aborts and all data changes are rolled back. The only
thing that is left is the original 100 accounts. Since the
error happened the last insert statement is never
reached. Best practice is to avoid DML statements
inside for loops.

B. 101 Incorrect. Salesforce has governor limits of 150 DML


statements per transaction. When the limit is reached, the
transaction aborts and all changes are rolled back. Best
practice is to avoid DML statements inside for loops.

C. 102 Incorrect. Salesforce has governor limits of 150 DML


statements per transaction. When the limit is reached, the
transaction aborts and all changes are rolled back. Best
practice is to avoid DML statements inside for loops.

D. 252 Incorrect. Salesforce has governor limits of 150 DML


statements per transaction. When the limit is reached, the
transaction aborts and all changes are rolled back. Best
practice is to avoid DML statements inside for loops.

13
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 3
Which two statements should a developer avoid using inside procedural loops? (Select two answers.)

ANSWER FEEDBACK

A. LIST<CONTACT> CONTACTS = [SELECT ID, SALUTATION, Correct. Avoid using SOQL in loops
FIRSTNAME, LASTNAME, EMAIL FROM CONTACT WHERE since there is a governor limit that
ACCOUNTID = :A.ID]; enforces a maximum number of
SOQL queries. When these
operations are placed inside a loop,
database operations are invoked
once per iteration of the loop making
it very easy to reach these governor
limits. Best practice is to query once
to obtain all results, and then iterate
over the results.

B. UPDATE CONTACTLIST; Correct. Avoid using DML in loops


since there is a governor limit that
enforces a maximum number of DML
statements. When these operations
are placed inside a loop, database
operations are invoked once per
iteration of the loop making it very
easy to reach these governor limits.

C. IF (O.ACCOUNTID == A.ID) Incorrect. An if statement can be used


inside of a loop to create a condition.

D. SYSTEM.DEBUG('AMOUNT OF CPU TIME (IN MS) USED Incorrect. System.debug is a great way
SO FAR: ' + LIMITS.GETCPUTIME()); to test the output especially in loops.

14
Platform Developer I Certification Prep: Logic and Process Automation

Exam Topic Flashcards


The user setup section of the exam covers user and license management, freezing and deactivation, and
password management. Use these interactive flashcards to brush up on some of the key topics you'll find on
this part of the exam.

Read the question or term on each card, then click on the card to reveal the correct answer. Click the right-
facing arrow to move to the next card, and the left facing arrow to return to the previous card.

Question/Term Answer/Definition

Which data structure is returned to a developer


A list of lists of sObjects
when performing a SOSL search?

A developer runs the following anonymous code


block.

List<Account> acc = [SELECT Id FROM


Account LIMIT 10];

Delete acc;
2,150
Database.emptyRecycleBin(acc);

system.debug(Limits.getDMLStatements()+',
'+Limits.getLimitDMLStatements());

What is the result?

A developer has the following query.

Contact c = [SELECT id, firstname,


lastname, email FROM Contact WHERE
lastname = 'Smith']; An error that no rows are found.

What does the query return if there is no contact


with the last name Smith?

15
Platform Developer I Certification Prep: Logic and Process Automation

Related Badges
Looking for more information? Explore these related badges.

Badge Content Type

Module

Database & .NET Basics

Module

Search Solution Basics

Great work! You’re almost finished reviewing the logic and process automation section of the Platform
Developer I exam. On to the last unit, which covers Apex classes and triggers.

16
Platform Developer I Certification Prep: Logic and Process Automation

Unit 3: Study Up on Apex Classes and Triggers


Learning Objectives
After completing this unit, you'll be able to:
• Describe how to write and when to use Apex classes and interfaces.
• Describe when to use and how to write triggers.
• Describe the basic patterns used in triggers and classes to process data efficiently.
• Describe the relationship between Apex transactions, the save order of execution, and the
potential for recursion and cascading.

Key Topics
This unit prepares you for these topics in the logic and process automation section of the Platform Developer I
exam.

• Apex classes
• Apex triggers
• Save order of execution

Exam Practice Questions


Ready to jump in? The sample tool below is not scored—it’s just an easy way to quiz yourself. To use it, read
the scenario on the left side, then click on the answer you think is correct. Some questions may have more
than one correct answer. Click submit, and you get a pop-up telling you whether the answer you chose is
correct or incorrect, and why. When you reach the end, you can review the answers or retake the questions.

17
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 1
What is an accurate constructor for a custom controller named MyController?

ANSWER FEEDBACK

A. PUBLIC Incorrect. This is the structure of a controller


MYCONTROLLER(APEXPAGES.STANDARDCONTROLLER extension, not a custom controller.
STDCONTROLLER){

ACCOUNT =
(ACCOUNT)STDCONTROLLER.GETRECORD();

B. PUBLIC MYCONTROLLER(){ Correct. To create a constructor for a custom


controller, the constructor cannot have a
ACCOUNT = NEW ACCOUNT(); parameter.

C. PUBLIC MYCONTROLLER(SOBJECT OBJ){ Incorrect. A custom controller constructor does not


have a parameter.
ACCOUNT = (ACCOUNT) OBJ;

D. PUBLIC MYCONTROLLER(LIST<SOBJECT> Incorrect. A custom controller constructor does not


OBJECTS){ have a parameter.

ACCOUNTS = (LIST<ACCOUNT>)OBJECTS;

18
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 2
A developer uses a before insert trigger on the Lead object to fetch the Territory__c object, where the
Territory__c.PostalCode__c matches the Lead.PostalCode. The code fails when the developer uses the Apex
Data Loader to insert 10,000 lead records. The developer has the following code block.

01 for(Lead l : Trigger.new){
02 if(l.PostalCode != null){
03 List<Territory__c> terrList = [SELECT Id FROM Territory__c WHERE
PostalCode__c = :l.PostalCode];
04 if(terrList.size() > 0){
05 l.Territory__c = terrList[0].Id;
06 }
07 }
08 }

Which line of code is causing the code block to fail?

ANSWER FEEDBACK

A. 01: TRIGGER.NEW IS NOT VALID IN A Incorrect. You can use trigger.new in a before insert
BEFORE INSERT TRIGGER. trigger.

B. 02: A NULLPOINTER EXCEPTION IS Incorrect. This will not happen because in line 2, the code
THROWN IF POSTALCODE IS NULL. is making sure PostalCode is not null.

C. 03: A SOQL QUERY IS LOCATED INSIDE Correct. This will fail on the record number 201
OF THE FOR LOOP CODE. because the limit of SOQL queries is 200. Best
practice is to avoid SOQL queries inside for loops.

D. 05: THE LEAD IN A BEFORE INSERT Incorrect. The lead fields in a before insert trigger can be
TRIGGER CANNOT BE UPDATED. updated.

19
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 3
A developer needs to automatically populate the ReportsTo field in a contact record based on the values of the
related Account and Department fields in the contact record. Which two trigger types should the developer
create? (Select two answers.)

ANSWER FEEDBACK

A. BEFORE UPDATE Correct. The developer should use a


before update trigger. That way there
is no need for an extra DML
statement. It is good practice to use
before triggers to validate updated
records before they are saved.

B. BEFORE INSERT Correct. The developer should use a


before insert trigger. That way there
is no need for an extra DML
statement. It is good practice to use
before triggers to validate records
before they are created.

C. AFTER INSERT Incorrect. After triggers should not be


used to update fields on the record
being created. After triggers are used to
access field values that are set by the
system and to affect changes in other
records.

D. AFTER UPDATE Incorrect. After triggers should not be


used to update fields on the record
being updated. After triggers are used
to access field values that are set by the
system and to affect changes in other
records.

20
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 4
A hierarchy custom setting stores a specific URL for each profile in Salesforce. Which statement can a
developer use to retrieve the correct URL for the current user’s profile and display this on a Visualforce Page?

ANSWER FEEDBACK

A. {!$SETUP.URL_SETTINGS__C.URL__C} Correct. A specific profile should get a


specific record type. So, simply getting a
record type Id will not work. We need to
know what each profile should get.
Hierarchy custom settings support unique
values per profile.

B. Incorrect. There is no need to specify the


{!$SETUP.URL_SETTINGS__C.INSTANCE[PROFILE.I profile. Correct syntax is
D].URL__C} {!$Setup.CustomSettingName__c.CustomField
Name__c}.

C. Incorrect. There is no need to specify the


{!$SETUP.URL_SETTINGS__C[PROFILE.ID].URL__C profile. Correct syntax is
} {!$Setup.CustomSettingName__c.CustomField
Name__c}.

D. Incorrect. There is no need to specify the


{!$SETUP.URL_SETTINGS__C[$PROFILE.ID].URL__ profile. Correct syntax is
C} {!$Setup.CustomSettingName__c.CustomField
Name__c}.

21
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 5
In which order does Salesforce execute events upon saving a record?

ANSWER FEEDBACK

A. VALIDATION RULES; BEFORE TRIGGERS; VALIDATION Correct.


RULES; AFTER TRIGGERS; ASSIGNMENT RULES;
WORKFLOW RULES; COMMIT Runs system validation check.

Executes all before triggers.

Runs most system validation steps


again, such as verifying that all
required fields have a non-null value,
and runs any user-defined validation
rules. The only system validation that
Salesforce doesn't run a second time
(when the request comes from a
standard UI edit page) is the
enforcement of layout-specific rules.

Executes duplicate rules. If the


duplicate rule identifies the record as a
duplicate and uses the block action,
the record is not saved and no further
steps, such as after triggers and
workflow rules, are taken.

Saves the record to the database, but


doesn't commit yet.

Executes all after triggers.

Executes assignment rules.

Executes auto-response rules.

Executes workflow rules.

If there are workflow field updates,


updates the record again.

If the record was updated with


workflow field updates, fires before
update triggers and after update
triggers one more time (and only one
more time), in addition to standard
validations. Custom validation rules,
duplicate rules, and escalation rules
are not run again.

22
Platform Developer I Certification Prep: Logic and Process Automation

B. BEFORE TRIGGERS; VALIDATION RULES; AFTER Incorrect. Once the after triggers are
TRIGGERS; WORKFLOW RULES; ASSIGNMENT RULES; executed, the assignment rules
COMMIT execute.

C. VALIDATION RULES; BEFORE TRIGGERS; AFTER Incorrect. Once the after triggers are
TRIGGERS; WORKFLOW RULES; ASSIGNMENT RULES; executed, the assignment rules
COMMIT execute.

D. BEFORE TRIGGERS; VALIDATION RULES; ASSIGNMENT Incorrect. There are validation rules that
RULES; WORKFLOW RULES; AFTER TRIGGERS; COMMIT happen before the before triggers
execute that are system level
validations, this includes page level
validations and field length checks.
Once the after triggers are executed,
the assignment rules execute.

23
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 6
A developer needs to create a Visualforce page that will override the standard Account edit button. The page
will be used to validate the account’s address using a SOQL query. The page will also allow the user to make
edits to the address. Where should the developer write the account address verification logic?

ANSWER FEEDBACK

A. IN A STANDARD EXTENSION Incorrect. This term does not exist.

B. IN A CUSTOM CONTROLLER Incorrect. If using a custom controller,


the developer will not be able to use the
existing standard controller functionality.

C. IN A STANDARD CONTROLLER Incorrect. A developer cannot use the


standard controller to override the save
button.

D. IN A CONTROLLER EXTENSION Correct. By creating a controller


extension, the developer can extend
the standard controller functionality.

24
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 7
How can a developer determine if a CustomObject__c record has been manually shared with the current user
in Apex?

ANSWER FEEDBACK

A. BY CALLING THE PROFILE SETTINGS OF THE CURRENT Incorrect. Profile does not provide
USER record sharing information.

B. BY QUERYING CUSTOMOBJECT__SHARE Correct. To access sharing


programmatically, you must use the
share object associated with the
standard or custom object for which
you want to share. All custom object
sharing objects are named
MyCustomObject__Share, where
MyCustomObject is the name of the
custom object.

C. BY CALLING THE ISSHARED() METHOD FOR THE Incorrect. The isShared method does
RECORD not exist for this functionality.

D. BY QUERYING THE ROLE HIERARCHY Incorrect. Role hierarchy alone does not
give enough information on sharing.

25
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 8
A developer creates a workflow rule declaratively that changes the value of a field on an object. An Apex after
update trigger exists for the object. What happens when a user updates a record?

ANSWER FEEDBACK

A. THE APEX TRIGGER IS FIRED MORE THAN ONCE. Correct. After the workflow rule, the
trigger is executed again.

B. THE WORKFLOW RULE IS FIRED MORE THAN ONCE. Incorrect. The workflow rule is only
executed once.

C. AFTER INSERT Incorrect. Changes are made, since the


workflow rule is executed and then the
trigger.

D. BOTH THE APEX TRIGGER AND WORKFLOW RULE ARE Incorrect. The workflow rule is fired
FIRED ONLY ONCE once, but the trigger is executed twice.

26
Platform Developer I Certification Prep: Logic and Process Automation

Scenario 9
A developer wants to display all of the available record types for a Case object. The developer also wants to
display the picklist values for the Case.Status field. The Case object and the Case.Status field are on a custom
Visualforce page. Which two actions should the developer perform to get the record types and picklist values in
the controller?

ANSWER FEEDBACK

A. USE SCHEMA.RECORDTYPEINFO RETURNED BY Correct. A RecordTypeInfo object is


CASE.SOBJECTTYPE.GETDESCRIBE().GETRECORDTY returned from the sObject describe result
PEINFOS(). using the getRecordTypeInfos method.

B. USE SOQL TO QUERY CASE RECORDS IN THE ORG Incorrect. This is unnecessary and very
TO GET ALL THE RECORDTYPE VALUES AVAILABLE inefficient since this information can be
FOR CASE. gathered using
Case.SObjectType.getDescribe().getRecordTy
peInfos().

C. USE SCHEMA.PICKLISTENTRY RETURNED BY Correct. getPicklistValues() returns a list of


CASE.STATUS.GETDESCRIBE().GETPICKLISTVALUES( PicklistEntry objects.
).

D. USE SOQL TO QUERY CASE RECORDS IN THE ORG Incorrect. This is unnecessary and very
TO GET ALL VALUES FOR THE STATUS PICKLIST inefficient since this information can be
FIELD. gathered using
Case.Status.getDescribe().getPicklistValues().

27
Platform Developer I Certification Prep: Logic and Process Automation

Exam Topic Flashcards


The user setup section of the exam covers user and license management, freezing and deactivation, and
password management. Use these interactive flashcards to brush up on some of the key topics you'll find on
this part of the exam.

Read the question or term on each card, then click on the card to reveal the correct answer. Click the right-
facing arrow to move to the next card, and the left facing arrow to return to the previous card.

Question/Term Answer/Definition

A developer writes a before insert


trigger. Which context variable can
the developer use to access the The Trigger.new context variable
incoming records in the trigger
body?

Which method can a developer use


to determine, from the
DescribeSObjectResult, if the current The isCreatable() method
user will be able to create records for
an object in Apex?

1. Before triggers are executed.

2. System validation steps are run again and


In the execution order of triggers, user-defined validation rules are checked.
what three steps happen after the
before triggers execute, and before 3. Executes duplicate rules.
the after triggers execute?
4. The record is saved to the database but
doesn’t commit yet.

5. Executes all after triggers.

28
Platform Developer I Certification Prep: Logic and Process Automation

Related Badges
Looking for more information? Explore these related badges.

Badge Content Type

Module

Lightning Flow

Module

Apex Triggers

Superbadge

Apex Specialist

Congratulations! You’ve studied up on logic and process automation section of the Platform Developer I
certification exam.

29

You might also like