PDI · Question #53
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
The correct answer is A. <ligthning-input-field field-name="Salary__c">. To create a currency input field that automatically respects Field-Level Security within a lightning-record-edit-form, the lightning-input-field component should be used.
Question
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 levelpermissions on salary__C?
Options
- A<ligthning-input-field field-name="Salary__c">
- B<lightning-formatted-number value="Salary__c" format-style="currency"> </lightning-formatted-
- C<lightning-input type="number" value="Salary__c" formatter="currency"> </lightning-input>
- D<lightning-input-currency value="Salary__c">
How the community answered
(24 responses)- A88% (21)
- B8% (2)
- D4% (1)
Why each option
To create a currency input field that automatically respects Field-Level Security within a lightning-record-edit-form, the lightning-input-field component should be used.
The <lightning-input-field> component automatically renders the correct input type based on the field's metadata (e.g., currency for a currency field) and, crucially, respects Field-Level Security (FLS) for visibility and editability without additional developer code.
<lightning-formatted-number> is used to display a formatted number, not to input data, and does not automatically handle FLS.
<lightning-input> is a generic input component; while it can be configured for numbers and currency formatting, it does not inherently respect Field-Level Security.
<lightning-input-currency> is not a standard Lightning Web Component (LWC) base component for inputting currency.
Concept tested: Lightning-input-field component and FLS
Source: https://developer.salesforce.com/docs/component-library/bundle/lightning-input-field/documentation
Topics
Community Discussion
No community discussion yet for this question.