If we override the new button with custom component, then how we can get the record id of the record while clicking the New button from the related list?
I have used workspaceAPI to get the recodeId.
getCaseId : function(component) {
var workspaceAPI = component.find("workspace");
workspaceAPI.getFocusedTabInfo().then(function(response) {
var strVal = response.pageReference.state.ws;
if(response.recordId){
component.set('v.caseId', response.recordId);
}else if(strVal){
strVal = strVal.replace("/lightning/r/Case/", '');
strVal = strVal.replace("/view", '');
component.set('v.caseId', strVal);
}
//console.log('CASE ID:::' + component.get('v.caseId'));
})
.catch(function(error) {
console.log(error);
});
}
This is also working. But I am searching alternative solution.