You need to sign in to do that
Don't have an account?

Use a dynamic SOQL inside a VF component
I have controller class where I am using a dynamic query as shown below
String query = 'SELECT ' + newsletterField + ' FROM Contact WHERE Id = ' + user_id;
Contact[] myContacts = Database.query(query);
How to include the dynamic query inside a Visualforce Component and the same Visualforce component is later used in a VF page
Thanks....
String query = 'SELECT ' + newsletterField + ' FROM Contact WHERE Id = ' + user_id;
Contact[] myContacts = Database.query(query);
How to include the dynamic query inside a Visualforce Component and the same Visualforce component is later used in a VF page
Thanks....
Below component is an example for your use case. Let me know if still any query.
Visuslforce Component Name = SQLQuery Visuslforce Page: