+ Start a Discussion
prati@salesforceprati@salesforce 

Passing parentId to child controller and vf page

Hi folks
I would like to clarify a confusion. I am trying to create a vf page with extension controller for a detail object B and later I want to embed this page on the page layout of object B. This object B is in master-detail relation with another object A. So for each record A, there are multiple B records.
 In the extension contrller, I will have a SOQl query to fetch some records of B which are all details of the record A which is in the current page.
   My question is how can I pass the Id of the current parent record to the extension so that I can use that in my query to fetch all the records of that master record A? So lets say if A has details n1,n2,n3, n4,etc and currently we are on n1 page I want to fetch all other detaills n2, n3, n4 and display themm on n1 page.
Hope that was clear.Please let me know if my question is not claer.
Thank you
prati@salesforceprati@salesforce
I think ApexPages.currentPage().getParameters().get('id'); might not work because it will pass the id of the page which we are currently viewing, in my case it is detail record but I want to be able to query all the fiedls from detail but only for that particular parent(master).