+ Start a Discussion

Refresh when navigating back to component

I have been working on this for quite a while without success. I posted this previously but did not get an answer.  I open a secnd 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 doint 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.  Please help!!!!! Trying to either close the first component out when I navigate to the second or refresh the first when I go back.  Here is the code on the second componet to save record and navigate back to first component.  thanks!!!!

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


Hi Fred,
This is the limitation of salesforce lightning, If we "e.force:navigateToURL" event then the navigate component will not call the doInit again or it will not refresh.
Here you add a workaround to call the doInit again.
Use window.location = '/lightning/n/Group_Structures_List?/Aid=" + recordId + "&Tid=123456789"';  instead of event.
Hope this will help you.
Please mark as solved and also best answer if it will solve your problem.
Thanks for your help Deepaksingh!  I am almost there.  Making your changes, I am not navigating to exactly the correctd url.  I need to navigate to:


However, with your changes, I am navigating to this:


Is there a way to make an adjustment?  thanks again!!!