How to pass Record Id from VF page to Lightning component / Aura Component

Today, I will show you how to send Record id from Visualforce page to Aura / Lightning Component. Getting current Record id in Lightning Component is very easy. You can directly use force:hasRecordId interface to the lightning component. 

But in some scenarios you may call the lightning component from Visualforce and at that time you have to pass the record Id from VF Page to lightning component. 

First, create an Aura component named as getIdFromVF.

Sample Code:

getIdFromVF.cmp

getIdFromVFController.cmp
Now, Create a lightning application named as getIdFromVFapp.

getIdFromVFapp.app
Its time to create a VisualForce Page (sendIdToAura).

sendIdToAura.vfp

I hope you understand how can we pass the record Id from VF Page to Aura component. If you have question, suggestion on to this or you want me to write a blog on some custom topic then just make sure to comment below. 

That's all for today.
Thank You!!



Comments