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
knght4yshuaknght4yshua 

Is there a way to pass component attributes from one lightning page to another?

Hello all!

I've searched the documentation, I've watched several demos/tutorials from Dreamforce/TrailheaDX online, and I haven't been able to find anything.  I have a Lightning component that has several children, and those children also have children.  Hosting the main parent component on the Community Home Page is easy enough.  But, I'd like to be able to click on an icon in the parent component and be taken to a completely different page in the Community.  

Again, creating new pages in the Community is simple.  Linking those pages via a navigation menu is also simple.  But, how do I pass an attribute from the parent component on the Home page, to a child component on a different page?  Example:  I have my main parent on the Home Page of the community.  I have a button on that main parent that, when clicked, displays a child component.  Through normal component code I am passing an attribute of the parent to the child.  I can then use that attribute value in the child component.

However, when that is done in a Lightning App, the url doesn't change when a new child component is displayed.  So, if the "Back" button in the browser is clicked, it won't go to the previous component, but it will go back to whatever page the browser was last on.  I can create a custom Back button to just reload the previous component, but I'd really like to have a different Url displayed in the browser's address bar.  That is where Communities and the different pages come in.  

I am not seeing a way to pass attributes from a component on one Community page to attributes on a different component on a different page.  

Is this possible?  If so, how?  Is there any documentation on how to accomplish this?

Thanks!
Deepali KulshresthaDeepali Kulshrestha
Hi knght4yshua,

Yes! It can be possible. Please refer the link given below that'll help you out in the same scenerio:
https://salesforce.stackexchange.com/questions/55051/how-to-pass-values-across-lightning-components

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
knght4yshuaknght4yshua
Hello Deepali,

Thank you for your response!  Can you please detail how this applies in Community pages?  Let's say I have a parent component on my community Home page, and want to pass an attribute to a child component that is on a different community page, say ".../testPage".  How do I access attribute values on the Home page from /testPage?