You need to sign in to do that
Don't have an account?
Yogesh Lolge
How to fetch cutom objects data to VF page?
Hi, I want to fetch data from 4 custom objects to one VF page, how it can be achieved using one controller class. if any example is there it would be very helpful.
http://burnignorance.com/salesforce-tips/how-to-fetch-and-display-data-from-a-custom-object-on-visualforce-page-in-salesforce/
It even has an example with the code snippet.
For further reference, you can try the below,
Below is the input field on the VF page
<input id="textpanel" type="text" name="txt" size="35" value="{!myoutput}"/>
apex class Code
Public static String myoutput {get;set;}
List<custom object name> obj =select query of the field from the custom object goes here
for(custom object name obj : obj){
if(obj.fieldname!=null){
myoutput=obj.fieldname
}
}
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
Hi Yogesh,
please find the solution
This pattern "mixes in" the controller extension with the standard controller so your page can reference both; in your example you are only referencing the controller extension field:
See e.g. the Building a Controller Extension (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/) documentation for more information.
If you find this helpful then mark it as the best answer.