I'm firing force:createRecord event from custom lightning component in lightning service console and it seems to always open a new tab or subtab with the record creation form in it. Is it possible to choose to open this in the same/origin tab or in a modal. There doesn't seem to be any documentation on this.
1 Answer
I faced a similar issue working in lightning service console. I used workspace api to close the tab before firing the force:createRecord event. This helped me to tackle it. Do check out the code snippet for your reference.
<!--in component-->
<lightning:workspaceAPI aura:id="workspace"/>
//in controller
var workspaceAPI = component.find("workspace");
workspaceAPI.isConsoleNavigation().then(function(response) {
if(response){
var focusedTabId = response.tabId;
workspaceAPI.closeTab({tabId: focusedTabId});
}
});
var createAcountContactEvent = $A.get("e.force:createRecord");
createAcountContactEvent.setParams({
"entityApiName": "Account",
"recordTypeId": component.get("v.TypeOfRecord")
});
createAcountContactEvent.fire();
-
1+1. Closing the current tab and allowing
e.force:createRecord
to open in tab. Awesome. Feb 17, 2019 at 21:32