I'm using aura within VF because custom list buttons don't support aura yet. I'm launching the vf using url apex/vfpagehereetc... to launch that VF container then the aura inside will fire event for createRecord. I want to close the previously opened blank VF sub tab once createevent has been fired. Workspace api component is visible on javascript and isValid equals true but the methods in it are not returning the promises not even errors. The code is not complete here because the rest are working fine, the workspace api is detectable. Any ideas why and/or how to fix?

enter image description hereenter image description here

<aura:component controller="ACRCloneActionCompController">
    <aura:registerEvent name="acrCloneEvt" type="c:ACRCloneAppEvt" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="acctId" type="String" access="global" />


    <lightning:spinner variant="brand" size="small" aura:id="theSpinner" />

    <lightning:workspaceAPI aura:id="workspace" />



    loadTabContext: function(component) {
        // will return valid
        console.log('DBG in loadTabContext', component.find("workspace"));

        var workspaceAPI = component.find("workspace");
        .then(function(response) {
            // never goes inside this
            console.log('DBg focused tab: ');
        .catch(function(error) {
            // neither this
            console.log('DBG error in tab: ');
        // skips directly here and doesn't go back to the promises
        console.log('DBG after workspace');


<apex:page standardStylesheets="false" showHeader="false" sidebar="false">

<apex:includeLightning />
    <div id="lightning" />

    var url = window.location.href;
    console.log('DBG url: ', url);
    var urlsplit = url.split('?acctid='); 

    var acctRecordId;// = "{!$CurrentPage.parameters.id}";

    console.log('DBG acctRecordId: ', urlsplit);

    if (urlsplit[1] != null && urlsplit[1].charAt(15) === '&') {     
        acctRecordId = urlsplit[1].substring(0,15);
    console.log('DBG acctRecordId: ', acctRecordId);

    var visualForceFunction = function(event) {
            console.log('DBG app event data: ');
            if (sforce && sforce.one) {
                console.log('DBG inside sforce');
                sforce.one.createRecord("AccountContactRelation", null,
                        "ContactId" : event.getParam("ContactId"),
                        "JobTitle__c" : event.getParam("JobTitle__c"),
                        "Language__c" : event.getParam("Language__c"),
                        "CommunicationMethod__c" : event.getParam("CommunicationMethod__c"),
                        "Function__c" : event.getParam("Function__c"),
                        "Telephone__c" : event.getParam("Telephone__c"),
                        "MobilePhone__c" : event.getParam("MobilePhone__c"),
                        "Fax__c" : event.getParam("Fax__c"),
                        "Email__c" : event.getParam("Email__c"),
                        "SafetyResponsible__c" : event.getParam("SafetyResponsible__c"),
                        "EnvironmentResponsible__c" : event.getParam("EnvironmentResponsible__c"),
                        "PricingResponsible__c" : event.getParam("PricingResponsible__c"),
                        "QuotationRepairResponsible__c" : event.getParam("QuotationRepairResponsible__c"),
                        "FMMainContact__c" : event.getParam("FMMainContact__c"),
                        "FleetExchange__c" : event.getParam("FleetExchange__c"),
                        "ONTrack__c" : event.getParam("ONTrack__c"),
                        "IsDirect" : false
    $Lightning.use("c:acrCloneActionApp", function() {
        $Lightning.createComponent("c:acrCloneActionComp", { acctId : acctRecordId }, "lightning", function() {
            $A.eventService.addHandler({ "event": "c:ACRCloneAppEvt", "handler" : visualForceFunction});

  • This is a known limitation. The workspaceAPI is not supported in Lightning Out. What are you actually trying to accomplish? What's your end goal?
    – Adrian Larson
    Commented Aug 22, 2019 at 18:04
  • I want to close the middle sub tab in the pic i attached. its the VF container that launched the Create Event from the lightning component. correct me if im wrong but if its not supported, why when i debug the workspace, it shows the the commands on the screenshot above ? or maybe just the commands doesn't work. If I can't use workspace api to close the VF sub tab, any other suggestion if there's any way we can close that Commented Aug 23, 2019 at 3:00

1 Answer 1


With the introduction of lightning:isUrlAddressable, the URLs have been normalised in a readable format for both setting and getting.

You can give direct URL of lightning component which has implemented lightning:isUrlAddressable. Below for example:

enter image description here

As you see, you can also pass URL parameters c__att1 and c__att2.

Consuming the attributes in JS:

doInit : function(component, event, helper){
    let state = component.get("v.pageReference").state;
    console.log('STATE => ',state.c__att1, state.c__att2);

and in COMPONENT file directly:

<div class="slds-theme_default">
    state - {!v.pageReference.state.c__att1}
  • yeah but its almost the same approach as above. it will open a sub tab to launch the POC_AURA, then i need the force:createEvent to launch the standard event to create record which will also launch another subtab. my issue is to close the previously opened subtab. Commented Aug 23, 2019 at 6:59
  • In this approach worksapceAPI will work because you are in lightning experience and not visualforce Commented Aug 23, 2019 at 7:00
  • 1
    ok will try and let you know Commented Aug 23, 2019 at 7:02
  • i'm encountering: This page isn't available in Salesforce Lightning Experience or mobile app. I tried both component and application aura, and implemented flexipage:availableForAllPageTypes. any idea ? Commented Aug 23, 2019 at 23:40
  • 1
    yeah thank you for answering that it needs c__ both at the beginning of the comp name and attributes. forgot about that Commented Aug 24, 2019 at 5:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .