Embedded LWC chart not refreshing on sales forecast record updates

When users update a sales forecast record, the embedded Chart.js LWC showing pipeline trends doesn’t refresh automatically. Users must manually refresh the browser to see updated data.

The component uses @wire decorator with getRecord to fetch forecast data:

@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
forecastRecord;

After a user updates forecast amount or probability fields, the chart still shows old values. I tried calling getRecordNotifyChange() after updates but it’s not triggering the wire adapter to re-fetch. The component is embedded in a Sales Forecast record page flexipage. Real-time chart updates are critical for our weekly forecast calls with 30+ sales managers reviewing live data. How do I force the wire adapter to refresh when the underlying record changes?

Are you calling getRecordNotifyChange with the correct record ID array? It needs to be an array even for a single record. Also, if your chart data comes from related records or aggregate queries, getRecordNotifyChange won’t help because it only invalidates the specific record cache, not query results. You might need to use refreshApex instead if you’re doing imperative Apex calls for the chart data.

Consider using platform events or change data capture if you need real-time updates across multiple users’ screens simultaneously. If one sales manager updates a forecast, other managers viewing the same forecast should see the update too. RefreshApex only works for the user who made the change. For collaborative forecasting, you’d need CDC or PE to push updates to all subscribed components.

The 30+ managers in forecast calls scenario definitely needs broadcast updates, not just local refresh.

Good point - I am calling it with an array: getRecordNotifyChange([{recordId: this.recordId}]). The chart actually pulls data from multiple related Opportunity records, not just the forecast record itself. I’m using a separate @wire(getOpportunities) to fetch related opps. Should I be using refreshApex for that instead? The getOpportunities is a custom Apex method that aggregates opportunity amounts by stage.

Also make sure you’re updating your Chart.js instance in the wired property’s reactive getter. If you’re only initializing the chart in renderedCallback, it won’t update when the wire adapter refreshes. Use a getter that watches for changes to the wired data and calls chart.update() method. Something like: get chartData() { return this.transformData(this.wiredOpportunitiesResult.data); } and watch that in a separate method that updates the chart.

Yes, exactly. Lightning Data Service wire adapters like getRecord only cache standard record data. Your custom Apex method results aren’t part of LDS cache, so getRecordNotifyChange has no effect on them. Import refreshApex from @salesforce/apex and call it with your wired Apex result variable. Store the wired result in a property and call refreshApex(this.wiredOpportunitiesResult) when you need to refresh. This forces the wire adapter to re-execute your Apex method and get fresh data.