nerdexam
Salesforce

PDI · Question #140

A developer is migrating a Visualforce page into a Lightning web component. The Visualforce page shows information about a single record. The developer decides to use Lightning Data Service to…

The correct answer is A. Lightning Data Service handles sharing rules and field-level security. When using Lightning Data Service (LDS) in Lightning web components, developers benefit from its built-in security features, as it automatically enforces both sharing rules and field-level security for accessed record data.

Submitted by anna_se· Apr 18, 2026User Interface

Question

A developer is migrating a Visualforce page into a Lightning web component. The Visualforce page shows information about a single record. The developer decides to use Lightning Data Service to access record data. Which security consideration should the developer be aware of?

Options

  • ALightning Data Service handles sharing rules and field-level security.
  • BLightning Data Service ignores field-level security.
  • CThe with sharing keyword must be used to enforce sharing rules.
  • DThe isAccessible ( ) method must be used for field-level access checks

How the community answered

(50 responses)
  • A
    92% (46)
  • B
    4% (2)
  • C
    2% (1)
  • D
    2% (1)

Why each option

When using Lightning Data Service (LDS) in Lightning web components, developers benefit from its built-in security features, as it automatically enforces both sharing rules and field-level security for accessed record data.

ALightning Data Service handles sharing rules and field-level security.Correct

Lightning Data Service automatically respects and enforces the user's field-level security (FLS) and sharing rules, ensuring that users only see data they are authorized to access without explicit Apex controller intervention.

BLightning Data Service ignores field-level security.

Lightning Data Service does not ignore field-level security; it actively enforces it to ensure data integrity and user access control.

CThe with sharing keyword must be used to enforce sharing rules.

The `with sharing` keyword is used in Apex controllers to enforce sharing rules, but LDS handles sharing rules automatically at the component level without needing an Apex controller for simple data access.

DThe isAccessible ( ) method must be used for field-level access checks

The `isAccessible()` method is used for manual programmatic field-level access checks in Apex, but LDS handles these checks automatically when accessing data directly.

Concept tested: LWC Lightning Data Service security

Source: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.data_lds_considerations_security

Topics

#Lightning Data Service#Lightning Web Components#Security#Field-Level Security

Community Discussion

No community discussion yet for this question.

Full PDI Practice