1

I have an Account VisualForce page that is tabbed. By using Record Types and Page Layouts I can have different fields visible for different record types. this however is not the case with the related lists. is there a way to show particular related lists for different record types within the visualforce page? i don't want to restrict the user from viewing the data completely.

apart from the first tab, each tab relates to a different related list

i think i need to do some IF statement by not sure how to go about doing this.

Below is the markup:

<apex:page standardController="Account" showHeader="true" 
      tabStyle="account" >
   <style>
      .activeTab {background-color: #236FBD; color:white; 
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black; 
         background-image:none}
   </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab">   
      <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true" inlineEdit="true"/>
      </apex:tab>
      <apex:tab label="Contacts" name="Contacts" id="tabContact">
         <apex:relatedList subject="{!account}" list="contacts" />
      </apex:tab>
      <apex:tab label="Opportunities" name="Opportunities" 
                id="tabOpp">
         <apex:relatedList subject="{!account}" 
                           list="opportunities" />
      </apex:tab>
      <apex:tab label="Inspections" name="Inspections" 
                id="tabInsp">
         <apex:relatedList subject="{!account}" 
                           list="Inspections__r"  />
      </apex:tab>
      <apex:tab label="Hotel Status" name="Hotel Status" 
                id="tabHot">
         <apex:relatedList subject="{!account}" 
                           list="Hotel_Status__r"  />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" 
                id="tabOpenAct">
         <apex:relatedList subject="{!account}" 
                           list="OpenActivities" />
      </apex:tab>
      <apex:tab label="Notes and Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt">
         <apex:relatedList subject="{!account}" 
                           list="CombinedAttachments" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>

Thanks in advance for everyone's help.

4
  • 3
    You can assign different related list per page layout, if you have different page layouts from different record types this should be a standard setting that can be adjusted : help.salesforce.com/apex/…
    – Rao
    Commented May 9, 2016 at 16:47
  • 3
    The related lists are part of a Page Layout. The main problem is that we can't see the implementation of your VF page. That implementation might be respecting PL for the main part but not for the Related Lists. Commented May 9, 2016 at 16:58
  • Please edit your post to share your markup.
    – Adrian Larson
    Commented May 9, 2016 at 17:18
  • Sorry. Added code to the question.
    – neo2049
    Commented May 10, 2016 at 8:23

1 Answer 1

1

I figured it out. What I did was create a visualforce page that redirected to the correct page based on their record type. Code is as follows:

<apex:page standardController="Account">
   <apex:outputPanel rendered="{!IF(Account.RecordTypeId ='01XXXXXXXXXXXXXXXX',true,false)}">
      <apex:include pageName="RecordType1" />
   </apex:outputPanel>
   <apex:outputPanel rendered="{!IF(Account.RecordTypeId ='01XXXXXXXXXXXXXXXX',true,false)}">
      <apex:include pageName="RecordType2" /> 
   </apex:outputPanel>
</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .