function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Apex:detail -- options for excluding fields?

I'm looking for a scalable solution where I can add a VF page to any object to render as PDF. I'm using apex:detail to list all fields on the VF page, but I'd like the option of excluding fields.


I'd like to know how to:


1) Exclude particular fields on the rendered PDF?

2) Exclude particular field labels? (ie on Activity, when creating a PDF for emails, i really don't need to see "Comments" label beside the email.

3) Change the location of field labels? Can they be moved to above and in line with the field data, rather than to the left margin and centered (vertically).


There will be several objects I'd like to do this for, so I was seeing if there was a way to start with all fields, then exclude ones i don't want, rather than having to add them all one by one.





<apex:detail> describes the standard detail page for a particular object, as defined by the associated page layout for the object in Setup. I think we cannot select particular fields/labels using this tag. Instead you can do change that object pagelayout as per your need then use the <apex:detail> on that object.


If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.



I see. Getting the right fields to display can be done on page layout, but the output of content is really poor, as is. Field labels are often unseparated from field data which does not look professional.

More than likely i'll have to create custom VF pages in a non scalable way. oh well.