You need to sign in to do that
Don't have an account?
SFDC Forum 9
OpenSubTab in lightning console
Hey folks, I have requirement pls help me.
I have menu bar with items in it in classic , all the items in it are basically other system tabs.When ii click on them, new sub tab will open and show the information of another system. It works fine in classic.
in VF, sfoce.console.getfocusedsubtabid & sforce.console.openSubTab is used.
Now I will have to migrate this vf page.Could not do with existing vf code.
So i have started creating lightning component.On click , i have to write controller , referring this below code to do so.
({
02 openTabWithSubtab : function(component, event, helper) {
03 var workspaceAPI = component.find("workspace");
04 workspaceAPI.openTab({
05 url: '/lightning/r/Account/001xx000003DI05AAG/view',
06 focus: true
07 }).then(function(response) {
08 workspaceAPI.openSubtab({
09 parentTabId: response,
10 url: '/lightning/r/Contact/003xx000004Ts30AAC/view',
11 focus: true
12 });
13 })
14 .catch(function(error) {
15 console.log(error);
16 });
17 }
18})
But in my case I am confused what should I pass under workspace.openTab & workspaceAPI.openSubtab, bcz I dont have URL and things like that.
can anyone of you suggest me.
OR can anyone suggest me how to use existing vf code and make it working in lightning, bcz this would be easy task
I have menu bar with items in it in classic , all the items in it are basically other system tabs.When ii click on them, new sub tab will open and show the information of another system. It works fine in classic.
in VF, sfoce.console.getfocusedsubtabid & sforce.console.openSubTab is used.
Now I will have to migrate this vf page.Could not do with existing vf code.
So i have started creating lightning component.On click , i have to write controller , referring this below code to do so.
({
02 openTabWithSubtab : function(component, event, helper) {
03 var workspaceAPI = component.find("workspace");
04 workspaceAPI.openTab({
05 url: '/lightning/r/Account/001xx000003DI05AAG/view',
06 focus: true
07 }).then(function(response) {
08 workspaceAPI.openSubtab({
09 parentTabId: response,
10 url: '/lightning/r/Contact/003xx000004Ts30AAC/view',
11 focus: true
12 });
13 })
14 .catch(function(error) {
15 console.log(error);
16 });
17 }
18})
But in my case I am confused what should I pass under workspace.openTab & workspaceAPI.openSubtab, bcz I dont have URL and things like that.
can anyone of you suggest me.
OR can anyone suggest me how to use existing vf code and make it working in lightning, bcz this would be easy task
It has many methods including openSubtab that will work for you.
If this answer helps you, please mark it as accepted.
Regards,
Tushar Sharma
https://newstechnologystuff.com/ (https://newstechnologystuff.com/)
I have used workspace API.I dont think i can use the above code alone.
bcz there are two points.
I will insert my component in below page.
1) I need to open sub tab in the existing tab or sub tab beside 'Detail' as highlihted in screenshot.
So as per my understanding in classic vf code, it is capturing enclosedtab Id as soon as page loads.Then user click on any menu item, it takes that main tab Id and gets details through web service and displays.
so when i use code given by you, there is no scope of mentoning sub tab details.
So I used this below code, it works exactly as per my requirement, but my problem is, since i am new to this, I am not getting what to pass as URL under openTab and URL under openSubTab.please suggest.
({
02 openTabWithSubtab : function(component, event, helper) {
03 var workspaceAPI = component.find("workspace");
04 workspaceAPI.openTab({
05 url: '/lightning/r/Account/001xx000003DI05AAG/view',
06 focus: true
07 }).then(function(response) {
08 workspaceAPI.openSubtab({
09 parentTabId: response,
10 url: '/lightning/r/Contact/003xx000004Ts30AAC/view',
11 focus: true
12 });
13 })
14 .catch(function(error) {
15 console.log(error);
16 });
17 }
18})
<lightning:workspaceAPI aura:id="workspace" />
2. Use the following code snippet to open a subtab. This will open Account record on a Contact page.
It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!
https://jbshelpdesk.secure.force.com/
Thanks,
Jarvis SFDC team
CMP:
<lightning:buttonMenu alternativeText="Toggle menu" label="Partcipant Info" onselect="{!c.doRedirect:doRedirect}" >
<lightning:menuItem label="Home Page" value="menuitem1" iconName="utility:table"/>
JS:: doRedirect: workspaceAPI.openTab({
url:URL,
focus: true
}).catch(function(error) {
console.log(error);
});