Salesforce Decode
Salesforcedecode
Back to questions
LWCIntermediateldssecurityerror-handling

Implement field-level permission messaging when LDS wire denies field

Real World Scenario

Wire getRecord succeeds but sensitive field null for restricted user. LWC shows blank salary column without explanation.

Expected Answer

• Check field value undefined vs null with objectInfo field metadata • Display em dash or Permission required label for inaccessible fields • Do not fetch sensitive field via imperative Apex bypassing wire FLS • getRecord errors vs missing field distinction in UI messaging • Admin documentation which profiles see restricted columns • Hide column entirely vs show locked icon based on UX policy • Test runAs user without field access asserting message not blank

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Check field value undefined vs null with objectInfo field metadata Also consider: Display em dash or Permission required label for inaccessible fields In practice: Do not fetch sensitive field via imperative Apex bypassing wire FLS Balance speed of delivery with maintainability.

Architect Perspective

Blank field from FLS is authorization signal—UX should communicate restriction not emptiness.