different standard page layout background colors?

For standard page layouts, Is it possible to change the background color from white to something else? or do a complete inversion of colors?

What I’m going for, is that when a user gets to a certain record type, they get something obvious that they are on a special RT.

Answer

You can handle this, although it falls into the unsupported technique territory, meaning that you’re depending on undocumented properties of Salesforce which may change in future releases and break your stuff. Before you go down this route it may be best to pursue other options, such as adding a image formula field as @Daniel suggests with eye-catching indicators to signifying the record type.

Step 1

First, you need to enable a way to inject your own CSS. The most straightforward way is to override the view page for the object. You can bring back the usual stuff quickly with an apex:detail tag. NB: new features on the view page typically lag a release or two before they’re available in the apex:detail tag. For example, as of Spring ’13, this method means you have to give up Social Contact features.

<apex:page standardController="Account">
  <apex:detail subject="{!Account.Id}" showChatter="true" inlineEdit="true"/>
</apex:page>

Step 2

Use the browser developer tools to inspect the CSS and figure out where you want to apply your changes. NB: this is where things can change with new release and break your enhancements. For example

<apex:page standardController="Account">
  <apex:detail subject="{!Account.Id}" showChatter="true" inlineEdit="true"/>
  <style>
    div.bodyDiv { background-color: red; }
  </style>
</apex:page>

Step 3

Wrap your style tag in an output panel so you can selectively add your CSS only when your record is interesting.

<apex:page standardController="Account">
  <apex:detail subject="{!Account.Id}" showChatter="true" inlineEdit="true"/>
  <apex:outputPanel rendered="{!Account.RecordType.DeveloperName = 'Test_RT'}">
    <style>
      div.bodyDiv { background-color: red; }
    </style>
  </apex:outputPanel>
</apex:page>

Attribution
Source : Link , Question Author : PartOfTheOhana , Answer Author : Ralph Callaway

Leave a Comment