First of all, I am quite new to developing Lightning components. In fact, this is my first.
I have created an Aura Component that opens some specific records as sub-tabs in a console. It is working OK, from a component perspective, but I trying to set it as a Quick Action from a button on the Account page.
The component I built from examples has a button display to initiate the component.
My aim is to remove the button & have it initiate the component immediately. So far my attempts have been dismal failures.
Any clues appreciated.
TestComponnet.CMP
<aura:component implements="flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<lightning:workspaceAPI aura:id="workspace" />
<lightning:button label="Billing Account Summary" onclick="{! c.openTabWithSubtab }" />
</aura:component>
TestComponentController.js
({
openTabWithSubtab : function(component, event, helper) {
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
url: '/lightning/r/Account/0011e000005h1l2AAA/view',
focus: true
}).then(function(response) {
workspaceAPI.openSubtab({
parentTabId: response,
url: 'https://iagpoc--dev--c.documentforce.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Jpg&versionId=0681e000000B6GG&operationContext=CHATTER&contentId=05T1e0000019kxV',
focus: true
});
})
.catch(function(error) {
console.log(error);
});
}
})