I open a second component to add some records and when I save, I navigate back to the original component. The problem is that the newly created records do not display on the original component. The odd thing is that the doInit function does not fire when I navigate back.

Therefore, my assumption is that the first component never closes when I navigate to the second component to create the records.

I'm trying to either close the first component out when I navigate to the second or refresh the first when I go back. How can I do that?

Here is the code on the second component to save record and navigate back to first component.

    insertGS : function(component, groupstructures, callback) {

        //call apex to save the newly created group structures
        var action = component.get("c.saveGroupStructure");
            action.setParams({gs: groupstructures


  ///This part of code is used to navigate back to the GroupStructuresList Component
        //variable to hold the account id for my naviagation back to original component
        var recordId = component.get("v.existinggroupstructure.Account__c")
        //set urlEvent Variable to navigate back to the original component
         var urlEvent = $A.get("e.force:navigateToURL");
            "url" : "lightning/n/Group_Structures_List?//Aid=" + recordId + "&Tid=123456789"    
        ///navigate back to groupstructures page


2 Answers 2


have you tried

window.location = "lightning/n/Group_Structures_List?//Aid=" + recordId + "&Tid=123456789";

instead of the urlEvent? Or is there any reason not to use that? My team and I built a heavily customized community and used that command to switch pages.

All the best, tiruman


I'm not exactly sure where you require a redirect but it seems like timing is the issue. I would try moving your redirect code into an action.setCallback() function. Or maybe you can write your redirect into the Renderer part of the second component that displays (assuming you get there).

  • Thanks lxalmida. I think you might be onto something. I had once or twice where the refresh worked so what your saying makes sense. I will try you approach. thanks!
    – Frank
    Commented Dec 11, 2018 at 20:22

You must log in to answer this question.

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