In one of my scenarios, we need to open a flexipage as a new subtab on click on some text link.

Let's take there are list of records like 0001 , 0002, 0003

On click on 0001 we need to open a new flexipage as a subtab and need to pass 0001 in URL.

We are able to open new subtab with the following code

Let workspaceApi = component.find('workspace'); 
    ParentabId : response
    url : 'lightning/n/'+myflexipagename+'?info='+0001}),
    Focus : true 

Now I'm back to my parent tab and click on 0002. Now also I need to open one more new subtab. This is not working.

  • 1
    Please take the time to edit your question properly. The code, as written, would not work because of case-sensitivity problems all over. It needs to be written as correctly as possible, and ideally as a sscce so we can help identify the problem. – sfdcfox Mar 5 '19 at 3:47

If I'm reading your question correctly, the issue is not related to subtabs per se. Your issue is that you need to know which item has been clicked in a list, and use that information to dynamically determine the URL you wish to open.

One common pattern for doing so is using data- attributes on your list elements, which you can then acquire in your controller. As a rough sketch, it can look like this:

<aura:iteration items="{! v.myObjects }" var="obj">
        <a onclick="{! c.openSubtab }" data-target="{! obj.Id }"> {! obj.Name } </a>

Then, in the controller,

openSubtab : function(component, event, helper) {
    let targetId = event.currentTarget.dataset.target;

    let workspaceApi = component.find('workspace'); 
        // generate parameters based on `targetId`

This is late answer but developer tends to use url everytime, where as salesforce has introduced other params for these specific scenario.

This is a scenario where you cannot use a url based parameter as the flexipage name would be same. I suggest you to use Page Reference based parameter and pass your unique id in state, so that it open new flexipage with different param each time you click.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.