When to fire force refreshview in Salesforce Lightning?

When to fire force refreshview in Salesforce Lightning?

During the submit event, assign the account ID to the contact record. When the contact record saves successfully, fire the force:refreshView event to reload the contact related list on the account page, which is a standard component on the record page. Refreshing the following views recreates and refreshes the custom components within it.

How to refresh the browser page in a lightning component?

As an alternative (but not recommended), you can try the old Lightning way with refresh event: https://developer.salesforce.com/docs/atlas.en-us.212.0.lightning.meta/lightning/ref_force_refreshView.htm e.g. I encountered the next issue in one of the places: and there is no documentation entries for this event on API v43 and v44.

Is the refresh view event supported in Salesforce?

Repeated firing of this event by a single component or multiple components on a page is not supported. This event is supported in Lightning Experience, the Salesforce mobile app, and Aura-based Experience Builder sites. This example refreshes the view after an action is successfully completed.

How is a custom component refreshed in Salesforce?

The custom component then refreshes the data on standard components on the record page, such as the contact related list. During the submit event, assign the account ID to the contact record.

When does Lightning refresh the state of a component?

I am using lightning:navigation component in our project, and it doesnt refresh the state of component, when the url changes. To be clear, lightning framework just keeps the state of component/page and ignores url changes, even when we go through different records, page layouts etc.

How to create custom components in Salesforce Lightning?

If you’re creating custom components with Lightning Web Components, use the Lightning Data Service wire adapters and functions in the lightning/ui*Api modules to work with record data.