function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Fred13Fred13 

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!!!!

Fred
 
insertGS : function(component, groupstructures, callback) {
 
		//call apex to save the newly created group structures
  		var action = component.get("c.saveGroupStructure");
        	action.setParams({gs: groupstructures
	        });
    
  $A.enqueueAction(action);
          
  ///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");
        urlEvent.setParams({
            "url" : "lightning/n/Group_Structures_List?//Aid=" + recordId + "&Tid=123456789"    
        });
        ///navigate back to groupstructures page
        urlEvent.fire();

      
        },

 
Deepak_KumarDeepak_Kumar
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
Deepak.
Fred13Fred13
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:

https://horizonblue--lightning.lightning.force.com/lightning/n/Group_Structures_List?//Aid=001q000000nv4YTAAY&Tid=123456789


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

https://horizonblue--lightning.my.salesforce.com/one/lightning/n/Group_Structures_List?//Aid=001q000000nv4YTAAY&Tid=123456789


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

Fred