function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

How to pass ParentID in a URL from Lightning Component


This might be one of the recurrance questions but I cannot seem to find the answer. I have been trying to resolve this for quiet a few months now. So here is my scenario. 

I have overwritten the New button with a visualforce page of a related list object(invoice__c) from Opportunity. However, this does not work with Console so I tried to write a simple Component re-directing user to the Visualforce page to create a new invoice. When using the lightning component, the ParentID (opportunity ID) is not passed to the new Invoice page. Opportunity has a lookup relationship to invoice. 

How do I pass the opportunity Id through lightning component? 
<aura:component implements="force:appHostable,lightning:actionOverride,flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
Note below: I tried to apply the same method as URL hacking. Obviously it's a fail. I'm not too familiar with URL parameter setting. So, I tried this method to see if it would work. 
	doInit : function(component, event, helper) {
		var ID = $A.get("v.recordId");
        var urlEvent = $A.get("e.force:navigateToURL");