Newer Version Available
Identifying the Salesforce Style Your Users See
There are two global variables that can help you identify which style a user sees: $User.UITheme and $User.UIThemeDisplayed. The difference between the two variables is that $User.UITheme returns the look and feel the user is supposed to see, while $User.UIThemeDisplayed returns the look and feel the user actually sees. For example, a user may have the permissions to see the new user interface theme look and feel, but if they are using a browser that doesn’t support that look and feel, for example, Internet Explorer 6, $User.UIThemeDisplayed returns a different value.
- Theme1—Obsolete Salesforce theme
- Theme2—Salesforce theme used before Spring ’10
- PortalDefault—Salesforce Customer Portal theme
- Webstore—Salesforce AppExchange theme
- Theme3—Current Salesforce theme, introduced during Spring ’10
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page standardController="Account">
18 <apex:variable var="newUI" value="newSkinOn"
19 rendered="{!$User.UIThemeDisplayed = 'Theme3'}">
20 <apex:stylesheet value="{!URLFOR($Resource.myStyles, 'newStyles.css')}" />
21 </apex:variable>
22 <apex:variable var="oldUI" value="oldSkinOn"
23 rendered="{!$User.UIThemeDisplayed != 'Theme3'}">
24 <apex:stylesheet value="{!URLFOR($Resource.myStyles, 'oldStyles.css')}" />
25 </apex:variable>
26 <!-- Continue page design -->
27</apex:page>- Using the rendered attribute you can “toggle” which sections display.
- Since the <apex:stylesheet> tag doesn't have a rendered attribute, you’ll need to wrap it in a component that does.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page showHeader="true" tabstyle="Case">
18 <apex:pageMessage severity="error" rendered="{!$User.UITheme = 'Theme3' &&
19 $User.UIThemeDisplayed != 'Theme3'}">
20 We've noticed that the new look and feel is enabled for your organization.
21 However, you can't take advantage of its brilliance. Please check with
22 your administrator for possible reasons for this impediment.
23 </apex:pageMessage>
24 <apex:ListViews type="Case" rendered="{!$User.UITheme = 'Theme3' &&
25 $User.UIThemeDisplayed = 'Theme3'}"/>
26</apex:page>