+ Start a Discussion

Embedding VF page into SF page results in blue line around cell

Ultimate purpose:  Dynamically display (or not) a field label/value without using profiles ... (It would take a single profile per user). The dynamic part works fine. It just looks pretty awful.


 I would like to display a field using the standard page's style, but I keep getting extra UI elements.  Like a blue line around the field and the columns don't line up with the other columns in the section.


 If I remove pageBlockSection, I don't get the label displayed nicely with the field value ... I only get the formatted field value.


 If I remove pageBlock, I get a white box containing an unformatted field value.


 FYI, The VF page is inserted into the Account Page layout as an element.


I've included the code below.  I'm brand new to this but I keep reading that the salesforce style is embedded automatically if you use VF, so I'm certain I'm missing something small.  Any and all help will be much appreciated.




 Here is VF page code:

<apex:page standardController="Account" extensions="AcctSalesRevenueControllerExtension" tabStyle="Account">
    <apex:pageBlock >
        <apex:pageBlockSection collapsible="false"  columns="2" showHeader="false" >
           <apex:outputField rendered="false" value="{!account.PB_Salesperson_1_ID__c}" />
           <apex:outputField rendered="false" value="{!account.PB_Salesperson_2_ID__c}" />
           <apex:outputField rendered="false" value="{!account.PB__c}" />
           <apex:outputField value="{!account.PB__c}" rendered="{!renderRevenue}" id="revenueID"/>

Here is the Apex class code:

public class AcctSalesRevenueControllerExtension {

    private final Account acct;
    private final String sid1;
    private final String sid2;
    private final String usrSid;
    public AcctSalesRevenueControllerExtension (ApexPages.StandardController stdController) {
       this.acct = (Account)stdController.getRecord();
        ID usrId = UserInfo.getUserId();
        this.usrSid = getSidFromUserID(usrId );
        ID id1 = acct.PB_Salesperson_1_ID__c;
        if (id1 == null){
            sid1 = 'id1 notfound in acct';
        else {
             sid1 = getSidFromEmpID(id1);
        if (sid1 == null){
            sid1 = 'sid1 notfound for id:' + id1 ;

        ID id2 = acct.PB_Salesperson_2_ID__c;
        if (id2 == null){
            sid2 = 'id2 notfound in acct';
        else {
             sid2 = getSidFromEmpID(id2);
        if (sid2 == null){
            sid2 = 'sid2 notfound for id:' + id2 ;
    private Boolean shouldRevenueDisplay(){
        Boolean result = false;
        if (this.usrSid != null)
            {result = (usrSid == sid1 || usrSid == sid2);}
        return (result);
    private String getSidFromUserID(ID userId){
            Employee__c emp =[select id, name,JPM_SID__c,Title__c from Employee__c where User__c = :userId];
             String userSid = emp.JPM_SID__c;
         if (userSid == null){
             userSid = 'userSid not found';
         return (userSid);
    private String getSidFromEmpID(ID empId){
            Employee__c emp =[select id, name,JPM_SID__c,Title__c from Employee__c where id = :empId];
             String userSid = emp.JPM_SID__c;
         if (userSid == null){
             userSid = 'userSid not found';
         return (userSid);
    public Boolean getRenderRevenue(){
        return (shouldRevenueDisplay());

Best Answer chosen by Admin (Salesforce Developers) 

Hi Vanya,

I had a similar problem,  I had embedded a VF in the Account page but the embedded VF had de old blue look-and-feel

After a big search I've found my solution.  

Try to change your <apex:pageBlock > to <apex:pageBlock mode="maindetail">