Plat-Dev-201 practice question 21 of 30
A developer must create a Lightning component that allows users to input Contact record information to create a Contact record, including a Salary__c custom field. What should the developer use, along with a lightning-record-edit-form, so that Salary__c field functions as a currency input and is only viewable and editable by users that have the correct field- level permissions on Salary__c?
Full set: 204 questionsThe lightning-record-edit-form component is designed to work with child lightning-input-field components to build a form for a specific record. The lightning-input-field component automatically handles several key aspects: it respects the field's data type from the schema (rendering a currency input for Salaryc), it displays the correct label, and most importantly, it automatically enforces field-level security (FLS). If the running user does not have edit access to the Salaryc field, the component will render as read-only or not at all, depending on their read access, without requiring any custom logic.
A. lightning-input is a generic input element. It does not automatically bind to a record's field metadata or enforce field-level security.
B. lightning-formatted-number is a display component used for showing a formatted number in a read-only state, not for user input in an edit form.
D. lightning-output-field is also a display component for showing a field's value in a read-only state, typically used within a lightning-record-view-form.
1. Salesforce Developer Documentation, Lightning Web Components Developer Guide, "lightning-record-edit-form": "To create a record edit form, use lightning-record-edit-form and include lightning-input-field components for the fields you want in the form."
2. Salesforce Developer Documentation, Lightning Web Components Developer Guide, "lightning-input-field": "Use this component in lightning-record-edit-form to display and edit the value of a record field... The component displays the field label and value, and enforces field-level security and sharing."
3. Salesforce Trailhead, "Lightning Web Components Basics," Unit: "Work with Salesforce Data": This module demonstrates the use of lightning-record-edit-form with lightning-input-field to create forms that respect the platform's data security model.
Keep practicing
Take the free Plat-Dev-201 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-201 practice questions
- Question 1Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightn…
- Question 2Which two statements are true about using the @testSetup annotation in an Apex test class…
- Question 3Managers at Universal Containers want to ensure that only decommissioned containers are a…
- Question 4Universal Containers has a Visualforce page that displays a table of every Container__c b…
- Question 5A developer is alerted to an issue with a custom Apex trigger that is causing records to …
- Question 6Which two operations affect the number of times a trigger can fire? Choose 2 answers
