Salesforce Decode
Salesforcedecode
Back to questions
LWCIntermediateldswireimperative

Use refreshApex and getRecordNotifyChange together after composite save

Real World Scenario

LWC saves parent Account and child Contacts via single Apex transaction. Wired getRecord updates Account but related list wire stale.

Expected Answer

• getRecordNotifyChange for parent record Id after save • refreshApex on wired related list property reference • Order: DML complete then notify then refreshApex in same tick • Return affected record IDs from Apex for comprehensive notify list • Related list wire may need recordId param unchanged to refresh • Avoid full page refresh as default user experience • Test multi-record notify in Jest with uiRecordApi mock

Follow-Up Questions & Answers

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

Direct answer: getRecordNotifyChange for parent record Id after save Also consider: refreshApex on wired related list property reference In practice: Order: DML complete then notify then refreshApex in same tick Balance speed of delivery with maintainability.

Architect Perspective

Composite saves need both parent LDS notify and child wire refresh—know both tools.