+ Start a Discussion

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 Name1Field Value1
Field Name2Field Value2
Field Name120Field Value120



the only solution, I could figure out was



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,



Best Answer chosen by Admin (Salesforce Developers) 
I may be misunderstanding you, but you say you have a predefined list of 120 fields you want to output. If you already have this list, "hardcoding" them into the output doean'y seem so bad to me...

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.