I have a lighnting component on a custom tab where I am creating a new record or editing the existing record. I am unable to refresh the my custom tab after I save the new record, currently I am manually refreshing the page to see the created record. I have tried naviagtePageItem and refreshTab() but nothing worked so far. Could some one give me some pointers ?

1 Answer 1


If you have a custom tab then I'm sure you are able to check if you have the record's Id or not, which will determine the mode in which the component will operate (either "edit" or "create" mode).

After submitting the record, you'll need to fire the same functionality you have when you load the component, no? You don't necessarily need to refresh the whole page for that.

Suppose that your user navigates to the page, and the record is not created yet. They proceed to do so, and when the record is saved on the database, it will return the record's Id (you would get it in a callback in your JS helper). With the record's Id, you would be able to reload the content of the tab using the record's Id as reference for it to load the data, instead of displaying an empty form to the user (so it would go into "edit mode" instead of "create mode").

For one moment I thought about the "refresh view" event. But I believe that would be useful if you were in a standard page, or if the component implements the handler for said event. You'd call the event like this: $A.get('e.force:refreshView').fire();. And then your component would implement a handler for it, like this:

<aura:handler event="force:refreshView" action="{!c.doRefresh}" />

Where doRefresh is a method in your JS controller.

  • This refreshes the other tabs like Details, Activities except my custom tab Jun 23, 2019 at 16:44
  • Read the whole post, not just the code snippets. Jun 23, 2019 at 17:01
  • Fixed, Thank you !! Jun 24, 2019 at 10:26
  • hello Renato Oliveira, one quick question, what if we have a visualForce page under that tab, how do we achieve this refresh thing! any pointers ?
    – Umesh Beti
    Jun 25, 2020 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .