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

Newbie Question - Can I use SOQL directly in a VisualForce page?

I'm trying to figure out how I can query a related object in Visualforce, without using a custom controller.  Essentially what I'm trying to do is embed a SOQL query and display the results in a VF page instead of having to use a custom controller or extension.  I have the custom controller working with the VF page, but was just wondering if there is an easier way to do this (like in ColdFusion or PHP).



Best Answer chosen by Admin (Salesforce Developers) 

Not directly.


You could do it using Java and then adding the elements to the page, much eaiser to create an extension for the page and return the queried record to be displayed.