+ Start a Discussion
Nathan HincheyNathan Hinchey 

Can't see new record in Related List without refresh: actionOverride

I'm building a lightning component to override the New action for a custom sObject, let's call it My_Object. My_Object has a master detail relationship with Contact (My_Object is the detail). The way user's are going to create a new My_Object is by clicking on the New button of the My_Object related list on Contact.

My issue is that after creating the record, I want to navigate back to the (master) Contact's page and see my newly created My_Object immediately.

I have a helper function to do this navigation:
 
navigateToContact: function(component) {
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
        "recordId": component.get("v.contact.Id") // this is the ID of the parent record
    });

    navEvt.fire();

}

This works for getting me to the page, but I can't see my new My_Object in the My_Object related list on Contact until I refresh the page.

What I tried:
  • I tried the method above
  • I also tried using force:navigateToURL, with the same result, and I tried using force:navigateToURL and adding a query string in the hopes of overcoming some kind of caching.
  • I unchecked Enable secure and persistent browser caching to improve performance in Session Settings

What I want is a way to make the newly created My_Object record appear on the Related List section without the User needing to manually refresh the page.

Is there a way to make this happen? Or a way to tell the Contact page to refresh immediately after navigation?