[SalesForce] Navigate to Record page from related list in lightning

I have a requirement where in i have over ridden the standard case button in contact related list. Now when i click 'New' in Case under contact related list a popup with few fields is opened but this takes to case tab and recordId of contact is lost,where in i want to redirect my page back to contact record page on click of any button in modal popup. Tried following approach but i am not getting recordId since page is navigating to case object.

Initial contact url--lightning/r/Contact/0035400000NIr0ZAAT/view

Case URL--lightning/o/Case/new?inContextOfRef=1.eyJ0eXBlIjoic3RhbmRhcmRfX3JlY29yZFBhZ2UiLCJhdHRyaWJ1dGVzIjp7InJlY29yZElkIjoiMDAzNTQwMDAwME5JcjBaQUFUIiwiYWN0aW9uTmFtZSI6InZ

This code i am using for redirect to contact record page.

logFeedback:function(component){
    component.find("navId").navigate({
        type: 'standard__recordPage',
        attributes: {
            recordId : component.get("v.recordId"), // record id from given objectApiName
            actionName: 'view',
            objectApiName:'Contact'
        }}, true);

But since record id is gone its not redirecting.

Any other suggestions/alternative approach.

Best Answer

that means you are trying to override the standard New case button, that's why it's redirect to standard case tab, by this approach you can not get the contactid. there is idea .

but you can achieve your use case

1 .by using visualforce-lightningout-custombutton
2 . you can add custom action in record detail page like beside in `edit` button it 
    opens your lightning component  then get contact id by using `force:hasRecordId` 
    get record id