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
Chamil MadusankaChamil Madusanka 

get parameters from page layout to visualforce page

Hi All,

 

I have developed a visualforce which embeded to the page layout. I want to get a parameter from the pagelayout to the embedded visualpage. According to that parameter I want to query some values. Is there any approach to get parameters as above?

 

Thanks in Advance

--

Chamil Madusanka

Best Answer chosen by Admin (Salesforce Developers) 
kamlesh_chauhankamlesh_chauhan

Hi Chamil,

 

You can get Employee record id in query string at embeded VF page.

 

Change your code to...

 

 

[Select c.LastName, c.Id, c.Employee__c, c.Email, (Select Id, Name From Employees__r) From Contact c WHERE Employee__c=:ApexPages.currentPage().getParameters().get('id')];

 

 

Regards,

Kamlesh

All Answers

bob_buzzardbob_buzzard

You won't be able to access the contents of the page that your visualforce is embedded into, as that is from a different server and the browser won't allow it.  However, as you are using the standard controller for the object, you can simply examine its fields.

 

Or are you trying to do something based on the page layout itself (e.g. based on the number of columns etc)?

Chamil MadusankaChamil Madusanka

Page layout is related to the custom object Employee__c. Employee__c and Contact object has a lookup relationship. custom visual page has used in Employee__c page layout.The query in the controller which communicate with visualforce page is related to the Contact object.

 

 

Select c.LastName, c.Id, c.Employee__c, c.Email, (Select Id, Name From Employees__r) From Contact c WHERE Employee__r.Name='0001' 

 I want to get the Employee__r.Name (Employee__c.Name) which is already in Employee__c page layout.

That's the issue.

 

--

Chamil Madusanka

 

kamlesh_chauhankamlesh_chauhan

Hi Chamil,

 

You can get Employee record id in query string at embeded VF page.

 

Change your code to...

 

 

[Select c.LastName, c.Id, c.Employee__c, c.Email, (Select Id, Name From Employees__r) From Contact c WHERE Employee__c=:ApexPages.currentPage().getParameters().get('id')];

 

 

Regards,

Kamlesh

This was selected as the best answer
Chamil MadusankaChamil Madusanka

Hi Kamlesh,

 

Thank you very much Kamlesh. I have solved my problem with your reply.

 

--

Chamil Madusanka