Salesforce CRT-450 Prepare for your Platform Developer I Certification Exam Practice Test

Page: 1 / 14
Total 174 questions
Question 1

Which statement should be used to allow some of the records in a list of records to be inserted if others fail to be inserted?



Answer : B

To allow partial success when inserting a list of records, the developer should use the Database class methods with the allOrNone parameter set to false.

Option B: Database.insert(records, false)

Correct Answer.

The Database.insert() method allows for partial processing.

By setting the second parameter (allOrNone) to false, the operation will attempt to insert all records.

If some records fail, the successful ones will be committed, and the errors can be examined from the result.

Usage:

Database.SaveResult[] results = Database.insert(records, false);

for (Database.SaveResult sr : results) {

if (sr.isSuccess()) {

// Record inserted successfully

} else {

// Handle errors

for (Database.Error err : sr.getErrors()) {

System.debug(err.getMessage());

}

}

}

The insert statement does not allow partial success; it operates with allOrNone set to true by default.

If any record fails, the entire operation is rolled back.

Option C: Insert(records, false)

Incorrect Syntax.

The insert keyword cannot take parameters.

The correct method with parameters is Database.insert().

Option D: Database.insert(records, true)

Incorrect.

Setting allOrNone to true (default behavior) means that if any record fails, the entire transaction is rolled back.

Conclusion:

To allow partial inserts when some records fail, use Database.insert(records, false), which is Option B.


Database Methods for DML

Incorrect Options:

Option A: insert records

Incorrect.

Question 2

What are two ways a developer can get the status of an enqueued job for a class that implements the queueable interface?

Choose 2 answers



Answer : C, D

To get the status of an enqueued job for a class that implements the Queueable interface, a developer can:

Option C: View the Apex Jobs page

Correct Answer.

The Apex Jobs page in Salesforce Setup lists all asynchronous Apex jobs, including queueable jobs.

Developers can view the status, start time, and completion time of the job.

The AsyncApexJob object contains information about the status of asynchronous Apex jobs.

Developers can write a SOQL query to retrieve details about the queueable job using the job ID returned when the job was enqueued.

Example:

AsyncApexJob job = [SELECT Id, Status, NumberOfErrors FROM AsyncApexJob WHERE Id = :jobId];

The Apex Flex Queue is used for holding batch jobs that are waiting to be processed.

Queueable jobs are not placed in the Apex Flex Queue.

Option B: View the Apex Status page

Incorrect.

There is no specific 'Apex Status' page.

This may refer to the Apex Jobs page.

Conclusion:

The two ways to get the status of an enqueued queueable job are C (Apex Jobs page) and D (Query the AsyncApexJob object).


Monitor Asynchronous Apex

Option D: Query the AsyncApexJob object

Correct Answer.

AsyncApexJob Object

Incorrect Options:

Option A: View the Apex Flex Queue

Incorrect.

Question 3

A developer is creating a Lightning web component to show a list of sales records.

The Sales Representative user should be able to see the commission field on each record. The Sales Assistant user should be able to see all fields on the record except the commission field.

How should this be enforced so that the component works for both users without showing any errors?



Answer : D

To ensure that the component works for both users without showing errors due to field-level security, the developer should handle field accessibility programmatically.

Option D: Use Security.stripInaccessible to remove fields inaccessible to the current user.

Correct Answer.

The Security.stripInaccessible method can be used in Apex to remove fields from SObjects that the current user doesn't have access to.

When data is fetched using SOQL, the method can be applied to ensure that inaccessible fields are not included, preventing any security exceptions when the component tries to display them.

This method enforces field-level security and prevents exposure of inaccessible data.

Usage:

// Apex Controller

public with sharing class SalesRecordsController {

@AuraEnabled(cacheable=true)

public static List<Sales_Record__c> getSalesRecords() {

List<Sales_Record__c> records = [SELECT Id, Name, Commission__c, Other_Field__c FROM Sales_Record__c];

return (List<Sales_Record__c>) Security.stripInaccessible(AccessType.READABLE, records);

}

}

WITH SECURITY_ENFORCED enforces field and object level security in SOQL queries.

If a field is not accessible to the user, the query will throw an exception, which may cause errors in the component.

It does not remove inaccessible fields; it enforces security by failing the query.

Option B: Use Lightning Locker Service to enforce sharing rules and field-level security.

