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

How to display select list of Fields
Hi Everyone,
I'm creating PDF version of an object. This object has around 400 fields out of which only 120 have to be displayed (predefined list). I don't want to use form elements as they don't render properly on PDF.
What I'm hoping for
. .
Name Value
Field Name1 | Field Value1 |
Field Name2 | Field Value2 |
Field Name120 | Field Value120 |
the only solution, I could figure out was
<apex:outputText>{!$ObjectType.Detriot__c.Fields.Name.Label}</apex:outputText>
<apex:outputText>{!field1}</apex:outputText}
in side a <table> tag.
but there are 120 fields and I have to do this for 30 more objects.Hardcoding doesn't seem like a good approach. Is there a more elegant way to do this? is there a way to perhaps make a list of field names and a list of values, then display those two lists as a table?
Thank you,
Sunny_Slp
Only other thing that comes to mind is you could use a Describe() call in your controller to retrieve a list of the fields that are available on the object and then use that list to build your SOQL query as well as your PDF output.