Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:pageBlockSection title="Results" collapsible="false">
- <apex:pageBlockTable value="{!queryResultsList}" var="prod2">
- <apex:repeat value="{!fieldAPINames}" var="fieldAPIName">
- <apex:column value="{!prod2.[fieldAPIName]}"/>
- </apex:repeat>
- <!--
- <apex:column value="{!prod2.Name}"/>
- <apex:column value="{!prod2.Description}"/>
- <apex:column value="{!prod2.IsActive}"/>
- <apex:column value="{!prod2.ProductCode}"/>
- <apex:column value="{!prod2.Family}"/>
- -->
- </apex:pageBlockTable>
- </apex:pageBlockSection>
- public class ProductCatalogPageController {
- public List<Product2> queryResultsList{get;set;}
- public String query{get;set;}
- public String strOfStuff{get;set;}
- public Map<String, Schema.SObjectField> fieldAPINames{get;set;}
- public PageReference testAction(){
- String SobjectApiName = 'Product2';
- Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
- Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap();
- String csvFields = '';
- for(String fieldName : fieldMap.keySet()){
- if(csvFields == null || csvFields == ''){
- csvFields = fieldName;
- }else{
- csvFields = csvFields + ', ' + fieldName;
- }
- }
- query = 'select ' + csvFields + ' from ' + SobjectApiName;
- queryResultsList = Database.query(query);
- strOfStuff = 'Stuff goes here';
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement