Valid PDI Dumps shared by ExamDiscuss.com for Helping Passing PDI Exam! ExamDiscuss.com now offer the newest PDI exam dumps, the ExamDiscuss.com PDI exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com PDI dumps with Test Engine here:
Access PDI Dumps Premium Version
(187 Q&As Dumps, 35%OFF Special Discount Code: freecram)
| Exam Code: | PDI |
| Exam Name: | Platform Developer I (PDI) |
| Certification Provider: | Salesforce |
| Free Question Number: | 96 |
| Version: | v2025-12-04 |
| Rating: | |
| # of views: | 4292 |
| # of Questions views: | 118524 |
| Go To PDI Questions | |

Recent Comments (The most recent comments are at the top.)
No.# Answer: D. JavaScript validation is run in the browser.
The mention of dependent picklists is the clue. Salesforce’s order of execution starts before any server-side step: if the record contains dependent picklist fields, the browser runs JavaScript validation first. That validation restricts each dependent picklist to its available values, and no other JavaScript validation happens. Only after that does the save request reach the server.
The server-side steps then run in this order:
The original record is loaded from the database (or initialized for an upsert).
The new field values from the request overwrite the old values, and system validation runs when the request came from the standard UI. This validation includes maximum field lengths.
Before triggers, then the remaining validation, duplicate rules, the save, after triggers, and so on.
So the other options come later:
A: Loading the original record is the first server-side step, but it runs after the browser’s JavaScript validation.
B and C: These belong to the second server-side step, when the new values are applied and system validation runs...
No.# code is not showing
No.# Answer: C. upsert orders Order_Number__c;
upsert inserts new records and updates existing ones in a single statement. To match on the external ID instead of the Salesforce Id, you name the external ID field after the list:
apex
upsert orders Order__c.Order_Number__c;
In Apex, the field has to be written as a field token, Order__c.Order_Number__c. Your option shows the shorthand Order Number c, which is OCR noise for the field name.
The other options don’t fit:
A and B. merge: It combines up to three duplicate records of the same object into one, which isn’t what the question asks. It also doesn’t accept a field name like that.
D. upsert orders;: Without an external ID field, it matches on the Salesforce Id. Records without an Id are inserted as new, so existing orders would be duplicated instead of updated.
No.# Code not showing
No.# Answer: B, D and E (Custom Permission, Lightning web component and Dynamic Action on the Account Record Page)
This is the same question you asked earlier with the options reordered, and my answer is unchanged.
D. Lightning web component: The form creates a record on a custom object and shows different fields depending on the user’s job role. That needs custom UI logic. An LWC can use lightning-record-edit-form and show or hide fields based on the user’s role or a permission check.
E. Dynamic Action on the Account Record Page: A Dynamic Action in Lightning App Builder can launch the component, for example as a quick action that opens a modal. Dynamic Actions have visibility rules, so the action can be restricted.
B. Custom Permission for the users: Assign it to the small group, then use it in the Dynamic Action’s visibility filter. The component can also check it through @salesforce/customPermission/....
The other options don’t fit:
A. Dynamic Form: Dynamic Forms control how the fields of the Account record itself appear on its page, with visibility rules. They can’t build a form that creates a record on a different custom object.
C. Dynamic Action on page layouts: Dynamic Actions are configured in Lightning App Builder on the record page, not on page layouts. Layouts apply by profile, which is a poor fit for a small group of users....
No.# Answer: B. 0
The watermark covers part of the loop condition. I’m reading it as i < 500, which is the standard version of this question and fits the options.
Each pass of the loop runs its own insert a;, which is one DML statement. Apex allows only 150 DML statements per transaction. On the 151st insert, Salesforce throws a System.LimitException: Too many DML statements: 151. A limit exception can’t be caught, and the whole transaction is rolled back, so the 150 Accounts inserted before it are undone. No Accounts are saved.
The other options are wrong:
150: That is how many inserts succeed before the limit is hit, but they are rolled back.
100 and 500: Neither matches what the code does. 500 would only be possible if the inserts were bulkified.
The fix is to collect the records in a list and insert once, outside the loop:
apex
List<Account> accts = new List<Account>();
for (Integer i = 0; i < 500; i++) {
accts.add(new Account(Name = 'New Account ' + i));
}
insert accts; // one DML statement, 500 rows (under the 10,000-row limit)...
No.# Answer: A and B
Both can run before the delete happens and block it. A before-delete record-triggered flow can check the Status and, if it isn’t “Decommissioned”, stop the delete with a Custom Error element. An Apex trigger can do the same in a before delete trigger.
apex
trigger ContainerTrigger on Container__c (before delete) {
for (Container__c c : Trigger.old) {
if (c.Status__c != 'Decommissioned') {
c.addError('Only decommissioned containers can be deleted.');
}
}
}
The other options don’t fit:
C. After record-triggered flow: It runs after the save step, when the delete has already been performed, so it isn’t the tool for preventing a delete. The “before” version is the expected answer.
D. Validation rule: Validation rules fire on insert and update only. They never run on delete, so they can’t block one.
Before-delete flows are a newer capability. In older material, the answer would be a trigger and one other option, but with current Flow support A is the declarative choice....
No.# Code missing
No.# Answer: share both parent records, Case and Defect__c.
This is the same question you asked earlier. Your options are garbled by OCR, so I can’t be sure which letter is which:
B reads “Share the parent Case and ... record”, so it is most likely the “both parents” option.
A is garbled (“Cast record Defect_c records”). It could also be a version of “both”, so please check the original wording.
C (Defect__c only) and D (the junction record itself) are clearly the wrong ones.
Case_Defect__c is a junction object with two master-detail relationships, one to Case and one to Defect__c. A detail record has no sharing settings of its own and inherits access from its parents. With two masters, and Private organization-wide defaults on both, the user needs access to both parents to see the junction record. Sharing only one of them isn’t enough.
The other options don’t fit:
Share the Case_Defect__c record (D): You can’t share a junction record directly. It has no owner and no sharing of its own.
Share only the Case (A or B, if either is single-parent) or only the Defect__c (C): The user would still lack access to the other parent....
No.# Answer: C. A for loop, with an if or if/else statement inside
The code has to visit each Account in the list, so the loop is the outer structure. For each Account, an if/else compares the last-modified date to 90 days ago and sets the status.
apex
Datetime cutoff = Datetime.now().addDays(-90);
for (Account a : accounts) {
if (a.LastModifiedDate < cutoff) {
a.Status__c = 'Inactive';
} else {
a.Status__c = 'Active';
}
}
The other options don’t fit:
A. A for loop with a switch inside: switch in Apex matches a variable against specific values, such as an Integer, String, enum or sObject type. It can’t test a range like “older than 90 days”.
B. An if-else with a for loop inside: The condition has to be checked per record, so it must be inside the loop. Put outside, it would test one condition for the whole list.
D. A switch with a for loop inside: It has the same placement problem as B and can’t evaluate a date comparison.
No.# No test class
No.# Answer: the third implementation (option C)
It declares implements PaymentProcessor and gives pay(Decimal amount) a real body, as in the example below:
apex
public class CheckPaymentProcessor implements PaymentProcessor {
public void pay(Decimal amount) {
// functional code here
}
}
PaymentProcessor is an interface, so a class uses it with implements. The class then has to provide a public or global implementation, with a body, of every method the interface declares.
The other images don’t fit:
First: It uses implements, but pay ends in a semicolon with no body. That declares the method without implementing it, so it won’t compile.
Fourth: It uses extends, which is for inheriting from a virtual or abstract class and not for applying an interface. It also has no method body.
Second: The Salesforce logo watermark covers the keyword in the class declaration, so I can’t read it. Since the third image is the clearly valid one, this one most likely has extends, which is wrong for an interface. If it did say implements, it would be identical to the third....
No.# Answer: B, the second line: <apex:outputText escape="false" value="{!$CurrentPage.parameters.userInput}" />
I’m assuming the options A to D follow the four lines in the order shown in your screenshot.
This line is vulnerable to cross-site scripting (XSS). escape="false" turns off HTML encoding, and the value comes straight from a URL parameter that the user controls. An attacker can craft a link such as ?userInput=<script>...</script>, and the script would run in the victim’s browser.
The other lines are safe:
A: outputText HTML-encodes its value by default (escape="true"), so any script in the parameter is displayed as text and not executed.
C and D: outputField renders the value according to its field type and also encodes it. The rendered attribute in D only controls whether the component appears.
How to fix it:
Leave escape at its default of true unless you really need raw HTML.
If you do need to output markup, sanitize the input in the controller first, or use JSENCODE, HTMLENCODE or URLENCODE as appropriate for where the value is placed....
No.# Answer: D. An invocable method
A screen flow can call Apex through an Apex action, which runs a method annotated with @InvocableMethod. The method makes the callout to the external order management system in real time and returns the order numbers and dates. The flow then shows them on a screen, for example in a data table or a choice list.
apex
public class GetExternalOrders {
public class Request { @InvocableVariable public String customerId; }
public class OrderInfo {
@InvocableVariable public String orderNumber;
@InvocableVariable public Date orderDate;
}
@InvocableMethod(label='Get external orders' callout=true)
public static List<List<OrderInfo>> getOrders(List<Request> requests) {
// HTTP callout to the order system, then build and return the results
}
}
The callout=true setting is needed so the flow can make the callout.
The other options don’t fit:
A. Outbound message: It pushes data from Salesforce to an external system when a workflow rule fires. It can’t retrieve data on demand.
B. Apex REST class: It exposes Salesforce as a web service that external systems call into. It is for inbound requests, not for calling out to another system.
C. Apex controller: It backs Visualforce pages and Lightning components. A flow can’t call it directly, and only methods exposed as invocable actions are available in Flow....
No.# Answer: D. An invocable method
A screen flow can call Apex through an Apex action, which runs a method annotated with @InvocableMethod. The method makes the callout to the external order management system in real time and returns the order numbers and dates. The flow then shows them on a screen, for example in a data table or a choice list.
apex
public class GetExternalOrders {
public class Request { @InvocableVariable public String customerId; }
public class OrderInfo {
@InvocableVariable public String orderNumber;
@InvocableVariable public Date orderDate;
}
@InvocableMethod(label='Get external orders' callout=true)
public static List<List<OrderInfo>> getOrders(List<Request> requests) {
// HTTP callout to the order system, then build and return the results
}
}
The callout=true setting is needed so the flow can make the callout.
The other options don’t fit:
A. Outbound message: It pushes data from Salesforce to an external system when a workflow rule fires. It can’t retrieve data on demand.
B. Apex REST class: It exposes Salesforce as a web service that external systems call into. It is for inbound requests, not for calling out to another system.
C. Apex controller: It backs Visualforce pages and Lightning components. A flow can’t call it directly, and only methods exposed as invocable actions are available in Flow....
No.# Answer: A, B and C
Your question says “three” in the title but “Choose 2” at the end. Three options are required, so I’m going with the “three” wording. The options have OCR typos, and I’m reading them as follows:
A. <apex:includeLightning/>: This loads the Lightning Components for Visualforce JavaScript library (lightning.out.js), which has to be on the page first.
C. $Lightning.use: This points to the Aura application that declares your component’s dependencies (an app that extends ltng:outApp) and runs a callback once it’s ready.
B. $Lightning.createComponent: This creates the component and inserts it into a DOM element on the page. It is called inside the $Lightning.use callback.
xml
<apex:page>
<apex:includeLightning/>
<div id="lightningContainer"></div>
<script>
$Lightning.use("c:myApp", function() {
$Lightning.createComponent("c:myComponent",
{ label: "Hello" },
"lightningContainer",
function(cmp) { /* component created */ }
);
});
</script>
</apex:page>
The other options don’t fit:
D. <apex:slds/>: This loads the Lightning Design System styles. It’s useful for styling, but it isn’t needed to create the component.
E. $Lightning.useComponent: This isn’t a real API. You may be thinking of $Lightning.use....
No.# Answer: B and D
B. Data goes in the detail property: When you create a custom event, you pass the payload through the detail property, and the handler reads it with event.detail.
D. Propagation is limited by default: A custom event doesn’t bubble and isn’t composed unless you set bubbles: true and composed: true. By default it reaches only the immediate parent that listens for it.
javascript
// child component
const evt = new CustomEvent('select', { detail: { recordId: this.recordId } });
this.dispatchEvent(evt);
// parent component's handler
handleSelect(event) {
console.log(event.detail.recordId);
}
The other options are wrong:
A: @wire is a decorator that reads data from the platform into a component property. It isn’t how an event’s payload is passed.
C: An event travels up to the parent, never down to a child. Parents pass data to children through public @api properties or methods.
No.# Answer: C. FIND 'Universal Containers' IN Name Fields RETURNING Lead(Id, Name), Account(Id, Name), Contact(Id, Name)
Searching text across several objects at once is a job for SOSL (Salesforce Object Search Language), not SOQL. The FIND clause sets the search term, and RETURNING lists each object with the fields to return. Your options have a lot of OCR typos (“Conteiners”, “saceount”, “PIND”). I’m reading C as the corrected statement above.
apex
List<List<SObject>> results = [
FIND 'Universal Containers' IN NAME FIELDS
RETURNING Lead(Id, Name), Account(Id, Name), Contact(Id, Name)
];
The other options don’t fit:
A: It is SOSL, but IN CompanyName Fields isn’t a valid search scope. The valid scopes are ALL FIELDS, NAME FIELDS, EMAIL FIELDS, PHONE FIELDS and SIDEBAR FIELDS.
B and D: These are SOQL. SOQL can’t query several unrelated objects with FROM Lead, Account, Contact, and CompanyName isn’t a field on those objects. Searching across multiple objects takes SOSL.
No.# Answer: C. Use the with sharing keyword.
This is the same idea as the Account search question you just asked. Apex runs in system mode by default and ignores the user’s record access. Declaring the class with sharing makes its queries return only records the logged-in user can access through ownership, roles, sharing rules and teams.
apex
public with sharing class RecordSearchController {
@AuraEnabled(cacheable=true)
public static List<Account> search(String term) {
String key = '%' + term + '%';
return [SELECT Id, Name FROM Account WHERE Name LIKE :key];
}
}
The other options:
A. WITH SECURITY_ENFORCED: It enforces object and field-level security, not record-level sharing. It throws an exception if the user can’t read a field in the query, and a query with it still returns records the user shouldn’t see if the class runs without sharing. It is a good addition, but it doesn’t answer “records accessible to the user”.
B. inherited sharing: The class takes the sharing mode of whatever calls it. When it is the entry point from an LWC, it runs as with sharing by default, so it can work here. It depends on the caller, though, and it is not the explicit guarantee the question asks for.
D. without sharing: It ignores sharing rules and exposes every record....
Your PDI training material is very useful to me.