You need to sign in to do that
Don't have an account?
how to keep the tab referencing a list view not to open in new window but instead should stay within ?
hello all,
i had to create a custom tab and link it to a ligening compoent so tht if i click on the tab, i will open a list view i created on the account object. I did that but it opens in a new window while i want to keep it within the current window. here is what i created:
cmp
js
i am hopping there is someting else to relpace the window.open to something else to keep the page within the current one. any help ?
i had to create a custom tab and link it to a ligening compoent so tht if i click on the tab, i will open a list view i created on the account object. I did that but it opens in a new window while i want to keep it within the current window. here is what i created:
cmp
<aura:component implements="force:appHostable" > <aura:handler name="init" value="{!this}" action="{!c.init}"/> </aura:component>
js
({ init : function(component, event, helper) { window.open("one/one.app#/sObject/Account/list?filterName=00B3D000001YKO7UAO",'_target'); window.history.back(); } })
i am hopping there is someting else to relpace the window.open to something else to keep the page within the current one. any help ?
In your code you're trying to navigate to a list view of Account object.
If you want to navigate using standard event then, your code will look like this:
IMPORTANT NOTE:
The thing about this piece of code is, everytime you will open that tab,you will be redirected that list view page.
But according to your requirement, you want that list view to show in your component and not to go get redirected to your page(please correct me if am wrong).
So now in order to do that, remove the init function code in your JS Controller and use this piece of code in your component code:
Note:
listName="AllAccounts", in this line replace 'AllAccounts' with the developer name(Api name) of your ist view.
To find the developer name to simply run a SQOL in your query editor:
Select DeveloperName from listview where id ='00B6A0000070O0bUAE'
Let me know if it helps,
Thanks
All Answers
You should use force:navigateToUrl event
https://developer.salesforce.com/docs/component-library/bundle/force:navigateToURL/documentation
Refer this documentation to know more about it.
cmp
and currecnt js
In your code you're trying to navigate to a list view of Account object.
If you want to navigate using standard event then, your code will look like this:
IMPORTANT NOTE:
The thing about this piece of code is, everytime you will open that tab,you will be redirected that list view page.
But according to your requirement, you want that list view to show in your component and not to go get redirected to your page(please correct me if am wrong).
So now in order to do that, remove the init function code in your JS Controller and use this piece of code in your component code:
Note:
listName="AllAccounts", in this line replace 'AllAccounts' with the developer name(Api name) of your ist view.
To find the developer name to simply run a SQOL in your query editor:
Select DeveloperName from listview where id ='00B6A0000070O0bUAE'
Let me know if it helps,
Thanks