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
nareshnaresh 

Field access in apex and vfpage

there is two objects A and B.. A contains one field location__c and B contains on field area__c .. how can we acces the two fields in apex and vf pages???
PratikPratik (Salesforce Developers) 
Hi Naresh,

For VF page:

You can use Standardcontroller for object A & B to directl;y use the fields of correspondig objects in the page.

For Controller:

You can create  Sobject of object type A or B and access the fields of corresponding objects.


To access these both fields at the same time in a VF page, go for Controller approach.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
yaswanthkumar bysani 9yaswanthkumar bysani 9
correct
PratikPratik (Salesforce Developers) 
Hi Naresh,

Hope this would answer your question. If you have any specific business scenario/requirement you can post that.

Thanks,
Pratik