Incorrect.

Lightning Locker Service provides security for components but does not enforce sharing rules or field-level security.

Option C: Use Lightning Data Service to get the collection of sales records.

Not Sufficient Alone.

Lightning Data Service respects field-level security but may still cause errors if the component tries to access fields the user cannot see.

Additional handling is needed to prevent errors.

Conclusion:

To ensure the component works for both users and respects field-level security without causing errors, the developer should use Security.stripInaccessible, which is Option D.


stripInaccessible Method

Enforcing CRUD and FLS

Incorrect Options:

Option A: Use WITH SECURITY_ENFORCED in the SOQL that fetches the data for the component.

Not Sufficient Alone.

Question 4

Which statement describes the execution order when triggers are associated to the same object and event?



Answer : D

When multiple triggers are associated with the same object and event, Salesforce does not guarantee the order in which they will execute.

Option D: Trigger execution order cannot be guaranteed.

Correct Answer.

Salesforce does not provide a mechanism to define or guarantee the execution order of triggers on the same object and event.

If order is important, developers should combine the logic into a single trigger or use trigger frameworks that manage execution order.


Apex Triggers

Best Practices for Triggers

Incorrect Options:

Option A: Triggers are executed in the order they are modified.

Incorrect.

Option B: Triggers are executed alphabetically by trigger name.

Incorrect.

Option C: Triggers are executed in the order they are created.

Incorrect.

Conclusion:

The execution order of triggers on the same object and event cannot be guaranteed by Salesforce.

Question 5

When using Salesforce DX, what does a developer need to enable to create and manage scratch orgs?



Answer : A

When using Salesforce DX, developers need to enable the Dev Hub in their org to create and manage scratch orgs.

Option A: Dev Hub

Correct Answer.

The Dev Hub is a feature that must be enabled in a Salesforce org (usually in a Developer Edition or a production org).

It allows developers to create and manage scratch orgs using Salesforce DX commands.

Dev Hub is the central point for creating and managing your scratch orgs.

While Dev Hub can be enabled in a production org, simply having a production org is not sufficient. Dev Hub must be explicitly enabled.

Option C: Environment Hub

Incorrect.

The Environment Hub is used to manage multiple orgs but is not required for Salesforce DX scratch orgs.

Option D: Sandbox

Incorrect.

Scratch orgs are not created from sandboxes, and enabling scratch org creation requires Dev Hub.

Conclusion:

To create and manage scratch orgs with Salesforce DX, the developer needs to enable Dev Hub.


Enable Dev Hub in Your Org

Salesforce DX Developer Guide

Incorrect Options:

Option B: Production

Incorrect.

Question 6

A developer created a Lightning web component called statusComponent to be inserted into the Account record page.

Which two things should the developer do to make this component available?

Choose 2 answers

A)

B)

C)

D)



Answer : B, D


Question 7

A developer wants to send an outbound message when a record meets a specific criteria.

Which two features satisfy this use case?

Choose 2 answers



Answer : B, D

To send an outbound message when a record meets specific criteria without using Apex code, we can use features that support outbound message actions.

Option B: Approval Process can be used to check the record criteria and send an outbound message without Apex code.

Correct Feature.

An Approval Process can include outbound message actions.

When a record enters a specific step of the approval process, an outbound message can be sent.

Criteria can be defined to determine when the approval process starts.

Flow Builder supports the 'Send Outbound Message' action.

A flow can be configured to trigger when records meet specific criteria and send an outbound message.

This allows for declarative automation without Apex code.

Entitlement Processes are used to manage support entitlements and service contracts.

They do not support outbound message actions.

Option C: Next Best Action can be used to check the record criteria and send an outbound message.

Incorrect.

Next Best Action (Einstein Next Best Action) is used to recommend actions to users.

It is not used to send outbound messages.

Conclusion:

The two features that satisfy the use case are:

Option B: Approval Process.

Option D: Flow Builder.

Both can evaluate record criteria and send an outbound message without the need for Apex code.


Approval Processes

Approval Process Actions

Option D: Flow Builder can be used to check the record criteria and send an outbound message.

Correct Feature.

Flows and Outbound Messages

Flow Builder

Options Not Suitable:

Option A: Entitlement Process can be used to check the record criteria and send an outbound message without Apex code.

Incorrect.

Page:    1 / 14   
Total 174 questions