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
Indu MIndu M 

Hi, I want to create a button that takes me to to a different lightning page/tab on click and it should get the data chosen from previous lightning page/tab and display it on the new lightning page/tab

Hi, I want to create a button that takes me to to a new lightning page/tab (open as a new tab in browser) on click and also it should get the data chosen from previous lightning page/tab and display it on the new lightning page/tab.
Jefferson FernandezJefferson Fernandez
I suggest to post what you have done so far, if there's any so we can pick up from there or give more context to your question.
  • What type of page do you want to navigate into? (custom, standard, detail page..etc)
  • What specific data you want to get from the previous page from? (record ID, field values..etc)
For an example design, either you could use a custom action that embeds a lightning component that you created. You could use the Lightning interface force:hasRecordId so you could fetch the ID of the previous page and use that to query the values you need on the new page.
Indu MIndu M
I have created two lightning component tabs. On first tab i have a search field and a search button which on click displays a table with records from a custom object. Each row in the table has a checkbox. So I want to know how implement the functionality to select a checkbox(which is a record or row) and click a button(another button, not search button) on the first lightning component tab, that takes me to the second lightning component tab and display that particular record selected from the first lightning componet tab on to the second lightning component tab in a table structure that is similar to the table structure in the first tab.
Jefferson FernandezJefferson Fernandez
Try if you could use force:navigateToComponent (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToComponent.htm) built-in event. It says there that it won't work if the target component is located in another tab. Unfortunately you may have to think of other designs if you could avoid working between 2 tabs. Otherwise, if a button will launch a component in a tab (coming from a non-tabbed component), you can use the said built-in event.
Indu MIndu M
Hi Jefferson,

I Have used gotoURL to navigate to the second tab. I want to know how to build a logic on a button which on click should navigate to second tab and has to pull a row in a table from the first tab and display that in the second tab.
Jefferson FernandezJefferson Fernandez
Perhaps you could save the chosen row of records from the first tab into the database upon clicking the respective checkbox. Then when you go to the second tab's component, create a function upon doInit to retrieve the values from the database too upon rendering. You could save those values on its own custom object as a value holder. Being built on 2 seperate tabs means that the other is not being rendered yet, unlike being on a single page which you could have one main component to house those values and events wouldn't work because they are only as good as the transaction lifetime of each component. There are possibly other advanced ways like storing the data on cache/local storage through local storage feature of HTML5, but it would be too complex for something which could be done through the earlier conventional way.